@introspection-ai/recipes 0.64.0 → 0.66.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.
Files changed (129) hide show
  1. package/dist/agent-tool/arguments.d.ts +4 -2
  2. package/dist/agent-tool/arguments.d.ts.map +1 -1
  3. package/dist/agent-tool/arguments.generated.d.ts.map +1 -1
  4. package/dist/agent-tool/arguments.generated.js +6 -2
  5. package/dist/agent-tool/arguments.generated.js.map +1 -1
  6. package/dist/agent-tool/run-cwd.d.ts +18 -0
  7. package/dist/agent-tool/run-cwd.d.ts.map +1 -0
  8. package/dist/agent-tool/run-cwd.js +49 -0
  9. package/dist/agent-tool/run-cwd.js.map +1 -0
  10. package/dist/agents.d.ts +25 -2
  11. package/dist/agents.d.ts.map +1 -1
  12. package/dist/agents.js +172 -114
  13. package/dist/agents.js.map +1 -1
  14. package/dist/api-bindings.d.ts.map +1 -1
  15. package/dist/api-bindings.js +2 -2
  16. package/dist/api-bindings.js.map +1 -1
  17. package/dist/artifact-review-tui.js +1 -1
  18. package/dist/artifact-review-tui.js.map +1 -1
  19. package/dist/artifact-viewer-tui.js +1 -1
  20. package/dist/artifact-viewer-tui.js.map +1 -1
  21. package/dist/artifact-viewer.d.ts.map +1 -1
  22. package/dist/artifact-viewer.js +3 -3
  23. package/dist/artifact-viewer.js.map +1 -1
  24. package/dist/batch/agent-batches.d.ts +10 -0
  25. package/dist/batch/agent-batches.d.ts.map +1 -1
  26. package/dist/batch/agent-batches.js +68 -12
  27. package/dist/batch/agent-batches.js.map +1 -1
  28. package/dist/batch/index.d.ts +2 -0
  29. package/dist/batch/index.d.ts.map +1 -1
  30. package/dist/batch/index.js +2 -1
  31. package/dist/batch/index.js.map +1 -1
  32. package/dist/batch/lines.d.ts +2 -2
  33. package/dist/batch/lines.d.ts.map +1 -1
  34. package/dist/batch/lines.js +8 -4
  35. package/dist/batch/lines.js.map +1 -1
  36. package/dist/batch/runner.d.ts +2 -0
  37. package/dist/batch/runner.d.ts.map +1 -1
  38. package/dist/batch/runner.js +1 -1
  39. package/dist/batch/runner.js.map +1 -1
  40. package/dist/child/agent-completions.d.ts +25 -8
  41. package/dist/child/agent-completions.d.ts.map +1 -1
  42. package/dist/child/agent-completions.js +68 -16
  43. package/dist/child/agent-completions.js.map +1 -1
  44. package/dist/child/agent-store.d.ts +4 -0
  45. package/dist/child/agent-store.d.ts.map +1 -1
  46. package/dist/child/agent-store.js +18 -0
  47. package/dist/child/agent-store.js.map +1 -1
  48. package/dist/child/inboxes.d.ts +21 -0
  49. package/dist/child/inboxes.d.ts.map +1 -0
  50. package/dist/child/inboxes.js +35 -0
  51. package/dist/child/inboxes.js.map +1 -0
  52. package/dist/child/messages.d.ts +105 -31
  53. package/dist/child/messages.d.ts.map +1 -1
  54. package/dist/child/messages.js +303 -78
  55. package/dist/child/messages.js.map +1 -1
  56. package/dist/child/run-processes.d.ts +14 -0
  57. package/dist/child/run-processes.d.ts.map +1 -0
  58. package/dist/child/run-processes.js +101 -0
  59. package/dist/child/run-processes.js.map +1 -0
  60. package/dist/child/session.d.ts.map +1 -1
  61. package/dist/child/session.js +12 -0
  62. package/dist/child/session.js.map +1 -1
  63. package/dist/documents/python.d.ts.map +1 -1
  64. package/dist/documents/python.js +2 -2
  65. package/dist/documents/python.js.map +1 -1
  66. package/dist/judges/cli-main.d.ts.map +1 -1
  67. package/dist/judges/cli-main.js +1 -1
  68. package/dist/judges/cli-main.js.map +1 -1
  69. package/dist/judges/run.d.ts.map +1 -1
  70. package/dist/judges/run.js +6 -2
  71. package/dist/judges/run.js.map +1 -1
  72. package/dist/judges/verdict.d.ts.map +1 -1
  73. package/dist/judges/verdict.js +1 -1
  74. package/dist/judges/verdict.js.map +1 -1
  75. package/dist/mcp/contract.d.ts.map +1 -1
  76. package/dist/mcp/contract.js +1 -3
  77. package/dist/mcp/contract.js.map +1 -1
  78. package/dist/mcp/daemon/client.d.ts.map +1 -1
  79. package/dist/mcp/daemon/client.js +1 -2
  80. package/dist/mcp/daemon/client.js.map +1 -1
  81. package/dist/mcp/pi-mcp-runtime.js +2 -2
  82. package/dist/mcp/pi-mcp-runtime.js.map +1 -1
  83. package/dist/mcp/pi-runtime.d.ts +3 -3
  84. package/dist/mcp/pi-runtime.d.ts.map +1 -1
  85. package/dist/mcp/pi-runtime.js +11 -20
  86. package/dist/mcp/pi-runtime.js.map +1 -1
  87. package/dist/mcp/tools.d.ts.map +1 -1
  88. package/dist/mcp/tools.js +1 -1
  89. package/dist/mcp/tools.js.map +1 -1
  90. package/dist/mcp-chunks/{chunk-OHAXEQ22.js → chunk-N6QLCGHR.js} +2 -2
  91. package/dist/mcp-chunks/{chunk-3UONQ24E.js → chunk-WVHEDCS6.js} +6 -4
  92. package/dist/mcp-chunks/chunk-ZH6FNTNJ.js +34 -0
  93. package/dist/mcp-chunks/{pi-mcp-runtime-V2OMZAIR.js → pi-mcp-runtime-W5OLELOO.js} +34 -27
  94. package/dist/mcp-chunks/{server-6DQUPUFW.js → server-UZ5OMTWP.js} +3 -3
  95. package/dist/mcp-daemon.js +3 -3
  96. package/dist/mcp-run-worker.js +2 -2
  97. package/dist/pi-extension.d.ts.map +1 -1
  98. package/dist/pi-extension.js +73 -72
  99. package/dist/pi-extension.js.map +1 -1
  100. package/dist/recipe/manifest.generated.d.ts +1 -1
  101. package/dist/recipe/manifest.generated.js +1 -1
  102. package/dist/recipe/package.d.ts +2 -0
  103. package/dist/recipe/package.d.ts.map +1 -1
  104. package/dist/recipe/package.js +15 -21
  105. package/dist/recipe/package.js.map +1 -1
  106. package/dist/recipe/python.d.ts.map +1 -1
  107. package/dist/recipe/python.js +8 -5
  108. package/dist/recipe/python.js.map +1 -1
  109. package/dist/run-controller.d.ts.map +1 -1
  110. package/dist/run-controller.js +43 -17
  111. package/dist/run-controller.js.map +1 -1
  112. package/dist/session.d.ts +3 -0
  113. package/dist/session.d.ts.map +1 -1
  114. package/dist/session.js +6 -2
  115. package/dist/session.js.map +1 -1
  116. package/dist/shell-quote.d.ts +3 -0
  117. package/dist/shell-quote.d.ts.map +1 -0
  118. package/dist/shell-quote.js +5 -0
  119. package/dist/shell-quote.js.map +1 -0
  120. package/docs/agent-batch.md +14 -4
  121. package/docs/agent-composition.md +20 -7
  122. package/docs/documents/README.md +1 -1
  123. package/docs/mcp-auth.md +2 -1
  124. package/docs/mcp-configuration.md +2 -3
  125. package/docs/recipe-format.md +4 -4
  126. package/package.json +14 -13
  127. package/python/shared/pyproject.toml +2 -2
  128. package/python/shared/uv.lock +30 -30
  129. package/dist/mcp-chunks/chunk-V65N6VX7.js +0 -33
