@hearsay-tools/squawk 0.18.0-pr3690.6754 → 0.18.0-pr3690.6785

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 (162) hide show
  1. package/dist/ci-wait/controller.d.ts +41 -41
  2. package/dist/contract/index.d.ts +2 -0
  3. package/dist/contract/index.js +74 -2
  4. package/dist/contract/own-lookup.d.ts +5 -0
  5. package/dist/contract/runner-facts.d.ts +91 -0
  6. package/dist/contract/runs.d.ts +1 -1
  7. package/dist/core/agent-runner.d.ts +11 -0
  8. package/dist/core/agent-runner.js.map +1 -1
  9. package/dist/core/claude-cli-runner.d.ts +6 -0
  10. package/dist/core/claude-forked-command.d.ts +36 -0
  11. package/dist/core/claude-forked-command.js +65 -0
  12. package/dist/core/claude-forked-command.js.map +1 -0
  13. package/dist/core/claude-ui-mapper.d.ts +2 -1
  14. package/dist/core/claude-ui-mapper.js +17 -1
  15. package/dist/core/claude-ui-mapper.js.map +1 -1
  16. package/dist/core/codex-app-server-runner.d.ts +6 -0
  17. package/dist/core/cursor-print-runner.d.ts +6 -0
  18. package/dist/core/cursor-runner.d.ts +6 -0
  19. package/dist/core/managed-session.js +3 -0
  20. package/dist/core/managed-session.js.map +1 -1
  21. package/dist/core/omp-runner.d.ts +6 -0
  22. package/dist/core/opencode-server-runner.d.ts +6 -0
  23. package/dist/core/opencode-server-runner.js +26 -43
  24. package/dist/core/opencode-server-runner.js.map +1 -1
  25. package/dist/core/opencode-session-error.d.ts +9 -0
  26. package/dist/core/opencode-session-error.js +45 -0
  27. package/dist/core/opencode-session-error.js.map +1 -1
  28. package/dist/core/own-lookup.d.ts +1 -5
  29. package/dist/core/own-lookup.js +1 -7
  30. package/dist/core/own-lookup.js.map +1 -1
  31. package/dist/core/pi-runner.d.ts +6 -0
  32. package/dist/core/runner-cli.d.ts +31 -0
  33. package/dist/core/runner-cli.js +40 -0
  34. package/dist/core/runner-cli.js.map +1 -0
  35. package/dist/core/runner-facts.d.ts +73 -0
  36. package/dist/core/runner-facts.js +66 -0
  37. package/dist/core/runner-facts.js.map +1 -1
  38. package/dist/core/runner-model-catalog.js +2 -9
  39. package/dist/core/runner-model-catalog.js.map +1 -1
  40. package/dist/delegation/routes.d.ts +16 -16
  41. package/dist/delegation/transport.d.ts +9 -9
  42. package/dist/runs/outcome-commit.d.ts +4 -1
  43. package/dist/runs/outcome-commit.js +8 -2
  44. package/dist/runs/outcome-commit.js.map +1 -1
  45. package/dist/server/checkout.d.ts +1 -1
  46. package/dist/server/open-in-targets.d.ts +1 -1
  47. package/dist/server/open-in-targets.js +5 -12
  48. package/dist/server/open-in-targets.js.map +1 -1
  49. package/dist/server/provider-action-gate.js +3 -10
  50. package/dist/server/provider-action-gate.js.map +1 -1
  51. package/dist/server/reports-api.d.ts +2 -2
  52. package/dist/server/server.d.ts +222 -229
  53. package/dist/server/server.js +33 -68
  54. package/dist/server/server.js.map +1 -1
  55. package/dist/server/workspace-live-routes.d.ts +6 -6
  56. package/dist/workflows/outcome-batches.d.ts +3 -2
  57. package/dist/workflows/outcome-batches.js +4 -3
  58. package/dist/workflows/outcome-batches.js.map +1 -1
  59. package/dist/workflows/run/auto-resume.d.ts +7 -6
  60. package/dist/workflows/run/auto-resume.js +16 -25
  61. package/dist/workflows/run/auto-resume.js.map +1 -1
  62. package/dist/workflows/run/completion-gate.js +1 -1
  63. package/dist/workflows/run/completion-gate.js.map +1 -1
  64. package/dist/workflows/run/compose.d.ts +3 -0
  65. package/dist/workflows/run/compose.js +13 -10
  66. package/dist/workflows/run/compose.js.map +1 -1
  67. package/dist/workflows/run/continuation-session.js +3 -1
  68. package/dist/workflows/run/continuation-session.js.map +1 -1
  69. package/dist/workflows/run/family-reconciler.d.ts +4 -5
  70. package/dist/workflows/run/family-reconciler.js +9 -19
  71. package/dist/workflows/run/family-reconciler.js.map +1 -1
  72. package/dist/workflows/run/human-waits.d.ts +19 -1
  73. package/dist/workflows/run/human-waits.js +48 -3
  74. package/dist/workflows/run/human-waits.js.map +1 -1
  75. package/dist/workflows/run/inbox-claims.d.ts +3 -4
  76. package/dist/workflows/run/inbox-claims.js +7 -17
  77. package/dist/workflows/run/inbox-claims.js.map +1 -1
  78. package/dist/workflows/run/input-delivery.d.ts +9 -1
  79. package/dist/workflows/run/input-delivery.js +23 -22
  80. package/dist/workflows/run/input-delivery.js.map +1 -1
  81. package/dist/workflows/run/input-receipts.d.ts +10 -4
  82. package/dist/workflows/run/input-receipts.js +5 -4
  83. package/dist/workflows/run/input-receipts.js.map +1 -1
  84. package/dist/workflows/run/input-timers.js +3 -2
  85. package/dist/workflows/run/input-timers.js.map +1 -1
  86. package/dist/workflows/run/live-session-state.d.ts +3 -0
  87. package/dist/workflows/run/live-session-state.js +3 -0
  88. package/dist/workflows/run/live-session-state.js.map +1 -1
  89. package/dist/workflows/run/liveness-timers.d.ts +101 -0
  90. package/dist/workflows/run/liveness-timers.js +132 -0
  91. package/dist/workflows/run/liveness-timers.js.map +1 -0
  92. package/dist/workflows/run/run-memory.d.ts +11 -3
  93. package/dist/workflows/run/run-memory.js +34 -8
  94. package/dist/workflows/run/run-memory.js.map +1 -1
  95. package/dist/workflows/run/session-events.d.ts +4 -2
  96. package/dist/workflows/run/session-events.js +3 -2
  97. package/dist/workflows/run/session-events.js.map +1 -1
  98. package/dist/workflows/run/squawk-tools.js +2 -0
  99. package/dist/workflows/run/squawk-tools.js.map +1 -1
  100. package/dist/workflows/run/subagent-waits.d.ts +16 -6
  101. package/dist/workflows/run/subagent-waits.js +51 -33
  102. package/dist/workflows/run/subagent-waits.js.map +1 -1
  103. package/dist/workflows/run/turn-nudges.d.ts +3 -1
  104. package/dist/workflows/run/turn-nudges.js +9 -6
  105. package/dist/workflows/run/turn-nudges.js.map +1 -1
  106. package/dist/workflows/run/turn-settler.d.ts +10 -3
  107. package/dist/workflows/run/turn-settler.js +20 -6
  108. package/dist/workflows/run/turn-settler.js.map +1 -1
  109. package/dist/workflows/run/wait-kinds.d.ts +0 -1
  110. package/dist/workflows/run/wait-kinds.js +0 -1
  111. package/dist/workflows/run/wait-kinds.js.map +1 -1
  112. package/dist/workflows/run/wait-registry.js +5 -4
  113. package/dist/workflows/run/wait-registry.js.map +1 -1
  114. package/dist/workflows/run/wake-retries.d.ts +5 -7
  115. package/dist/workflows/run/wake-retries.js +17 -42
  116. package/dist/workflows/run/wake-retries.js.map +1 -1
  117. package/dist/workflows/run/worker-executions.js +2 -0
  118. package/dist/workflows/run/worker-executions.js.map +1 -1
  119. package/dist/workflows/run-states.js +3 -1
  120. package/dist/workflows/run-states.js.map +1 -1
  121. package/dist/workflows/run.js +9 -2
  122. package/dist/workflows/run.js.map +1 -1
  123. package/package.json +4 -4
  124. package/scripts/mock-ask-answer.d.mts +2 -0
  125. package/scripts/mock-opencode-questions.d.mts +14 -0
  126. package/scripts/mock-pi-rpc.mjs +9 -4
  127. package/web/dist/assets/{activity-motion-CjPL-sr2.js → activity-motion-gOopdagH.js} +1 -1
  128. package/web/dist/assets/{activity-route-C0tIKFED.js → activity-route-D7bDtXpW.js} +1 -1
  129. package/web/dist/assets/agent-accounts-otlDWnij.js +18 -0
  130. package/web/dist/assets/{commit-diff-panel-uIMnjowv.js → commit-diff-panel-iQf0Rlcx.js} +1 -1
  131. package/web/dist/assets/{diff-CUIYkwMG.js → diff-DQfcliZC.js} +2 -2
  132. package/web/dist/assets/{diff-view-CH27Vgln.js → diff-view-BbM-71Cs.js} +1 -1
  133. package/web/dist/assets/{file-preview-wrsPzzjz.js → file-preview-DgU8vo8k.js} +1 -1
  134. package/web/dist/assets/{git-toolbar-C1v8n8nd.js → git-toolbar-C8agvpYS.js} +1 -1
  135. package/web/dist/assets/{github-0PYN1Ju2.js → github-hXmxAXmA.js} +1 -1
  136. package/web/dist/assets/{global-activity-route-KDUFNxgb.js → global-activity-route-D_r1ImUh.js} +1 -1
  137. package/web/dist/assets/index-tN02NX7A.js +17 -0
  138. package/web/dist/assets/{preview-pane-connected-B1XJVVoo.js → preview-pane-connected-D__9JwyU.js} +1 -1
  139. package/web/dist/assets/{prompt-template-menu-DC5XoYEs.js → prompt-template-menu-BJfUg1uF.js} +1 -1
  140. package/web/dist/assets/queries-BJM44umy.js +1 -0
  141. package/web/dist/assets/{reference-chip-peKR_0El.js → reference-chip-vraIzoEF.js} +1 -1
  142. package/web/dist/assets/{repo-git-DU5eh5V8.js → repo-git-B4qZq37d.js} +1 -1
  143. package/web/dist/assets/{report-reader-DsvVau4u.js → report-reader-Djix-ICM.js} +1 -1
  144. package/web/dist/assets/{reports-Brs9M380.js → reports-Do-dkavq.js} +1 -1
  145. package/web/dist/assets/run-header-Di9LaKQs.js +2 -0
  146. package/web/dist/assets/{skills-TJPEPrU2.js → skills-CPnIvFnR.js} +1 -1
  147. package/web/dist/assets/{task-changes-BMMqKQZQ.js → task-changes-CW7NzgL5.js} +1 -1
  148. package/web/dist/assets/{task-commits-DzOQ_acm.js → task-commits-Bkwi7o1B.js} +1 -1
  149. package/web/dist/assets/{task-files-CqBxJ5lZ.js → task-files-geRzIszC.js} +1 -1
  150. package/web/dist/assets/{task-github-item-DYZGczpf.js → task-github-item-UbCCP2Ud.js} +1 -1
  151. package/web/dist/assets/task-thread-CkiEiypn.js +9 -0
  152. package/web/dist/assets/{thread-state-VHo3TMiY.js → thread-state-CajkV5Ft.js} +1 -1
  153. package/web/dist/assets/{use-desktop-DBpXK7UB.js → use-desktop-Ct4lvA3b.js} +1 -1
  154. package/web/dist/assets/{use-hand-to-agent-state-DiPruziF.js → use-hand-to-agent-state-Cnxq_2F6.js} +1 -1
  155. package/web/dist/assets/workflows-Csr2hbks.js +7 -0
  156. package/web/dist/index.html +6 -6
  157. package/web/dist/assets/agent-accounts-Bfv01ivB.js +0 -18
  158. package/web/dist/assets/index-DgeV0f4H.js +0 -17
  159. package/web/dist/assets/queries-Ce9CPdRy.js +0 -1
  160. package/web/dist/assets/run-header-BYyz-dXB.js +0 -2
  161. package/web/dist/assets/task-thread-DYEBHvdF.js +0 -9
  162. package/web/dist/assets/workflows-DiURHZJ-.js +0 -7
