refactor: expand bootstrap helpers and tests

This commit is contained in:
Peter Steinberger
2026-01-18 05:50:23 +00:00
parent d5be8fa576
commit 88b37e80fc
8 changed files with 177 additions and 45 deletions

View File

@@ -1,7 +1,4 @@
import {
buildBootstrapContextFiles,
resolveBootstrapMaxChars,
} from "../../agents/pi-embedded-helpers.js";
import { resolveBootstrapMaxChars } from "../../agents/pi-embedded-helpers.js";
import { createClawdbotCodingTools } from "../../agents/pi-tools.js";
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
@@ -9,7 +6,7 @@ import { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
import { buildAgentSystemPrompt } from "../../agents/system-prompt.js";
import { buildSystemPromptReport } from "../../agents/system-prompt-report.js";
import { buildToolSummaryMap } from "../../agents/tool-summaries.js";
import { resolveBootstrapFilesForRun } from "../../agents/bootstrap-files.js";
import { resolveBootstrapContextForRun } from "../../agents/bootstrap-files.js";
import type { SessionSystemPromptReport } from "../../config/sessions/types.js";
import { getRemoteSkillEligibility } from "../../infra/skills-remote.js";
import type { ReplyPayload } from "../types.js";
@@ -52,15 +49,12 @@ async function resolveContextReport(
const workspaceDir = params.workspaceDir;
const bootstrapMaxChars = resolveBootstrapMaxChars(params.cfg);
const hookAdjustedBootstrapFiles = await resolveBootstrapFilesForRun({
const { bootstrapFiles, contextFiles: injectedFiles } = await resolveBootstrapContextForRun({
workspaceDir,
config: params.cfg,
sessionKey: params.sessionKey,
sessionId: params.sessionEntry?.sessionId,
});
const injectedFiles = buildBootstrapContextFiles(hookAdjustedBootstrapFiles, {
maxChars: bootstrapMaxChars,
});
const skillsSnapshot = (() => {
try {
return buildWorkspaceSkillSnapshot(workspaceDir, {