mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:20:43 +00:00
refactor: trim agent local helper exports
This commit is contained in:
@@ -89,7 +89,7 @@ function findLastAssistantUsage(messages: AgentMessage[]): Record<string, unknow
|
||||
return null;
|
||||
}
|
||||
|
||||
export type AnthropicPayloadLogger = {
|
||||
type AnthropicPayloadLogger = {
|
||||
enabled: true;
|
||||
wrapStreamFn: (streamFn: StreamFn) => StreamFn;
|
||||
recordUsage: (messages: AgentMessage[], error?: unknown) => void;
|
||||
|
||||
@@ -20,18 +20,6 @@ function loadAnthropicVertexStreamFacade(): AnthropicVertexStreamFacade {
|
||||
});
|
||||
}
|
||||
|
||||
export function createAnthropicVertexStreamFn(
|
||||
projectId: string | undefined,
|
||||
region: string,
|
||||
baseURL?: string,
|
||||
): StreamFn {
|
||||
return loadAnthropicVertexStreamFacade().createAnthropicVertexStreamFn(
|
||||
projectId,
|
||||
region,
|
||||
baseURL,
|
||||
);
|
||||
}
|
||||
|
||||
export function createAnthropicVertexStreamFnForModel(
|
||||
model: { baseUrl?: string },
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import { stripHeartbeatToken } from "../auto-reply/heartbeat.js";
|
||||
import { isSilentReplyText } from "../auto-reply/tokens.js";
|
||||
|
||||
export const TOOL_RESULT_REAL_CONVERSATION_LOOKBACK = 20;
|
||||
const TOOL_RESULT_REAL_CONVERSATION_LOOKBACK = 20;
|
||||
const NON_CONVERSATION_BLOCK_TYPES = new Set([
|
||||
"toolCall",
|
||||
"toolUse",
|
||||
|
||||
@@ -181,7 +181,7 @@ export function mergeIdentityMarkdownContent(
|
||||
return nextLines.join("\n").replace(/\n*$/, "\n");
|
||||
}
|
||||
|
||||
export function loadIdentityFromFile(identityPath: string): AgentIdentityFile | null {
|
||||
function loadIdentityFromFile(identityPath: string): AgentIdentityFile | null {
|
||||
try {
|
||||
const content = fs.readFileSync(identityPath, "utf-8");
|
||||
const parsed = parseIdentityMarkdown(content);
|
||||
|
||||
@@ -221,7 +221,7 @@ export function hasInternalRuntimeContext(text: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export function isOpenClawRuntimeContextCustomMessage(message: unknown): boolean {
|
||||
function isOpenClawRuntimeContextCustomMessage(message: unknown): boolean {
|
||||
if (!message || typeof message !== "object") {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ export function normalizeBaseUrl(
|
||||
return raw.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
export function mergeProviderRequestHeaders(
|
||||
function mergeProviderRequestHeaders(
|
||||
...headerSets: Array<Record<string, string> | undefined>
|
||||
): Record<string, string> | undefined {
|
||||
let merged: Record<string, string> | undefined;
|
||||
|
||||
@@ -50,7 +50,7 @@ function inferPeerKindFromBareId(value: string): ChatType | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function extractRequesterPeer(
|
||||
function extractRequesterPeer(
|
||||
channelId: string | undefined,
|
||||
requesterTo: string | undefined,
|
||||
): { peerId?: string; peerKind?: ChatType } {
|
||||
|
||||
@@ -54,7 +54,7 @@ export function isLiveUnendedSubagentRun(
|
||||
return !hasSubagentRunEnded(entry) && !isStaleUnendedSubagentRun(entry, now);
|
||||
}
|
||||
|
||||
export function isRecentlyEndedSubagentRun(
|
||||
function isRecentlyEndedSubagentRun(
|
||||
entry: Pick<SubagentRunRecord, "endedAt">,
|
||||
now = Date.now(),
|
||||
recentMs = RECENT_ENDED_SUBAGENT_CHILD_SESSION_MS,
|
||||
|
||||
@@ -14,7 +14,7 @@ function truncateSummary(value: string, maxLen = 120): string {
|
||||
return `${trimmed}...`;
|
||||
}
|
||||
|
||||
export function isToolDocBlockStart(line: string): boolean {
|
||||
function isToolDocBlockStart(line: string): boolean {
|
||||
const normalized = line.trim().toUpperCase();
|
||||
if (!normalized) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user