refactor: reuse prompt params in context report
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { resolveSessionAgentIds } from "../../agents/agent-scope.js";
|
||||||
import { resolveBootstrapMaxChars } from "../../agents/pi-embedded-helpers.js";
|
import { resolveBootstrapMaxChars } from "../../agents/pi-embedded-helpers.js";
|
||||||
import { createClawdbotCodingTools } from "../../agents/pi-tools.js";
|
import { createClawdbotCodingTools } from "../../agents/pi-tools.js";
|
||||||
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
||||||
@@ -5,6 +6,7 @@ import { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
|
|||||||
import { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
|
import { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
|
||||||
import { buildAgentSystemPrompt } from "../../agents/system-prompt.js";
|
import { buildAgentSystemPrompt } from "../../agents/system-prompt.js";
|
||||||
import { buildSystemPromptReport } from "../../agents/system-prompt-report.js";
|
import { buildSystemPromptReport } from "../../agents/system-prompt-report.js";
|
||||||
|
import { buildSystemPromptParams } from "../../agents/system-prompt-params.js";
|
||||||
import { buildToolSummaryMap } from "../../agents/tool-summaries.js";
|
import { buildToolSummaryMap } from "../../agents/tool-summaries.js";
|
||||||
import { resolveBootstrapContextForRun } from "../../agents/bootstrap-files.js";
|
import { resolveBootstrapContextForRun } from "../../agents/bootstrap-files.js";
|
||||||
import type { SessionSystemPromptReport } from "../../config/sessions/types.js";
|
import type { SessionSystemPromptReport } from "../../config/sessions/types.js";
|
||||||
@@ -87,13 +89,21 @@ async function resolveContextReport(
|
|||||||
})();
|
})();
|
||||||
const toolSummaries = buildToolSummaryMap(tools);
|
const toolSummaries = buildToolSummaryMap(tools);
|
||||||
const toolNames = tools.map((t) => t.name);
|
const toolNames = tools.map((t) => t.name);
|
||||||
const runtimeInfo = {
|
const { sessionAgentId } = resolveSessionAgentIds({
|
||||||
host: "unknown",
|
sessionKey: params.sessionKey,
|
||||||
os: "unknown",
|
config: params.cfg,
|
||||||
arch: "unknown",
|
});
|
||||||
node: process.version,
|
const { runtimeInfo, userTimezone, userTime, userTimeFormat } = buildSystemPromptParams({
|
||||||
model: `${params.provider}/${params.model}`,
|
config: params.cfg,
|
||||||
};
|
agentId: sessionAgentId,
|
||||||
|
runtime: {
|
||||||
|
host: "unknown",
|
||||||
|
os: "unknown",
|
||||||
|
arch: "unknown",
|
||||||
|
node: process.version,
|
||||||
|
model: `${params.provider}/${params.model}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
const sandboxInfo = sandboxRuntime.sandboxed
|
const sandboxInfo = sandboxRuntime.sandboxed
|
||||||
? {
|
? {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -116,8 +126,9 @@ async function resolveContextReport(
|
|||||||
toolNames,
|
toolNames,
|
||||||
toolSummaries,
|
toolSummaries,
|
||||||
modelAliasLines: [],
|
modelAliasLines: [],
|
||||||
userTimezone: "",
|
userTimezone,
|
||||||
userTime: "",
|
userTime,
|
||||||
|
userTimeFormat,
|
||||||
contextFiles: injectedFiles,
|
contextFiles: injectedFiles,
|
||||||
skillsPrompt,
|
skillsPrompt,
|
||||||
heartbeatPrompt: undefined,
|
heartbeatPrompt: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user