agentfootprint-lens 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3N4WQXQP.js → chunk-5A3FABSM.js} +3 -322
- package/dist/chunk-5A3FABSM.js.map +1 -0
- package/dist/{chunk-S7ZDOAUU.js → chunk-HJ4VDPJF.js} +81 -26
- package/dist/chunk-HJ4VDPJF.js.map +1 -0
- package/dist/core.cjs +2 -322
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -143
- package/dist/core.d.ts +1 -143
- package/dist/core.js +1 -3
- package/dist/index.cjs +81 -345
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -4
- package/dist/react.cjs +81 -345
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +17 -5
- package/dist/react.d.ts +17 -5
- package/dist/react.js +2 -4
- package/package.json +1 -1
- package/dist/chunk-3N4WQXQP.js.map +0 -1
- package/dist/chunk-AWPI6OVI.js +0 -4973
- package/dist/chunk-AWPI6OVI.js.map +0 -1
- package/dist/chunk-FMWPUZP4.js +0 -4970
- package/dist/chunk-FMWPUZP4.js.map +0 -1
- package/dist/chunk-KEZW45M7.js +0 -4973
- package/dist/chunk-KEZW45M7.js.map +0 -1
- package/dist/chunk-S7ZDOAUU.js.map +0 -1
- package/dist/chunk-VTJ6OQYJ.js +0 -4934
- package/dist/chunk-VTJ6OQYJ.js.map +0 -1
|
@@ -1,321 +1,3 @@
|
|
|
1
|
-
// src/core/LiveTimelineBuilder.ts
|
|
2
|
-
var LiveTimelineBuilder = class {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.turns = [];
|
|
5
|
-
this.currentTurn = null;
|
|
6
|
-
/**
|
|
7
|
-
* The most-recently-started iteration. Stays bound through the entire
|
|
8
|
-
* iteration lifecycle — llm_start opens it, llm_end ends the LLM phase
|
|
9
|
-
* but the iter stays current so subsequent `tool_start` / `tool_end`
|
|
10
|
-
* events (which fire AFTER llm_end in the agent loop) still attach to
|
|
11
|
-
* it. Cleared only on `commitCurrentTurn()` / `reset()`.
|
|
12
|
-
*/
|
|
13
|
-
this.currentIter = null;
|
|
14
|
-
/**
|
|
15
|
-
* True between an iteration's `llm_start` and its `llm_end`. Drives
|
|
16
|
-
* context-injection routing: events emitted while the LLM phase is
|
|
17
|
-
* active belong to THIS iteration's prompt; events emitted after
|
|
18
|
-
* `llm_end` belong to the NEXT iteration (they shape its context).
|
|
19
|
-
* Tool start/end ignore this flag — they always attach to the
|
|
20
|
-
* most-recent iter regardless of LLM phase.
|
|
21
|
-
*/
|
|
22
|
-
this.llmPhaseActive = false;
|
|
23
|
-
this.toolByCallId = /* @__PURE__ */ new Map();
|
|
24
|
-
this.messages = [];
|
|
25
|
-
this.finalDecision = {};
|
|
26
|
-
/** Context injections that fired BEFORE this turn's first llm_start —
|
|
27
|
-
* they shape iteration 1's context. Flushed onto iteration 1 at its
|
|
28
|
-
* llm_start. Reset at turn_start so each turn accumulates its own. */
|
|
29
|
-
this.pendingPreIterInjections = [];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Begin a new turn. Call this BEFORE `agent.run(userPrompt)` so the
|
|
33
|
-
* user's prompt appears alongside the iterations it produced. Safe to
|
|
34
|
-
* call even mid-conversation — it closes the previous turn cleanly.
|
|
35
|
-
*/
|
|
36
|
-
startTurn(userPrompt) {
|
|
37
|
-
if (this.currentTurn) this.commitCurrentTurn();
|
|
38
|
-
this.currentTurn = {
|
|
39
|
-
index: this.turns.length,
|
|
40
|
-
userPrompt,
|
|
41
|
-
iterations: [],
|
|
42
|
-
finalContent: "",
|
|
43
|
-
totalInputTokens: 0,
|
|
44
|
-
totalOutputTokens: 0,
|
|
45
|
-
totalDurationMs: 0,
|
|
46
|
-
startMs: Date.now()
|
|
47
|
-
};
|
|
48
|
-
this.pendingPreIterInjections = [];
|
|
49
|
-
this.messages.push({ role: "user", content: userPrompt });
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Optional — attach the system prompt so MessagesPanel can render it
|
|
53
|
-
* in the collapsible preamble. Usually set once at agent construction.
|
|
54
|
-
*/
|
|
55
|
-
setSystemPrompt(prompt) {
|
|
56
|
-
this.systemPrompt = prompt;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Feed one agent stream event. Safe to call for unknown events; we
|
|
60
|
-
* ignore anything we don't recognize.
|
|
61
|
-
*/
|
|
62
|
-
ingest(event) {
|
|
63
|
-
const e = event;
|
|
64
|
-
if (!e || typeof e.type !== "string") return;
|
|
65
|
-
switch (e.type) {
|
|
66
|
-
case "turn_start":
|
|
67
|
-
case "agentfootprint.agent.turn_start": {
|
|
68
|
-
const userMessage = e.userMessage ?? "";
|
|
69
|
-
this.startTurn(userMessage);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
case "llm_start":
|
|
73
|
-
case "agentfootprint.stream.llm_start":
|
|
74
|
-
this.onLLMStart(e);
|
|
75
|
-
return;
|
|
76
|
-
case "llm_end":
|
|
77
|
-
case "agentfootprint.stream.llm_end":
|
|
78
|
-
this.onLLMEnd(e);
|
|
79
|
-
return;
|
|
80
|
-
case "tool_start":
|
|
81
|
-
case "agentfootprint.stream.tool_start":
|
|
82
|
-
this.onToolStart(e);
|
|
83
|
-
return;
|
|
84
|
-
case "tool_end":
|
|
85
|
-
case "agentfootprint.stream.tool_end":
|
|
86
|
-
this.onToolEnd(e);
|
|
87
|
-
return;
|
|
88
|
-
case "turn_end":
|
|
89
|
-
case "agentfootprint.agent.turn_complete":
|
|
90
|
-
this.commitCurrentTurn();
|
|
91
|
-
return;
|
|
92
|
-
default:
|
|
93
|
-
if (typeof e.type === "string" && e.type.startsWith("agentfootprint.context.")) {
|
|
94
|
-
this.onContextInjection(e.type, e);
|
|
95
|
-
}
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Route a context-engineering event to the iteration it shaped.
|
|
101
|
-
*
|
|
102
|
-
* Routing rule: the `llmPhaseActive` flag (true between this iter's
|
|
103
|
-
* llm_start and llm_end) decides. While active, the event shaped THIS
|
|
104
|
-
* iter's prompt → attach directly. While inactive (between llm_end
|
|
105
|
-
* and the next llm_start, or before the first llm_start), the event
|
|
106
|
-
* is preparing context for the NEXT iter → queue on
|
|
107
|
-
* `pendingPreIterInjections`, flushed onto the next iter at its
|
|
108
|
-
* llm_start. Tool events do not gate on this flag — they bind to the
|
|
109
|
-
* most-recent iter unconditionally.
|
|
110
|
-
*/
|
|
111
|
-
onContextInjection(rawName, e) {
|
|
112
|
-
if (!this.currentTurn) return;
|
|
113
|
-
const injection = buildInjection(rawName, e);
|
|
114
|
-
if (!injection) return;
|
|
115
|
-
if (this.currentIter && this.llmPhaseActive) {
|
|
116
|
-
this.currentIter.contextInjections.push(injection);
|
|
117
|
-
} else {
|
|
118
|
-
this.pendingPreIterInjections.push(injection);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
onLLMStart(e) {
|
|
122
|
-
if (!this.currentTurn) return;
|
|
123
|
-
const iterNum = e.iteration ?? this.currentTurn.iterations.length + 1;
|
|
124
|
-
const carriedInjections = this.pendingPreIterInjections;
|
|
125
|
-
this.pendingPreIterInjections = [];
|
|
126
|
-
this.currentIter = {
|
|
127
|
-
index: iterNum,
|
|
128
|
-
assistantContent: "",
|
|
129
|
-
toolCalls: [],
|
|
130
|
-
decisionAtStart: {},
|
|
131
|
-
visibleTools: [],
|
|
132
|
-
startMs: Date.now(),
|
|
133
|
-
// Freeze the message count here so "What Neo saw" can reproduce
|
|
134
|
-
// the context window at this exact iteration later.
|
|
135
|
-
messagesSentCount: this.messages.length,
|
|
136
|
-
contextInjections: carriedInjections
|
|
137
|
-
};
|
|
138
|
-
this.currentTurn.iterations.push(this.currentIter);
|
|
139
|
-
this.llmPhaseActive = true;
|
|
140
|
-
}
|
|
141
|
-
onLLMEnd(e) {
|
|
142
|
-
if (!this.currentIter || !this.currentTurn) return;
|
|
143
|
-
this.currentIter.assistantContent = e.content ?? this.currentIter.assistantContent;
|
|
144
|
-
if (e.model) this.currentIter.model = e.model;
|
|
145
|
-
if (e.usage?.inputTokens !== void 0) this.currentIter.inputTokens = e.usage.inputTokens;
|
|
146
|
-
if (e.usage?.outputTokens !== void 0) this.currentIter.outputTokens = e.usage.outputTokens;
|
|
147
|
-
if (e.stopReason) this.currentIter.stopReason = e.stopReason;
|
|
148
|
-
this.currentIter.durationMs = e.durationMs ?? Date.now() - this.currentIter.startMs;
|
|
149
|
-
this.currentTurn.totalInputTokens += this.currentIter.inputTokens ?? 0;
|
|
150
|
-
this.currentTurn.totalOutputTokens += this.currentIter.outputTokens ?? 0;
|
|
151
|
-
this.currentTurn.totalDurationMs += this.currentIter.durationMs ?? 0;
|
|
152
|
-
if (this.currentIter.assistantContent) {
|
|
153
|
-
this.messages.push({ role: "assistant", content: this.currentIter.assistantContent });
|
|
154
|
-
}
|
|
155
|
-
if ((e.toolCallCount ?? 0) === 0) {
|
|
156
|
-
this.currentTurn.finalContent = this.currentIter.assistantContent;
|
|
157
|
-
}
|
|
158
|
-
this.llmPhaseActive = false;
|
|
159
|
-
}
|
|
160
|
-
onToolStart(e) {
|
|
161
|
-
if (!this.currentIter || !this.currentTurn) return;
|
|
162
|
-
const tool = {
|
|
163
|
-
id: e.toolCallId ?? `tool-${this.currentIter.toolCalls.length}`,
|
|
164
|
-
name: e.toolName ?? "unknown",
|
|
165
|
-
arguments: e.args ?? {},
|
|
166
|
-
result: "",
|
|
167
|
-
iterationIndex: this.currentIter.index,
|
|
168
|
-
turnIndex: this.currentTurn.index,
|
|
169
|
-
startMs: Date.now()
|
|
170
|
-
};
|
|
171
|
-
this.currentIter.toolCalls.push(tool);
|
|
172
|
-
this.toolByCallId.set(tool.id, tool);
|
|
173
|
-
}
|
|
174
|
-
onToolEnd(e) {
|
|
175
|
-
const tool = this.toolByCallId.get(e.toolCallId ?? "");
|
|
176
|
-
if (!tool) return;
|
|
177
|
-
const r = e.result;
|
|
178
|
-
if (typeof r === "string") {
|
|
179
|
-
tool.result = r;
|
|
180
|
-
} else if (r && typeof r === "object") {
|
|
181
|
-
tool.result = r.content ?? "";
|
|
182
|
-
if (r.error === true) tool.error = true;
|
|
183
|
-
}
|
|
184
|
-
tool.durationMs = e.durationMs ?? Date.now() - tool.startMs;
|
|
185
|
-
this.messages.push({ role: "tool", content: tool.result, toolCallId: tool.id });
|
|
186
|
-
}
|
|
187
|
-
commitCurrentTurn() {
|
|
188
|
-
if (!this.currentTurn) return;
|
|
189
|
-
this.turns.push(this.currentTurn);
|
|
190
|
-
this.currentTurn = null;
|
|
191
|
-
this.currentIter = null;
|
|
192
|
-
this.llmPhaseActive = false;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Snapshot the current state as an immutable `AgentTimeline`. Safe to
|
|
196
|
-
* call at any point — mid-run gives you the partial state so Lens can
|
|
197
|
-
* live-update.
|
|
198
|
-
*/
|
|
199
|
-
getTimeline() {
|
|
200
|
-
const allTurns = [...this.turns];
|
|
201
|
-
if (this.currentTurn) allTurns.push(this.currentTurn);
|
|
202
|
-
const tools = [];
|
|
203
|
-
const frozenTurns = allTurns.map((t) => {
|
|
204
|
-
const turnInjections = [];
|
|
205
|
-
const turnLedger = {};
|
|
206
|
-
const iterations = t.iterations.map((i) => {
|
|
207
|
-
const tcs = i.toolCalls.map((tc) => ({ ...tc }));
|
|
208
|
-
tools.push(...tcs);
|
|
209
|
-
const contextInjections = i.contextInjections.map(
|
|
210
|
-
(ci) => ({ ...ci })
|
|
211
|
-
);
|
|
212
|
-
const contextLedger = {};
|
|
213
|
-
for (const ci of contextInjections) {
|
|
214
|
-
const d = ci.deltaCount;
|
|
215
|
-
if (!d) continue;
|
|
216
|
-
for (const [key, val] of Object.entries(d)) {
|
|
217
|
-
if (typeof val === "number") {
|
|
218
|
-
const prev = typeof contextLedger[key] === "number" ? contextLedger[key] : 0;
|
|
219
|
-
contextLedger[key] = prev + val;
|
|
220
|
-
const prevTurn = typeof turnLedger[key] === "number" ? turnLedger[key] : 0;
|
|
221
|
-
turnLedger[key] = prevTurn + val;
|
|
222
|
-
} else if (typeof val === "boolean") {
|
|
223
|
-
contextLedger[key] = contextLedger[key] === true || val;
|
|
224
|
-
turnLedger[key] = turnLedger[key] === true || val;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
turnInjections.push(...contextInjections);
|
|
229
|
-
return {
|
|
230
|
-
...i,
|
|
231
|
-
toolCalls: tcs,
|
|
232
|
-
contextInjections,
|
|
233
|
-
contextLedger
|
|
234
|
-
};
|
|
235
|
-
});
|
|
236
|
-
return {
|
|
237
|
-
...t,
|
|
238
|
-
iterations,
|
|
239
|
-
contextInjections: turnInjections,
|
|
240
|
-
contextLedger: turnLedger
|
|
241
|
-
};
|
|
242
|
-
});
|
|
243
|
-
return {
|
|
244
|
-
turns: frozenTurns,
|
|
245
|
-
messages: [...this.messages],
|
|
246
|
-
tools,
|
|
247
|
-
finalDecision: { ...this.finalDecision },
|
|
248
|
-
rawSnapshot: null
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Fold in a final `decision` scope after the run — useful when
|
|
253
|
-
* the consumer wants the Decision Ribbon (phase-2) to reflect the
|
|
254
|
-
* post-run state. Safe no-op during the run itself.
|
|
255
|
-
*/
|
|
256
|
-
setFinalDecision(decision) {
|
|
257
|
-
this.finalDecision = decision;
|
|
258
|
-
}
|
|
259
|
-
/** Get the optional system prompt for the Messages preamble. */
|
|
260
|
-
getSystemPrompt() {
|
|
261
|
-
return this.systemPrompt;
|
|
262
|
-
}
|
|
263
|
-
/** Wipe state. Useful when the consumer starts a fresh conversation. */
|
|
264
|
-
reset() {
|
|
265
|
-
this.turns = [];
|
|
266
|
-
this.currentTurn = null;
|
|
267
|
-
this.currentIter = null;
|
|
268
|
-
this.llmPhaseActive = false;
|
|
269
|
-
this.toolByCallId.clear();
|
|
270
|
-
this.messages = [];
|
|
271
|
-
this.finalDecision = {};
|
|
272
|
-
this.pendingPreIterInjections = [];
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
function buildInjection(name, e) {
|
|
276
|
-
const suffix = name.slice("agentfootprint.context.".length);
|
|
277
|
-
const payload = e.payload;
|
|
278
|
-
const data = payload && typeof payload === "object" ? payload : e ?? {};
|
|
279
|
-
const role = typeof data.role === "string" ? data.role : void 0;
|
|
280
|
-
const targetIndex = typeof data.targetIndex === "number" ? data.targetIndex : void 0;
|
|
281
|
-
const deltaCount = data.deltaCount && typeof data.deltaCount === "object" ? data.deltaCount : void 0;
|
|
282
|
-
const enrich = (base) => ({
|
|
283
|
-
...base,
|
|
284
|
-
...role !== void 0 && { role },
|
|
285
|
-
...targetIndex !== void 0 && { targetIndex },
|
|
286
|
-
...deltaCount !== void 0 && { deltaCount },
|
|
287
|
-
payload: data
|
|
288
|
-
});
|
|
289
|
-
switch (suffix) {
|
|
290
|
-
case "rag.chunks": {
|
|
291
|
-
const chunkCount = Number(data.chunkCount ?? 0);
|
|
292
|
-
const topScore = typeof data.topScore === "number" ? data.topScore : void 0;
|
|
293
|
-
const label = chunkCount > 0 ? `${chunkCount} chunk${chunkCount === 1 ? "" : "s"}${topScore !== void 0 ? ` \xB7 top ${topScore.toFixed(2)}` : ""}` : "0 chunks";
|
|
294
|
-
return enrich({ source: "rag", slot: "messages", label });
|
|
295
|
-
}
|
|
296
|
-
case "skill.activated": {
|
|
297
|
-
const skillId = String(data.skillId ?? "skill");
|
|
298
|
-
return enrich({ source: "skill", slot: "system-prompt", label: skillId });
|
|
299
|
-
}
|
|
300
|
-
case "memory.injected": {
|
|
301
|
-
const count = Number(data.count ?? 0);
|
|
302
|
-
const label = count > 0 ? `memory \xB7 ${count} msg${count === 1 ? "" : "s"}` : "memory";
|
|
303
|
-
return enrich({ source: "memory", slot: "messages", label });
|
|
304
|
-
}
|
|
305
|
-
case "instructions.fired": {
|
|
306
|
-
const count = Number(data.count ?? (Array.isArray(data.ids) ? data.ids.length : 1));
|
|
307
|
-
const label = `${count} instruction${count === 1 ? "" : "s"}`;
|
|
308
|
-
return enrich({ source: "instructions", slot: "system-prompt", label });
|
|
309
|
-
}
|
|
310
|
-
default:
|
|
311
|
-
return enrich({
|
|
312
|
-
source: suffix.split(".")[0] || "context",
|
|
313
|
-
slot: "messages",
|
|
314
|
-
label: suffix
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
1
|
// src/core/fromAgentSnapshot.ts
|
|
320
2
|
function fromAgentSnapshot(runtime) {
|
|
321
3
|
const shared = runtime?.sharedState ?? {};
|
|
@@ -491,7 +173,7 @@ function assembleTurns(messages, llmCalls, toolExecs, instructionEvals, toolReso
|
|
|
491
173
|
visibleTools: visible?.visibleTools ?? [],
|
|
492
174
|
// Post-process path (snapshot-import — no live emit stream) has no
|
|
493
175
|
// way to reconstruct context-injection timing. Leave empty; the
|
|
494
|
-
// live path via
|
|
176
|
+
// live path via agentTimeline() recorder fills these in naturally.
|
|
495
177
|
contextInjections: [],
|
|
496
178
|
contextLedger: {}
|
|
497
179
|
};
|
|
@@ -525,7 +207,7 @@ function finalizeTurn(t) {
|
|
|
525
207
|
totalDurationMs,
|
|
526
208
|
// Post-process snapshot path has no live emit timing, so the
|
|
527
209
|
// turn-level context fields stay empty here too — the live
|
|
528
|
-
//
|
|
210
|
+
// live recorder path is the one that captures injections.
|
|
529
211
|
contextInjections: [],
|
|
530
212
|
contextLedger: {}
|
|
531
213
|
};
|
|
@@ -685,8 +367,7 @@ function truncate(s, max) {
|
|
|
685
367
|
}
|
|
686
368
|
|
|
687
369
|
export {
|
|
688
|
-
LiveTimelineBuilder,
|
|
689
370
|
fromAgentSnapshot,
|
|
690
371
|
deriveStages
|
|
691
372
|
};
|
|
692
|
-
//# sourceMappingURL=chunk-
|
|
373
|
+
//# sourceMappingURL=chunk-5A3FABSM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/fromAgentSnapshot.ts","../src/core/deriveStages.ts"],"sourcesContent":["/**\n * fromAgentSnapshot — turn an agentfootprint runtimeSnapshot into the\n * agent-shaped AgentTimeline Lens renders against.\n *\n * ─────────────────────────────────────────────────────────────────────────\n * The raw snapshot is flowchart-shaped (stages, commitLog, subflowResults).\n * Lens needs agent-shape: turns[] → iterations[] → {messages, toolCalls,\n * decision, tokens, latency, visibleTools}. That's what this file does.\n *\n * Derivation strategy (all sources already present — no library change\n * needed):\n * • `sharedState.messages[]` — canonical conversation\n * • `commitLog` entries for `call-llm` / `streaming-call-llm` — per-iter\n * LLM request+response (model, tokens, duration, stop reason)\n * • `commitLog` entries for `execute-tool-calls` — per-iter tool outputs\n * and decision updates\n * • `sf-instructions-to-llm` snapshots — matched instruction ids +\n * injection counts per iter\n * • `sf-tools` snapshots — tool list visible to the LLM that iter\n *\n * Turn boundaries are inferred by walking `messages[]` and grouping\n * everything between user messages into one turn. Iteration boundaries\n * are the LLM call events within a turn.\n * ─────────────────────────────────────────────────────────────────────────\n */\n\nimport type {\n AgentIteration,\n AgentMessage,\n AgentTimeline,\n AgentToolInvocation,\n AgentTurn,\n} from \"./types\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnySnapshot = any;\n\nexport function fromAgentSnapshot(runtime: AnySnapshot): AgentTimeline {\n const shared = runtime?.sharedState ?? {};\n const rawMessages: RawMessage[] = shared.messages ?? [];\n const messages = rawMessages.map(normalizeMessage);\n\n const commitLog = Array.isArray(runtime?.commitLog) ? runtime.commitLog : [];\n const llmCalls = extractLLMCalls(commitLog);\n const toolExecs = extractToolExecutions(commitLog);\n const instructionEvals = extractInstructionEvals(commitLog);\n const toolResolves = extractToolResolves(commitLog);\n\n const turns = assembleTurns(messages, llmCalls, toolExecs, instructionEvals, toolResolves);\n const allTools = turns.flatMap((t) => t.iterations.flatMap((i) => i.toolCalls));\n\n return {\n turns,\n messages,\n tools: allTools,\n finalDecision: (shared.decision as Record<string, unknown>) ?? {},\n rawSnapshot: runtime,\n };\n}\n\n// ── Normalize ─────────────────────────────────────────────────────────\n\ninterface RawMessage {\n role: string;\n content: string | unknown;\n toolCalls?: Array<{ id: string; name: string; arguments: Record<string, unknown> }>;\n toolCallId?: string;\n}\n\nfunction normalizeMessage(m: RawMessage): AgentMessage {\n const role = ((): AgentMessage[\"role\"] => {\n if (m.role === \"system\" || m.role === \"user\" || m.role === \"assistant\" || m.role === \"tool\")\n return m.role;\n return \"user\";\n })();\n const content = typeof m.content === \"string\" ? m.content : JSON.stringify(m.content);\n return {\n role,\n content,\n ...(m.toolCalls?.length ? { toolCalls: m.toolCalls } : {}),\n ...(m.toolCallId ? { toolCallId: m.toolCallId } : {}),\n };\n}\n\n// ── Extract from commitLog ────────────────────────────────────────────\n\ninterface RawCommit {\n stageId?: string;\n stage?: string;\n runtimeStageId?: string;\n updates?: Record<string, unknown>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n trace?: any;\n}\n\ninterface LLMCall {\n iterationIndex: number;\n model?: string;\n inputTokens?: number;\n outputTokens?: number;\n durationMs?: number;\n stopReason?: string;\n assistantContent: string;\n toolCallsRequested: Array<{ id: string; name: string; arguments: Record<string, unknown> }>;\n}\n\nfunction extractLLMCalls(commitLog: RawCommit[]): LLMCall[] {\n const out: LLMCall[] = [];\n let iter = 0;\n for (const entry of commitLog) {\n const id = entry.stageId ?? \"\";\n if (id !== \"call-llm\" && id !== \"streaming-call-llm\") continue;\n iter++;\n const u = (entry.updates ?? {}) as Record<string, unknown>;\n const rawResponse =\n (u[\"adapterRawResponse\"] as Record<string, unknown> | undefined) ??\n (u[\"llmResponse\"] as Record<string, unknown> | undefined);\n const usage = rawResponse?.usage as\n | { inputTokens?: number; outputTokens?: number }\n | undefined;\n out.push({\n iterationIndex: iter,\n model: rawResponse?.model as string | undefined,\n inputTokens: usage?.inputTokens,\n outputTokens: usage?.outputTokens,\n durationMs: (u[\"callDurationMs\"] as number | undefined) ?? undefined,\n stopReason: rawResponse?.stopReason as string | undefined,\n assistantContent: (rawResponse?.content as string | undefined) ?? \"\",\n toolCallsRequested:\n (rawResponse?.toolCalls as LLMCall[\"toolCallsRequested\"] | undefined) ?? [],\n });\n }\n return out;\n}\n\ninterface ToolExec {\n iterationIndex: number;\n toolCalls: AgentToolInvocation[];\n}\n\nfunction extractToolExecutions(commitLog: RawCommit[]): ToolExec[] {\n const out: ToolExec[] = [];\n let iter = 0;\n for (const entry of commitLog) {\n const id = entry.stageId ?? \"\";\n if (id !== \"execute-tool-calls\") continue;\n iter++;\n const u = (entry.updates ?? {}) as Record<string, unknown>;\n // agentfootprint stores parsed tool calls + their results via\n // tool-start / tool-end emit events + the tool-role messages appended\n // to `messages`. Simplest stable derivation: walk messages right\n // after this commit and collect the tool-result entries.\n // For v0.1 we emit the tool call stubs; full resolution happens at\n // the assembler step where we have both sides in hand.\n const rawCalls = u[\"toolCalls\"] as LLMCall[\"toolCallsRequested\"] | undefined;\n const stubs: AgentToolInvocation[] = (rawCalls ?? []).map((c) => ({\n id: c.id,\n name: c.name,\n arguments: c.arguments ?? {},\n result: \"\", // filled in during assembly\n iterationIndex: iter,\n turnIndex: 0, // reassigned during assembly\n decisionUpdate: u[\"updatedDecision\"] as Record<string, unknown> | undefined,\n }));\n out.push({ iterationIndex: iter, toolCalls: stubs });\n }\n return out;\n}\n\ninterface InstructionEval {\n iterationIndex: number;\n matchedInstructions?: string[];\n promptInjectionCount: number;\n toolInjectionCount: number;\n}\n\nfunction extractInstructionEvals(commitLog: RawCommit[]): InstructionEval[] {\n const out: InstructionEval[] = [];\n let iter = 0;\n for (const entry of commitLog) {\n const id = entry.stageId ?? \"\";\n if (id !== \"evaluate-instructions\") continue;\n iter++;\n const u = (entry.updates ?? {}) as Record<string, unknown>;\n const matchedRaw = u[\"matchedInstructions\"];\n const matched = parseMatched(matchedRaw);\n const promptInj = Array.isArray(u[\"promptInjections\"]) ? u[\"promptInjections\"].length : 0;\n const toolInj = Array.isArray(u[\"toolInjections\"]) ? u[\"toolInjections\"].length : 0;\n out.push({\n iterationIndex: iter,\n ...(matched.length > 0 && { matchedInstructions: matched }),\n promptInjectionCount: promptInj,\n toolInjectionCount: toolInj,\n });\n }\n return out;\n}\n\nfunction parseMatched(v: unknown): string[] {\n if (!v) return [];\n if (Array.isArray(v)) return v.filter((x) => typeof x === \"string\");\n if (typeof v === \"string\") {\n // format: \"N matched: id1, id2, id3...\"\n const m = v.match(/:\\s*(.+)/);\n if (!m) return [];\n return m[1]\n .split(\",\")\n .map((s) => s.trim().replace(/\\.{3}$/, \"\"))\n .filter(Boolean);\n }\n return [];\n}\n\ninterface ToolResolve {\n iterationIndex: number;\n visibleTools: string[];\n}\n\nfunction extractToolResolves(commitLog: RawCommit[]): ToolResolve[] {\n const out: ToolResolve[] = [];\n let iter = 0;\n for (const entry of commitLog) {\n const id = entry.stageId ?? \"\";\n if (id !== \"resolve-tools\") continue;\n iter++;\n const u = (entry.updates ?? {}) as Record<string, unknown>;\n const descs = u[\"toolDescriptions\"] as Array<{ name: string }> | undefined;\n out.push({\n iterationIndex: iter,\n visibleTools: (descs ?? []).map((d) => d.name),\n });\n }\n return out;\n}\n\n// ── Assemble turns ────────────────────────────────────────────────────\n\nfunction assembleTurns(\n messages: AgentMessage[],\n llmCalls: LLMCall[],\n toolExecs: ToolExec[],\n instructionEvals: InstructionEval[],\n toolResolves: ToolResolve[],\n): AgentTurn[] {\n // Build a per-iteration map (flat across turns) then split by turn.\n // For a fresh agent instance, iter counts restart every turn — but\n // because commitLog is cumulative, iter numbers across commitLog are\n // monotonically increasing over the whole execution. So we group\n // iterations by the message boundary they fall in.\n //\n // Algorithm: walk messages in order. Each user message starts a new\n // turn. Each assistant message that has toolCalls (or is the final)\n // consumes the next LLM call from llmCalls. Tool-role messages that\n // follow bind to the most recent assistant message's toolCalls.\n\n const turns: AgentTurn[] = [];\n let currentTurn: {\n index: number;\n userPrompt: string;\n iterations: AgentIteration[];\n finalContent: string;\n } | null = null;\n let llmIdx = 0;\n const toolExecByIter = new Map(toolExecs.map((t) => [t.iterationIndex, t]));\n const instrByIter = new Map(instructionEvals.map((i) => [i.iterationIndex, i]));\n const visibleByIter = new Map(toolResolves.map((t) => [t.iterationIndex, t]));\n\n for (const msg of messages) {\n if (msg.role === \"user\") {\n if (currentTurn) turns.push(finalizeTurn(currentTurn));\n currentTurn = {\n index: turns.length,\n userPrompt: msg.content,\n iterations: [],\n finalContent: \"\",\n };\n continue;\n }\n if (!currentTurn) continue; // skip system prompt + anything before first user\n\n if (msg.role === \"assistant\") {\n const call = llmCalls[llmIdx];\n llmIdx++;\n const iterIndex = call?.iterationIndex ?? currentTurn.iterations.length + 1;\n const exec = toolExecByIter.get(iterIndex);\n const instr = instrByIter.get(iterIndex);\n const visible = visibleByIter.get(iterIndex);\n\n const toolCalls: AgentToolInvocation[] = (exec?.toolCalls ?? []).map((tc) => ({\n ...tc,\n turnIndex: currentTurn!.index,\n }));\n\n // For the post-process fallback path we can't know the precise\n // messages-at-iter-start, so approximate it as \"all messages\n // currently accumulated in this turn before this iter\" — close\n // enough for imported traces where we don't have emit timing.\n const msgsBefore = messages.indexOf(msg);\n const iteration: AgentIteration = {\n index: iterIndex,\n messagesSentCount: msgsBefore >= 0 ? msgsBefore : 0,\n ...(call?.model && { model: call.model }),\n ...(call?.inputTokens !== undefined && { inputTokens: call.inputTokens }),\n ...(call?.outputTokens !== undefined && { outputTokens: call.outputTokens }),\n ...(call?.durationMs !== undefined && { durationMs: call.durationMs }),\n ...(call?.stopReason && { stopReason: call.stopReason }),\n assistantContent: call?.assistantContent ?? msg.content,\n toolCalls,\n decisionAtStart: {}, // TODO(phase-2): derive from pre-iter commit\n ...(instr?.matchedInstructions && { matchedInstructions: instr.matchedInstructions }),\n visibleTools: visible?.visibleTools ?? [],\n // Post-process path (snapshot-import — no live emit stream) has no\n // way to reconstruct context-injection timing. Leave empty; the\n // live path via agentTimeline() recorder fills these in naturally.\n contextInjections: [],\n contextLedger: {},\n };\n\n currentTurn.iterations.push(iteration);\n if (!toolCalls.length) currentTurn.finalContent = iteration.assistantContent;\n continue;\n }\n\n if (msg.role === \"tool\" && msg.toolCallId) {\n // Bind the result string back to the matching tool invocation in\n // the latest iteration.\n const iter = currentTurn.iterations[currentTurn.iterations.length - 1];\n if (!iter) continue;\n const idx = iter.toolCalls.findIndex((tc) => tc.id === msg.toolCallId);\n if (idx < 0) continue;\n const updated = { ...iter.toolCalls[idx], result: msg.content };\n // Rewrite via mutation — iter is readonly at the type level but we\n // own this intermediate structure during assembly.\n (iter.toolCalls as AgentToolInvocation[])[idx] = updated;\n }\n }\n\n if (currentTurn) turns.push(finalizeTurn(currentTurn));\n return turns;\n}\n\nfunction finalizeTurn(t: {\n index: number;\n userPrompt: string;\n iterations: AgentIteration[];\n finalContent: string;\n}): AgentTurn {\n const totalInputTokens = t.iterations.reduce((s, i) => s + (i.inputTokens ?? 0), 0);\n const totalOutputTokens = t.iterations.reduce((s, i) => s + (i.outputTokens ?? 0), 0);\n const totalDurationMs = t.iterations.reduce((s, i) => s + (i.durationMs ?? 0), 0);\n return {\n index: t.index,\n userPrompt: t.userPrompt,\n iterations: t.iterations,\n finalContent: t.finalContent,\n totalInputTokens,\n totalOutputTokens,\n totalDurationMs,\n // Post-process snapshot path has no live emit timing, so the\n // turn-level context fields stay empty here too — the live\n // live recorder path is the one that captures injections.\n contextInjections: [],\n contextLedger: {},\n };\n}\n","/**\n * deriveStages — turn an `AgentTimeline` into an ordered list of\n * \"stages\" (edges in the node flowchart).\n *\n * Each stage is one directed edge between two of the four nodes:\n *\n * USER ──── message ────▶ AGENT ──── tool call ────▶ TOOL\n * ▲ │ ▲ │\n * └──── final answer ────┘ └── activation ── SKILL │\n * ▲ │\n * └── tool result ──┘\n *\n * Grounding rule from the spec: every stage maps to one of the three\n * LLM primitives (System Prompt · Message · Tool). Skills aren't a\n * fourth primitive — they're a *bracket* wrapping whichever primitive\n * they use to reach the LLM. So the SKILL node is optional and only\n * shows when a skill activation actually happens.\n *\n * Derivation is pure: given the same timeline you always get the same\n * stage sequence. Safe to re-run on every render; live updates simply\n * append new stages as new events arrive.\n */\nimport type { AgentTimeline, AgentToolInvocation } from \"./types\";\n\nexport type StageNodeId = \"user\" | \"agent\" | \"tool\" | \"skill\";\n\n/** Which of the three LLM primitives this stage touches. */\nexport type StagePrimitive = \"message\" | \"tool\" | \"system-prompt\";\n\n/**\n * Which of the three Agent-input channels this stage MUTATED.\n * Drives the per-port highlight inside the Agent node. A single stage\n * can touch multiple — e.g. a `read_skill` return simultaneously adds\n * a tool-role message, grows the System Prompt (skill body injected),\n * and surfaces new Tools (autoActivate-gated tools go live).\n */\nexport interface StageMutations {\n /** A message appended to the conversation this step. */\n readonly messages?: boolean;\n /** The System Prompt sent on the NEXT LLM call changed this step. */\n readonly systemPrompt?: boolean;\n /** The Tools list sent on the NEXT LLM call changed this step. */\n readonly tools?: boolean;\n /** Count of tools added this step (when known). */\n readonly toolsAdded?: number;\n /** Count of tools removed this step (when known). */\n readonly toolsRemoved?: number;\n /** System-prompt delta in characters (when known). */\n readonly systemPromptDeltaChars?: number;\n /**\n * Actual text that was appended to the System Prompt this step —\n * e.g. the skill body delivered by a `read_skill` return. Captured\n * at the moment we know it (the return stage) and propagated via\n * `pending` to the stage that's attributed with the mutation. This\n * is what lets the mutation drill-down show the real diff instead\n * of an \"isn't captured\" placeholder.\n */\n readonly systemPromptAdded?: string;\n /** Skill id that activated this step (from `read_skill` args). */\n readonly activatedSkillId?: string;\n /** Names of tools that came online as a result of this step. */\n readonly toolsAddedList?: readonly string[];\n}\n\nexport interface Stage {\n /** 0-based stage index across the whole run. */\n readonly index: number;\n /** Source node. */\n readonly from: StageNodeId;\n /** Destination node. */\n readonly to: StageNodeId;\n /** Human-friendly one-line description (appears on the edge). */\n readonly label: string;\n /** Which LLM primitive carries this stage — for vocabulary grounding. */\n readonly primitive: StagePrimitive;\n /**\n * What CHANGED on the Agent's three input channels (System Prompt,\n * Messages, Tools) when this stage fired. Per-port highlights on\n * the Agent node read from here.\n */\n readonly mutations: StageMutations;\n /**\n * Which turn + iteration this stage belongs to. Lets the UI jump\n * the Messages panel to the same moment when a stage is clicked.\n */\n readonly turnIndex: number;\n readonly iterIndex?: number;\n /**\n * Secondary node that should ALSO light up for this stage. Used when\n * a skill activation is a bracket over another primitive — e.g. a\n * `read_skill` tool call lights both TOOL (primary) and SKILL\n * (secondary). `undefined` for non-bracketed stages.\n */\n readonly alsoLights?: StageNodeId;\n /** Tool or skill name, when applicable. */\n readonly toolName?: string;\n /**\n * If this stage belongs to a round that fired MULTIPLE tool calls\n * concurrently (LLM emitted them in one response), the total count.\n * `undefined` for single-tool rounds. Drives the \"parallel N\" badge\n * on the Tool node so users can see \"this isn't a single tool call\n * — three are happening at the same logical step\" without reading\n * the commentary.\n */\n readonly parallelCount?: number;\n /**\n * What *kind* of tool this is from the user's mental model:\n * • \"skill\" — a skill-management tool (list_skills / read_skill).\n * • \"ask-human\" — a clarification-from-user tool.\n * • undefined — a regular data/action tool.\n * Lets UI labels render as `Tool (Skill)` / `Tool (Ask user)` /\n * just `Tool` while the underlying edges still flow Agent ↔ Tool.\n */\n readonly toolKind?: \"skill\" | \"ask-human\";\n /** Token usage attributed to this stage (if LLM call). */\n readonly tokens?: { readonly input?: number; readonly output?: number };\n /** Wall-clock duration in ms (if the source event provided it). */\n readonly durationMs?: number;\n}\n\nexport function deriveStages(timeline: AgentTimeline): Stage[] {\n const stages: Stage[] = [];\n let idx = 0;\n const push = (s: Omit<Stage, \"index\">) => {\n stages.push({ ...s, index: idx++ });\n };\n\n // Mutations that were PROMISED by a prior stage but only take\n // effect on the NEXT outgoing LLM call. The canonical case is\n // `read_skill`: the return leg appends a tool-role Message, but\n // System Prompt + Tools injections only land when the NEXT\n // iteration starts (via autoActivate + AgentInstruction.activeWhen).\n // We hold them here and merge into the next `agent → …` edge we\n // emit, then clear.\n let pending: StageMutations | null = null;\n const consumePending = (base: StageMutations): StageMutations => {\n if (!pending) return base;\n const merged: StageMutations = { ...base, ...pending };\n pending = null;\n return merged;\n };\n\n for (const turn of timeline.turns) {\n // 1. USER → AGENT: the prompt. Mutates Messages only, plus any\n // pending mutations promised from a prior turn's last stage.\n push({\n from: \"user\",\n to: \"agent\",\n label: truncate(turn.userPrompt, 60),\n primitive: \"message\",\n turnIndex: turn.index,\n mutations: consumePending({ messages: true }),\n });\n\n for (const iter of turn.iterations) {\n // A round with > 1 tool call means the LLM fired all of them\n // concurrently (parallel fanout). Carry that count onto each\n // tool stage so UIs can annotate \"parallel N\" without having to\n // walk sibling stages.\n const parallelCount = iter.toolCalls.length > 1 ? iter.toolCalls.length : undefined;\n for (const tc of iter.toolCalls) {\n const kind = classifyTool(tc);\n if (kind === \"skill-management\") {\n // Outgoing: Agent → Tool (the LLM making the skill call).\n // This is an LLM-outgoing edge, so pending mutations from a\n // *prior* read_skill — if any — surface here.\n push({\n from: \"agent\",\n to: \"tool\",\n alsoLights: \"skill\",\n label: skillManagementLabel(tc),\n primitive: \"tool\",\n turnIndex: turn.index,\n iterIndex: iter.index,\n toolName: tc.name,\n toolKind: \"skill\",\n mutations: consumePending({ messages: true }),\n });\n // Return leg: only a tool-role Message is added RIGHT NOW.\n // SP + Tools mutations caused by read_skill take effect on\n // the NEXT outgoing LLM call (autoActivate fires at the\n // start of the next iteration, not here). Defer them via\n // `pending` so they appear on the correct edge.\n const isReadSkill = tc.name === \"read_skill\";\n push({\n from: \"tool\",\n to: \"agent\",\n alsoLights: \"skill\",\n label: isReadSkill\n ? `Skill body delivered (+${tc.result.length} chars) — will activate next step`\n : `Skills list (${countSkills(tc.result)} skills)`,\n primitive: \"tool\",\n turnIndex: turn.index,\n iterIndex: iter.index,\n toolName: tc.name,\n toolKind: \"skill\",\n mutations: { messages: true },\n });\n if (isReadSkill) {\n const spDelta = tc.result.length;\n const activatedSkillId =\n (tc.arguments?.id as string | undefined) ?? undefined;\n pending = {\n systemPrompt: true,\n tools: true,\n systemPromptDeltaChars: spDelta,\n // Stash the ACTUAL content that just entered the System\n // Prompt + the skill id that activated. These ride along\n // `pending` and land on the next outgoing LLM edge where\n // the mutation is attributed, so the UI can render a\n // real diff instead of a \"not captured\" placeholder.\n systemPromptAdded: tc.result,\n ...(activatedSkillId ? { activatedSkillId } : {}),\n };\n }\n } else if (kind === \"ask-human\") {\n push({\n from: \"agent\",\n to: \"user\",\n label: askHumanLabel(tc),\n primitive: \"message\",\n turnIndex: turn.index,\n iterIndex: iter.index,\n toolName: tc.name,\n toolKind: \"ask-human\",\n mutations: consumePending({ messages: true }),\n });\n } else {\n // Regular tool. Outgoing edge is the LLM's next call — so\n // it consumes any pending mutations from a prior read_skill.\n push({\n from: \"agent\",\n to: \"tool\",\n label: `Called ${tc.name}`,\n primitive: \"tool\",\n turnIndex: turn.index,\n iterIndex: iter.index,\n toolName: tc.name,\n ...(parallelCount ? { parallelCount } : {}),\n mutations: consumePending({ messages: true }),\n });\n push({\n from: \"tool\",\n to: \"agent\",\n label: truncate(tc.result, 80),\n primitive: \"tool\",\n turnIndex: turn.index,\n iterIndex: iter.index,\n toolName: tc.name,\n ...(parallelCount ? { parallelCount } : {}),\n mutations: { messages: true },\n });\n }\n }\n }\n\n // Final AGENT → USER: last LLM call's output. Also consumes\n // pending (in case the very last iteration before Finalize was\n // a read_skill — unusual, but possible).\n //\n // Attach this stage to the LAST iter of the turn so the\n // \"ready to answer\" round (which has no tool calls, and would\n // otherwise produce no stages) gets a valid stage range. Without\n // this the range map is missing a key for that round and UIs\n // fall back to defaults — e.g. the commentary's \"active/past/\n // future\" dimming would get confused and mark the final round\n // active regardless of slider position.\n if (turn.finalContent) {\n const lastIter = turn.iterations[turn.iterations.length - 1];\n push({\n from: \"agent\",\n to: \"user\",\n label: truncate(turn.finalContent, 80),\n primitive: \"message\",\n turnIndex: turn.index,\n ...(lastIter ? { iterIndex: lastIter.index } : {}),\n mutations: consumePending({ messages: true }),\n });\n }\n }\n\n return stages;\n}\n\n// ── Helpers ───────────────────────────────────────────────────────\n\ntype ToolKind = \"skill-management\" | \"ask-human\" | \"regular\";\n\nfunction classifyTool(tc: AgentToolInvocation): ToolKind {\n if (tc.name === \"list_skills\" || tc.name === \"read_skill\") return \"skill-management\";\n if (tc.name === \"ask_human\" || tc.name === \"ask_user\") return \"ask-human\";\n return \"regular\";\n}\n\nfunction skillManagementLabel(tc: AgentToolInvocation): string {\n if (tc.name === \"list_skills\") return \"Asked what skills are available\";\n if (tc.name === \"read_skill\") {\n const id = (tc.arguments?.id as string | undefined) ?? \"?\";\n return `Activated the \"${id}\" skill`;\n }\n return `Called ${tc.name}`;\n}\n\nfunction askHumanLabel(tc: AgentToolInvocation): string {\n const q = (tc.arguments?.question as string | undefined) ?? \"\";\n return q ? `Asked user: ${truncate(q, 50)}` : \"Asked user for clarification\";\n}\n\nfunction countSkills(result: string): number {\n try {\n const parsed = JSON.parse(result);\n if (Array.isArray(parsed?.skills)) return parsed.skills.length;\n if (Array.isArray(parsed)) return parsed.length;\n } catch {\n /* fall through */\n }\n return 0;\n}\n\nfunction truncate(s: string, max: number): string {\n const one = s.replace(/\\s+/g, \" \").trim();\n return one.length <= max ? one : one.slice(0, max - 1).trim() + \"…\";\n}\n"],"mappings":";AAqCO,SAAS,kBAAkB,SAAqC;AACrE,QAAM,SAAS,SAAS,eAAe,CAAC;AACxC,QAAM,cAA4B,OAAO,YAAY,CAAC;AACtD,QAAM,WAAW,YAAY,IAAI,gBAAgB;AAEjD,QAAM,YAAY,MAAM,QAAQ,SAAS,SAAS,IAAI,QAAQ,YAAY,CAAC;AAC3E,QAAM,WAAW,gBAAgB,SAAS;AAC1C,QAAM,YAAY,sBAAsB,SAAS;AACjD,QAAM,mBAAmB,wBAAwB,SAAS;AAC1D,QAAM,eAAe,oBAAoB,SAAS;AAElD,QAAM,QAAQ,cAAc,UAAU,UAAU,WAAW,kBAAkB,YAAY;AACzF,QAAM,WAAW,MAAM,QAAQ,CAAC,MAAM,EAAE,WAAW,Q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6
5
|
|
|
7
6
|
// src/react/Lens.tsx
|
|
8
7
|
import { useEffect as useEffect5, useReducer, useState as useState7 } from "react";
|
|
@@ -4080,51 +4079,107 @@ function SelfSizingRoot({
|
|
|
4080
4079
|
|
|
4081
4080
|
// src/react/hooks/useLiveTimeline.ts
|
|
4082
4081
|
import { useCallback as useCallback3, useMemo as useMemo3, useRef as useRef5, useState as useState6 } from "react";
|
|
4082
|
+
import { agentTimeline } from "agentfootprint/observe";
|
|
4083
4083
|
function useLiveTimeline() {
|
|
4084
|
-
const
|
|
4085
|
-
if (!
|
|
4086
|
-
const
|
|
4087
|
-
const
|
|
4084
|
+
const recorderRef = useRef5(null);
|
|
4085
|
+
if (!recorderRef.current) recorderRef.current = agentTimeline();
|
|
4086
|
+
const recorder = recorderRef.current;
|
|
4087
|
+
const systemPromptRef = useRef5(void 0);
|
|
4088
|
+
const [timeline, setTimeline] = useState6(
|
|
4089
|
+
() => decorateTimeline(recorder.getTimeline(), systemPromptRef.current)
|
|
4090
|
+
);
|
|
4088
4091
|
const sync = useCallback3(() => {
|
|
4089
|
-
setTimeline(
|
|
4090
|
-
}, [
|
|
4092
|
+
setTimeline(decorateTimeline(recorder.getTimeline(), systemPromptRef.current));
|
|
4093
|
+
}, [recorder]);
|
|
4091
4094
|
const ingest = useCallback3(
|
|
4092
4095
|
(event) => {
|
|
4093
|
-
|
|
4096
|
+
const emit = runnerEventToEmit(event);
|
|
4097
|
+
if (emit) recorder.onEmit(emit);
|
|
4094
4098
|
sync();
|
|
4095
4099
|
},
|
|
4096
|
-
[
|
|
4100
|
+
[recorder, sync]
|
|
4097
4101
|
);
|
|
4098
4102
|
const startTurn = useCallback3(
|
|
4099
4103
|
(userPrompt) => {
|
|
4100
|
-
|
|
4104
|
+
recorder.onEmit(
|
|
4105
|
+
synthEmit("agentfootprint.agent.turn_start", { userMessage: userPrompt })
|
|
4106
|
+
);
|
|
4101
4107
|
sync();
|
|
4102
4108
|
},
|
|
4103
|
-
[
|
|
4109
|
+
[recorder, sync]
|
|
4104
4110
|
);
|
|
4105
4111
|
const setSystemPrompt = useCallback3(
|
|
4106
4112
|
(prompt) => {
|
|
4107
|
-
|
|
4108
|
-
sync();
|
|
4109
|
-
},
|
|
4110
|
-
[builder, sync]
|
|
4111
|
-
);
|
|
4112
|
-
const setFinalDecision = useCallback3(
|
|
4113
|
-
(decision) => {
|
|
4114
|
-
builder.setFinalDecision(decision);
|
|
4113
|
+
systemPromptRef.current = prompt;
|
|
4115
4114
|
sync();
|
|
4116
4115
|
},
|
|
4117
|
-
[
|
|
4116
|
+
[sync]
|
|
4118
4117
|
);
|
|
4119
4118
|
const reset = useCallback3(() => {
|
|
4120
|
-
|
|
4119
|
+
recorder.clear();
|
|
4121
4120
|
sync();
|
|
4122
|
-
}, [
|
|
4121
|
+
}, [recorder, sync]);
|
|
4123
4122
|
return useMemo3(
|
|
4124
|
-
() => ({ timeline, ingest, startTurn, setSystemPrompt,
|
|
4125
|
-
[timeline, ingest, startTurn, setSystemPrompt,
|
|
4123
|
+
() => ({ timeline, ingest, startTurn, setSystemPrompt, reset, recorder }),
|
|
4124
|
+
[timeline, ingest, startTurn, setSystemPrompt, reset, recorder]
|
|
4126
4125
|
);
|
|
4127
4126
|
}
|
|
4127
|
+
function runnerEventToEmit(event) {
|
|
4128
|
+
if (!event || typeof event !== "object") return null;
|
|
4129
|
+
const e = event;
|
|
4130
|
+
if (typeof e.name === "string" && "payload" in e) {
|
|
4131
|
+
return e;
|
|
4132
|
+
}
|
|
4133
|
+
if (typeof e.type !== "string") return null;
|
|
4134
|
+
const name = canonicalNameFor(e.type);
|
|
4135
|
+
if (!name) return null;
|
|
4136
|
+
const { type: _t, ...rest } = e;
|
|
4137
|
+
return {
|
|
4138
|
+
name,
|
|
4139
|
+
payload: rest,
|
|
4140
|
+
runtimeStageId: `runner:${e.type}#${Date.now()}-${synthCounter++}`,
|
|
4141
|
+
stageName: e.type,
|
|
4142
|
+
subflowPath: [],
|
|
4143
|
+
pipelineId: "runner-stream",
|
|
4144
|
+
timestamp: Date.now()
|
|
4145
|
+
};
|
|
4146
|
+
}
|
|
4147
|
+
var synthCounter = 0;
|
|
4148
|
+
function canonicalNameFor(runnerType) {
|
|
4149
|
+
switch (runnerType) {
|
|
4150
|
+
case "turn_start":
|
|
4151
|
+
return "agentfootprint.agent.turn_start";
|
|
4152
|
+
case "turn_end":
|
|
4153
|
+
return "agentfootprint.agent.turn_complete";
|
|
4154
|
+
case "llm_start":
|
|
4155
|
+
return "agentfootprint.stream.llm_start";
|
|
4156
|
+
case "llm_end":
|
|
4157
|
+
return "agentfootprint.stream.llm_end";
|
|
4158
|
+
case "tool_start":
|
|
4159
|
+
return "agentfootprint.stream.tool_start";
|
|
4160
|
+
case "tool_end":
|
|
4161
|
+
return "agentfootprint.stream.tool_end";
|
|
4162
|
+
default:
|
|
4163
|
+
if (runnerType.startsWith("agentfootprint.stream.") || runnerType.startsWith("agentfootprint.context.") || runnerType.startsWith("agentfootprint.agent.")) {
|
|
4164
|
+
return runnerType;
|
|
4165
|
+
}
|
|
4166
|
+
return null;
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
function synthEmit(name, payload) {
|
|
4170
|
+
return {
|
|
4171
|
+
name,
|
|
4172
|
+
payload,
|
|
4173
|
+
runtimeStageId: `synth:${name}#${Date.now()}-${synthCounter++}`,
|
|
4174
|
+
stageName: name,
|
|
4175
|
+
subflowPath: [],
|
|
4176
|
+
pipelineId: "lens-synth",
|
|
4177
|
+
timestamp: Date.now()
|
|
4178
|
+
};
|
|
4179
|
+
}
|
|
4180
|
+
function decorateTimeline(base, _systemPrompt) {
|
|
4181
|
+
return base;
|
|
4182
|
+
}
|
|
4128
4183
|
|
|
4129
4184
|
// src/react/Lens.tsx
|
|
4130
4185
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
@@ -4994,4 +5049,4 @@ export {
|
|
|
4994
5049
|
ToolCallInspector,
|
|
4995
5050
|
useLens
|
|
4996
5051
|
};
|
|
4997
|
-
//# sourceMappingURL=chunk-
|
|
5052
|
+
//# sourceMappingURL=chunk-HJ4VDPJF.js.map
|