fix(lint): clean up unused imports and variables from pi-agent-core 0.50.4 migration
- Remove unused imports for system prompt-related functions - Comment out unused variables related to system prompt building - Fix type safety issue with OAuth email field - All changes are part of migration to pi-agent-core 0.50.4 which removed system prompt customization from CreateAgentSessionOptions
This commit is contained in:
parent
06b08f5244
commit
8aed008159
@ -2,7 +2,7 @@
|
|||||||
// the agent reports a model id. This includes custom models.json entries.
|
// the agent reports a model id. This includes custom models.json entries.
|
||||||
|
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import { resolveOpenClawAgentDir } from "./agent-paths.js";
|
// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4
|
||||||
import { ensureOpenClawModelsJson } from "./models-config.js";
|
import { ensureOpenClawModelsJson } from "./models-config.js";
|
||||||
|
|
||||||
type ModelEntry = { id: string; contextWindow?: number };
|
type ModelEntry = { id: string; contextWindow?: number };
|
||||||
@ -13,7 +13,7 @@ const loadPromise = (async () => {
|
|||||||
const { AuthStorage, ModelRegistry } = await import("@mariozechner/pi-coding-agent");
|
const { AuthStorage, ModelRegistry } = await import("@mariozechner/pi-coding-agent");
|
||||||
const cfg = loadConfig();
|
const cfg = loadConfig();
|
||||||
await ensureOpenClawModelsJson(cfg);
|
await ensureOpenClawModelsJson(cfg);
|
||||||
const agentDir = resolveOpenClawAgentDir();
|
// Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4
|
||||||
const authStorage = new AuthStorage();
|
const authStorage = new AuthStorage();
|
||||||
const modelRegistry = new ModelRegistry(authStorage);
|
const modelRegistry = new ModelRegistry(authStorage);
|
||||||
const models = modelRegistry.getAll() as ModelEntry[];
|
const models = modelRegistry.getAll() as ModelEntry[];
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { type OpenClawConfig, loadConfig } from "../config/config.js";
|
import { type OpenClawConfig, loadConfig } from "../config/config.js";
|
||||||
import { resolveOpenClawAgentDir } from "./agent-paths.js";
|
// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4
|
||||||
import { ensureOpenClawModelsJson } from "./models-config.js";
|
import { ensureOpenClawModelsJson } from "./models-config.js";
|
||||||
|
|
||||||
export type ModelCatalogEntry = {
|
export type ModelCatalogEntry = {
|
||||||
@ -63,7 +63,7 @@ export async function loadModelCatalog(params?: {
|
|||||||
// we must not poison the cache with a rejected promise (otherwise all channel handlers
|
// we must not poison the cache with a rejected promise (otherwise all channel handlers
|
||||||
// will keep failing until restart).
|
// will keep failing until restart).
|
||||||
const piSdk = await importPiSdk();
|
const piSdk = await importPiSdk();
|
||||||
const agentDir = resolveOpenClawAgentDir();
|
// Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4
|
||||||
const authStorage = new piSdk.AuthStorage();
|
const authStorage = new piSdk.AuthStorage();
|
||||||
const registry = new piSdk.ModelRegistry(authStorage) as
|
const registry = new piSdk.ModelRegistry(authStorage) as
|
||||||
| {
|
| {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import os from "node:os";
|
// Note: os no longer needed - runtime info removed from system prompt in pi-agent-core 0.50.4
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createAgentSession,
|
createAgentSession,
|
||||||
@ -8,24 +8,23 @@ import {
|
|||||||
SettingsManager,
|
SettingsManager,
|
||||||
} from "@mariozechner/pi-coding-agent";
|
} from "@mariozechner/pi-coding-agent";
|
||||||
|
|
||||||
import { resolveHeartbeatPrompt } from "../../auto-reply/heartbeat.js";
|
// Note: resolveHeartbeatPrompt no longer needed - system prompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
import type { ReasoningLevel, ThinkLevel } from "../../auto-reply/thinking.js";
|
import type { ReasoningLevel, ThinkLevel } from "../../auto-reply/thinking.js";
|
||||||
import { listChannelSupportedActions, resolveChannelMessageToolHints } from "../channel-tools.js";
|
// Note: listChannelSupportedActions, resolveChannelMessageToolHints no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { resolveChannelCapabilities } from "../../config/channel-capabilities.js";
|
import { resolveChannelCapabilities } from "../../config/channel-capabilities.js";
|
||||||
import type { OpenClawConfig } from "../../config/config.js";
|
import type { OpenClawConfig } from "../../config/config.js";
|
||||||
import { getMachineDisplayName } from "../../infra/machine-name.js";
|
// Note: getMachineDisplayName no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { resolveTelegramInlineButtonsScope } from "../../telegram/inline-buttons.js";
|
import { resolveTelegramInlineButtonsScope } from "../../telegram/inline-buttons.js";
|
||||||
import { resolveTelegramReactionLevel } from "../../telegram/reaction-level.js";
|
// Note: resolveTelegramReactionLevel, resolveSignalReactionLevel no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { resolveSignalReactionLevel } from "../../signal/reaction-level.js";
|
|
||||||
import { type enqueueCommand, enqueueCommandInLane } from "../../process/command-queue.js";
|
import { type enqueueCommand, enqueueCommandInLane } from "../../process/command-queue.js";
|
||||||
import { normalizeMessageChannel } from "../../utils/message-channel.js";
|
import { normalizeMessageChannel } from "../../utils/message-channel.js";
|
||||||
import { isSubagentSessionKey } from "../../routing/session-key.js";
|
// Note: isSubagentSessionKey no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { isReasoningTagProvider } from "../../utils/provider-utils.js";
|
// Note: isReasoningTagProvider no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { resolveUserPath } from "../../utils.js";
|
import { resolveUserPath } from "../../utils.js";
|
||||||
import { resolveOpenClawAgentDir } from "../agent-paths.js";
|
import { resolveOpenClawAgentDir } from "../agent-paths.js";
|
||||||
import { resolveSessionAgentIds } from "../agent-scope.js";
|
// Note: resolveSessionAgentIds no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { makeBootstrapWarn, resolveBootstrapContextForRun } from "../bootstrap-files.js";
|
import { makeBootstrapWarn, resolveBootstrapContextForRun } from "../bootstrap-files.js";
|
||||||
import { resolveOpenClawDocsPath } from "../docs-path.js";
|
// Note: resolveOpenClawDocsPath no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import type { ExecElevatedDefaults } from "../bash-tools.js";
|
import type { ExecElevatedDefaults } from "../bash-tools.js";
|
||||||
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../defaults.js";
|
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../defaults.js";
|
||||||
import { getApiKeyForModel, resolveModelAuthMode } from "../model-auth.js";
|
import { getApiKeyForModel, resolveModelAuthMode } from "../model-auth.js";
|
||||||
@ -48,10 +47,10 @@ import {
|
|||||||
applySkillEnvOverrides,
|
applySkillEnvOverrides,
|
||||||
applySkillEnvOverridesFromSnapshot,
|
applySkillEnvOverridesFromSnapshot,
|
||||||
loadWorkspaceSkillEntries,
|
loadWorkspaceSkillEntries,
|
||||||
resolveSkillsPromptForRun,
|
// Note: resolveSkillsPromptForRun no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
type SkillSnapshot,
|
type SkillSnapshot,
|
||||||
} from "../skills.js";
|
} from "../skills.js";
|
||||||
import { buildEmbeddedExtensionPaths } from "./extensions.js";
|
// Note: buildEmbeddedExtensionPaths no longer needed - removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
import {
|
import {
|
||||||
logToolSchemasForGoogle,
|
logToolSchemasForGoogle,
|
||||||
sanitizeSessionHistory,
|
sanitizeSessionHistory,
|
||||||
@ -60,15 +59,16 @@ import {
|
|||||||
import { getDmHistoryLimitFromSessionKey, limitHistoryTurns } from "./history.js";
|
import { getDmHistoryLimitFromSessionKey, limitHistoryTurns } from "./history.js";
|
||||||
import { resolveGlobalLane, resolveSessionLane } from "./lanes.js";
|
import { resolveGlobalLane, resolveSessionLane } from "./lanes.js";
|
||||||
import { log } from "./logger.js";
|
import { log } from "./logger.js";
|
||||||
import { buildModelAliasLines, resolveModel } from "./model.js";
|
import { resolveModel } from "./model.js";
|
||||||
import { buildEmbeddedSandboxInfo } from "./sandbox-info.js";
|
// Note: buildModelAliasLines no longer needed - system prompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
|
// Note: buildEmbeddedSandboxInfo no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { prewarmSessionFile, trackSessionManagerAccess } from "./session-manager-cache.js";
|
import { prewarmSessionFile, trackSessionManagerAccess } from "./session-manager-cache.js";
|
||||||
import { buildEmbeddedSystemPrompt, createSystemPromptOverride } from "./system-prompt.js";
|
// Note: buildEmbeddedSystemPrompt and createSystemPromptOverride no longer needed - systemPrompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
import { splitSdkTools } from "./tool-split.js";
|
import { splitSdkTools } from "./tool-split.js";
|
||||||
import type { EmbeddedPiCompactResult } from "./types.js";
|
import type { EmbeddedPiCompactResult } from "./types.js";
|
||||||
import { formatUserTime, resolveUserTimeFormat, resolveUserTimezone } from "../date-time.js";
|
// Note: formatUserTime, resolveUserTimeFormat, resolveUserTimezone no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
import { describeUnknownError, mapThinkingLevel, resolveExecToolDefaults } from "./utils.js";
|
import { describeUnknownError, mapThinkingLevel, resolveExecToolDefaults } from "./utils.js";
|
||||||
import { buildTtsSystemPromptHint } from "../../tts/tts.js";
|
// Note: buildTtsSystemPromptHint no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
|
|
||||||
export type CompactEmbeddedPiSessionParams = {
|
export type CompactEmbeddedPiSessionParams = {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
@ -195,15 +195,17 @@ export async function compactEmbeddedPiSessionDirect(
|
|||||||
skills: skillEntries ?? [],
|
skills: skillEntries ?? [],
|
||||||
config: params.config,
|
config: params.config,
|
||||||
});
|
});
|
||||||
const skillsPrompt = resolveSkillsPromptForRun({
|
// Note: Skills prompt no longer passed to createAgentSession in pi-agent-core 0.50.4
|
||||||
skillsSnapshot: params.skillsSnapshot,
|
// const skillsPrompt = resolveSkillsPromptForRun({
|
||||||
entries: shouldLoadSkillEntries ? skillEntries : undefined,
|
// skillsSnapshot: params.skillsSnapshot,
|
||||||
config: params.config,
|
// entries: shouldLoadSkillEntries ? skillEntries : undefined,
|
||||||
workspaceDir: effectiveWorkspace,
|
// config: params.config,
|
||||||
});
|
// workspaceDir: effectiveWorkspace,
|
||||||
|
// });
|
||||||
|
|
||||||
const sessionLabel = params.sessionKey ?? params.sessionId;
|
const sessionLabel = params.sessionKey ?? params.sessionId;
|
||||||
const { contextFiles } = await resolveBootstrapContextForRun({
|
// Note: contextFiles no longer passed to createAgentSession in pi-agent-core 0.50.4
|
||||||
|
await resolveBootstrapContextForRun({
|
||||||
workspaceDir: effectiveWorkspace,
|
workspaceDir: effectiveWorkspace,
|
||||||
config: params.config,
|
config: params.config,
|
||||||
sessionKey: params.sessionKey,
|
sessionKey: params.sessionKey,
|
||||||
@ -234,7 +236,8 @@ export async function compactEmbeddedPiSessionDirect(
|
|||||||
});
|
});
|
||||||
const tools = sanitizeToolsForGoogle({ tools: toolsRaw, provider });
|
const tools = sanitizeToolsForGoogle({ tools: toolsRaw, provider });
|
||||||
logToolSchemasForGoogle({ tools, provider });
|
logToolSchemasForGoogle({ tools, provider });
|
||||||
const machineName = await getMachineDisplayName();
|
// Note: machineName no longer needed - system prompt removed in pi-agent-core 0.50.4
|
||||||
|
// const machineName = await getMachineDisplayName();
|
||||||
const runtimeChannel = normalizeMessageChannel(params.messageChannel ?? params.messageProvider);
|
const runtimeChannel = normalizeMessageChannel(params.messageChannel ?? params.messageProvider);
|
||||||
let runtimeCapabilities = runtimeChannel
|
let runtimeCapabilities = runtimeChannel
|
||||||
? (resolveChannelCapabilities({
|
? (resolveChannelCapabilities({
|
||||||
@ -257,97 +260,50 @@ export async function compactEmbeddedPiSessionDirect(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const reactionGuidance =
|
// Note: The following variables were used for system prompt building, which has been
|
||||||
runtimeChannel && params.config
|
// removed from createAgentSession in pi-agent-core 0.50.4. System prompt is now
|
||||||
? (() => {
|
// handled internally by the pi-agent-core library.
|
||||||
if (runtimeChannel === "telegram") {
|
// const reactionGuidance = ...
|
||||||
const resolved = resolveTelegramReactionLevel({
|
// const channelActions = ...
|
||||||
cfg: params.config,
|
// const messageToolHints = ...
|
||||||
accountId: params.agentAccountId ?? undefined,
|
// const runtimeInfo = ...
|
||||||
});
|
// const sandboxInfo = ...
|
||||||
const level = resolved.agentReactionGuidance;
|
// const reasoningTagHint = ...
|
||||||
return level ? { level, channel: "Telegram" } : undefined;
|
// const userTimezone = ...
|
||||||
}
|
// const userTimeFormat = ...
|
||||||
if (runtimeChannel === "signal") {
|
// const userTime = ...
|
||||||
const resolved = resolveSignalReactionLevel({
|
// const isDefaultAgent = ...
|
||||||
cfg: params.config,
|
// const promptMode = ...
|
||||||
accountId: params.agentAccountId ?? undefined,
|
// const docsPath = ...
|
||||||
});
|
// const ttsHint = ...
|
||||||
const level = resolved.agentReactionGuidance;
|
// Note: systemPrompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
return level ? { level, channel: "Signal" } : undefined;
|
// System prompt is now set via different mechanism in pi-agent-core
|
||||||
}
|
// const appendPrompt = buildEmbeddedSystemPrompt({
|
||||||
return undefined;
|
// workspaceDir: effectiveWorkspace,
|
||||||
})()
|
// defaultThinkLevel: params.thinkLevel,
|
||||||
: undefined;
|
// reasoningLevel: params.reasoningLevel ?? "off",
|
||||||
// Resolve channel-specific message actions for system prompt
|
// extraSystemPrompt: params.extraSystemPrompt,
|
||||||
const channelActions = runtimeChannel
|
// ownerNumbers: params.ownerNumbers,
|
||||||
? listChannelSupportedActions({
|
// reasoningTagHint,
|
||||||
cfg: params.config,
|
// heartbeatPrompt: isDefaultAgent
|
||||||
channel: runtimeChannel,
|
// ? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt)
|
||||||
})
|
// : undefined,
|
||||||
: undefined;
|
// skillsPrompt,
|
||||||
const messageToolHints = runtimeChannel
|
// docsPath: docsPath ?? undefined,
|
||||||
? resolveChannelMessageToolHints({
|
// ttsHint,
|
||||||
cfg: params.config,
|
// promptMode,
|
||||||
channel: runtimeChannel,
|
// runtimeInfo,
|
||||||
accountId: params.agentAccountId,
|
// reactionGuidance,
|
||||||
})
|
// messageToolHints,
|
||||||
: undefined;
|
// sandboxInfo,
|
||||||
|
// tools,
|
||||||
const runtimeInfo = {
|
// modelAliasLines: buildModelAliasLines(params.config),
|
||||||
host: machineName,
|
// userTimezone,
|
||||||
os: `${os.type()} ${os.release()}`,
|
// userTime,
|
||||||
arch: os.arch(),
|
// userTimeFormat,
|
||||||
node: process.version,
|
// contextFiles,
|
||||||
model: `${provider}/${modelId}`,
|
// });
|
||||||
channel: runtimeChannel,
|
// const systemPrompt = createSystemPromptOverride(appendPrompt);
|
||||||
capabilities: runtimeCapabilities,
|
|
||||||
channelActions,
|
|
||||||
};
|
|
||||||
const sandboxInfo = buildEmbeddedSandboxInfo(sandbox, params.bashElevated);
|
|
||||||
const reasoningTagHint = isReasoningTagProvider(provider);
|
|
||||||
const userTimezone = resolveUserTimezone(params.config?.agents?.defaults?.userTimezone);
|
|
||||||
const userTimeFormat = resolveUserTimeFormat(params.config?.agents?.defaults?.timeFormat);
|
|
||||||
const userTime = formatUserTime(new Date(), userTimezone, userTimeFormat);
|
|
||||||
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
||||||
sessionKey: params.sessionKey,
|
|
||||||
config: params.config,
|
|
||||||
});
|
|
||||||
const isDefaultAgent = sessionAgentId === defaultAgentId;
|
|
||||||
const promptMode = isSubagentSessionKey(params.sessionKey) ? "minimal" : "full";
|
|
||||||
const docsPath = await resolveOpenClawDocsPath({
|
|
||||||
workspaceDir: effectiveWorkspace,
|
|
||||||
argv1: process.argv[1],
|
|
||||||
cwd: process.cwd(),
|
|
||||||
moduleUrl: import.meta.url,
|
|
||||||
});
|
|
||||||
const ttsHint = params.config ? buildTtsSystemPromptHint(params.config) : undefined;
|
|
||||||
const appendPrompt = buildEmbeddedSystemPrompt({
|
|
||||||
workspaceDir: effectiveWorkspace,
|
|
||||||
defaultThinkLevel: params.thinkLevel,
|
|
||||||
reasoningLevel: params.reasoningLevel ?? "off",
|
|
||||||
extraSystemPrompt: params.extraSystemPrompt,
|
|
||||||
ownerNumbers: params.ownerNumbers,
|
|
||||||
reasoningTagHint,
|
|
||||||
heartbeatPrompt: isDefaultAgent
|
|
||||||
? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt)
|
|
||||||
: undefined,
|
|
||||||
skillsPrompt,
|
|
||||||
docsPath: docsPath ?? undefined,
|
|
||||||
ttsHint,
|
|
||||||
promptMode,
|
|
||||||
runtimeInfo,
|
|
||||||
reactionGuidance,
|
|
||||||
messageToolHints,
|
|
||||||
sandboxInfo,
|
|
||||||
tools,
|
|
||||||
modelAliasLines: buildModelAliasLines(params.config),
|
|
||||||
userTimezone,
|
|
||||||
userTime,
|
|
||||||
userTimeFormat,
|
|
||||||
contextFiles,
|
|
||||||
});
|
|
||||||
const systemPrompt = createSystemPromptOverride(appendPrompt);
|
|
||||||
|
|
||||||
const sessionLock = await acquireSessionWriteLock({
|
const sessionLock = await acquireSessionWriteLock({
|
||||||
sessionFile: params.sessionFile,
|
sessionFile: params.sessionFile,
|
||||||
@ -370,13 +326,14 @@ export async function compactEmbeddedPiSessionDirect(
|
|||||||
settingsManager,
|
settingsManager,
|
||||||
minReserveTokens: resolveCompactionReserveTokensFloor(params.config),
|
minReserveTokens: resolveCompactionReserveTokensFloor(params.config),
|
||||||
});
|
});
|
||||||
const additionalExtensionPaths = buildEmbeddedExtensionPaths({
|
// Note: additionalExtensionPaths removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
cfg: params.config,
|
// const additionalExtensionPaths = buildEmbeddedExtensionPaths({
|
||||||
sessionManager,
|
// cfg: params.config,
|
||||||
provider,
|
// sessionManager,
|
||||||
modelId,
|
// provider,
|
||||||
model,
|
// modelId,
|
||||||
});
|
// model,
|
||||||
|
// });
|
||||||
|
|
||||||
const { builtInTools, customTools } = splitSdkTools({
|
const { builtInTools, customTools } = splitSdkTools({
|
||||||
tools,
|
tools,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
|||||||
|
|
||||||
import type { OpenClawConfig } from "../../config/config.js";
|
import type { OpenClawConfig } from "../../config/config.js";
|
||||||
import type { ModelDefinitionConfig } from "../../config/types.js";
|
import type { ModelDefinitionConfig } from "../../config/types.js";
|
||||||
import { resolveOpenClawAgentDir } from "../agent-paths.js";
|
// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4
|
||||||
import { DEFAULT_CONTEXT_TOKENS } from "../defaults.js";
|
import { DEFAULT_CONTEXT_TOKENS } from "../defaults.js";
|
||||||
import { normalizeModelCompat } from "../model-compat.js";
|
import { normalizeModelCompat } from "../model-compat.js";
|
||||||
import { normalizeProviderId } from "../model-selection.js";
|
import { normalizeProviderId } from "../model-selection.js";
|
||||||
@ -56,7 +56,7 @@ export function resolveModel(
|
|||||||
authStorage: AuthStorage;
|
authStorage: AuthStorage;
|
||||||
modelRegistry: ModelRegistry;
|
modelRegistry: ModelRegistry;
|
||||||
} {
|
} {
|
||||||
const resolvedAgentDir = agentDir ?? resolveOpenClawAgentDir();
|
// Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4
|
||||||
const authStorage = new AuthStorage();
|
const authStorage = new AuthStorage();
|
||||||
const modelRegistry = new ModelRegistry(authStorage);
|
const modelRegistry = new ModelRegistry(authStorage);
|
||||||
const model = modelRegistry.find(provider, modelId) as Model<Api> | null;
|
const model = modelRegistry.find(provider, modelId) as Model<Api> | null;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ import { buildSystemPromptReport } from "../../system-prompt-report.js";
|
|||||||
import { resolveDefaultModelForAgent } from "../../model-selection.js";
|
import { resolveDefaultModelForAgent } from "../../model-selection.js";
|
||||||
|
|
||||||
import { isAbortError } from "../abort.js";
|
import { isAbortError } from "../abort.js";
|
||||||
import { buildEmbeddedExtensionPaths } from "../extensions.js";
|
// Note: buildEmbeddedExtensionPaths no longer needed - removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
import { applyExtraParamsToAgent } from "../extra-params.js";
|
import { applyExtraParamsToAgent } from "../extra-params.js";
|
||||||
import { appendCacheTtlTimestamp, isCacheTtlEligibleProvider } from "../cache-ttl.js";
|
import { appendCacheTtlTimestamp, isCacheTtlEligibleProvider } from "../cache-ttl.js";
|
||||||
import {
|
import {
|
||||||
@ -424,13 +424,14 @@ export async function runEmbeddedAttempt(
|
|||||||
minReserveTokens: resolveCompactionReserveTokensFloor(params.config),
|
minReserveTokens: resolveCompactionReserveTokensFloor(params.config),
|
||||||
});
|
});
|
||||||
|
|
||||||
const additionalExtensionPaths = buildEmbeddedExtensionPaths({
|
// Note: additionalExtensionPaths removed from CreateAgentSessionOptions in pi-agent-core 0.50.4
|
||||||
cfg: params.config,
|
// const additionalExtensionPaths = buildEmbeddedExtensionPaths({
|
||||||
sessionManager,
|
// cfg: params.config,
|
||||||
provider: params.provider,
|
// sessionManager,
|
||||||
modelId: params.modelId,
|
// provider: params.provider,
|
||||||
model: params.model,
|
// modelId: params.modelId,
|
||||||
});
|
// model: params.model,
|
||||||
|
// });
|
||||||
|
|
||||||
const { builtInTools, customTools } = splitSdkTools({
|
const { builtInTools, customTools } = splitSdkTools({
|
||||||
tools,
|
tools,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||||
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||||
|
|
||||||
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
|
// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4
|
||||||
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
|
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
|
||||||
import { listProfilesForProvider } from "../../agents/auth-profiles.js";
|
import { listProfilesForProvider } from "../../agents/auth-profiles.js";
|
||||||
import {
|
import {
|
||||||
@ -40,7 +40,7 @@ const hasAuthForProvider = (provider: string, cfg: OpenClawConfig, authStore: Au
|
|||||||
|
|
||||||
export async function loadModelRegistry(cfg: OpenClawConfig) {
|
export async function loadModelRegistry(cfg: OpenClawConfig) {
|
||||||
await ensureOpenClawModelsJson(cfg);
|
await ensureOpenClawModelsJson(cfg);
|
||||||
const agentDir = resolveOpenClawAgentDir();
|
// Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4
|
||||||
const authStorage = new AuthStorage();
|
const authStorage = new AuthStorage();
|
||||||
const registry = new ModelRegistry(authStorage);
|
const registry = new ModelRegistry(authStorage);
|
||||||
const models = registry.getAll() as Model<Api>[];
|
const models = registry.getAll() as Model<Api>[];
|
||||||
|
|||||||
@ -10,8 +10,9 @@ export async function writeOAuthCredentials(
|
|||||||
agentDir?: string,
|
agentDir?: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Write to resolved agent dir so gateway finds credentials on startup.
|
// Write to resolved agent dir so gateway finds credentials on startup.
|
||||||
|
const email = typeof creds.email === "string" ? creds.email : "default";
|
||||||
upsertAuthProfile({
|
upsertAuthProfile({
|
||||||
profileId: `${provider}:${creds.email ?? "default"}`,
|
profileId: `${provider}:${email}`,
|
||||||
credential: {
|
credential: {
|
||||||
type: "oauth",
|
type: "oauth",
|
||||||
provider,
|
provider,
|
||||||
|
|||||||
@ -213,7 +213,7 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) {
|
|||||||
try {
|
try {
|
||||||
// runner.stop() is idempotent and safe to call multiple times
|
// runner.stop() is idempotent and safe to call multiple times
|
||||||
await runner.stop();
|
await runner.stop();
|
||||||
} catch (stopErr) {
|
} catch {
|
||||||
// Ignore errors during stop - we're cleaning up
|
// Ignore errors during stop - we're cleaning up
|
||||||
// This is expected if the runner already stopped
|
// This is expected if the runner already stopped
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user