feat(settings): agent.sessionDir setting shown on settings page
null keeps the deployment default (AGENT_SESSION_DIR / DATA_DIR/agent-sessions). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f9c20c67dc
commit
f6457a29db
3 files changed
+26
-3
No files matched your search
@@ -81,9 +81,16 @@ export function scopeFor(mode: "execute" | "plan_only", allowlist?: readonly str
|
||||
return { capabilities: allowlist?.length ? [...allowlist] : all.map((d) => d.id), allowedKinds: null };
|
||||
}
|
||||
|
||||
export function sessionDirOf(env: AgentEnv): string {
|
||||
/**
|
||||
* 会话目录优先级:模块装配参数(测试)> settings.agent.sessionDir > AGENT_SESSION_DIR(main 按 DATA_DIR 算好注入)
|
||||
* > ./data/agent-sessions
|
||||
*/
|
||||
export function sessionDirOf(env: AgentEnv, configured?: string | null): string {
|
||||
return resolve(
|
||||
env.opts.sessionDir ?? Deno.env.get("AGENT_SESSION_DIR") ?? join(Deno.cwd(), "data", "agent-sessions"),
|
||||
env.opts.sessionDir ??
|
||||
configured ??
|
||||
Deno.env.get("AGENT_SESSION_DIR") ??
|
||||
join(Deno.cwd(), "data", "agent-sessions"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -349,7 +356,7 @@ export async function drive(
|
||||
systemPrompt: systemPromptFor(run, scope),
|
||||
capabilities: scope.capabilities?.length ? scope.capabilities : Object.keys(CAPABILITY_CATALOG),
|
||||
settings,
|
||||
sessionDir: sessionDirOf(env),
|
||||
sessionDir: sessionDirOf(env, s.agent.sessionDir),
|
||||
actor,
|
||||
firstSeq: maxSeq?.m === null || maxSeq?.m === undefined ? 0 : Number(maxSeq.m) + 1,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user