@@ -280,12 +280,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
280
280
  "/api/v1/tools/ask": {
281
281
  $post: {
282
282
  output: {
283
- ok: false;
284
- code: 'unavailable';
283
+ code: 'capability_revoked';
285
284
  message: string;
286
285
  };
287
286
  outputFormat: "json";
288
- status: import("hono/utils/http-status").ContentfulStatusCode;
287
+ status: 401;
289
288
  input: {
290
289
  json: {
291
290
  questions: {
@@ -303,11 +302,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
303
302
  };
304
303
  } | {
305
304
  output: {
306
- code: 'capability_revoked';
305
+ ok: false;
306
+ code: 'unavailable';
307
307
  message: string;
308
308
  };
309
309
  outputFormat: "json";
310
- status: 401;
310
+ status: import("hono/utils/http-status").ContentfulStatusCode;
311
311
  input: {
312
312
  json: {
313
313
  questions: {
@@ -375,12 +375,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
375
375
  "/api/v1/tools/cancel-wait": {
376
376
  $post: {
377
377
  output: {
378
- cancelled: false;
379
- code: 'unavailable';
378
+ code: 'capability_revoked';
380
379
  message: string;
381
380
  };
382
381
  outputFormat: "json";
383
- status: import("hono/utils/http-status").ContentfulStatusCode;
382
+ status: 401;
384
383
  input: {
385
384
  json: {
386
385
  wait_id: string;
@@ -388,11 +387,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
388
387
  };
389
388
  } | {
390
389
  output: {
391
- code: 'capability_revoked';
390
+ cancelled: false;
391
+ code: 'unavailable';
392
392
  message: string;
393
393
  };
394
394
  outputFormat: "json";
395
- status: 401;
395
+ status: import("hono/utils/http-status").ContentfulStatusCode;
396
396
  input: {
397
397
  json: {
398
398
  wait_id: string;
@@ -440,12 +440,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
440
440
  "/api/v1/tools/done": {
441
441
  $post: {
442
442
  output: {
443
- ok: false;
444
- code: 'unavailable';
443
+ code: 'capability_revoked';
445
444
  message: string;
446
445
  };
447
446
  outputFormat: "json";
448
- status: import("hono/utils/http-status").ContentfulStatusCode;
447
+ status: 401;
449
448
  input: {
450
449
  json: {
451
450
  summary?: string | undefined;
@@ -453,11 +452,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
453
452
  };
454
453
  } | {
455
454
  output: {
456
- code: 'capability_revoked';
455
+ ok: false;
456
+ code: 'unavailable';
457
457
  message: string;
458
458
  };
459
459
  outputFormat: "json";
460
- status: 401;
460
+ status: import("hono/utils/http-status").ContentfulStatusCode;
461
461
  input: {
462
462
  json: {
463
463
  summary?: string | undefined;
@@ -525,13 +525,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
525
525
  "/api/v1/tools/preview-stop": {
526
526
  $post: {
527
527
  output: {
528
- ok: boolean;
529
- code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
528
+ code: 'capability_revoked';
530
529
  message: string;
531
- hint: string;
532
530
  };
533
531
  outputFormat: "json";
534
- status: import("hono/utils/http-status").ContentfulStatusCode;
532
+ status: 401;
535
533
  input: {
536
534
  json: {
537
535
  port: number;
@@ -540,11 +538,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
540
538
  };
541
539
  } | {
542
540
  output: {
543
- code: 'capability_revoked';
541
+ ok: boolean;
542
+ code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
544
543
  message: string;
544
+ hint: string;
545
545
  };
546
546
  outputFormat: "json";
547
- status: 401;
547
+ status: import("hono/utils/http-status").ContentfulStatusCode;
548
548
  input: {
549
549
  json: {
550
550
  port: number;
@@ -557,13 +557,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
557
557
  "/api/v1/tools/preview-serve": {
558
558
  $post: {
559
559
  output: {
560
- ok: boolean;
561
- code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
560
+ code: 'capability_revoked';
562
561
  message: string;
563
- hint: string;
564
562
  };
565
563
  outputFormat: "json";
566
- status: import("hono/utils/http-status").ContentfulStatusCode;
564
+ status: 401;
567
565
  input: {
568
566
  json: {
569
567
  command: string;
@@ -575,11 +573,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
575
573
  };
576
574
  } | {
577
575
  output: {
578
- code: 'capability_revoked';
576
+ ok: boolean;
577
+ code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
579
578
  message: string;
579
+ hint: string;
580
580
  };
581
581
  outputFormat: "json";
582
- status: 401;
582
+ status: import("hono/utils/http-status").ContentfulStatusCode;
583
583
  input: {
584
584
  json: {
585
585
  command: string;
@@ -595,12 +595,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
595
595
  "/api/v1/tools/schedule-task": {
596
596
  $post: {
597
597
  output: {
598
- ok: false;
599
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
598
+ code: 'capability_revoked';
600
599
  message: string;
601
600
  };
602
601
  outputFormat: "json";
603
- status: import("hono/utils/http-status").ContentfulStatusCode;
602
+ status: 401;
604
603
  input: {
605
604
  json: {
606
605
  at?: string | undefined;
@@ -617,11 +616,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
617
616
  };
618
617
  } | {
619
618
  output: {
620
- code: 'capability_revoked';
619
+ ok: false;
620
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
621
621
  message: string;
622
622
  };
623
623
  outputFormat: "json";
624
- status: 401;
624
+ status: import("hono/utils/http-status").ContentfulStatusCode;
625
625
  input: {
626
626
  json: {
627
627
  at?: string | undefined;
@@ -638,6 +638,10 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
638
638
  };
639
639
  } | {
640
640
  output: {
641
+ ok: false;
642
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
643
+ message: string;
644
+ } | {
641
645
  ok: true;
642
646
  task: {
643
647
  id: string;
@@ -649,10 +653,6 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
649
653
  url?: string | undefined;
650
654
  };
651
655
  note: string;
652
- } | {
653
- ok: false;
654
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
655
- message: string;
656
656
  };
657
657
  outputFormat: "json";
658
658
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -676,12 +676,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
676
676
  "/api/v1/tools/scheduled-tasks": {
677
677
  $post: {
678
678
  output: {
679
- ok: false;
680
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
679
+ code: 'capability_revoked';
681
680
  message: string;
682
681
  };
683
682
  outputFormat: "json";
684
- status: import("hono/utils/http-status").ContentfulStatusCode;
683
+ status: 401;
685
684
  input: {
686
685
  json: {
687
686
  at?: string | undefined;
@@ -714,11 +713,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
714
713
  };
715
714
  } | {
716
715
  output: {
717
- code: 'capability_revoked';
716
+ ok: false;
717
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
718
718
  message: string;
719
719
  };
720
720
  outputFormat: "json";
721
- status: 401;
721
+ status: import("hono/utils/http-status").ContentfulStatusCode;
722
722
  input: {
723
723
  json: {
724
724
  at?: string | undefined;
@@ -8,6 +8,7 @@ export * from './pending-ask.ts';
8
8
  export * from './delegation.ts';
9
9
  export * from './effort.ts';
10
10
  export * from './health.ts';
11
+ export * from './runner-facts.ts';
11
12
  export * from './runs.ts';
12
13
  export * from './task-options.ts';
13
14
  export * from './run-labels.ts';
@@ -44,6 +45,7 @@ export * from './live-coordination.ts';
44
45
  export * from './workspace-events.ts';
45
46
  export * from './permissions.ts';
46
47
  export * from './defined.ts';
48
+ export * from './own-lookup.ts';
47
49
  export * from './tool-display.ts';
48
50
  export * from './version.ts';
49
51
  export * from './active-provider.ts';
@@ -1115,6 +1115,67 @@ var healthResponseSchema = z12.object({
1115
1115
  bootProject: z12.string()
1116
1116
  });
1117
1117
 
1118
+ // ../contract/src/runner-facts.ts
1119
+ var RUNNER_COCKPIT_FACTS = {
1120
+ claude: {
1121
+ displayName: "Claude Code",
1122
+ modelListName: "Claude",
1123
+ modelCatalogDelivery: "on-request",
1124
+ effortLevels: "catalog-or-generic",
1125
+ modelIdScope: "own",
1126
+ inputMode: "steer"
1127
+ },
1128
+ codex: {
1129
+ displayName: "Codex",
1130
+ modelListName: "Codex",
1131
+ modelCatalogDelivery: "on-request",
1132
+ effortLevels: "catalog-or-generic",
1133
+ modelIdScope: "own",
1134
+ inputMode: "steer"
1135
+ },
1136
+ opencode: {
1137
+ displayName: "OpenCode",
1138
+ modelListName: "OpenCode",
1139
+ modelCatalogDelivery: "on-request",
1140
+ effortLevels: "catalog-or-generic",
1141
+ modelIdScope: "provider-spanning",
1142
+ inputMode: "steer"
1143
+ },
1144
+ pi: {
1145
+ displayName: "pi",
1146
+ modelListName: "Pi",
1147
+ modelCatalogDelivery: "on-request",
1148
+ effortLevels: "catalog-or-generic",
1149
+ modelIdScope: "provider-spanning",
1150
+ inputMode: "steer"
1151
+ },
1152
+ cursor: {
1153
+ displayName: "Cursor",
1154
+ modelListName: "Cursor",
1155
+ modelCatalogDelivery: "pushed",
1156
+ effortLevels: "catalog-only",
1157
+ modelIdScope: "any-provider",
1158
+ inputMode: "boundary"
1159
+ },
1160
+ omp: {
1161
+ displayName: "OMP",
1162
+ modelListName: "OMP",
1163
+ modelCatalogDelivery: "on-request",
1164
+ effortLevels: "catalog-or-generic",
1165
+ modelIdScope: "provider-spanning",
1166
+ inputMode: "steer"
1167
+ }
1168
+ };
1169
+ function runnerDisplayName(runner) {
1170
+ return RUNNER_COCKPIT_FACTS[runner].displayName;
1171
+ }
1172
+ function runnerModelListName(runner) {
1173
+ return RUNNER_COCKPIT_FACTS[runner].modelListName;
1174
+ }
1175
+ function cockpitRunnersWhere(matches) {
1176
+ return Object.keys(RUNNER_COCKPIT_FACTS).filter((runner) => matches(RUNNER_COCKPIT_FACTS[runner]));
1177
+ }
1178
+
1118
1179
  // ../contract/src/runs.ts
1119
1180
  import { z as z20 } from "zod";
1120
1181
 
@@ -2742,7 +2803,8 @@ var apiRunSchema = runRecordSchema.extend({
2742
2803
  /** Read-only GET /runs/:id verdict: null permits Finish, a string explains refusal.
2743
2804
  * Absent on lists, stored records and mutation responses; absence is not permission. */
2744
2805
  finishBlocked: z20.string().nullable().optional(),
2745
- /** Server-resolved Cursor CLI command, including the configured executable. Never persisted. */
2806
+ /** The server's take-over command for the run's latest session, with the executable the server
2807
+ * resolves. Absent without a session or for an id the server refuses. Never persisted. */
2746
2808
  cliResumeCommand: z20.string().optional(),
2747
2809
  usage: processUsageSchema.optional()
2748
2810
  });
@@ -5044,6 +5106,11 @@ function defined(value) {
5044
5106
  return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
5045
5107
  }
5046
5108
 
5109
+ // ../contract/src/own-lookup.ts
5110
+ function ownLookup(table, key) {
5111
+ return typeof key === "string" && Object.hasOwn(table, key) ? table[key] : void 0;
5112
+ }
5113
+
5047
5114
  // ../contract/src/tool-display.ts
5048
5115
  var MAX_LABEL = 120;
5049
5116
  function isRecord(value) {
@@ -5286,7 +5353,7 @@ function imageMimeType(path) {
5286
5353
  const name = path.slice(path.lastIndexOf("/") + 1);
5287
5354
  const dot = name.lastIndexOf(".");
5288
5355
  if (dot <= 0) return null;
5289
- return IMAGE_MIME[name.slice(dot + 1).toLowerCase()] ?? null;
5356
+ return ownLookup(IMAGE_MIME, name.slice(dot + 1).toLowerCase()) ?? null;
5290
5357
  }
5291
5358
  var OS_OPENABLE_EXT = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "avif"]);
5292
5359
  function isOsOpenableImage(path) {
@@ -5873,6 +5940,7 @@ export {
5873
5940
  RENEW_MS,
5874
5941
  REPORTS_QUERY_MAX,
5875
5942
  RETENTION_RUN_RULE,
5943
+ RUNNER_COCKPIT_FACTS,
5876
5944
  RUNS_SEARCH_PER_PROJECT_MAX,
5877
5945
  RUN_HISTORY_PAGE_ITEMS,
5878
5946
  RUN_SEARCH_FIELDS,
@@ -6019,6 +6087,7 @@ export {
6019
6087
  ciWaitRequestSchema,
6020
6088
  ciWaitResultSchema,
6021
6089
  ciWaitSchema,
6090
+ cockpitRunnersWhere,
6022
6091
  commitQuerySchema,
6023
6092
  completionActionSchema,
6024
6093
  completionControlsShape,
@@ -6205,6 +6274,7 @@ export {
6205
6274
  openTargetSchema,
6206
6275
  openTargetsResponseSchema,
6207
6276
  openWaitSchema,
6277
+ ownLookup,
6208
6278
  ownerInputSchema,
6209
6279
  ownerOutputSchema,
6210
6280
  parentFileRefusal,
@@ -6344,7 +6414,9 @@ export {
6344
6414
  runWorktreeSetupSchema,
6345
6415
  rungNeedsYou,
6346
6416
  runnerDiscoversModels,
6417
+ runnerDisplayName,
6347
6418
  runnerModelCatalogResponseSchema,
6419
+ runnerModelListName,
6348
6420
  runnerModelOptionSchema,
6349
6421
  runnerModelsSchema,
6350
6422
  runnerSchema,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Look a wire string up in a plain-object table by own keys only. A plain index returns
3
+ * `Object.prototype` members for keys such as `toString`, `constructor` or `__proto__`.
4
+ */
5
+ export declare function ownLookup<V>(table: Readonly<Record<string, V>>, key: unknown): V | undefined;
@@ -0,0 +1,91 @@
1
+ import type { Runner } from './runner.ts';
2
+ /**
3
+ * What the cockpit and the server both need to know about one runner, declared once per runner
4
+ * id (hearsay-tools/squawk#3642). Shared code reads a row instead of comparing runner ids, so a
5
+ * new runner needs one new row and no new branch. The server's own wire facts live in
6
+ * `RUNNER_FACTS` (`packages/cezar/src/core/runner-facts.ts`); its test checks that the two agree
7
+ * where they state the same fact.
8
+ */
9
+ export interface CockpitRunnerFacts {
10
+ /** The runner's name on provider, account and conversation surfaces and in server messages. */
11
+ readonly displayName: string;
12
+ /** The runner's name in model discovery messages and in the model picker's status line. */
13
+ readonly modelListName: string;
14
+ /**
15
+ * `pushed`: the server refreshes the model catalog in the background, serves the cached copy on
16
+ * request and pushes each change on the `models:<runner>` topic. `on-request`: each request
17
+ * discovers the catalog, through the server's short cache.
18
+ */
19
+ readonly modelCatalogDelivery: 'pushed' | 'on-request';
20
+ /**
21
+ * `catalog-only`: the effort levels come only from the runner's own discovered catalog; without
22
+ * them the picker offers only auto. `catalog-or-generic`: without catalog levels the picker
23
+ * offers every generic level.
24
+ */
25
+ readonly effortLevels: 'catalog-only' | 'catalog-or-generic';
26
+ /**
27
+ * Which model ids the runner serves. `own`: its own provider's ids, so another runner's known
28
+ * preset conflicts with it. `provider-spanning`: `provider/model` ids of every configured
29
+ * provider, so an id it lists belongs to no runner alone. `any-provider`: bare ids of every
30
+ * provider, so no id conflicts with it.
31
+ */
32
+ readonly modelIdScope: 'own' | 'provider-spanning' | 'any-provider';
33
+ /** `steer`: input reaches the agent during its turn. `boundary`: input waits for the turn to end. */
34
+ readonly inputMode: 'steer' | 'boundary';
35
+ }
36
+ export declare const RUNNER_COCKPIT_FACTS: {
37
+ readonly claude: {
38
+ readonly displayName: 'Claude Code';
39
+ readonly modelListName: 'Claude';
40
+ readonly modelCatalogDelivery: 'on-request';
41
+ readonly effortLevels: 'catalog-or-generic';
42
+ readonly modelIdScope: 'own';
43
+ readonly inputMode: 'steer';
44
+ };
45
+ readonly codex: {
46
+ readonly displayName: 'Codex';
47
+ readonly modelListName: 'Codex';
48
+ readonly modelCatalogDelivery: 'on-request';
49
+ readonly effortLevels: 'catalog-or-generic';
50
+ readonly modelIdScope: 'own';
51
+ readonly inputMode: 'steer';
52
+ };
53
+ readonly opencode: {
54
+ readonly displayName: 'OpenCode';
55
+ readonly modelListName: 'OpenCode';
56
+ readonly modelCatalogDelivery: 'on-request';
57
+ readonly effortLevels: 'catalog-or-generic';
58
+ readonly modelIdScope: 'provider-spanning';
59
+ readonly inputMode: 'steer';
60
+ };
61
+ readonly pi: {
62
+ readonly displayName: 'pi';
63
+ readonly modelListName: 'Pi';
64
+ readonly modelCatalogDelivery: 'on-request';
65
+ readonly effortLevels: 'catalog-or-generic';
66
+ readonly modelIdScope: 'provider-spanning';
67
+ readonly inputMode: 'steer';
68
+ };
69
+ readonly cursor: {
70
+ readonly displayName: 'Cursor';
71
+ readonly modelListName: 'Cursor';
72
+ readonly modelCatalogDelivery: 'pushed';
73
+ readonly effortLevels: 'catalog-only';
74
+ readonly modelIdScope: 'any-provider';
75
+ readonly inputMode: 'boundary';
76
+ };
77
+ readonly omp: {
78
+ readonly displayName: 'OMP';
79
+ readonly modelListName: 'OMP';
80
+ readonly modelCatalogDelivery: 'on-request';
81
+ readonly effortLevels: 'catalog-or-generic';
82
+ readonly modelIdScope: 'provider-spanning';
83
+ readonly inputMode: 'steer';
84
+ };
85
+ };
86
+ /** The display name of a runner. */
87
+ export declare function runnerDisplayName(runner: Runner): string;
88
+ /** The runner's name in model discovery messages. */
89
+ export declare function runnerModelListName(runner: Runner): string;
90
+ /** The runners whose cockpit facts match, in the table's order. */
91
+ export declare function cockpitRunnersWhere(matches: (facts: CockpitRunnerFacts) => boolean): Runner[];
@@ -2141,7 +2141,7 @@ export type RunRecord = z.infer<typeof runRecordSchema>;
2141
2141
  /**
2142
2142
  * What `GET /runs` and `GET /runs/:id` answer: the stored record plus host-derived fields.
2143
2143
  * The live `usage` sample is absent for finished runs and wherever `ps` yields nothing.
2144
- * Cursor resume commands use the server executable override. Finish eligibility is computed
2144
+ * The take-over command uses the server's executable override. Finish eligibility is computed
2145
2145
  * only for detail reads. These fields are never persisted or attached by mutation routes.
2146
2146
  */
2147
2147
  export declare const apiRunSchema: z.ZodObject<{
@@ -340,6 +340,17 @@ export interface AgentSession {
340
340
  heldHumanInputCount?(): number;
341
341
  /** Graceful close: end input, then a SIGTERM→SIGKILL watchdog. */
342
342
  end(): void;
343
+ /**
344
+ * The close after an accepted done (hearsay-tools/squawk#1680). Exactly the runners whose facts
345
+ * row declares `nativePermission: 'after-turn'` implement it. `open` reads false at once, so the
346
+ * session takes no input. It stays up `AUTO_END_DELAY_MS` for a permission request the wire raises
347
+ * after the turn ended; such a request still reaches `respondPermission`, and the session ends once
348
+ * none is pending and the turn it reopened has ended. Every other runner closes with `end()`.
349
+ */
350
+ endWhenQuiet?(): void;
351
+ /** True from `endWhenQuiet` until the session ends: closed to input, still live for its late
352
+ * permission request and for a human Finish or Stop. */
353
+ readonly closingQuietly?: boolean;
343
354
  /** Hard stop (used by cancel). */
344
355
  interrupt(): void;
345
356
  /** True while the session still accepts messages. */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAQ1F,gFAAgF;AAChF,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAQ,UAAgC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,4EAA4E;AAC5E,MAAM,iBAAiB,GAAkC,IAAI,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE7F;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAA2B;IACpD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC3C,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC;AACpF,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E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAuB;IAC7D,OAAO,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG,CAAC;AAClE,CAAC;AAUD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,KAAqB;IAClD,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC;IAChE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;QACtB,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC;AACtB,CAAC;AAoLD,MAAM,CAAC,MAAM,uBAAuB,GAAkB;IACpD,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,GAAG,EAAE,gBAAgB;CACtI,CAAC;AACF,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,MAA0C;IACxE,OAAO,MAAM,CAAC,aAAa,IAAI,uBAAuB,CAAC;AACzD,CAAC"}
@@ -30,6 +30,11 @@ export declare class ClaudeCliRunner implements AgentRunner {
30
30
  readonly specSupport: Readonly<Record<keyof AgentRunSpec, import("./agent-runner.ts").SpecFieldSupport>>;
31
31
  readonly systemPromptOnResume: "resent";
32
32
  readonly facts: {
33
+ readonly childWork: 'nested';
34
+ readonly hookEvents: 'reported';
35
+ readonly nativePermission: 'none';
36
+ readonly transport: 'stdio';
37
+ readonly humanPromptHold: 'none';
33
38
  readonly inputDelivery: {
34
39
  readonly mode: 'steer';
35
40
  readonly consumption: 'observable';
@@ -44,6 +49,7 @@ export declare class ClaudeCliRunner implements AgentRunner {
44
49
  readonly costReport: 'cumulative';
45
50
  readonly sessionIdSource: 'launch';
46
51
  readonly claudeModelAliases: true;
52
+ readonly turnStart: 'on-write';
47
53
  };
48
54
  readonly inputDelivery: InputDelivery;
49
55
  private readonly bin;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Typed forked commands (hearsay-tools/squawk#1315). A typed `/name` command whose skill has
3
+ * `context: fork` runs a subagent with no spawn call: its `task_started` carries no tool_use_id
4
+ * and arrives before `init`, and its children name a synthetic parent, `forked-command-<name>`.
5
+ * The first child mints one root task item for the fork, so the fork's work nests under it in
6
+ * the same turn. The item stays running until the turn ends: Claude reports the task completed
7
+ * before its children run.
8
+ */
9
+ import type { UiEvent, UiToolItem } from './ui-events.ts';
10
+ interface ForkedCommandStart {
11
+ readonly description?: string | undefined;
12
+ readonly subagentType?: string | undefined;
13
+ }
14
+ /** The slice of the Claude mapper state that tracks typed forked commands. */
15
+ export interface ForkedCommandState {
16
+ /** Claude's task id → the `task_started` of a typed forked command. Its children name the
17
+ * task in `agent_id`. Cleared when the turn ends. */
18
+ readonly forkedCommandStarts: ReadonlyMap<string, ForkedCommandStart>;
19
+ /** Typed forked commands open in this turn, keyed by the wire parent id their children carry. */
20
+ readonly openForkedCommands: ReadonlyMap<string, UiToolItem>;
21
+ /** Every fork item id minted in this session: a command typed again gets a fresh item id, so
22
+ * each fork nests in its own turn and never overwrites another fork's item. */
23
+ readonly forkedCommandIds: ReadonlySet<string>;
24
+ }
25
+ export declare function withForkedCommandStart<S extends ForkedCommandState>(msg: Record<string, unknown>, state: S): S;
26
+ /** The fork item's start, and the message re-parented under its item id, for a forked command's
27
+ * child; undefined for any other message. */
28
+ export declare function adoptForkedCommand<S extends ForkedCommandState>(msg: Record<string, unknown>, state: S): {
29
+ events: UiEvent[];
30
+ state: S;
31
+ msg: Record<string, unknown>;
32
+ } | undefined;
33
+ /** The turn's end settles every fork it opened: failed when the turn did not end normally
34
+ * (an error or the turn cap), else completed. */
35
+ export declare function completeForkedCommands(state: ForkedCommandState, turnFailed: boolean): UiEvent[];
36
+ export {};
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Typed forked commands (hearsay-tools/squawk#1315). A typed `/name` command whose skill has
3
+ * `context: fork` runs a subagent with no spawn call: its `task_started` carries no tool_use_id
4
+ * and arrives before `init`, and its children name a synthetic parent, `forked-command-<name>`.
5
+ * The first child mints one root task item for the fork, so the fork's work nests under it in
6
+ * the same turn. The item stays running until the turn ends: Claude reports the task completed
7
+ * before its children run.
8
+ */
9
+ const FORKED_COMMAND_PREFIX = 'forked-command-';
10
+ export function withForkedCommandStart(msg, state) {
11
+ const taskId = str(msg.task_id);
12
+ if (taskId === undefined)
13
+ return state;
14
+ const start = { description: str(msg.description), subagentType: str(msg.subagent_type) };
15
+ return { ...state, forkedCommandStarts: new Map(state.forkedCommandStarts).set(taskId, start) };
16
+ }
17
+ /** The fork item's start, and the message re-parented under its item id, for a forked command's
18
+ * child; undefined for any other message. */
19
+ export function adoptForkedCommand(msg, state) {
20
+ const wireId = str(msg.parent_tool_use_id);
21
+ if (wireId === undefined || !wireId.startsWith(FORKED_COMMAND_PREFIX))
22
+ return undefined;
23
+ const open = state.openForkedCommands.get(wireId);
24
+ if (open)
25
+ return { events: [], state, msg: { ...msg, parent_tool_use_id: open.id } };
26
+ const item = startForkedCommandItem(wireId, state, str(msg.agent_id));
27
+ const next = {
28
+ ...state,
29
+ openForkedCommands: new Map(state.openForkedCommands).set(wireId, item),
30
+ forkedCommandIds: new Set(state.forkedCommandIds).add(item.id),
31
+ };
32
+ return { events: [{ type: 'item.started', item }], state: next, msg: { ...msg, parent_tool_use_id: item.id } };
33
+ }
34
+ /** The wire id, or the first free `<wire id>-<n>`: a suffixed id can equal another command's
35
+ * wire id (`/review` typed twice, then `/review-2`), so every minted id is checked. */
36
+ function freeForkItemId(wireId, minted) {
37
+ let id = wireId;
38
+ for (let n = 2; minted.has(id); n += 1)
39
+ id = `${wireId}-${n}`;
40
+ return id;
41
+ }
42
+ function startForkedCommandItem(wireId, state, taskId) {
43
+ const start = taskId === undefined ? undefined : state.forkedCommandStarts.get(taskId);
44
+ const item = {
45
+ kind: 'tool',
46
+ id: freeForkItemId(wireId, state.forkedCommandIds),
47
+ name: 'Skill',
48
+ toolKind: 'task',
49
+ title: start?.description ?? `/${wireId.slice(FORKED_COMMAND_PREFIX.length)}`,
50
+ status: 'running',
51
+ };
52
+ if (start?.subagentType !== undefined)
53
+ item.input = { subagent_type: start.subagentType };
54
+ return item;
55
+ }
56
+ /** The turn's end settles every fork it opened: failed when the turn did not end normally
57
+ * (an error or the turn cap), else completed. */
58
+ export function completeForkedCommands(state, turnFailed) {
59
+ const status = turnFailed ? 'failed' : 'completed';
60
+ return [...state.openForkedCommands.values()].map((open) => ({ type: 'item.completed', item: { ...open, status } }));
61
+ }
62
+ function str(value) {
63
+ return typeof value === 'string' && value !== '' ? value : undefined;
64
+ }
65
+ //# sourceMappingURL=claude-forked-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-forked-command.js","sourceRoot":"","sources":["../../src/core/claude-forked-command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAmBhD,MAAM,UAAU,sBAAsB,CAA+B,GAA4B,EAAE,KAAQ;IACzG,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACvC,MAAM,KAAK,GAAuB,EAAE,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;IAC9G,OAAO,EAAE,GAAG,KAAK,EAAE,mBAAmB,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;AAClG,CAAC;AAED;8CAC8C;AAC9C,MAAM,UAAU,kBAAkB,CAChC,GAA4B,EAC5B,KAAQ;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,CAAC,SAAS,CAAC;AACvE,CAAC"}
@@ -24,7 +24,8 @@
24
24
  * the two id spaces then drift silently — updates land on the wrong row.
25
25
  */
26
26
  import type { PlanEntry, PlanStatus, UiEvent, UiToolItem } from './ui-events.ts';
27
- export interface ClaudeUiMapperState {
27
+ import { type ForkedCommandState } from './claude-forked-command.ts';
28
+ export interface ClaudeUiMapperState extends ForkedCommandState {
28
29
  /** Used when `system/init` lacks `session_id` (the dry-run mock does). */
29
30
  readonly fallbackSessionId?: string | undefined;
30
31
  /** True once `system/init` produced `session.started`. */