feat(cli): add trajectory stats tracking and completion summary (#773)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-02-01 16:37:30 -08:00
committed by GitHub
parent 514a3f8bcf
commit 2e1bd1ce78
8 changed files with 516 additions and 42 deletions

View File

@@ -174,6 +174,13 @@ export type Line =
id: string;
lines: string[]; // Multi-line status message with arrow formatting
}
| {
kind: "trajectory_summary";
id: string;
durationMs: number;
stepCount: number;
verb: string;
}
| { kind: "separator"; id: string };
/**

View File

@@ -43,6 +43,52 @@ const THINKING_VERBS = [
"internalizing",
] as const;
type ThinkingVerb = (typeof THINKING_VERBS)[number];
const PAST_TENSE_VERBS: Record<ThinkingVerb, string> = {
thinking: "thought",
processing: "processed",
computing: "computed",
calculating: "calculated",
analyzing: "analyzed",
synthesizing: "synthesized",
deliberating: "deliberated",
cogitating: "cogitated",
reflecting: "reflected",
reasoning: "reasoned",
spinning: "spun",
focusing: "focused",
machinating: "machinated",
contemplating: "contemplated",
ruminating: "ruminated",
considering: "considered",
pondering: "pondered",
evaluating: "evaluated",
assessing: "assessed",
inferring: "inferred",
deducing: "deduced",
interpreting: "interpreted",
formulating: "formulated",
strategizing: "strategized",
orchestrating: "orchestrated",
optimizing: "optimized",
calibrating: "calibrated",
indexing: "indexed",
compiling: "compiled",
rendering: "rendered",
executing: "executed",
initializing: "initialized",
"absolutely right": "was absolutely right",
"thinking about thinking": "thought about thinking",
metathinking: "did metathinking",
learning: "learned",
adapting: "adapted",
evolving: "evolved",
remembering: "remembered",
absorbing: "absorbed",
internalizing: "internalized",
};
// Get a random thinking verb (e.g., "thinking", "processing")
function getRandomVerb(): string {
const index = Math.floor(Math.random() * THINKING_VERBS.length);
@@ -54,6 +100,12 @@ export function getRandomThinkingVerb(): string {
return `is ${getRandomVerb()}`;
}
// Get a random past tense verb (e.g., "thought", "processed")
export function getRandomPastTenseVerb(): string {
const verb = getRandomVerb() as ThinkingVerb;
return PAST_TENSE_VERBS[verb] ?? "completed";
}
// Get a random thinking message (full string with agent name)
export function getRandomThinkingMessage(agentName?: string | null): string {
const verb = getRandomVerb();