Handoff-style /model switch command and per-turn thinking level (#64)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import path from "node:path";
|
||||
import { open, readdir } from "node:fs/promises";
|
||||
import {
|
||||
createAgent,
|
||||
findLatestTraceFile,
|
||||
isSessionMeta,
|
||||
parseTraceLines,
|
||||
readTraceTolerant,
|
||||
@@ -389,6 +390,21 @@ export class SessionService {
|
||||
return this.toInfo(row, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute path of a Session's **latest** Trace file (the current context shard);
|
||||
* undefined when no Trace exists. Costs a directory walk, so only the single-session
|
||||
* GET includes it in the DTO (see SessionInfo.tracePath) — the web's `/model` switch
|
||||
* hands it to the new session's `<model_switch_from>` block so the model can read the
|
||||
* source history itself when it needs it.
|
||||
*/
|
||||
async latestTracePath(row: SessionRow): Promise<string | undefined> {
|
||||
const located = await findLatestTraceFile(
|
||||
tracesDir(this.deps.root, row.projectId, row.agentId),
|
||||
row.sessionId,
|
||||
);
|
||||
return located?.path;
|
||||
}
|
||||
|
||||
/**
|
||||
* One walk over the Trace directory: session_id → its **earliest** shard (the shard
|
||||
* whose head carries the original session_meta). Discovery (which Sessions have
|
||||
|
||||
Reference in New Issue
Block a user