mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:41:25 +00:00
refactor: expand bootstrap helpers and tests
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user