refactor: trim agent local helper exports

This commit is contained in:
Peter Steinberger
2026-05-02 01:18:53 +01:00
parent 25d3f11243
commit 322139c84e
9 changed files with 8 additions and 20 deletions

View File

@@ -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;

View File

@@ -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,

View File

@@ -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",

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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 } {

View File

@@ -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,

View File

@@ -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;