refactor: trim agent local helper exports · openclaw/openclaw@322139c
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -89,7 +89,7 @@ function findLastAssistantUsage(messages: AgentMessage[]): Record<string, unknow
|
89 | 89 | return null; |
90 | 90 | } |
91 | 91 | |
92 | | -export type AnthropicPayloadLogger = { |
| 92 | +type AnthropicPayloadLogger = { |
93 | 93 | enabled: true; |
94 | 94 | wrapStreamFn: (streamFn: StreamFn) => StreamFn; |
95 | 95 | recordUsage: (messages: AgentMessage[], error?: unknown) => void; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,18 +20,6 @@ function loadAnthropicVertexStreamFacade(): AnthropicVertexStreamFacade {
|
20 | 20 | }); |
21 | 21 | } |
22 | 22 | |
23 | | -export function createAnthropicVertexStreamFn( |
24 | | -projectId: string | undefined, |
25 | | -region: string, |
26 | | -baseURL?: string, |
27 | | -): StreamFn { |
28 | | -return loadAnthropicVertexStreamFacade().createAnthropicVertexStreamFn( |
29 | | -projectId, |
30 | | -region, |
31 | | -baseURL, |
32 | | -); |
33 | | -} |
34 | | - |
35 | 23 | export function createAnthropicVertexStreamFnForModel( |
36 | 24 | model: { baseUrl?: string }, |
37 | 25 | env: NodeJS.ProcessEnv = process.env, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
2 | 2 | import { stripHeartbeatToken } from "../auto-reply/heartbeat.js"; |
3 | 3 | import { isSilentReplyText } from "../auto-reply/tokens.js"; |
4 | 4 | |
5 | | -export const TOOL_RESULT_REAL_CONVERSATION_LOOKBACK = 20; |
| 5 | +const TOOL_RESULT_REAL_CONVERSATION_LOOKBACK = 20; |
6 | 6 | const NON_CONVERSATION_BLOCK_TYPES = new Set([ |
7 | 7 | "toolCall", |
8 | 8 | "toolUse", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -181,7 +181,7 @@ export function mergeIdentityMarkdownContent(
|
181 | 181 | return nextLines.join("\n").replace(/\n*$/, "\n"); |
182 | 182 | } |
183 | 183 | |
184 | | -export function loadIdentityFromFile(identityPath: string): AgentIdentityFile | null { |
| 184 | +function loadIdentityFromFile(identityPath: string): AgentIdentityFile | null { |
185 | 185 | try { |
186 | 186 | const content = fs.readFileSync(identityPath, "utf-8"); |
187 | 187 | const parsed = parseIdentityMarkdown(content); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -221,7 +221,7 @@ export function hasInternalRuntimeContext(text: string): boolean {
|
221 | 221 | ); |
222 | 222 | } |
223 | 223 | |
224 | | -export function isOpenClawRuntimeContextCustomMessage(message: unknown): boolean { |
| 224 | +function isOpenClawRuntimeContextCustomMessage(message: unknown): boolean { |
225 | 225 | if (!message || typeof message !== "object") { |
226 | 226 | return false; |
227 | 227 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -400,7 +400,7 @@ export function normalizeBaseUrl(
|
400 | 400 | return raw.replace(/\/+$/, ""); |
401 | 401 | } |
402 | 402 | |
403 | | -export function mergeProviderRequestHeaders( |
| 403 | +function mergeProviderRequestHeaders( |
404 | 404 | ...headerSets: Array<Record<string, string> | undefined> |
405 | 405 | ): Record<string, string> | undefined { |
406 | 406 | let merged: Record<string, string> | undefined; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ function inferPeerKindFromBareId(value: string): ChatType | undefined {
|
50 | 50 | return undefined; |
51 | 51 | } |
52 | 52 | |
53 | | -export function extractRequesterPeer( |
| 53 | +function extractRequesterPeer( |
54 | 54 | channelId: string | undefined, |
55 | 55 | requesterTo: string | undefined, |
56 | 56 | ): { peerId?: string; peerKind?: ChatType } { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -54,7 +54,7 @@ export function isLiveUnendedSubagentRun(
|
54 | 54 | return !hasSubagentRunEnded(entry) && !isStaleUnendedSubagentRun(entry, now); |
55 | 55 | } |
56 | 56 | |
57 | | -export function isRecentlyEndedSubagentRun( |
| 57 | +function isRecentlyEndedSubagentRun( |
58 | 58 | entry: Pick<SubagentRunRecord, "endedAt">, |
59 | 59 | now = Date.now(), |
60 | 60 | recentMs = RECENT_ENDED_SUBAGENT_CHILD_SESSION_MS, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,7 @@ function truncateSummary(value: string, maxLen = 120): string {
|
14 | 14 | return `${trimmed}...`; |
15 | 15 | } |
16 | 16 | |
17 | | -export function isToolDocBlockStart(line: string): boolean { |
| 17 | +function isToolDocBlockStart(line: string): boolean { |
18 | 18 | const normalized = line.trim().toUpperCase(); |
19 | 19 | if (!normalized) { |
20 | 20 | return false; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。