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

@@ -5,6 +5,8 @@ import {
loadWorkspaceBootstrapFiles,
type WorkspaceBootstrapFile,
} from "./workspace.js";
import { buildBootstrapContextFiles, resolveBootstrapMaxChars } from "./pi-embedded-helpers.js";
import type { EmbeddedContextFile } from "./pi-embedded-helpers.js";
export async function resolveBootstrapFilesForRun(params: {
workspaceDir: string;
@@ -27,3 +29,22 @@ export async function resolveBootstrapFilesForRun(params: {
agentId: params.agentId,
});
}
export async function resolveBootstrapContextForRun(params: {
workspaceDir: string;
config?: ClawdbotConfig;
sessionKey?: string;
sessionId?: string;
agentId?: string;
warn?: (message: string) => void;
}): Promise<{
bootstrapFiles: WorkspaceBootstrapFile[];
contextFiles: EmbeddedContextFile[];
}> {
const bootstrapFiles = await resolveBootstrapFilesForRun(params);
const contextFiles = buildBootstrapContextFiles(bootstrapFiles, {
maxChars: resolveBootstrapMaxChars(params.config),
warn: params.warn,
});
return { bootstrapFiles, contextFiles };
}