@@ -9,15 +9,17 @@ import { existsSync } from "node:fs";
9
9
  import { rm } from "node:fs/promises";
10
10
  import { basename, resolve } from "node:path";
11
11
  import { createCodemodeExtension, } from "@earendil-works/pi-coding-agent";
12
+ import { createRootInbox, createRunnerInbox } from "./child/inboxes.js";
12
13
  import { Text, truncateToWidth } from "@earendil-works/pi-tui";
13
14
  import { createRecipeChildAgentRunner, promptResultText, } from "./child/agent.js";
14
15
  import { registerGenAiSpansFile } from "./genai-spans-file.js";
15
16
  import { loadRecipeExtensionFactory } from "./recipe/extensions.js";
16
17
  import { bindRecipeExtensionFactory, createRecipeExtensionSessionContext, createRecipeExtensionRegistrationRegistry, } from "./extensions.js";
17
- import { ChildAgentRunStore, } from "./child/agent-store.js";
18
- import { ChildCompletionQueue, costText, envelopeFromRun, renderCompletionNotice, tokenText, usageText, } from "./child/agent-completions.js";
19
- import { AGENT_RUN_MESSAGE_TYPE, AgentInbox, AgentMessageBus, renderAgentMessage, renderAgentMessages, ROOT_AGENT, } from "./child/messages.js";
20
- import { AGENT_RUN_EVENT_ENTRY_TYPE, notifyAgentRunEvent, persistsAgentRunEvent, agentLine, runProgress, toolActivity, } from "./agents.js";
18
+ import { ChildAgentRunStore, snapshotOf, } from "./child/agent-store.js";
19
+ import { ChildCompletionQueue, combinedUsage, envelopeFromRun, mergePricing, runUsage, sumUsage, usageParts, renderCompletionNotice, usageText, } from "./child/agent-completions.js";
20
+ import { AGENT_RUN_MESSAGE_TYPE, AgentMessageBus, renderAgentMessages, ROOT_AGENT, } from "./child/messages.js";
21
+ import { AGENT_RUN_EVENT_ENTRY_TYPE, notifyAgentRunEvent, persistsAgentRunEvent, agentLine, runProgress, runTotals, waitedTotals, toolActivity, expandHint, } from "./agents.js";
22
+ import { runCwd } from "./agent-tool/run-cwd.js";
21
23
  import { applyStreamingEvent, liveUsage, } from "./child/streaming-usage.js";
