feat: enhance workspace scaffolding with new identity and soul templates, and support for default user file

This commit is contained in:
Lauren ten Hoor
2026-02-16 14:57:17 +08:00
parent 25ce06e14f
commit d0d1bdda60
3 changed files with 99 additions and 3 deletions

View File

@@ -66,7 +66,8 @@ export async function runSetup(opts: SetupOpts): Promise<SetupResult> {
await writePluginConfig(opts.api, agentId, opts.projectExecution);
const filesWritten = await scaffoldWorkspace(workspacePath);
const defaultWorkspacePath = getDefaultWorkspacePath(opts.api);
const filesWritten = await scaffoldWorkspace(workspacePath, defaultWorkspacePath);
const models = buildModelConfig(opts.models);
await writeModelsToWorkflow(workspacePath, models);
@@ -140,6 +141,15 @@ function buildModelConfig(overrides?: SetupOpts["models"]): ModelConfig {
return result;
}
function getDefaultWorkspacePath(api: OpenClawPluginApi): string | undefined {
try {
const config = api.runtime.config.loadConfig();
return (config as any).agents?.defaults?.workspace ?? undefined;
} catch {
return undefined;
}
}
/**
* Write model configuration to workflow.yaml (single source of truth).
* Reads the existing workflow.yaml, merges model overrides into the roles section, and writes back.