22
24
  import { clearMcpSession, clearSessionMcpCli, configureMcpLocalConfigPath, createIsolatedMcpEnvironment, endpointBindings, formatMcpConfigurationDiagnostics, materializeMcpSession, materializeSessionMcpCli, resolveAgentMcpSelections, resolveMcpSessionServers, stopMcpDaemon, } from "./mcp/index.js";
23
25
  import { mcpServersBehindTools } from "./mcp/policy.js";
@@ -241,22 +243,6 @@ function formatCompletionMessage(batch, options, theme) {
241
243
  });
242
244
  return blocks.join("\n");
243
245
  }
244
- function snapshotOf(run) {
245
- return {
246
- id: run.id,
247
- agent: run.agent,
248
- label: run.label,
249
- prompt: run.prompt,
250
- status: run.status,
251
- startedAt: run.startedAt,
252
- completedAt: run.completedAt,
253
- output: run.output,
254
- error: run.error,
255
- toolCalls: run.toolCalls.map((call) => ({ ...call })),
256
- ...(run.usage ? { usage: { ...run.usage } } : {}),
257
- ...(run.pricing ? { pricing: { ...run.pricing } } : {}),
258
- };
259
- }
260
246
  /** Folds how one assistant message's model is paid for into its run's pricing. */
261
247
  function notePricing(run, event, registry) {
262
248
  const record = asRecord(event);
@@ -276,15 +262,6 @@ function notePricing(run, event, registry) {
276
262
  };
277
263
  run.pricing = mergePricing(run.pricing, pricing);
278
264
  }
279
- /** Several runs' pricing: a subscription only if every one is, priced if any one is. */
280
- function mergePricing(a, b) {
281
- if (!a || !b)
282
- return a ?? b;
283
- return {
284
- subscription: a.subscription && b.subscription,
285
- priced: a.priced || b.priced,
286
- };
287
- }
288
265
  /** Adds an assistant message's usage, from a child's `message_end` event, to its run's. */
289
266
  function addMessageUsage(run, event) {
290
267
  const record = asRecord(event);
@@ -327,7 +304,9 @@ function controllerSummary(run, status = run.status) {
327
304
  const running = [...run.toolCalls]
328
305
  .reverse()
329
306
  .find((call) => call.status === "running");
330
- const currentActivity = running && toolActivity(running.name, running.args);
307
+ // The last call stays on the line while the model thinks, so it doesn't flash between tools.
308
+ const latest = running ?? run.toolCalls.at(-1);
309
+ const currentActivity = latest && toolActivity(latest.name, latest.args);
331
310
  const usage = liveUsage(run.usage, streaming?.values() ?? []);
332
311
  return {
333
312
  agent_run_id: run.id,
@@ -346,10 +325,15 @@ function controllerSummary(run, status = run.status) {
346
325
  : Number.isFinite(startedAt)
347
326
  ? startedAt
348
327
  : Date.now(),
349
- ...(running
350
- ? { current_tool: running.name, current_activity: currentActivity }
328
+ ...(running ? { current_tool: running.name } : {}),
329
+ ...(currentActivity ? { current_activity: currentActivity } : {}),
330
+ ...(latest && Number.isFinite(Date.parse(latest.startedAt))
331
+ ? { activity_at: Date.parse(latest.startedAt) }
351
332
  : {}),
352
333
  ...(run.statusNote ? { status_text: run.statusNote.text } : {}),
334
+ ...(run.statusNote?.at !== undefined
335
+ ? { status_at: run.statusNote.at }
336
+ : {}),
353
337
  ...(run.statusNote?.usage ? { reported_usage: run.statusNote.usage } : {}),
354
338
  nested_tools: run.toolCalls.map((call) => ({
355
339
  toolName: call.name,
@@ -372,6 +356,7 @@ function controllerSummary(run, status = run.status) {
372
356
  },
373
357
  }
374
358
  : {}),
359
+ ...(run.cwd ? { cwd: run.cwd } : {}),
375
360
  };
376
361
  }
377
362
  function nameList(names) {
@@ -506,17 +491,13 @@ export function createRecipesExtension(opts = {}) {
506
491
  // The session's agents by name, for `send_message`. Root takes a message in
507
492
  // its current wait, or as a steer or follow-up, starting a turn when idle.
508
493
  const messages = new AgentMessageBus();
509
- const rootInbox = new AgentInbox(async (message) => {
510
- extensionApi?.sendMessage({
511
- customType: AGENT_RUN_MESSAGE_TYPE,
512
- content: renderAgentMessage(message),
513
- display: true,
514
- details: message,
515
- },
516
- // An idle root only stores a message without triggerTurn; streaming, it
517
- // takes the message as `deliver` says.
518
- { triggerTurn: true, deliverAs: message.deliver });
519
- }, () => !(sessionCtx?.isIdle?.() ?? true));
494
+ let deliverToRoot;
495
+ const root = createRootInbox({
496
+ api: () => extensionApi ?? undefined,
497
+ session: () => sessionCtx,
498
+ onHeld: () => deliverToRoot?.(),
499
+ });
500
+ const rootInbox = root.inbox;
520
501
  messages.register({
521
502
  id: ROOT_AGENT,
522
503
  name: ROOT_AGENT,
@@ -562,17 +543,15 @@ export function createRecipesExtension(opts = {}) {
562
543
  const runs = [...childRuns.values()].filter((run) => run.status === "running");
563
544
  if (runs.length === 0)
564
545
  return undefined;
565
- const usages = runs.map((run) => liveUsage(run.usage, run.streaming.values()));
566
- const input = usages.reduce((sum, usage) => sum + (usage?.input ?? 0), 0);
567
- const output = usages.reduce((sum, usage) => sum + (usage?.output ?? 0), 0);
568
- const cost = usages.reduce((sum, usage) => sum + (usage?.cost ?? 0), 0);
569
- const pricing = runs.reduce((merged, run) => mergePricing(merged, run.pricing), undefined);
570
- const costPart = costText(cost, pricing);
546
+ // Each run counts what it reported for work it ran elsewhere, as its own line does.
547
+ const usages = runs.map((run) => {
548
+ const own = liveUsage(run.usage, run.streaming.values());
549
+ return combinedUsage(runUsage(own, run.pricing), run.statusNote?.usage);
550
+ });
551
+ const total = sumUsage(usages);
571
552
  return [
572
553
  `${runs.length} agent${runs.length === 1 ? "" : "s"}`,
573
- ...(output > 0
574
- ? [tokenText(input, output), ...(costPart ? [costPart] : [])]
575
- : []),
554
+ ...(total.output_tokens > 0 ? usageParts(total) : []),
576
555
  ].join(" · ");
577
556
  };
578
557
  const watchAgents = () => {
@@ -649,7 +628,7 @@ export function createRecipesExtension(opts = {}) {
649
628
  if (!state || !localAgentContext) {
650
629
  throw new Error("No recipe session is active");
651
630
  }
652
- const run = await runChildAgent(state, input.name, input.prompt, input.label, localAgentContext, input.onUpdate);
631
+ const run = await runChildAgent(state, input.name, input.prompt, input.label, localAgentContext, input.onUpdate, input.cwd);
653
632
  return controllerSummary(run);
654
633
  },
655
634
  async wait(id, signal) {
@@ -679,11 +658,14 @@ export function createRecipesExtension(opts = {}) {
679
658
  });
680
659
  return controllerSummary(run);
681
660
  }
661
+ // Claimed, and its new turn published, before anything yields: a second caller's
662
+ // message goes to its inbox, and a wait waits for that turn.
682
663
  run.status = "running";
683
664
  run.completedAt = undefined;
684
665
  run.error = undefined;
685
666
  run.output = undefined;
686
- run.promise = executeChildPrompt(run, message, state?.cwd ?? process.cwd());
667
+ const resumed = run.inbox.resume();
668
+ run.promise = resumed.then(() => executeChildPrompt(run, message, state?.cwd ?? process.cwd()));
687
669
  void persistRun(state?.cwd ?? process.cwd(), run);
688
670
  return controllerSummary(run);
689
671
  },
@@ -723,6 +705,7 @@ export function createRecipesExtension(opts = {}) {
723
705
  await run.runner.cancel();
724
706
  await run.promise;
725
707
  }
708
+ await run.inbox.close();
726
709
  await run.runner.shutdown();
727
710
  run.unregisterMessages();
728
711
  childRuns.delete(id);
@@ -1322,19 +1305,13 @@ export function createRecipesExtension(opts = {}) {
1322
1305
  throw error;
1323
1306
  }
1324
1307
  }
1325
- async function runChildAgent(launchState, agentName, prompt, label, ctx, onUpdate) {
1308
+ async function runChildAgent(launchState, agentName, prompt, label, ctx, onUpdate, requestedCwd) {
1326
1309
  if (label !== undefined && messages.hasName(label)) {
1327
1310
  throw new Error(`An agent named "${label}" is already running in this session; pick another label.`);
1328
1311
  }
1312
+ const where = runCwd(launchState.cwd, requestedCwd);
1329
1313
  const id = nextChildRunId();
1330
- const inbox = new AgentInbox(async (message) => {
1331
- const text = renderAgentMessage(message);
1332
- if (message.deliver === "followUp")
1333
- await run.runner.followUp(text);
1334
- else
1335
- await run.runner.steer(text);
1336
- });
1337
- inbox.holdUntilStarted();
1314
+ const inbox = createRunnerInbox(() => run.runner);
1338
1315
  // `notifyUpdate` reads it and can run before the run record exists.
1339
1316
  // eslint-disable-next-line prefer-const
1340
1317
  let run;
@@ -1370,7 +1347,7 @@ export function createRecipesExtension(opts = {}) {
1370
1347
  const runner = createChildAgentRunner({
1371
1348
  messages: { bus: messages, id, inbox },
1372
1349
  recipe: launchState.resolvedRecipe,
1373
- workspaceDir: launchState.cwd,
1350
+ workspaceDir: where.cwd,
1374
1351
  env,
1375
1352
  agentName,
1376
1353
  modelRegistry: ctx.modelRegistry,
@@ -1429,6 +1406,7 @@ export function createRecipesExtension(opts = {}) {
1429
1406
  startedAt: new Date().toISOString(),
1430
1407
  toolCalls: [],
1431
1408
  streaming: new Map(),
1409
+ ...(where.shown ? { cwd: where.shown } : {}),
1432
1410
  runner,
1433
1411
  promise: Promise.resolve(undefined),
1434
1412
  notifyUpdate,
@@ -1446,7 +1424,11 @@ export function createRecipesExtension(opts = {}) {
1446
1424
  const current = run;
1447
1425
  // A note without usage keeps the last reported total.
1448
1426
  const usage = note.usage ?? current.statusNote?.usage;
1449
- current.statusNote = { text: note.text, ...(usage ? { usage } : {}) };
1427
+ current.statusNote = {
1428
+ text: note.text,
1429
+ at: Date.now(),
1430
+ ...(usage ? { usage } : {}),
1431
+ };
1450
1432
  current.notifyUpdate();
1451
1433
  },
1452
1434
  }),
@@ -1469,7 +1451,11 @@ export function createRecipesExtension(opts = {}) {
1469
1451
  run.notifyUpdate();
1470
1452
  await run.runner.start();
1471
1453
  // Messages sent before the session was up come with its first prompt.
1472
- const early = run.inbox.started();
1454
+ const early = await run.inbox.started();
1455
+ if (run.status !== "running") {
1456
+ await run.inbox.turnEnded(early);
1457
+ return run;
1458
+ }
1473
1459
  const result = await run.runner.prompt(early.length > 0
1474
1460
  ? `${prompt}\n\n${renderAgentMessages(early)}`
1475
1461
  : prompt);
@@ -1500,7 +1486,7 @@ export function createRecipesExtension(opts = {}) {
1500
1486
  // an empty queue, deferring delivery to the full batch window. It also
1501
1487
  // still notifies if the disk write fails. Wait and terminal status
1502
1488
  // reads acknowledge it back out.
1503
- const envelope = envelopeFromRun(run);
1489
+ const envelope = envelopeFromRun(run, run.statusNote?.usage);
1504
1490
  // A batch row is reported in its batch's results, not on its own.
1505
1491
  if (envelope && !run.batchRow)
1506
1492
  completions.enqueue(envelope);
@@ -1542,7 +1528,7 @@ export function createRecipesExtension(opts = {}) {
1542
1528
  clearTimeout(deliveryRetryTimer);
1543
1529
  deliveryRetryTimer = null;
1544
1530
  }
1545
- if (!completions.hasPending() && !rootInbox.hasHeld())
1531
+ if (!completions.hasPending() && !rootInbox.needsTurn())
1546
1532
  return;
1547
1533
  // The retry timer can outlive this extension instance across a reload,
1548
1534
  // where pi API calls throw as stale. Never crash the timer callback;
@@ -1554,7 +1540,7 @@ export function createRecipesExtension(opts = {}) {
1554
1540
  return;
1555
1541
  }
1556
1542
  // Follow-ups held while root was busy, in send order, go the same idle-gated way.
1557
- rootInbox.flush().catch(() => { });
1543
+ root.flush().catch(() => { });
1558
1544
  const batch = completions.consumeBatch();
1559
1545
  if (batch.length === 0)
1560
1546
  return;
@@ -1573,9 +1559,15 @@ export function createRecipesExtension(opts = {}) {
1573
1559
  }
1574
1560
  };
1575
1561
  completions.setDeliverer(deliverCompletions);
1562
+ deliverToRoot = deliverCompletions;
1563
+ pi.on("message_end", (event) => {
1564
+ const message = event.message;
1565
+ if (message.customType === AGENT_RUN_MESSAGE_TYPE)
1566
+ rootInbox.read(message.details);
1567
+ });
1576
1568
  pi.on("agent_end", (_event, ctx) => {
1577
1569
  sessionCtx = ctx;
1578
- if (rootInbox.hasHeld())
1570
+ if (rootInbox.needsTurn())
1579
1571
  deliverCompletions();
1580
1572
  else
1581
1573
  completions.poke();
@@ -1709,13 +1701,22 @@ export function createRecipesExtension(opts = {}) {
1709
1701
  liveTicker = undefined;
1710
1702
  }
1711
1703
  };
1712
- agentTool.renderResult = (result, _options, _theme, context) => {
1704
+ agentTool.renderResult = (result, options, theme, context) => {
1713
1705
  const text = context.lastComponent ?? new Text("", 0, 0);
1714
1706
  const content = result.content
1715
1707
  .map((part) => (part.type === "text" ? part.text : ""))
1716
1708
  .join("\n");
1717
1709
  const summary = asRecord(result.details)?.agent;
1718
1710
  const live = summary ? childRuns.get(summary.agent_run_id) : undefined;
1711
+ const totals = !options.expanded && !options.isPartial
1712
+ ? waitedTotals(context.args, result.details, live && controllerSummary(live))
1713
+ : undefined;
1714
+ if (totals) {
1715
+ const hint = expandHint(context);
1716
+ const suffix = hint ? ` ${themeFg(theme, "muted", `(${hint})`)}` : "";
1717
+ text.setText(`${totals}${suffix}`);
1718
+ return text;
1719
+ }
1719
1720
  if (!summary || !live) {
1720
1721
  text.setText(content);
1721
1722
  return text;
@@ -1723,7 +1724,7 @@ export function createRecipesExtension(opts = {}) {
1723
1724
  const current = controllerSummary(live);
1724
1725
  const progress = current.status === "running"
1725
1726
  ? runProgress(current)
1726
- : `${current.status} · ${runProgress(current)}`;
1727
+ : runTotals(current);
1727
1728
  const lead = `run ${summary.agent_run_id} (`;
1728
1729
  text.setText(content
1729
1730
  .split("\n")