@humwick/server 0.130.2 → 0.130.3

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 (570) hide show
  1. package/bundled/prompts/manifest.json +1 -0
  2. package/bundled/prompts/task.hydration.md +1 -1
  3. package/bundled/roles/builder.md +1 -1
  4. package/docs/guides/sub-coordinators.md +12 -5
  5. package/docs/guides/tools-coordination.md +1 -0
  6. package/docs/guides/workflows.md +16 -0
  7. package/docs/openapi.json +73 -4
  8. package/package.json +8 -7
  9. package/public/assets/{MessageBubble-BWLqMGKG.js → MessageBubble-Bq9kr21N.js} +2 -2
  10. package/public/assets/{PlanGraphPanel-3TlIQpjk.js → PlanGraphPanel-Dqiroy06.js} +2 -2
  11. package/public/assets/{TraceView-Wimm0Czv.js → TraceView-DYU962-H.js} +2 -2
  12. package/public/assets/{VaultDecisionCard-Bau_vNax.js → VaultDecisionCard-DhPfzioE.js} +2 -2
  13. package/public/assets/{activity-CrSurn-r.js → activity-DzCcQTee.js} +2 -2
  14. package/public/assets/{agent-lineage-CknAJKcb.js → agent-lineage-SgDt9i3T.js} +2 -2
  15. package/public/assets/agent-liveness-Bq-s73jW.js +2 -0
  16. package/public/assets/{agent-name-DKbiIhBo.js → agent-name-CcY3Aijy.js} +2 -2
  17. package/public/assets/{agent-profiles-DwF6EQ4R.js → agent-profiles-cxtRBn6O.js} +2 -2
  18. package/public/assets/{agent-project-badge-Diz4Sjjb.js → agent-project-badge-DGYbIhaI.js} +2 -2
  19. package/public/assets/{agent-tools-CRhpRQza.js → agent-tools-DHbftV0N.js} +2 -2
  20. package/public/assets/{agent-type-icon-LrUEU3lB.js → agent-type-icon-CY113sp-.js} +2 -2
  21. package/public/assets/{agents-B-v66C-4.js → agents-BPzY7IlQ.js} +2 -2
  22. package/public/assets/{analytics-BqCb-LKi.js → analytics-DENFPv_a.js} +2 -2
  23. package/public/assets/{artifact-viewer-kf4pGuAR.js → artifact-viewer-KRvSc7sl.js} +2 -2
  24. package/public/assets/{artifacts-DJevXcvg.js → artifacts-C9gSmL3s.js} +2 -2
  25. package/public/assets/{artifacts-D32zyw4Y.js → artifacts-DT-HkI5O.js} +2 -2
  26. package/public/assets/{automation-BpRajx_5.js → automation-BsmjQhKD.js} +2 -2
  27. package/public/assets/{backlog-D_UjTdzX.js → backlog-8NYH_62t.js} +2 -2
  28. package/public/assets/{busy-health-N3VEh4ao.js → busy-health-D3hwvYb4.js} +2 -2
  29. package/public/assets/{channels-9jopungq.js → channels-DCJ5WL7O.js} +2 -2
  30. package/public/assets/{chat-CSXrTB3C.js → chat-DAIl357U.js} +3 -3
  31. package/public/assets/{code-preview-p1NnmqK0.js → code-preview-CzrZfr9U.js} +2 -2
  32. package/public/assets/{connectors-CZdqlDNL.js → connectors-xTxtlyou.js} +2 -2
  33. package/public/assets/{cosmos-BgdsE4dG.js → cosmos-BpebFLK2.js} +2 -2
  34. package/public/assets/{crate-agent-30aXTKva.js → crate-agent-BHvI5wXC.js} +2 -2
  35. package/public/assets/{dependency-graph-B_jvw2GE.js → dependency-graph-DGT0o3wJ.js} +2 -2
  36. package/public/assets/{deploys-DoN6bAb5.js → deploys-hqWOHSHE.js} +2 -2
  37. package/public/assets/{display-BrKWFGJz.js → display-CDeH4I8T.js} +2 -2
  38. package/public/assets/{files-D6XEu8Ng.js → files-BTeGVmTg.js} +2 -2
  39. package/public/assets/{fleet-C7jQWbw2.js → fleet-DgXtNgCa.js} +2 -2
  40. package/public/assets/{fleet-metrics-BiDs3MLx.js → fleet-metrics-BHEt5yc_.js} +2 -2
  41. package/public/assets/{formatted-body-CQBwc1fb.js → formatted-body-MLtodyPp.js} +3 -3
  42. package/public/assets/{formatted-body-impl-DyG0WsQS.js → formatted-body-impl-CAe664Z8.js} +2 -2
  43. package/public/assets/{host-providers-dialog-DKaW31dN.js → host-providers-dialog-mapF4Fj9.js} +2 -2
  44. package/public/assets/{index-CRHep3M9.js → index-CqqgOI5R.js} +5 -5
  45. package/public/assets/{insights-CzrtkpOE.js → insights-DNyf7IzF.js} +2 -2
  46. package/public/assets/{integrations-aVsUmigt.js → integrations-DlYOHq7T.js} +2 -2
  47. package/public/assets/{issue-ref-chip-BnSlM_95.js → issue-ref-chip-CeWBNWn7.js} +2 -2
  48. package/public/assets/{log-viewer-qe7Ee47Z.js → log-viewer-Cib8nqdE.js} +2 -2
  49. package/public/assets/{maintenance-NfjqFZAk.js → maintenance-DSn1cPm7.js} +2 -2
  50. package/public/assets/{managed-agents-BiH0HgaE.js → managed-agents-C3CkM81m.js} +2 -2
  51. package/public/assets/{markdown-preview-BixaT3Xr.js → markdown-preview-W4VQQPAv.js} +3 -3
  52. package/public/assets/{markdown-preview-impl-DNGlWIS3.js → markdown-preview-impl-CMsTdhjq.js} +2 -2
  53. package/public/assets/{memory-DNsCl6UX.js → memory-BV17qtO4.js} +2 -2
  54. package/public/assets/{messages-DopU1L1X.js → messages-Bm_1AqSA.js} +2 -2
  55. package/public/assets/{orchestrators-Cq7ckLQT.js → orchestrators-Dg-vfP09.js} +2 -2
  56. package/public/assets/{overview-C1DCTzzV.js → overview-DcYCrvlr.js} +2 -2
  57. package/public/assets/{pairs-DE_m6rrE.js → pairs-8o9nuG3V.js} +2 -2
  58. package/public/assets/{profile-icon-B3rfh77F.js → profile-icon-BsRyBMea.js} +2 -2
  59. package/public/assets/{project-profile-instructions-DQWZE0kA.js → project-profile-instructions-DETKFn_E.js} +2 -2
  60. package/public/assets/{projects-Br2Bd2h1.js → projects-M_m6AHws.js} +2 -2
  61. package/public/assets/{prompt-settings-BKvFsvGD.js → prompt-settings-C_mNCgeL.js} +2 -2
  62. package/public/assets/provider-display-BEeLXC_D.js +2 -0
  63. package/public/assets/{registry-Cw38_6gW.js → registry-DDHHHE5N.js} +2 -2
  64. package/public/assets/run-card-Dt4I4jaP.js +2 -0
  65. package/public/assets/{secrets-DxI-vzSq.js → secrets-BkVwxI5O.js} +2 -2
  66. package/public/assets/{service-access-settings-D9s_VJbd.js → service-access-settings-Crq-6a-B.js} +2 -2
  67. package/public/assets/{settings-CKZTVGIx.js → settings-CYcavMFu.js} +2 -2
  68. package/public/assets/shipping-H6gzEeZB.js +2 -0
  69. package/public/assets/{stats-DyUBKyWI.js → stats-BJVeWkpV.js} +2 -2
  70. package/public/assets/{status-dot-DYqlEUhJ.js → status-dot-BcHyw1Vw.js} +2 -2
  71. package/public/assets/store-DKPDIZBe.js +9 -0
  72. package/public/assets/{tasks-Bh7Chr4-.js → tasks-qJjlQPpx.js} +2 -2
  73. package/public/assets/{teams-bowI7qVY.js → teams-Cd5Sk1uX.js} +2 -2
  74. package/public/assets/{terminal-viewer-BgVLHdsU.js → terminal-viewer-CpY5_m7W.js} +3 -3
  75. package/public/assets/{terminal-viewer-impl-Dz22UPy6.js → terminal-viewer-impl-DI_2llFR.js} +2 -2
  76. package/public/assets/{use-agent-terminal-DSQQ-iY7.js → use-agent-terminal-0yJA_buM.js} +2 -2
  77. package/public/assets/{use-decisions-samMQhQf.js → use-decisions-uJXHf34W.js} +2 -2
  78. package/public/assets/{use-project-list-59LheVP7.js → use-project-list-CpWl6eHQ.js} +2 -2
  79. package/public/assets/{use-selectors-BZa25xEB.js → use-selectors-BdxBW8mL.js} +2 -2
  80. package/public/assets/{user-avatar-DHxlvUvV.js → user-avatar-3IndfpOc.js} +2 -2
  81. package/public/assets/{versioned-prompt-editor-BmED5DnJ.js → versioned-prompt-editor-CIVg7XB1.js} +2 -2
  82. package/public/assets/{work-queue-CSvpuNLz.js → work-queue-B9rnLwHZ.js} +2 -2
  83. package/public/assets/{workflow-marker-DAZcj5qt.js → workflow-marker-X8wxyhzC.js} +2 -2
  84. package/public/assets/{workflows-DdmxRSyg.js → workflows-o5YyMFW7.js} +2 -2
  85. package/public/assets/{workspaces-BxeKfVuF.js → workspaces-CzEGoAng.js} +2 -2
  86. package/public/cosmos.html +4 -4
  87. package/public/index.html +28 -28
  88. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  89. package/runner/src/adapters/claude-headless.ts +1 -1
  90. package/runner/src/adapters/claude-launch-exit.ts +26 -0
  91. package/runner/src/adapters/claude-session-probe.ts +1 -1
  92. package/runner/src/adapters/claude-tmux.ts +38 -10
  93. package/runner/src/adapters/claude.ts +28 -75
  94. package/runner/src/adapters/provider-quota-harvest.ts +20 -71
  95. package/runner/src/agent-runner/lifecycle-milestones.ts +2 -2
  96. package/runner/src/agent-runner/liveness-exchange.ts +104 -0
  97. package/runner/src/claude-system-prompt.ts +49 -0
  98. package/runner/src/launch-assembly.ts +14 -10
  99. package/runner/src/profile-home.ts +1 -1
  100. package/runner/src/project-instructions.ts +2 -2
  101. package/runner/src/provider-command.ts +18 -0
  102. package/runner/src/provider-setup.ts +2 -1
  103. package/runner/src/runner-core.ts +14 -15
  104. package/runner/src/runner-helpers.ts +0 -8
  105. package/runner/src/session-scratch.ts +6 -2
  106. package/runner/test-support/provisioning-context.ts +4 -2
  107. package/runner/test-support/runner-harness.ts +2 -1
  108. package/scripts/steward-policy-cleanup.ts +2 -2
  109. package/src/agent-authz.ts +2 -2
  110. package/src/agent-drive-arbiter.ts +3 -8
  111. package/src/agent-exit-cleanup-async.ts +2 -2
  112. package/src/agent-exit-cleanup.ts +23 -19
  113. package/src/agent-lifecycle-events.ts +112 -85
  114. package/src/agent-ref.ts +3 -2
  115. package/src/agent-status-events.ts +43 -14
  116. package/src/auth/password.ts +4 -3
  117. package/src/auth/session-refresh.ts +1 -1
  118. package/src/auth/session.test-fixture.ts +2 -2
  119. package/src/auth/session.ts +7 -7
  120. package/src/automations/crud.ts +8 -81
  121. package/src/automations/dispatch.ts +33 -58
  122. package/src/automations/index.ts +1 -1
  123. package/src/automations/persistence.ts +65 -0
  124. package/src/automations/precheck.ts +18 -16
  125. package/src/automations/read-async.ts +11 -0
  126. package/src/automations/reconcile.ts +30 -39
  127. package/src/automations/storage.ts +33 -10
  128. package/src/automations/write-async.ts +33 -0
  129. package/src/branch-land-notice.ts +3 -3
  130. package/src/branch-landed.ts +25 -23
  131. package/src/bus.ts +21 -19
  132. package/src/cd-deploy-notify.ts +2 -2
  133. package/src/ci/notifications.ts +4 -4
  134. package/src/ci/root-missing.ts +3 -3
  135. package/src/ci/transition-notify.ts +5 -5
  136. package/src/claude-app/oauth-http.ts +3 -3
  137. package/src/cli/workflow.ts +12 -3
  138. package/src/commands-db.ts +4 -4
  139. package/src/commands-write.ts +8 -0
  140. package/src/compaction-watch.ts +10 -8
  141. package/src/config-store-write.ts +2 -2
  142. package/src/config.ts +4 -11
  143. package/src/connectors.ts +10 -8
  144. package/src/context-advisory.ts +22 -21
  145. package/src/db/agent-action-write.ts +36 -0
  146. package/src/db/agent-control-async.ts +9 -0
  147. package/src/db/agent-control-write.ts +49 -0
  148. package/src/db/agent-effort-observe.ts +22 -0
  149. package/src/db/agent-meta.ts +14 -3
  150. package/src/db/agents-async.ts +8 -5
  151. package/src/db/agents.ts +15 -12
  152. package/src/db/auth-identities.ts +2 -2
  153. package/src/db/automation-read-ops.ts +11 -0
  154. package/src/db/automation-write-ops.ts +46 -0
  155. package/src/db/blackboard.ts +2 -2
  156. package/src/db/browser-session-write.ts +32 -0
  157. package/src/db/bus-outbox-write-ops.ts +3 -1
  158. package/src/db/checkout-refresh-schema.ts +47 -0
  159. package/src/db/checkout-refresh.ts +5 -5
  160. package/src/db/command-agent-profile-backfill.ts +39 -0
  161. package/src/db/command-agent-profiles.ts +5 -1
  162. package/src/db/command-retention.ts +126 -0
  163. package/src/db/commands-planner-stats.test-fixture.ts +8 -0
  164. package/src/db/commands-read-ops.ts +16 -0
  165. package/src/db/connection.ts +1 -182
  166. package/src/db/context-carry-write.ts +74 -0
  167. package/src/db/continuations.ts +4 -4
  168. package/src/db/db-error-registry.ts +12 -0
  169. package/src/db/gateway.ts +26 -133
  170. package/src/db/history-retention-ops.ts +13 -0
  171. package/src/db/inbox-async.ts +2 -2
  172. package/src/db/inbox-read-ops.ts +1 -1
  173. package/src/db/inbox.ts +9 -3
  174. package/src/db/issue-associations.ts +2 -2
  175. package/src/db/issue-refs-async.ts +4 -1
  176. package/src/db/issue-refs-read-ops.ts +6 -0
  177. package/src/db/issue-refs.ts +8 -8
  178. package/src/db/kernel-event-log-schema.ts +2 -0
  179. package/src/db/land-boundaries.ts +51 -5
  180. package/src/db/land-gate-attestations.ts +2 -2
  181. package/src/db/landing-receipts.ts +2 -2
  182. package/src/db/lifecycle-context-write.ts +5 -0
  183. package/src/db/lifecycle-tail-async.ts +76 -0
  184. package/src/db/lifecycle-tail-write-ops.ts +62 -0
  185. package/src/db/lifecycle-write-window.ts +2 -1
  186. package/src/db/lineage-pair-dedupe-sql.ts +3 -3
  187. package/src/db/main-connection-mode.ts +11 -0
  188. package/src/db/main-connection-writes.ts +20 -2
  189. package/src/db/maintenance-job-runs-async.ts +2 -2
  190. package/src/db/maintenance-job-write-ops.ts +1 -1
  191. package/src/db/maintenance-pauses.ts +2 -2
  192. package/src/db/message-send.ts +4 -0
  193. package/src/db/messages.ts +31 -25
  194. package/src/db/migrations.ts +18 -1
  195. package/src/db/notification-write-ops.ts +19 -0
  196. package/src/db/operator-answer-write.ts +19 -0
  197. package/src/db/orchestrators.ts +10 -4
  198. package/src/db/pairs-async.ts +22 -1
  199. package/src/db/pairs-write-ops.ts +8 -3
  200. package/src/db/pairs.ts +41 -48
  201. package/src/db/plan-dispatch-schema.ts +5 -1
  202. package/src/db/plan-ready-notices.ts +43 -0
  203. package/src/db/plan-tools-include-migration.ts +36 -0
  204. package/src/db/plans-write-ops.ts +2 -0
  205. package/src/db/presence-buffer.ts +5 -0
  206. package/src/db/presence-loop.ts +18 -23
  207. package/src/db/presence-write.ts +0 -6
  208. package/src/db/project-entries-async.ts +14 -0
  209. package/src/db/project-entries-read-ops.ts +5 -1
  210. package/src/db/project-entries-write-ops.ts +8 -0
  211. package/src/db/project-entries.ts +15 -12
  212. package/src/db/project-journal.ts +2 -2
  213. package/src/db/project-trust-approvals.ts +2 -2
  214. package/src/db/prompt-templates.ts +4 -4
  215. package/src/db/read-op-marshaling-fixtures.ts +18 -0
  216. package/src/db/read-ops.ts +4 -0
  217. package/src/db/retention.ts +13 -2
  218. package/src/db/review-publish-write.ts +8 -0
  219. package/src/db/runtime-admin-async.ts +19 -0
  220. package/src/db/runtime-admin-write-ops.ts +36 -0
  221. package/src/db/runtime-tail-async.ts +288 -0
  222. package/src/db/runtime-tail-write-ops.ts +97 -0
  223. package/src/db/schema.ts +4 -1
  224. package/src/db/spawn-budget.ts +5 -0
  225. package/src/db/spawn-delegation.ts +1 -11
  226. package/src/db/sql-audit-indexes.ts +3 -0
  227. package/src/db/stats-async.ts +5 -3
  228. package/src/db/task-entity.ts +5 -4
  229. package/src/db/team-claim-policy.ts +60 -0
  230. package/src/db/teams-async.ts +4 -0
  231. package/src/db/teams-write-ops.ts +4 -0
  232. package/src/db/terminal-events.ts +15 -0
  233. package/src/db/timer-cutover-bodies.ts +292 -0
  234. package/src/db/timer-cutover-core.ts +37 -278
  235. package/src/db/timer-cutover-state.ts +40 -0
  236. package/src/db/timer-cutover-write-ops.ts +1 -40
  237. package/src/db/token-db-write-ops.ts +2 -0
  238. package/src/db/token-standing-async.ts +12 -0
  239. package/src/db/token-standing.ts +6 -9
  240. package/src/db/token-usage-retention.ts +33 -0
  241. package/src/db/token-usage-write-ops.ts +1 -1
  242. package/src/db/token-usage.ts +4 -1
  243. package/src/db/user-invites-async.ts +13 -0
  244. package/src/db/user-invites.ts +3 -3
  245. package/src/db/users.ts +14 -6
  246. package/src/db/workspaces.ts +8 -5
  247. package/src/db/write-ops.ts +31 -12
  248. package/src/db/writer-fault-seam.ts +2 -9
  249. package/src/db/writer-fault-test-ops.ts +18 -0
  250. package/src/db/writer-gateway.ts +42 -46
  251. package/src/dev.ts +8 -3
  252. package/src/event-loop-lag.ts +4 -2
  253. package/src/event-loop-yield.ts +2 -2
  254. package/src/events.ts +10 -8
  255. package/src/host-provider-store.ts +5 -4
  256. package/src/hub-metrics-report.ts +5 -1
  257. package/src/hub-metrics.ts +38 -18
  258. package/src/injection-sweep-pacing.ts +6 -8
  259. package/src/land-gate-notifications.ts +11 -10
  260. package/src/land-gate-queue-progress.ts +3 -3
  261. package/src/land-settle-dispatch.ts +52 -92
  262. package/src/lifecycle-context-pressure.ts +11 -10
  263. package/src/lifecycle-manager.ts +104 -98
  264. package/src/maintenance/breaker.ts +18 -16
  265. package/src/maintenance/checkout-refresh.ts +18 -1
  266. package/src/maintenance/critical-job-watchdog.ts +3 -3
  267. package/src/maintenance/events.ts +3 -3
  268. package/src/maintenance/history-retention-job.ts +30 -0
  269. package/src/maintenance/jobs.ts +29 -67
  270. package/src/maintenance/long-running-work.ts +3 -1
  271. package/src/maintenance/offline-agent-prune-job.ts +28 -0
  272. package/src/maintenance/orphaned-sessions.ts +5 -4
  273. package/src/maintenance/pauses.ts +4 -10
  274. package/src/maintenance/plan-ready-notice-job.ts +71 -0
  275. package/src/maintenance/scheduler.ts +18 -13
  276. package/src/maintenance/stalled-delivery-pager.ts +4 -4
  277. package/src/maintenance/teams.ts +19 -30
  278. package/src/maintenance/workspaces.ts +17 -27
  279. package/src/managed-policy-escalation.ts +7 -7
  280. package/src/managed-policy.ts +3 -3
  281. package/src/managed-provider-gate.ts +5 -4
  282. package/src/managed-spawn-reservation.ts +5 -4
  283. package/src/mcp/index.ts +8 -8
  284. package/src/mcp/output-descriptions.ts +1 -1
  285. package/src/mcp/presentation.ts +2 -1
  286. package/src/mcp/runtime-output.ts +6 -1
  287. package/src/mcp/self-care-visibility.ts +2 -2
  288. package/src/mcp/spawn-targets-matrix.ts +10 -1
  289. package/src/mcp/tool-groups.ts +3 -2
  290. package/src/mcp/tool-roles.ts +81 -0
  291. package/src/mcp/tools-workspace.ts +1 -1
  292. package/src/mcp-blackboard-tools.ts +6 -5
  293. package/src/mcp-decision-tools.ts +7 -7
  294. package/src/mcp-egress-tools.ts +10 -9
  295. package/src/mcp-issue-activity-tools.ts +2 -2
  296. package/src/mcp-issue-association-tools.ts +4 -4
  297. package/src/mcp-issue-ref-tools.ts +3 -3
  298. package/src/mcp-merge-tools.ts +5 -5
  299. package/src/mcp-notification-subscription-tools.ts +14 -15
  300. package/src/mcp-output-levels.test-fixture.ts +1 -1
  301. package/src/mcp-profile-trust-tools.ts +1 -1
  302. package/src/mcp-project-journal-tools.ts +4 -12
  303. package/src/mcp-project-tools.ts +17 -18
  304. package/src/mcp-routing-policy-tools.ts +3 -2
  305. package/src/mcp-team-tools.ts +6 -6
  306. package/src/mcp-workflow-tools.ts +5 -3
  307. package/src/memory-area-injection.ts +13 -12
  308. package/src/memory-boundary-capture.ts +6 -6
  309. package/src/memory-injection.ts +45 -43
  310. package/src/merge-pause-maintenance.ts +5 -4
  311. package/src/notification-router.ts +44 -17
  312. package/src/notify.ts +5 -5
  313. package/src/observed-reset-refresh.ts +4 -4
  314. package/src/operator-alarm.ts +2 -5
  315. package/src/project-ingest.ts +6 -6
  316. package/src/project-instructions.ts +8 -1
  317. package/src/project-trust.ts +12 -11
  318. package/src/prompt-resolver.ts +3 -3
  319. package/src/provider-quota-async.ts +5 -7
  320. package/src/provider-timeline-event.ts +4 -7
  321. package/src/quota-band-delivery.ts +2 -2
  322. package/src/recipe-runner.ts +4 -3
  323. package/src/retention-config-store.ts +4 -3
  324. package/src/reviewer-pipeline.ts +11 -10
  325. package/src/routes/_route.ts +4 -4
  326. package/src/routes/_shared.ts +13 -12
  327. package/src/routes/agent-effort.ts +5 -5
  328. package/src/routes/agent-heartbeat-quota.ts +23 -0
  329. package/src/routes/agent-keep.ts +1 -1
  330. package/src/routes/agent-reporting.ts +1 -1
  331. package/src/routes/agent-self-effort.ts +5 -5
  332. package/src/routes/agent-sessions.ts +24 -24
  333. package/src/routes/agents-spawn.ts +1 -1
  334. package/src/routes/agents.ts +17 -119
  335. package/src/routes/auth.ts +14 -15
  336. package/src/routes/authority-audit.ts +2 -2
  337. package/src/routes/automations.ts +6 -5
  338. package/src/routes/channel-binding-delete.ts +1 -1
  339. package/src/routes/channel-output.ts +3 -3
  340. package/src/routes/claude-api-budget.ts +5 -5
  341. package/src/routes/commands-listing.ts +1 -1
  342. package/src/routes/commands.ts +29 -27
  343. package/src/routes/context-resets.ts +2 -2
  344. package/src/routes/coordinator-teams.ts +1 -1
  345. package/src/routes/decisions.ts +2 -2
  346. package/src/routes/host-secret-files.ts +1 -1
  347. package/src/routes/hosts.ts +11 -11
  348. package/src/routes/inbox.ts +3 -2
  349. package/src/routes/index.ts +2 -1
  350. package/src/routes/integrations.ts +9 -7
  351. package/src/routes/issue-activity.ts +2 -2
  352. package/src/routes/issue-associations.ts +4 -4
  353. package/src/routes/issue-refs.ts +3 -3
  354. package/src/routes/kernel-timers-operator.ts +1 -1
  355. package/src/routes/memory.ts +1 -1
  356. package/src/routes/merges.ts +11 -11
  357. package/src/routes/messages.ts +23 -17
  358. package/src/routes/orchestrator-bootstrap.ts +1 -1
  359. package/src/routes/orchestrator-host-registration.ts +2 -0
  360. package/src/routes/orchestrator-host-utilization.ts +2 -2
  361. package/src/routes/orchestrator-proxy.ts +2 -2
  362. package/src/routes/orchestrator.ts +27 -18
  363. package/src/routes/pairs.ts +8 -8
  364. package/src/routes/project-profile-instructions.ts +1 -1
  365. package/src/routes/project-trust.ts +1 -1
  366. package/src/routes/projects.ts +16 -16
  367. package/src/routes/prompt-templates.ts +12 -12
  368. package/src/routes/provider-quotas.ts +10 -10
  369. package/src/routes/run-command.ts +1 -1
  370. package/src/routes/secrets-backup.ts +2 -2
  371. package/src/routes/secrets-import.ts +1 -1
  372. package/src/routes/secrets-vault.ts +7 -7
  373. package/src/routes/settings.ts +1 -1
  374. package/src/routes/shipping.ts +9 -1
  375. package/src/routes/spawn-policy.ts +8 -7
  376. package/src/routes/sse.ts +2 -2
  377. package/src/routes/team-templates.ts +7 -7
  378. package/src/routes/teams.ts +10 -10
  379. package/src/routes/tokens.ts +18 -17
  380. package/src/routes/users.ts +24 -24
  381. package/src/routes/viewer-read.ts +3 -3
  382. package/src/routes/web-tool-calls.ts +4 -4
  383. package/src/routes/workflows.ts +2 -2
  384. package/src/routes/workspaces.ts +17 -16
  385. package/src/routing-policy-push.ts +6 -6
  386. package/src/runtime-grant.ts +17 -11
  387. package/src/runtime-tokens.ts +20 -28
  388. package/src/secrets-broker/config.ts +1 -1
  389. package/src/secrets-broker/service.ts +2 -2
  390. package/src/security.ts +3 -1
  391. package/src/self-resume-carry.ts +21 -110
  392. package/src/self-resume-supersede.ts +4 -3
  393. package/src/self-resume.ts +54 -66
  394. package/src/server-background.ts +1 -1
  395. package/src/server.ts +21 -22
  396. package/src/services/agent-action.ts +12 -31
  397. package/src/services/agent-effort.ts +7 -32
  398. package/src/services/agent-hang-watchdog-job.ts +2 -2
  399. package/src/services/agent-heartbeat.ts +166 -0
  400. package/src/services/agent-reporting.ts +1 -1
  401. package/src/services/browser-inventory.ts +3 -3
  402. package/src/services/browser-session-state.ts +3 -2
  403. package/src/services/browser-session.ts +21 -27
  404. package/src/services/bus-command-update.ts +9 -9
  405. package/src/services/checkout-refresh-state.ts +1 -0
  406. package/src/services/checkout-refresh.test-fixture.ts +3 -2
  407. package/src/services/command-host.ts +7 -2
  408. package/src/services/coordinator-digest.ts +3 -2
  409. package/src/services/dispatch-command.ts +12 -13
  410. package/src/services/effective-launch-driver.ts +14 -9
  411. package/src/services/host-changed-paths.test-fixture.ts +5 -6
  412. package/src/services/host-project-readiness.ts +2 -2
  413. package/src/services/host-providers.ts +1 -1
  414. package/src/services/host-utilization.ts +9 -9
  415. package/src/services/idle-agent-digest.ts +17 -12
  416. package/src/services/idle-epics.ts +4 -4
  417. package/src/services/interrupt-agent.ts +12 -9
  418. package/src/services/issue-activity.ts +3 -3
  419. package/src/services/issue-associations.ts +15 -18
  420. package/src/services/issue-lifecycle-comments.ts +3 -2
  421. package/src/services/issue-lifecycle.ts +14 -13
  422. package/src/services/issue-refs.ts +4 -5
  423. package/src/services/kernel-timers-cutover-chaos-worker.ts +1 -1
  424. package/src/services/kernel-timers-ingress-chaos-worker.ts +6 -1
  425. package/src/services/kernel-timers-ingress.ts +3 -3
  426. package/src/services/kernel-timers-message-authority-chaos-worker.ts +3 -10
  427. package/src/services/kernel-timers-operator-chaos-worker.ts +3 -2
  428. package/src/services/kernel-timers-outbox.ts +1 -1
  429. package/src/services/kernel-timers-stage10-operator.ts +1 -1
  430. package/src/services/kernel-timers.ts +4 -3
  431. package/src/services/land-gate-placement.ts +11 -2
  432. package/src/services/land-issue-relations.ts +5 -4
  433. package/src/services/land-restart-retry.ts +7 -6
  434. package/src/services/landed-ancestry.ts +6 -5
  435. package/src/services/legacy-landing-host.ts +4 -1
  436. package/src/services/legacy-landing-recovery.ts +8 -6
  437. package/src/services/managed-running.ts +17 -17
  438. package/src/services/memory-areas.ts +3 -3
  439. package/src/services/merge-pause.ts +9 -15
  440. package/src/services/operator-decisions.ts +37 -41
  441. package/src/services/orchestrator-registration-recovery.ts +6 -2
  442. package/src/services/orchestrator-upgrade.ts +14 -12
  443. package/src/services/permission-decision.ts +4 -3
  444. package/src/services/plan-ci-notice.ts +1 -1
  445. package/src/services/plan-conformance.ts +4 -4
  446. package/src/services/plan-dispatch-policy.ts +10 -3
  447. package/src/services/plan-dispatch.ts +35 -14
  448. package/src/services/plan-graph.ts +39 -261
  449. package/src/services/plan-import.ts +1 -1
  450. package/src/services/plan-live-bindings.ts +8 -37
  451. package/src/services/plan-task-create.ts +1 -1
  452. package/src/services/plan-terminal-refs.ts +2 -12
  453. package/src/services/plan-wake-digest.ts +8 -3
  454. package/src/services/profile-trust.ts +2 -2
  455. package/src/services/project.ts +11 -10
  456. package/src/services/prompt-templates.ts +6 -5
  457. package/src/services/provider-hold-nudge.ts +9 -9
  458. package/src/services/provider-hold-record.ts +13 -12
  459. package/src/services/provider-state-audit.ts +19 -18
  460. package/src/services/provisioning-harness/driver.ts +1 -1
  461. package/src/services/provisioning-harness/fixture-matrix.ts +3 -3
  462. package/src/services/provisioning-harness/lifecycle.ts +24 -22
  463. package/src/services/provisioning-harness/prepare.ts +16 -17
  464. package/src/services/rate-limit-resume.ts +10 -9
  465. package/src/services/red-main-auto-revert.ts +7 -5
  466. package/src/services/red-main-controller-deps.ts +20 -3
  467. package/src/services/red-main-incident.ts +3 -1
  468. package/src/services/red-main-quarantine.ts +2 -3
  469. package/src/services/register-agent.ts +22 -22
  470. package/src/services/restart-project-role.ts +1 -1
  471. package/src/services/restart-spawn.ts +17 -16
  472. package/src/services/review-publish.ts +7 -24
  473. package/src/services/review-ref-reconcile.ts +29 -38
  474. package/src/services/runtime-dependency-alert.ts +27 -0
  475. package/src/services/scheduler-command.ts +11 -9
  476. package/src/services/scheduler.ts +5 -5
  477. package/src/services/self-effort-grant.ts +5 -25
  478. package/src/services/send-message.ts +16 -33
  479. package/src/services/shutdown-agent.ts +17 -14
  480. package/src/services/spawn-agent.ts +12 -41
  481. package/src/services/spawn-chain-inspector.ts +1 -1
  482. package/src/services/spawn-cwd-placement.ts +21 -5
  483. package/src/services/spawn-issue-activity.ts +8 -6
  484. package/src/services/spawn-launch.ts +17 -1
  485. package/src/services/spawn-loss-escalation.ts +1 -1
  486. package/src/services/spawn-registration-watchdog.ts +2 -2
  487. package/src/services/spawn-repo-probe.ts +7 -5
  488. package/src/services/spawn-tree-cleanup.ts +7 -8
  489. package/src/services/steward-reaper.ts +4 -4
  490. package/src/services/task-context-hydration.ts +25 -1
  491. package/src/services/task-delivery.ts +20 -34
  492. package/src/services/task-entity.ts +40 -203
  493. package/src/services/task-issue-link.ts +13 -20
  494. package/src/services/task-issue-weave.ts +12 -11
  495. package/src/services/task-lifecycle.ts +27 -31
  496. package/src/services/task-repo-cwd.ts +37 -0
  497. package/src/services/task-review-hold.ts +4 -17
  498. package/src/services/task-semantic-events.ts +13 -11
  499. package/src/services/task-state-reconcile.ts +3 -4
  500. package/src/services/task-validation.ts +2 -2
  501. package/src/services/team-templates.ts +5 -5
  502. package/src/services/team.ts +31 -98
  503. package/src/services/terminal-provider-exit.ts +6 -5
  504. package/src/services/timer-message-fire-chaos-worker.ts +7 -3
  505. package/src/services/timer-message-fire-outbox.ts +1 -1
  506. package/src/services/transient-agent-reaper.ts +22 -19
  507. package/src/services/turn-reconcile-audit.ts +9 -9
  508. package/src/services/user-onboarding.ts +8 -6
  509. package/src/services/user-profile.ts +6 -9
  510. package/src/services/work-finality.ts +16 -4
  511. package/src/services/workflow-auto-start.ts +2 -1
  512. package/src/services/workflow-caller.ts +61 -4
  513. package/src/services/workflow-child-proof-worker.ts +1 -1
  514. package/src/services/workflow-control-proof-worker.ts +1 -1
  515. package/src/services/workflow-coordinator.ts +8 -2
  516. package/src/services/workflow-decisions.ts +5 -5
  517. package/src/services/workflow-deferred-cleanup.ts +1 -1
  518. package/src/services/workflow-effect-driver.ts +42 -19
  519. package/src/services/workflow-effects.ts +41 -27
  520. package/src/services/workflow-pins.ts +7 -4
  521. package/src/services/workflow-reconcile.ts +1 -0
  522. package/src/services/workflow-resume-pins.ts +3 -3
  523. package/src/services/workflow-routing-defaults.ts +18 -0
  524. package/src/services/workflow-run-view.ts +4 -3
  525. package/src/services/workflow-run.test-fixture.ts +1 -1
  526. package/src/services/workflow-runs.ts +34 -22
  527. package/src/services/workflow-supervisor-state.ts +21 -1
  528. package/src/services/workflow-supervisor.ts +4 -3
  529. package/src/services/workspace-recovery.ts +4 -3
  530. package/src/spawn-admission.ts +10 -2
  531. package/src/spawn-placement.ts +27 -9
  532. package/src/spawn-targets.ts +8 -8
  533. package/src/sse-agent-status.ts +15 -6
  534. package/src/sse.ts +49 -24
  535. package/src/startup-context-injection.ts +61 -57
  536. package/src/steward-handoff.ts +4 -3
  537. package/src/steward-policy-cleanup.ts +9 -8
  538. package/src/steward.ts +2 -2
  539. package/src/task-dispatch-live.ts +5 -2
  540. package/src/task-dispatcher.ts +2 -2
  541. package/src/token-db.ts +2 -2
  542. package/src/token-usage-async.ts +2 -4
  543. package/src/user-awaiting-reply.ts +5 -5
  544. package/src/workspace-actions.ts +24 -29
  545. package/src/workspace-auto-merge.ts +14 -12
  546. package/src/workspace-changed-paths-client.ts +16 -5
  547. package/src/workspace-cleanup-stale.ts +30 -7
  548. package/src/workspace-command-settle.ts +24 -16
  549. package/src/workspace-config.ts +1 -1
  550. package/src/workspace-conflict-resolver.ts +9 -7
  551. package/src/workspace-dead-owner-recovery.ts +5 -4
  552. package/src/workspace-escalation.ts +12 -11
  553. package/src/workspace-human-escalation.ts +3 -3
  554. package/src/workspace-land-gate-watchdog.ts +3 -3
  555. package/src/workspace-land-refusal.ts +20 -0
  556. package/src/workspace-land-stopped.ts +1 -0
  557. package/src/workspace-merge.ts +10 -26
  558. package/src/workspace-nothing-to-land-notice.ts +2 -2
  559. package/src/workspace-orphans.ts +18 -37
  560. package/src/workspace-pr-completion.ts +10 -8
  561. package/src/workspace-rekey.ts +3 -3
  562. package/src/workspace-steward-failure.ts +2 -2
  563. package/src/workspace-steward-wake.ts +2 -2
  564. package/public/assets/agent-liveness-CaNwK0Zf.js +0 -2
  565. package/public/assets/provider-display-DsuWMvVL.js +0 -2
  566. package/public/assets/run-card-CpKqRbhg.js +0 -2
  567. package/public/assets/shipping-B9YtnwtG.js +0 -2
  568. package/public/assets/store-DcClXLH0.js +0 -9
  569. package/runner/src/agent-runner/http-liveness.ts +0 -85
  570. package/src/db/on-loop-write-transaction.ts +0 -34
@@ -103,6 +103,7 @@
103
103
  "intent",
104
104
  "context",
105
105
  "doneWhen",
106
+ "afterLand",
106
107
  "issues",
107
108
  "decisions",
108
109
  "history",
@@ -9,7 +9,7 @@ Intent (Task data):
9
9
  {{context}}
10
10
  Acceptance — done when:
11
11
  {{doneWhen}}
12
-
12
+ {{afterLand}}
13
13
  Linked issue spec (resolved server-side once — do NOT re-read GitHub):
14
14
  {{issues}}
15
15
 
@@ -11,7 +11,7 @@ workspace: { mode: isolated }
11
11
  You implement the Task you are bound to and deliver it. The `build-review` workflow runs your delivery through a fresh reviewer; you do not choose when it lands.
12
12
 
13
13
  1. Read the Task and the repo's agent instructions (`CLAUDE.md`, `AGENTS.md` or `CONTRIBUTING.md`, whichever exist), and follow its conventions. Meet the Done-when exactly.
14
- 2. Implement and prove the Task, then deliver `complete` per Delivery.
14
+ 2. Implement and prove the Task, then deliver `complete` per Delivery. Post-deploy, live-check and independent-proof criteria in the Done-when are checked after land by QA/onDeploy; they never block delivery. Deliver `complete` when code, tests and the delivery gate pass.
15
15
  3. A Relay message starting "returned NO-GO" carries the reviewer's findings for the head you delivered. Fix them and deliver `complete` again on the same Task; a fresh reviewer checks the new head. If a finding is wrong or conflicts with the Done-when, say so in the delivery `summary` and fix what is valid. Do not argue by message.
16
16
  4. Need a decision, a dependency or access you do not have: deliver `blocked` with `blockedBy`. Task cannot be done as written: deliver `failed` with the reason. Either one stops the workflow and goes to the coordinator with the history.
17
17
 
@@ -79,11 +79,18 @@ notice. Read or change the budget with `GET` or `PATCH
79
79
 
80
80
  ## Workflows, decisions and project MCP
81
81
 
82
- With `HUMWICK_CHILD_WORKFLOWS=1`, a sub-coordinator can start workflows on
83
- Tasks it owns, creates or coordinates. Its profile's `workflows` policy defaults
84
- to three concurrent runs and ten live step agents per run. Workflow agents also
85
- consume the same delegated subtree and root quotas as direct workers. The hub
86
- flag stays off until operations enables it.
82
+ With `HUMWICK_CHILD_WORKFLOWS=1`, a sub-coordinator owns the workflow runs of a
83
+ Task it created, a Task assigned to it (`relay_task_assign_agent`), or a Task in
84
+ its private team. It can start, read (`relay_workflow_get`), resume, pause and
85
+ cancel those runs, including a run the root started before it handed the Task
86
+ down. Run escalations, results and coordinator decisions go to the
87
+ sub-coordinator first. The root gets them only when the sub-coordinator is gone.
88
+ A run on such a Task is the sub-coordinator's run, even when the root starts it:
89
+ its step agents spawn under the sub-coordinator and count against its quota. The
90
+ root coordinator keeps full control of these runs. Its profile's `workflows`
91
+ policy defaults to three concurrent runs and ten live step agents per run.
92
+ Workflow agents also consume the same delegated subtree and root quotas as
93
+ direct workers. The hub flag stays off until operations enables it.
87
94
 
88
95
  Use `relay_decision` to file operator questions; answers return to the private
89
96
  team's coordinator seat. A project role may `extends: sub-coordinator` and select
@@ -208,6 +208,7 @@ Run the repo's declared workflow `.agent-relay/workflows/<workflow>.yaml` on a T
208
208
 
209
209
  - `workflow`: Workflow name: .agent-relay/workflows/<workflow>.yaml on the default branch, else Relay's bundled one (build-review).
210
210
  - `taskId`: Task id (TNNNN accepted).
211
+ - `cwd`: Checkout to read the workflow and its roles from. Omit it to resolve the Task repo using the caller’s checkout, recorded worktree or project team; pass it explicitly when several roots remain ambiguous.
211
212
  - `pins`: Per-step pins { <step>: { provider?, model?, effort?, orchestratorId?, profile? } }. Each field set wins over the YAML step's same field, which wins over the role file, which wins over the Task's dispatch policy. A provider pin wins over the step's crossProvider. A model pin needs its provider (here or in the YAML). `profile` replaces the base profile the step's role extends (e.g. worker-gui for a UI builder). An invalid pin for its host fails the call before anything spawns.
212
213
  - `budget`: Observed token cap for this run's step agents and descendants. Ignored when the server sets HUMWICK_DELEGATION_TOKEN_BUDGETS=0; at the cap new spawns are refused and the owner is notified once. Running work can finish.
213
214
  - `inputs`: Declared workflow application inputs.
@@ -70,6 +70,22 @@ Use `pins` on `relay_workflow_start` when a particular step needs specific setti
70
70
  }
71
71
  ```
72
72
 
73
+ The run owner or a Task coordinator can also change a later step's pins while
74
+ the run is running or paused. Call `relay_workflow_resume` with only `runId`,
75
+ `pins` and an optional `note`:
76
+
77
+ ```json
78
+ {"runId":"<run-id>","pins":{"review":{"provider":"codex","model":"sol","effort":"high","orchestratorId":"wbox-1","profile":"worker"}},"note":"Move review to wbox-1"}
79
+ ```
80
+
81
+ This preserves the current step, wait and pause. Each named step must never have
82
+ started; a request naming a started step refuses without changing any pins.
83
+ Each named pin replaces that step's previous call pin; `{}` restores its workflow
84
+ defaults. `relay_workflow_get` with `verbose:true` shows the actor, time, note and
85
+ new pins in `pinChanges`. The dashboard's Workflows page has **Change [step] pins**
86
+ controls for future steps and a **Pin history** ledger. The CLI equivalent is
87
+ `humwick workflow resume <run-id> --pins '{"review":{"effort":"low"}}'`.
88
+
73
89
  Keys are step names, such as `build` and `review`. A pin can set `provider`, `model`,
74
90
  `effort`, `orchestratorId` (the host id), or `profile` (the role's base profile). A
75
91
  model pin needs a provider, either in the pin or the step definition. Pins override
package/docs/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Humwick API",
5
- "version": "0.130.2",
5
+ "version": "0.130.3",
6
6
  "description": "Real-time message bus for inter-agent communication. Agent-first: this spec is designed for machine consumption — agents can self-discover the full API surface via GET /api/spec.",
7
7
  "license": {
8
8
  "name": "MIT",
@@ -9163,7 +9163,7 @@
9163
9163
  "tags": [
9164
9164
  "Other"
9165
9165
  ],
9166
- "description": "Returns the global workspace provisioning config `{ symlinkPaths: string[] }` — untracked files/filename patterns symlinked from the main checkout into each isolated worktree (the dashboard \"Workspace\" spawn option). Defaults seed `.claude-rig` only (`AGENTS.md` is tracked); merged over defaults until set.",
9166
+ "description": "Returns the global workspace provisioning config `{ symlinkPaths: string[] }` — untracked files/filename patterns symlinked from the main checkout into each isolated worktree (the dashboard \"Workspace\" spawn option). No defaults (`AGENTS.md` is tracked); merged over defaults until set.",
9167
9167
  "responses": {
9168
9168
  "200": {
9169
9169
  "description": "Success",
@@ -18074,6 +18074,42 @@
18074
18074
  ]
18075
18075
  }
18076
18076
  },
18077
+ "/api/shipping/known-failures": {
18078
+ "get": {
18079
+ "operationId": "getKnownFailuresRoute",
18080
+ "summary": "Test failures already present on a repository's main",
18081
+ "tags": [
18082
+ "Other"
18083
+ ],
18084
+ "description": "The failing test cases recorded on each open red-main incident whose red land is in `remote`, with the incident id and red sha. A builder's delivery gate reports these apart and holds them out of runs whose diff does not touch the failing file; new failures still block. Requires agent:read.",
18085
+ "parameters": [
18086
+ {
18087
+ "name": "remote",
18088
+ "in": "query",
18089
+ "description": "GitHub `owner/repo`."
18090
+ }
18091
+ ],
18092
+ "responses": {
18093
+ "200": {
18094
+ "description": "Success",
18095
+ "content": {
18096
+ "application/json": {}
18097
+ }
18098
+ }
18099
+ },
18100
+ "security": [
18101
+ {
18102
+ "bearerAuth": []
18103
+ },
18104
+ {
18105
+ "tokenHeader": []
18106
+ },
18107
+ {
18108
+ "tokenQuery": []
18109
+ }
18110
+ ]
18111
+ }
18112
+ },
18077
18113
  "/api/gates/stats": {
18078
18114
  "get": {
18079
18115
  "operationId": "getGateStatsRoute",
@@ -18538,11 +18574,11 @@
18538
18574
  "/api/workflows/runs/{runId}/resume": {
18539
18575
  "post": {
18540
18576
  "operationId": "postWorkflowRunResumeRoute",
18541
- "summary": "Resume a workflow decision or retry one failed item",
18577
+ "summary": "Resume a workflow or update future step pins",
18542
18578
  "tags": [
18543
18579
  "Other"
18544
18580
  ],
18545
- "description": "Resume an escalated workflow or explicitly retry a failed for-each activation. For decision.answeredBy coordinator, pass decision: {action: answer, waitKey, answers} or {action: escalate, waitKey}, with optional note. Answers use the same typed approved IDs or choice as the operator card. Escalate files that card with the note in context. Only the run notice coordinator seat or an admin can respond; other agents receive 403. Cancellation invalidates both paths. Requires task:write; ordinary step resumes also require spawn authority unless admitted as a child caller.",
18581
+ "description": "Resume an escalated workflow or explicitly retry a failed for-each activation. For decision.answeredBy coordinator, pass decision: {action: answer, waitKey, answers} or {action: escalate, waitKey}, with optional note. Answers use the same typed approved IDs or choice as the operator card. Escalate files that card with the note in context. Only the run notice coordinator seat or an admin can respond; other agents receive 403. Cancellation invalidates both paths. Requires task:write; ordinary step resumes also require spawn authority unless admitted as a child caller. On a running or paused run, pins alone replaces each named not-yet-started step pin, without resuming, unpausing or changing its current wait. Pins support provider, model, effort, orchestratorId and profile; steps already started refuse atomically. The run owner or a Task coordinator can update pins. GET with verbose=true returns pinChanges with actor, timestamp, note and pins.",
18546
18582
  "parameters": [
18547
18583
  {
18548
18584
  "name": "runId",
@@ -18623,6 +18659,39 @@
18623
18659
  "additionalProperties": false
18624
18660
  }
18625
18661
  ]
18662
+ },
18663
+ "step": {
18664
+ "type": "string",
18665
+ "maxLength": 64
18666
+ },
18667
+ "pins": {
18668
+ "type": "object",
18669
+ "additionalProperties": {
18670
+ "type": "object",
18671
+ "additionalProperties": false,
18672
+ "properties": {
18673
+ "provider": {
18674
+ "type": "string",
18675
+ "maxLength": 200
18676
+ },
18677
+ "model": {
18678
+ "type": "string",
18679
+ "maxLength": 200
18680
+ },
18681
+ "effort": {
18682
+ "type": "string",
18683
+ "maxLength": 200
18684
+ },
18685
+ "orchestratorId": {
18686
+ "type": "string",
18687
+ "maxLength": 200
18688
+ },
18689
+ "profile": {
18690
+ "type": "string",
18691
+ "maxLength": 200
18692
+ }
18693
+ }
18694
+ }
18626
18695
  }
18627
18696
  }
18628
18697
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humwick/server",
3
- "version": "0.130.2",
3
+ "version": "0.130.3",
4
4
  "description": "Lightweight HTTP message relay for inter-agent communication across machines",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
@@ -84,11 +84,11 @@
84
84
  ],
85
85
  "dependencies": {
86
86
  "age-encryption": "0.3.1",
87
- "@humwick/channels-host": "0.130.2",
88
- "@humwick/kernel": "0.130.2",
89
- "@humwick/offload": "0.130.2",
90
- "@humwick/providers": "0.104.8",
91
- "@humwick/sdk": "0.2.137",
87
+ "@humwick/channels-host": "0.130.3",
88
+ "@humwick/kernel": "0.130.3",
89
+ "@humwick/offload": "0.130.3",
90
+ "@humwick/providers": "0.104.9",
91
+ "@humwick/sdk": "0.2.138",
92
92
  "ajv": "^8.20.0",
93
93
  "@modelcontextprotocol/sdk": "1.32.0",
94
94
  "express": "^5.2.1",
@@ -113,7 +113,8 @@
113
113
  "deploy:dashboard": "bun run scripts/deploy-dashboard.ts",
114
114
  "ci:land": "sh scripts/gate.sh bun run scripts/ci-land.ts",
115
115
  "ci:release": "sh scripts/gate.sh sh -c 'bun run build:dashboard:bundle && bun run build:claude-monitor:check && bun run lint:import-boundaries && bun run lint:provider-contract && bun run typecheck && bun run docs:api:check && AGENT_RELAY_RELEASE_TESTS=1 bun test --timeout 30000 --bail && bun --config=bunfig.integration.toml test --isolate --timeout 30000 --bail dashboard/src'",
116
- "ci": "bun run ci:land",
116
+ "ci:full": "sh scripts/gate.sh bun run scripts/ci-full.ts",
117
+ "ci": "bun run ci:full",
117
118
  "test": "sh scripts/gate.sh sh -c 'bun run test:guards && bun test --timeout 30000 --bail'",
118
119
  "steward:cleanup": "bun run scripts/steward-policy-cleanup.ts",
119
120
  "test:affected": "sh scripts/gate.sh bun run scripts/test-affected.ts",
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./react-dom-DSFxiC7T.js";import{Nt as a,jt as o,t as s}from"./store-DcClXLH0.js";import{O as c}from"./provider-display-DsuWMvVL.js";import{o as l}from"./artifacts-D32zyw4Y.js";import{F as u,J as d,S as f,_ as p,p as ee}from"./display-BrKWFGJz.js";import{n as m}from"./api-CIIVBtAV.js";import{n as h,t as g}from"./radio-Bn0_qc0G.js";import{t as _}from"./arrow-right-vFsRqG8V.js";import{D as v,G as y,I as te,N as ne,O as b,T as x,c as S,h as C,j as re,k as w,m as ie,n as T,p as E,v as D,w as O}from"./TraceView-Wimm0Czv.js";import{t as k}from"./brain-CagXMEKE.js";import{t as A}from"./chevron-right-iljytE0x.js";import{t as j}from"./circle-alert-CryagaZd.js";import{t as M}from"./file-text-CKuoMR2U.js";import{t as N}from"./git-merge-C7eIG425.js";import{t as P}from"./loader-circle-BfPd4kOD.js";import{t as ae}from"./plug-zap-V0wMDJ-G.js";import{t as oe}from"./smile-plus-q6EQBXHZ.js";import{t as F}from"./triangle-alert-BBNhfgMi.js";import{t as I}from"./agent-type-icon-LrUEU3lB.js";import{t as se}from"./volume-2-XrcRKD9Z.js";import{t as L}from"./zoom-in-Bs8Qv8VL.js";import{n as R,t as z}from"./task-chip-CYj0mpoL.js";import{t as B}from"./formatted-body-CQBwc1fb.js";import{t as ce}from"./user-avatar-DHxlvUvV.js";var V=e(n(),1),H=e(i(),1),U=`[data-testid="chat-scroller"]`,W=`data-anchor-step`,G=e=>({[W]:e}),K=90,q=15,J=[`wheel`,`touchstart`,`pointerdown`,`keydown`],Y=new Map;function X(e,t){return Y.set(e,t),()=>void Y.delete(e)}var Z=(e,t)=>e.getBoundingClientRect().top-t.getBoundingClientRect().top;function le(e,t){let n=e.getBoundingClientRect(),r=null,i=Array.from(e.querySelectorAll(`[${W}]`)).filter(e=>e.getAttribute(W)!==t).map(e=>({el:e,top:e.getBoundingClientRect().top,bottom:e.getBoundingClientRect().bottom})).sort((e,t)=>e.top-t.top),a=null;for(let e of i){if(e.bottom>n.top&&e.top<n.bottom){a=e;break}e.bottom<=n.top&&(!r||e.bottom>r.bottom)&&(r=e)}if(a??=r,!a)return null;let o=a.el;return{find:()=>o.isConnected?o:null,offset:a.top-n.top}}function ue(e){let t=e.getBoundingClientRect(),n=t.top+t.height/2,r=new Set;return Array.from(e.querySelectorAll(`[data-msg-id]`)).filter(e=>!r.has(e.dataset.msgId)&&!!r.add(e.dataset.msgId)).map(e=>{let r=e.getBoundingClientRect();return{id:e.dataset.msgId,offset:r.top-t.top,distance:Math.abs((r.top+r.bottom)/2-n)}}).sort((e,t)=>e.distance-t.distance)}function de(e,t,n){let r=()=>{let r=n.find();if(!r)return!1;let i=Z(r,e)-n.offset;return Math.abs(i)<=.5?!1:(t.nudge(i),!0)};r();let i=0,a=()=>{cancelAnimationFrame(i),t.pin(null);for(let t of J)e.removeEventListener(t,a)};for(let t of J)e.addEventListener(t,a,{passive:!0});let o=0,s=0,c=()=>{if(o=r()?0:o+1,!e.isConnected||!n.find()||o>=q||++s>=K)return a();i=requestAnimationFrame(c)};i=requestAnimationFrame(c)}function fe(e,t,n){let r=e.closest(U),i=r&&Y.get(r),a=r&&i&&r.dataset.scrollMode===`anchored`?le(r,t):null;(0,H.flushSync)(n),r&&i&&a&&de(r,i,a)}function pe(e){let t=Array.from(Y,([e,t])=>({scroller:e,owner:t,rows:e.dataset.scrollMode===`anchored`?ue(e):[]})).filter(({rows:e})=>e.length);for(let{owner:e,rows:n}of t)e.pin(n.map(({id:e})=>Number(e)));(0,H.flushSync)(e);for(let{scroller:e,owner:n,rows:r}of t){let t=t=>()=>e.querySelector(`[data-msg-id="${CSS.escape(t)}"]`),i=r.find(({id:e})=>t(e)());i?de(e,n,{find:t(i.id),offset:i.offset}):n.pin(null)}}var Q=r();function me(e){let t=new Set,n=(()=>{try{return window.localStorage.getItem(e)===`on`}catch{return!1}})(),r=()=>t.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,t=>{t.key===e&&(n=t.newValue===`on`,r())}),{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>n,toggle(){n=!n;try{window.localStorage.setItem(e,n?`on`:`off`)}catch{}r()}}}var he=me(`humwick:chat-hide-tools`),ge=me(`humwick:chat-hide-reasoning`);function _e(e){return[(0,V.useSyncExternalStore)(e.subscribe,e.get,()=>!1),e.toggle]}function ve(e){return e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./react-dom-DSFxiC7T.js";import{Nt as a,jt as o,t as s}from"./store-DKPDIZBe.js";import{O as c}from"./provider-display-BEeLXC_D.js";import{o as l}from"./artifacts-DT-HkI5O.js";import{F as u,J as d,S as f,_ as p,p as ee}from"./display-CDeH4I8T.js";import{n as m}from"./api-CIIVBtAV.js";import{n as h,t as g}from"./radio-Bn0_qc0G.js";import{t as _}from"./arrow-right-vFsRqG8V.js";import{D as v,G as y,I as te,N as ne,O as b,T as x,c as S,h as C,j as re,k as w,m as ie,n as T,p as E,v as D,w as O}from"./TraceView-DYU962-H.js";import{t as k}from"./brain-CagXMEKE.js";import{t as A}from"./chevron-right-iljytE0x.js";import{t as j}from"./circle-alert-CryagaZd.js";import{t as M}from"./file-text-CKuoMR2U.js";import{t as N}from"./git-merge-C7eIG425.js";import{t as P}from"./loader-circle-BfPd4kOD.js";import{t as ae}from"./plug-zap-V0wMDJ-G.js";import{t as oe}from"./smile-plus-q6EQBXHZ.js";import{t as F}from"./triangle-alert-BBNhfgMi.js";import{t as I}from"./agent-type-icon-CY113sp-.js";import{t as se}from"./volume-2-XrcRKD9Z.js";import{t as L}from"./zoom-in-Bs8Qv8VL.js";import{n as R,t as z}from"./task-chip-CYj0mpoL.js";import{t as B}from"./formatted-body-MLtodyPp.js";import{t as ce}from"./user-avatar-3IndfpOc.js";var V=e(n(),1),H=e(i(),1),U=`[data-testid="chat-scroller"]`,W=`data-anchor-step`,G=e=>({[W]:e}),K=90,q=15,J=[`wheel`,`touchstart`,`pointerdown`,`keydown`],Y=new Map;function X(e,t){return Y.set(e,t),()=>void Y.delete(e)}var Z=(e,t)=>e.getBoundingClientRect().top-t.getBoundingClientRect().top;function le(e,t){let n=e.getBoundingClientRect(),r=null,i=Array.from(e.querySelectorAll(`[${W}]`)).filter(e=>e.getAttribute(W)!==t).map(e=>({el:e,top:e.getBoundingClientRect().top,bottom:e.getBoundingClientRect().bottom})).sort((e,t)=>e.top-t.top),a=null;for(let e of i){if(e.bottom>n.top&&e.top<n.bottom){a=e;break}e.bottom<=n.top&&(!r||e.bottom>r.bottom)&&(r=e)}if(a??=r,!a)return null;let o=a.el;return{find:()=>o.isConnected?o:null,offset:a.top-n.top}}function ue(e){let t=e.getBoundingClientRect(),n=t.top+t.height/2,r=new Set;return Array.from(e.querySelectorAll(`[data-msg-id]`)).filter(e=>!r.has(e.dataset.msgId)&&!!r.add(e.dataset.msgId)).map(e=>{let r=e.getBoundingClientRect();return{id:e.dataset.msgId,offset:r.top-t.top,distance:Math.abs((r.top+r.bottom)/2-n)}}).sort((e,t)=>e.distance-t.distance)}function de(e,t,n){let r=()=>{let r=n.find();if(!r)return!1;let i=Z(r,e)-n.offset;return Math.abs(i)<=.5?!1:(t.nudge(i),!0)};r();let i=0,a=()=>{cancelAnimationFrame(i),t.pin(null);for(let t of J)e.removeEventListener(t,a)};for(let t of J)e.addEventListener(t,a,{passive:!0});let o=0,s=0,c=()=>{if(o=r()?0:o+1,!e.isConnected||!n.find()||o>=q||++s>=K)return a();i=requestAnimationFrame(c)};i=requestAnimationFrame(c)}function fe(e,t,n){let r=e.closest(U),i=r&&Y.get(r),a=r&&i&&r.dataset.scrollMode===`anchored`?le(r,t):null;(0,H.flushSync)(n),r&&i&&a&&de(r,i,a)}function pe(e){let t=Array.from(Y,([e,t])=>({scroller:e,owner:t,rows:e.dataset.scrollMode===`anchored`?ue(e):[]})).filter(({rows:e})=>e.length);for(let{owner:e,rows:n}of t)e.pin(n.map(({id:e})=>Number(e)));(0,H.flushSync)(e);for(let{scroller:e,owner:n,rows:r}of t){let t=t=>()=>e.querySelector(`[data-msg-id="${CSS.escape(t)}"]`),i=r.find(({id:e})=>t(e)());i?de(e,n,{find:t(i.id),offset:i.offset}):n.pin(null)}}var Q=r();function me(e){let t=new Set,n=(()=>{try{return window.localStorage.getItem(e)===`on`}catch{return!1}})(),r=()=>t.forEach(e=>e());return typeof window<`u`&&window.addEventListener(`storage`,t=>{t.key===e&&(n=t.newValue===`on`,r())}),{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>n,toggle(){n=!n;try{window.localStorage.setItem(e,n?`on`:`off`)}catch{}r()}}}var he=me(`humwick:chat-hide-tools`),ge=me(`humwick:chat-hide-reasoning`);function _e(e){return[(0,V.useSyncExternalStore)(e.subscribe,e.get,()=>!1),e.toggle]}function ve(e){return e.split(`
2
2
  `).find(e=>e.trim())?.trim()??`thinking`}function ye({step:e,issueRepo:t}){return(0,Q.jsx)(ie,{id:`reasoning-step-${e.id}`,icon:k,label:`thinking`,summary:ve(e.text),tone:`border-tone-neutral/25 bg-tone-neutral/10 text-tone-neutral-fg`,children:(0,Q.jsx)(B,{text:e.text,issueRepo:t,className:`italic break-words min-w-0 text-xs leading-relaxed`})})}function be({hidden:e,count:n,kind:r,onToggle:i}){return(0,Q.jsxs)(`button`,{...G(`control`),onClick:t=>fe(t.currentTarget,e?null:r,i),className:`flex items-center gap-1 text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors text-left`,children:[(0,Q.jsx)(A,{className:t(`w-3 h-3 shrink-0 transition-transform`,!e&&`rotate-90`)}),(0,Q.jsx)(`span`,{children:e?`show ${n} ${r} step${n===1?``:`s`}`:`hide ${r} steps`})]})}function xe({steps:e,showReasoning:t,issueRepo:n}){let[r,i]=_e(he),[a,o]=_e(ge),s=t?e:e.filter(e=>e.kind!==`reasoning`);if(!s.length)return null;let c=s.filter(e=>e.kind===`tool`).length,l=s.filter(e=>e.kind===`reasoning`).length;return(0,Q.jsx)(`div`,{className:`flex justify-start mb-2`,children:(0,Q.jsxs)(`div`,{className:`max-w-[85%] md:max-w-[75%] min-w-0 space-y-1.5`,children:[s.map(e=>(e.kind===`reasoning`?a:e.kind===`tool`&&r)?null:(0,Q.jsx)(`div`,{...G(e.kind),children:e.kind===`narration`?(0,Q.jsx)(B,{text:e.text,issueRepo:n,className:`text-sm leading-relaxed break-words text-foreground/90 min-w-0`}):e.kind===`reasoning`?(0,Q.jsx)(ye,{step:e,issueRepo:n}):(0,Q.jsx)(E,{step:e})},e.id)),l>0&&(0,Q.jsx)(be,{hidden:a,count:l,kind:`reasoning`,onToggle:o}),c>0&&(0,Q.jsx)(be,{hidden:r,count:c,kind:`tool`,onToggle:i})]})})}var Se={memory:`memories`,"memory-area":`memories`,instructions:`startup`,context:`startup`,tools:`injected`,comms:`injected`,knowledge:`injected`},Ce={narration:`narration`,tool:`tools`,reasoning:`reasoning`};function we(e){return e.startsWith(`workflow.`)||e.startsWith(`plan.`)?`workflow`:e===`branch.landed`||e===`landed-failure`||e===`task.steward-rekey`||e.startsWith(`workspace.`)||e.startsWith(`ci.`)||e.startsWith(`cd.`)?`land`:e.startsWith(`task.`)?`task`:e.startsWith(`agent.`)||e.startsWith(`team.`)||e.startsWith(`managed-policy.`)?`agents`:`other`}function Te(e){let t=e.payload??{};return typeof t.notificationKind==`string`?t.notificationKind:typeof t.kind==`string`?t.kind:``}function Ee(e,t){if(D(e))return we(Te(e));if(e.kind===`session`){let t=e.payload?.session;return t?.type===`relay-injection`?Se[t.relayInjection?.category]??`injected`:Ce[t?.type??``]??null}let n=e.from===t?e.to:e.from;return n&&n!==`system`&&!c(n)?`agentMessages`:null}function De(e,t,n){if(e.kind!==`session`&&e.deliveryStatus===`history`&&!n.undelivered)return!1;let r=Ee(e,t);return r===null||n[r]}var Oe={"branch.landed":N,"context.warning":F,"agent.context_threshold":F,"agent.rate_limit_resume":ae},ke={"branch.landed":`branch landed`,"context.warning":`context warning`,"agent.context_threshold":`context threshold reached`,"task.status-pulse":`Status Pulse`};function Ae(e){return e.payload?.kind===`agent.self_resume_continuation`?e.payload.delivery?.state===`ingested`?`self-resume continuation ingested`:`self-resume continuation stored / recoverable`:null}function je(e){return e.replace(/[._-]+/g,` `).trim()}function Me(e,t,n){return Ae(e)??ke[t]??(je(t)||e.subject?.trim()||n||`notice #${e.id}`)}function Ne(e,t){return t===e?``:t.startsWith(`${e}:`)?t.slice(e.length+1).trim():t}function Pe(e){return e.length?e.map(e=>[e.taskId==null?null:`T${e.taskId}`,e.transition,e.title].filter(Boolean).join(` `)).join(` · `):`update`}var $=e=>typeof e==`string`?e:``,Fe=[`sha`,`landedSha`,`newHeadSha`,`sourceHeadSha`,`greenHeadSha`,`gitSha`],Ie=[`taskId`,`runId`,`agentId`,`author`,`workspaceId`,`branch`,`base`,`commandId`,...Fe];function Le(e){let t=e.payload??{},n=Te(e),r=typeof t.taskId==`number`&&Number.isSafeInteger(t.taskId)?t.taskId:void 0,i=Fe.map(e=>$(t[e])).find(Boolean)??``,a=e.body.split(`
3
3
  `).find(e=>e.trim())?.replace(/`/g,``).trim()??``;return n===`branch.landed`&&$(t.branch)&&(a=`${$(t.branch)} → ${$(t.base)||`base`}`),n===`task.status-pulse`&&(a=Pe(Array.isArray(t.events)?t.events:[])),{kind:n,summary:a,agentId:$(t.agentId)||$(t.author)||$(t.memberId),taskId:r,taskLabel:$(t.taskLabel)||void 0,runId:$(t.runId),sha:i}}function Re(e){let t=e.payload?.routing;return!t||typeof t!=`object`||Array.isArray(t)?``:$(t.reason)}function ze({msg:e}){let t=e.payload??{},{routing:n,...r}=t,i=Re(e),a=Ie.flatMap(e=>t[e]==null||t[e]===``?[]:[[e,String(t[e])]]);return(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-current/10 pt-2`,children:[e.body.trim()&&(0,Q.jsx)(B,{text:e.body,className:`break-words text-xs leading-relaxed text-foreground/85`}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-[11px]`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`message`}),(0,Q.jsxs)(`dd`,{className:`font-mono`,children:[`#`,e.id,` · `,e.deliveryStatus??`pending`]}),a.map(([e,t])=>(0,Q.jsxs)(`div`,{className:`contents`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:t})]},e)),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`why here`}),(0,Q.jsx)(`dd`,{children:i})]})]}),(0,Q.jsx)(C,{value:r,className:`max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75`,compact:!0})]})}function Be({msg:e}){let n=Le(e),r=`notice-${e.id}`,i=s(e=>e.chatExpandedItems.includes(r)),a=s(e=>e.toggleChatItemExpanded),o=s(e=>e.openTaskDetailById),c=s(e=>e.showWorkflowRun),l=Oe[n.kind]??g,u=Me(e,n.kind,n.summary),d=Ne(u,n.summary),f=n.kind===`branch.landed`,p=e.deliveryStatus===`history`;return(0,Q.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,Q.jsxs)(`div`,{"data-testid":`chat-notice`,"data-notice-kind":n.kind,className:t(`w-full min-w-0 max-w-full rounded-lg border px-2.5 py-1.5 text-xs md:max-w-[85%]`,f?`border-tone-success/35 bg-tone-success/10 text-tone-success-fg`:`border-border bg-muted/20 text-muted-foreground`,p&&`border-dashed opacity-80`),children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(r),className:`flex min-w-0 flex-1 basis-full items-center gap-1.5 text-left @2xl/chat:basis-56`,children:[(0,Q.jsx)(A,{className:t(`h-3.5 w-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,Q.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:u}),d&&(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/75`,children:d})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[n.agentId&&(0,Q.jsx)(T,{agentId:n.agentId,className:`text-current`}),n.taskId!=null&&(0,Q.jsx)(z,{id:n.taskId,title:n.taskLabel,compact:!0,onClick:()=>o(n.taskId)}),n.runId&&(0,Q.jsx)(R,{label:n.runId,compact:!0,title:`Workflow run ${n.runId}`,ariaLabel:`Open workflow run ${n.runId}`,onClick:()=>void c(n.runId)}),n.sha&&(0,Q.jsx)(`span`,{className:`rounded bg-current/10 px-1 font-mono text-[10px]`,title:n.sha,children:n.sha.slice(0,7)}),f&&e.payload?.pushed===!1&&(0,Q.jsx)(`span`,{className:`text-tone-warning-fg`,title:`Local-only land — not pushed to origin`,children:`local only`}),p&&(0,Q.jsx)(`span`,{className:`rounded border border-current/30 px-1 text-[10px]`,title:`Settled as history: this notice never reached the agent's turn`,children:`not delivered`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(e.occurredAt??e.createdAt)})]})]}),i&&(0,Q.jsx)(ze,{msg:e})]})})}function Ve(){return(0,V.useSyncExternalStore)(e=>o.subscribe(e),()=>o.getPlayingKey(),()=>null)}function He({msg:e,peer:t}){return(0,Q.jsx)(S,{msg:e,issueRepo:s(e=>e.agentsById[t]?.issueRepo)})}function Ue({agent:e,onClick:n}){let r=!!(n&&e);return(0,Q.jsx)(`button`,{type:`button`,title:e?e.label||e.name||e.id:void 0,onClick:n,disabled:!r,className:t(`shrink-0 self-end transition-opacity`,r?`cursor-pointer hover:opacity-80`:`cursor-default opacity-60`),children:(0,Q.jsx)(I,{agent:e})})}function We({agentId:e,onOpen:t}){let n=s(t=>t.agentsById[e]??null);return(0,Q.jsx)(Ue,{agent:n,onClick:n?()=>t(n):void 0})}function Ge({attachment:e,outbound:n}){let r=e.title||e.artifactId;return e.kind===`image`?(0,Q.jsx)(Ke,{artifactId:e.artifactId,title:r}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>l(e.artifactId),className:t(`mt-2 flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors`,n?`border-primary-foreground/20 bg-primary-foreground/10 hover:bg-primary-foreground/15`:`border-border bg-background hover:bg-muted`),children:[(0,Q.jsx)(M,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),(0,Q.jsx)(A,{className:`h-3.5 w-3.5 shrink-0`})]})}function Ke({artifactId:e,title:n}){let[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let t=!1,n=null;return o(null),i(null),m(`/artifacts/${encodeURIComponent(e)}/content`).then(e=>{t||(n=URL.createObjectURL(e),i(n))},e=>{t||o(e.message)}),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e]),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:`group/img mt-2 block overflow-hidden rounded-md border border-foreground/10 bg-black/10 text-left relative`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`img`,{src:r,alt:n,loading:`lazy`,className:`block max-h-72 max-w-full object-contain`}),(0,Q.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/img:bg-black/30 transition-colors`,children:(0,Q.jsx)(L,{className:`w-6 h-6 text-white opacity-0 group-hover/img:opacity-100 transition-opacity drop-shadow-md`})})]}):(0,Q.jsxs)(`span`,{className:t(`flex min-h-20 items-center gap-2 px-3 py-2 text-xs`,a?`text-tone-danger-fg`:`text-muted-foreground`),children:[a?(0,Q.jsx)(j,{className:`h-4 w-4`}):(0,Q.jsx)(P,{className:`h-4 w-4 animate-spin`}),a||`Loading image`]})})}function qe({open:e,onToggle:n,onReact:r}){return(0,Q.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,Q.jsx)(`button`,{type:`button`,title:`Add reaction`,onClick:n,className:t(`inline-flex h-5 w-6 items-center justify-center rounded-full border border-border bg-popover text-muted-foreground shadow-sm transition hover:bg-muted hover:text-foreground`,e?`opacity-100`:`opacity-0 pointer-events-none md:group-hover/msg:opacity-100 md:group-hover/msg:pointer-events-auto`),children:(0,Q.jsx)(oe,{className:`h-3 w-3`})}),e&&(0,Q.jsx)(`div`,{className:`absolute bottom-full left-0 z-30 mb-1 flex gap-0.5 rounded-full border border-border bg-popover p-0.5 shadow-md`,children:O.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:`React ${e}`,onClick:()=>r(e),className:`inline-flex h-6 w-7 items-center justify-center rounded-full text-xs transition-colors hover:bg-muted`,children:e},e))})]})}function Je({msg:e,peer:n}){let[r,i]=(0,V.useState)(!1),a=s(e=>e.agentsById),o=s(e=>e.openAgentDetail),c=e.from===n,l=(c?e.to:e.from)||``,d=a[c?n:l]?.issueRepo??a[n]?.issueRepo,f=!l||l===`broadcast`||l.includes(`:`),p=u(e),m=x(e.occurredAt??e.createdAt),g=c?_:h,v=a[e.from??``]??null;function y(e){e.stopPropagation(),v&&o(v)}return(0,Q.jsx)(`div`,{"data-msg-id":e.id,className:`flex justify-center mb-1.5`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-[94%] rounded-md border border-border/50 bg-muted/15 px-2.5 py-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs cursor-pointer select-none`,onClick:()=>i(e=>!e),children:[(0,Q.jsx)(A,{className:t(`h-3 w-3 shrink-0 text-muted-foreground/60 transition-transform`,r&&`rotate-90`)}),(0,Q.jsx)(`button`,{type:`button`,title:v?v.label||v.name||v.id:void 0,disabled:!v,onClick:y,className:t(`shrink-0 transition-opacity`,v?`cursor-pointer hover:opacity-80`:`cursor-default opacity-60`),children:(0,Q.jsx)(I,{agent:v,className:`!w-4 !h-4 !rounded-sm opacity-70`})}),(0,Q.jsx)(g,{className:`h-3 w-3 shrink-0 text-muted-foreground/70`}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`Message `,c?`to`:`from`]}),f?(0,Q.jsx)(`span`,{className:`shrink-0 font-medium text-muted-foreground`,children:ee(l,a)}):(0,Q.jsx)(T,{agentId:l,className:`shrink-0 px-0.5 text-foreground/80`,noIcon:!0}),!r&&(0,Q.jsx)(`span`,{className:`min-w-24 flex-1 truncate text-muted-foreground/50`,children:p}),(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground/40`,children:m})]}),r&&(0,Q.jsx)(`div`,{className:`mt-1.5 pl-5`,children:(0,Q.jsx)(B,{text:p,rawBody:e.body,issueRepo:d,className:`text-sm leading-relaxed text-foreground/90`})})]})})}var Ye=(0,V.memo)(function({msg:e,peer:n,showAvatar:r=!1,onOpenReferencedPath:i,onPreviewReferencedPath:l,onPreviewReferencedPathEnd:ee}){if(!c(e.from)&&!c(e.to))return(0,Q.jsx)(Je,{msg:e,peer:n});let m=e.kind===`session`?e.payload?.session:void 0;if(m?.type===`prompt`&&m?.origin===`provider`)return(0,Q.jsx)(He,{msg:e,peer:n});let h=c(e.from),g=s(e=>e.reactToMessage),_=s(e=>e.voiceTtsEnabled),S=Ve(),C=s(e=>{let t=e.agentsById[n]?.meta?.cwd;return typeof t==`string`?t:``}),ie=s(e=>e.agentsById[n]?.issueRepo),T=s(e=>e.usersById),E=s(e=>e.users.length>1),D=h?d(e.from,T):void 0,O=s(e=>e.openAgentDetail);s(e=>e.openTaskDetailById);let[k,A]=(0,V.useState)(!1),j=(0,V.useRef)(null),M=(0,V.useRef)(null),N=(0,V.useRef)(!1),P=u(e),ae=x(e.occurredAt??e.createdAt),oe=re(e),F=v(e,a(s(e=>e.sessionUser))),I=h?ne(e,n):null,L=I?.icon,z=S===String(e.id),H=_&&!h&&!w(e)&&P.trim().length>0;function U(t){t.stopPropagation(),z?o.bargeIn():o.speak(e.body,String(e.id))}(0,V.useEffect)(()=>{if(!k)return;function e(e){b()||j.current&&!j.current.contains(e.target)&&A(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[k]);function W(e){return te(C||`/`,e)}function G(e,t){let n=W(e);i?.(n,t)}function K(e,t,n){let r=W(e);l?.(r,t,n)}function q(t){g(e,t),A(!1)}function J(e){e.button===0&&(M.current={x:e.clientX,y:e.clientY},N.current=!1)}function Y(e){let t=M.current;t&&(Math.abs(e.clientX-t.x)>3||Math.abs(e.clientY-t.y)>3)&&(N.current=!0)}function X(t){if(!(w(e)||h)&&!t.target.closest(`a,button,input,textarea,select,[role="button"]`)){if(N.current||b()){N.current=!1;return}A(e=>!e)}}let Z=r&&!w(e);return(0,Q.jsxs)(`div`,{"data-msg-id":e.id,className:t(`group/msg flex mb-3 items-end`,h?`justify-end`:`justify-start`,Z&&`gap-1.5`),children:[!h&&Z&&(0,Q.jsx)(We,{agentId:n,onOpen:O}),(0,Q.jsxs)(`div`,{ref:j,className:t(`relative`,h?`max-w-full md:max-w-[75%]`:`max-w-[calc(100%-2rem)] md:max-w-[calc(75%-2rem)]`),children:[H&&(0,Q.jsx)(`button`,{type:`button`,title:z?`Stop playback`:`Play aloud`,onClick:U,className:t(`absolute -top-2 -right-2 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border bg-popover shadow-sm transition`,z?`border-primary/50 text-primary opacity-100`:`border-border text-muted-foreground opacity-70 hover:bg-muted hover:text-foreground hover:opacity-100 [@media(hover:hover)]:md:opacity-0 [@media(hover:hover)]:md:group-hover/msg:opacity-100`),children:z?(0,Q.jsx)(y,{className:`h-3.5 w-3.5 animate-pulse`}):(0,Q.jsx)(se,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`div`,{className:t(`rounded-2xl px-3.5 py-2 text-sm select-text`,!h&&!w(e)&&`cursor-pointer`,h?`tone-on-primary bg-primary text-primary-foreground rounded-br-sm`:`bg-card ring-1 ring-foreground/10 rounded-bl-sm`),onPointerDown:J,onPointerMove:Y,onClick:X,children:[h&&E&&(0,Q.jsx)(`p`,{className:`text-[11px] font-semibold mb-0.5 text-right`,children:f(e.from,T)}),e.subject&&(0,Q.jsx)(`p`,{className:t(`text-xs font-semibold mb-1`,h?`text-primary-foreground`:`text-muted-foreground`),children:e.subject}),(0,Q.jsx)(B,{text:P,rawBody:e.body,issueRepo:ie,className:`leading-relaxed`,onPrimary:h,onOpenPath:G,onPreviewPath:K,onPreviewPathEnd:ee,resolvePathTitle:(e,t)=>`${W(e)}${t?`:${t}`:``}`}),oe.map(t=>(0,Q.jsx)(Ge,{attachment:t,outbound:h},`${e.id}-${t.artifactId}-${t.role||``}`)),(0,Q.jsxs)(`p`,{className:t(`text-xs mt-1 flex items-center gap-1.5`,h?`justify-end text-primary-foreground`:`justify-end text-muted-foreground`),children:[(0,Q.jsx)(R,{label:p(e.id),title:`Message id`,compact:!0}),(0,Q.jsx)(`span`,{children:ae}),I&&L&&(0,Q.jsxs)(`span`,{className:t(`inline-flex items-center gap-1`,I.tone!==`muted`&&`text-primary-foreground`,I.tone===`danger`&&`font-semibold`),title:I.title,children:[(0,Q.jsx)(L,{className:`h-3 w-3`}),I.label]})]})]}),!w(e)&&F.length>0&&(0,Q.jsxs)(`div`,{className:t(`flex flex-wrap items-center gap-0.5 -mt-1 relative z-10`,h?`justify-end pr-2`:`justify-start pl-2`),children:[!h&&(0,Q.jsx)(qe,{open:k,onToggle:()=>A(e=>!e),onReact:q}),F.map(e=>(0,Q.jsxs)(`button`,{type:`button`,title:e.actors.join(`, `),onClick:()=>q(e.emoji),className:t(`inline-flex h-5 items-center gap-0.5 rounded-full border px-1.5 text-[11px] shadow-sm transition-colors`,e.mine?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-background hover:bg-muted text-foreground`),children:[(0,Q.jsx)(`span`,{children:e.emoji}),e.count>1&&(0,Q.jsx)(`span`,{children:e.count})]},e.emoji))]}),!w(e)&&!h&&F.length===0&&(0,Q.jsx)(`div`,{className:`absolute -bottom-2.5 left-1 z-20`,children:(0,Q.jsx)(qe,{open:k,onToggle:()=>A(e=>!e),onReact:q})})]}),h&&Z&&(0,Q.jsx)(`span`,{className:`shrink-0 self-end opacity-60`,children:(0,Q.jsx)(ce,{user:D,address:e.from,distinct:E})})]})});export{pe as a,xe as i,Be as n,X as o,De as r,Ye as t};
4
- //# sourceMappingURL=MessageBubble-BWLqMGKG.js.map
4
+ //# sourceMappingURL=MessageBubble-Bq9kr21N.js.map
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,St as a,d as o,f as s,p as c,t as l}from"./store-DcClXLH0.js";import"./provider-display-DsuWMvVL.js";import{ct as u,et as d,h as f,v as p,vt as m}from"./display-BrKWFGJz.js";import{t as h}from"./api-CIIVBtAV.js";import{i as ee,n as g,r as _,t as v}from"./list-todo-9qT0fgxZ.js";import{t as y}from"./archive-CIuPSvmx.js";import{t as b}from"./check-B3M9Ug1P.js";import{t as x}from"./chevron-down-BoG3JCZn.js";import{t as S}from"./chevron-up-Bv3yC5ma.js";import{t as C}from"./issue-ref-chip-BnSlM_95.js";import{t as w}from"./circle-UESLMi2-.js";import{t as te}from"./git-branch-yxhV0m8E.js";import{r as T}from"./workflow-marker-DAZcj5qt.js";import{t as E}from"./x-Bge17hWJ.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{t as O}from"./agent-name-DKbiIhBo.js";var k=[`reserved`,`running`,`escalated`,`ci-blocked`];function A(e){return k.includes(e)}var j=e(n(),1);function M(e){if(typeof window>`u`)return()=>{};let t=window.matchMedia(m);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function N(){return(0,j.useSyncExternalStore)(M,()=>typeof window<`u`&&window.matchMedia(m).matches,()=>!1)}var P=r(),F={open:{label:`open`,className:`border-border bg-muted/40 text-muted-foreground`},"conformance-pending":{label:`conformance pending`,className:`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`},done:{label:`done`,className:`border-tone-success/40 bg-tone-success/10 text-tone-success-fg`}};function I({completion:e}){let n=F[e];return(0,P.jsx)(`span`,{className:t(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] font-medium`,n.className),children:n.label})}function ne({plan:e,onArchive:t}){let n=e.nodes.length;if(!n||e.nodes.some(e=>e.status!==`landed`))return null;let r=`${n} node${n===1?``:`s`}`;return e.completion===`conformance-pending`?(0,P.jsxs)(`div`,{role:`status`,className:`mb-2 rounded-md border border-tone-warning/30 bg-tone-warning/10 px-2.5 py-1.5 text-[11px] text-tone-warning-fg`,children:[`All `,r,` landed — conformance pending. The plan is not done until its acceptance check passes.`]}):e.completion&&e.completion!==`done`?null:(0,P.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md border border-tone-success/30 bg-tone-success/10 px-2.5 py-1.5`,children:[(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-tone-success-fg`,children:[e.completion===`done`?`Acceptance passed`:`All ${r} landed`,` — archive this plan?`]}),(0,P.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded border border-tone-success/40 bg-tone-success/15 px-2 py-0.5 text-[10px] font-medium text-tone-success-fg hover:bg-tone-success/20 hover:text-tone-success-fg`,children:`Archive plan`})]})}function L({check:e}){let t=`command`in e;return(0,P.jsx)(`code`,{className:`block max-w-full truncate rounded-sm bg-muted/60 px-1 py-px font-mono text-[10px] text-muted-foreground`,title:t?e.command:e.path,children:t?`$ ${e.command}`:e.path})}function re({plan:e}){let n=e.acceptance??[];if(!n.length)return null;let r=e.conformance,i=r?r.planVersion!==e.version:!1,a=new Map(r?.items.map(e=>[e.id,e])??[]),o=n.filter(e=>a.get(e.id)?.status===`met`).length;return(0,P.jsxs)(`section`,{"aria-label":`Plan acceptance`,className:`mt-2 rounded-md border border-border bg-background/60 px-2.5 py-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,P.jsx)(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Acceptance`}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:r?`${o}/${n.length} met`:`${n.length} item${n.length===1?``:`s`} · not checked yet`})]}),r&&(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{children:`Last verdict`}),(0,P.jsx)(`span`,{className:t(`rounded-sm px-1 py-px font-semibold uppercase tracking-wide`,r.verdict===`pass`?`bg-tone-success/15 text-tone-success-fg`:`bg-tone-danger/15 text-tone-danger-fg`),children:r.verdict}),(0,P.jsxs)(`span`,{children:[`on main `,(0,P.jsx)(`code`,{className:`font-mono`,children:r.mainSha.slice(0,9)})]}),(0,P.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`by `,r.by]}),(0,P.jsx)(`span`,{title:p(r.at),children:d(Date.now(),r.at)}),i&&(0,P.jsxs)(`span`,{className:`rounded-sm bg-tone-warning/15 px-1 py-px text-tone-warning-fg`,title:`The plan changed after this verdict; a new check is needed.`,children:[`stale · v`,r.planVersion,`, plan now v`,e.version]})]}),(0,P.jsx)(`ul`,{className:`max-h-48 space-y-1 overflow-auto`,children:n.map(e=>{let n=a.get(e.id);return(0,P.jsxs)(`li`,{className:t(`flex min-w-0 gap-1.5`,i&&`opacity-70`),children:[(0,P.jsx)(`span`,{className:`mt-px shrink-0`,"aria-label":n?.status??`not checked`,children:n?.status===`met`?(0,P.jsx)(b,{className:`h-3.5 w-3.5 text-tone-success-fg`}):n?.status===`unmet`?(0,P.jsx)(E,{className:`h-3.5 w-3.5 text-tone-danger-fg`}):(0,P.jsx)(w,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,P.jsxs)(`div`,{className:`text-[11px] leading-snug text-foreground`,children:[(0,P.jsx)(`span`,{className:`mr-1.5 font-mono text-[10px] text-muted-foreground`,children:e.id}),e.text]}),e.check&&(0,P.jsx)(L,{check:e.check}),n?.note&&(0,P.jsx)(`div`,{className:`text-[10px] leading-snug text-muted-foreground`,children:n.note})]})]},e.id)})})]})}function ie({listId:e,plans:n,shownId:r,open:i,onToggle:a}){let o=n.findIndex(e=>e.id===r)+1;return(0,P.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":i,"aria-controls":e,"aria-label":`Switch plan (${n.length} active)`,title:`${n.length} active plans`,className:t(`flex h-6 shrink-0 items-center gap-0.5 rounded border border-border px-1.5 text-[10px] font-medium tabular-nums`,`text-muted-foreground hover:bg-muted/60 hover:text-foreground`,i&&`bg-muted/60 text-foreground`),children:[o>0?`${o}/${n.length}`:n.length,(0,P.jsx)(_,{className:`h-3 w-3`})]})}function R({listId:e,plans:n,shownId:r,onChoose:a,className:o}){let s=i();return(0,P.jsx)(`ul`,{id:e,"aria-label":`Active plans`,className:t(`overflow-hidden rounded-md border border-border bg-background/95`,o),children:n.map(e=>{let n=e.id===r,i=`${e.nodeCount} node${e.nodeCount===1?``:`s`}`;return(0,P.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),"aria-current":n?`true`:void 0,className:t(`flex min-h-11 w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left sm:min-h-0`,n?`bg-muted/50`:`hover:bg-muted/40`),children:[(0,P.jsx)(b,{className:t(`h-3.5 w-3.5 shrink-0 text-foreground`,!n&&`invisible`),"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-[12px] font-medium leading-tight text-foreground`,children:e.title||`Untitled plan`}),(0,P.jsxs)(`span`,{className:`block truncate text-[10px] leading-tight text-muted-foreground`,children:[i,` · updated `,d(s,e.updatedAt)]})]}),e.completion&&(0,P.jsx)(I,{completion:e.completion})]})},e.id)})})}function z(e){return new Map((e.dispatch?.slots??[]).flatMap(e=>e.runId?[[e.taskId,e.runId]]:[]))}function B({runId:e,label:n,className:r}){let i=l(e=>e.showWorkflowRun);return(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void i(e),title:`Open workflow run ${e}`,"aria-label":`Open workflow run ${e}`,className:t(`wf-marker inline-flex min-w-0 items-center gap-0.5 rounded-sm border border-border/70 px-1 py-px text-[9px] font-medium text-muted-foreground hover:text-foreground`,r),children:[(0,P.jsx)(T,{className:`h-2.5 w-2.5 shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:n??e})]})}function ae({plan:e}){let t=e.dispatch;if(!t)return null;let n=t.slots.filter(e=>A(e.status)).length;return(0,P.jsxs)(`div`,{"data-testid":`plan-dispatch`,className:`mb-2 flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground`,children:[(0,P.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`Autopilot `,t.state]}),(0,P.jsxs)(`span`,{children:[n,`/`,t.concurrency,` running`]}),t.slots.filter(e=>e.ciBlock).map(e=>(0,P.jsxs)(`span`,{className:`text-tone-warning-fg`,title:e.ciBlock.sha,children:[`T`,e.taskId,` CI blocked · `,e.ciBlock.sha.slice(0,12),` · `,e.ciBlock.incidentIds.join(`, `),` · `,e.ciBlock.retriedAt===void 0?`retry on clearance`:`exact SHA retried; awaiting pass`]},e.taskId)),t.audit&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`audit T`,t.audit.taskId,t.audit.verdict?` · ${t.audit.verdict}`:``,t.audit.runId&&(0,P.jsx)(B,{runId:t.audit.runId,label:`audit run`})]})]})}var V=4,H={satisfied:`text-tone-success-fg`,waiting:`text-tone-warning-fg`,unreachable:`text-tone-danger-fg`};function U(e){return e.verdict.state===`unreachable`?`unreachable · ${e.verdict.reason}`:e.verdict.state}function W({entry:e,now:n,nodeLabels:r}){let i=l(e=>e.openTaskDetailById),a=e.waitingSince===void 0?``:f(n,e.waitingSince);return(0,P.jsxs)(`li`,{"data-testid":`plan-external`,"data-verdict":e.verdict.state,title:e.projectId?`Project ${e.projectId}`:void 0,className:`min-w-0 rounded-md border border-dashed border-border bg-background/60 px-2 py-1.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(e.taskId),className:`flex w-full min-w-0 items-baseline gap-1.5 text-left`,title:`Open T${e.taskId}`,children:[(0,P.jsxs)(`span`,{className:`shrink-0 text-[11px] font-semibold tabular-nums text-foreground`,children:[`T`,e.taskId]}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-muted-foreground`,children:e.title??`title hidden`})]}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`font-medium`,H[e.verdict.state]),children:U(e)}),(0,P.jsxs)(`span`,{children:[`stage `,e.stage]}),(0,P.jsxs)(`span`,{children:[`needs `,e.requiredStage]}),a&&(0,P.jsxs)(`span`,{title:`How long this plan has waited on it`,children:[`waiting `,a]}),(0,P.jsxs)(`span`,{className:`truncate`,children:[`→ `,e.dependents.map(e=>r.get(e)??e).join(`, `)]})]})]})}function G({plan:e}){let[t,n]=(0,j.useState)(!1),r=a(e=>e.now),i=e.external;if(!i?.length)return null;let o=e.externalCount??i.length,s=t?i:i.slice(0,V),c=new Map(e.nodes.map(e=>[e.id,e.label])),l=i.length-s.length,u=o-i.length;return(0,P.jsxs)(`div`,{"data-testid":`plan-externals`,className:`mb-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),(0,P.jsxs)(`span`,{children:[`Waits on other work (`,o,`)`]})]}),(0,P.jsx)(`ul`,{className:`grid gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,P.jsx)(W,{entry:e,now:r,nodeLabels:c},e.taskId))}),(l>0||t&&i.length>V||u>0)&&(0,P.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(l>0||t)&&i.length>V&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(!t),"aria-expanded":t,className:`rounded border border-border bg-muted/30 px-1.5 py-0.5 font-medium hover:bg-muted/50 hover:text-foreground`,children:t?`Show fewer`:`+ ${l} more`}),u>0&&(0,P.jsxs)(`span`,{children:[u,` more not listed`]})]})]})}var K=196,q=84,J=52,Y=16,X=14,Z=[`landed`,`in-progress`,`pending`,`blocked`],Q={landed:{label:`landed`,dot:`bg-tone-success`,accent:`border-l-tone-success`,text:`text-tone-success-fg`,wire:`#34d399`},"in-progress":{label:`in progress`,dot:`bg-tone-sky`,accent:`border-l-tone-sky`,text:`text-tone-sky-fg`,wire:`#38bdf8`},pending:{label:`pending`,dot:`bg-tone-warning`,accent:`border-l-tone-warning`,text:`text-tone-warning-fg`,wire:`#fbbf24`},blocked:{label:`blocked`,dot:`bg-tone-danger`,accent:`border-l-tone-danger`,text:`text-tone-danger-fg`,wire:`#f87171`}},oe=new Set([...u,`completed`]);function $(e){return oe.has(e.status)}function se(e,t){return t?e:e.filter(e=>!$(e))}function ce(e){return e?e.label||(e.policyName?`policy:${e.policyName}`:e.agentId||``):``}function le({owner:e}){let t=l(t=>e?.agentId?t.agentsById[e.agentId]:void 0),n=ce(e);return!t&&!n?null:(0,P.jsx)(O,{agent:t,fallback:n,className:`text-[10px] text-muted-foreground`})}function ue(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=new Map(e.nodes.map((e,t)=>[e.id,t])),r=new Map,i=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.edges)!t.has(n.from)||!t.has(n.to)||(r.set(n.from,[...r.get(n.from)??[],n.to]),i.set(n.to,(i.get(n.to)??0)+1));let a=new Map(e.nodes.map(e=>[e.id,0])),o=e.nodes.filter(e=>(i.get(e.id)??0)===0).map(e=>e.id),s=new Set;for(;o.length;){let e=o.shift();s.add(e);let t=a.get(e)??0;for(let n of r.get(e)??[])a.set(n,Math.max(a.get(n)??0,t+1)),i.set(n,(i.get(n)??0)-1),(i.get(n)??0)===0&&o.push(n)}let c=Math.max(0,...Array.from(a.values()))+1;for(let t of e.nodes)s.has(t.id)||a.set(t.id,c++);let l=new Map;for(let t of e.nodes){let e=a.get(t.id)??0;l.set(e,[...l.get(e)??[],t])}let u=[...l.entries()].sort(([e],[t])=>e-t),d=Math.max(1,...u.map(([,e])=>e.length)),f=[];u.forEach(([e,t],r)=>{let i=[...t].sort((e,t)=>(e.lane||``).localeCompare(t.lane||``)||(n.get(e.id)??0)-(n.get(t.id)??0)),a=(d-i.length)*100/2;i.forEach((t,n)=>{f.push({node:t,layer:e,x:X+r*248,y:X+a+n*100})})});let p=u.length;return{nodes:f,width:Math.max(320,X*2+p*K+Math.max(0,p-1)*J),height:Math.max(112,X*2+d*q+Math.max(0,d-1)*Y)}}function de(e,t){let n=e.x+K,r=e.y+q/2,i=t.x,a=t.y+q/2,o=n+Math.max(20,(i-n)/2);return`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`}function fe({threadId:e,teamId:n,channel:r}){let i=n?s(n,r):e?o(e,r):``,a=l(e=>n?c(e,i):i?e.plansByThread[i]:null),u=l(e=>n?e.planListsByTeam[i]?.plans:void 0),d=l(e=>e.fetchPlan),f=l(e=>e.fetchTeamPlanList),p=l(e=>e.chooseTeamPlan),[m,h]=(0,j.useState)(!1),g=(0,j.useId)(),_=l(e=>e.setPlanArchived),v=l(e=>e.planCollapsed),b=l(e=>e.setPlanCollapsed),w=l(e=>e.issueRefsById),T=l(e=>e.deliverableTasks),E=l(e=>e.openTaskDetailById),O=N(),[k,A]=(0,j.useState)(!1),M=v??O;(0,j.useEffect)(()=>{if(n){d({teamId:n,channel:r}),f({teamId:n,channel:r});return}e&&d({threadId:e,channel:r})},[r,d,f,n,e]);let F=(0,j.useMemo)(()=>a?ue(a):null,[a]),L=(0,j.useMemo)(()=>a?z(a):new Map,[a]),V=(0,j.useMemo)(()=>new Map(F?.nodes.map(e=>[e.node.id,e])??[]),[F]),H=(0,j.useMemo)(()=>{if(!a)return[];let e=new Map;for(let t of a.nodes)e.set(t.status,(e.get(t.status)??0)+1);return Z.filter(t=>e.has(t)).map(t=>({status:t,count:e.get(t)??0}))},[a]);if(!a||!F)return null;if(a.archived&&!k)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`flex min-w-0 items-center gap-2 text-left text-muted-foreground hover:text-foreground`,"aria-expanded":`false`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold uppercase tracking-wider`,children:`Show archived plan (1)`}),(0,P.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`})]})});if(a.archived)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-muted-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:`Archived plan`})]}),(0,P.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:`archived`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>A(!1),className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground`,"aria-expanded":`true`,children:`Hide`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!1),title:`Unarchive plan`,"aria-label":`Unarchive plan`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(ee,{className:`h-3.5 w-3.5`})})]})});let U=a.nodes.length,W=H.find(e=>e.status===`landed`)?.count??0,J=`${U} node${U===1?``:`s`}${W>0?` · ${W} landed`:``}`,Y=n&&u&&u.length>1?u:null,X=!!(Y&&m);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsx)(ne,{plan:a,onArchive:()=>void _(a.id,!0)}),(0,P.jsx)(ae,{plan:a}),(0,P.jsxs)(`div`,{className:t(`flex min-w-0 items-center gap-2`,(!M||X)&&`mb-2`),children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(te,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:M?J:a.objective||J})]})]}),H.length>0&&(0,P.jsx)(`div`,{className:`hidden shrink-0 items-center gap-2.5 sm:flex`,children:H.map(({status:e,count:n})=>(0,P.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 rounded-full`,Q[e].dot)}),(0,P.jsx)(`span`,{className:t(`font-medium tabular-nums`,Q[e].text),children:n}),(0,P.jsx)(`span`,{children:Q[e].label})]},e))}),a.completion&&(0,P.jsx)(I,{completion:a.completion}),Y&&(0,P.jsx)(ie,{listId:g,plans:Y,shownId:a.id,open:m,onToggle:()=>h(!m)}),(0,P.jsxs)(`span`,{className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,children:[`v`,a.version]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!0),title:`Archive plan`,"aria-label":`Archive plan`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(y,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:M?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),Y&&X&&(0,P.jsx)(R,{listId:g,className:M?void 0:`mb-2`,plans:Y,shownId:a.id,onChoose:e=>{h(!1),p({teamId:n,channel:r},e)}}),!M&&(0,P.jsx)(G,{plan:a}),M?null:a.nodes.length===0?(0,P.jsx)(`div`,{className:`rounded-md border border-dashed border-border px-3 py-3 text-center text-xs text-muted-foreground`,children:`No nodes yet — the plan graph fills in as the team is composed.`}):(0,P.jsx)(`div`,{className:`max-h-[min(46vh,360px)] overflow-auto`,children:(0,P.jsxs)(`div`,{className:`relative`,style:{width:F.width,height:F.height},children:[(0,P.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0`,width:F.width,height:F.height,"aria-hidden":`true`,children:[(0,P.jsx)(`defs`,{children:Z.map(e=>(0,P.jsx)(`marker`,{id:`plan-arrow-${e}`,viewBox:`0 0 8 8`,refX:`6.5`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,P.jsx)(`path`,{d:`M0 0 L8 4 L0 8 z`,fill:Q[e].wire})},e))}),a.edges.map(e=>{let t=V.get(e.from),n=V.get(e.to);if(!t||!n)return null;let r=Q[t.node.status];return(0,P.jsx)(`path`,{d:de(t,n),stroke:r.wire,strokeOpacity:.7,strokeWidth:2,fill:`none`,strokeLinecap:`round`,markerEnd:`url(#plan-arrow-${t.node.status})`},`${e.from}->${e.to}`)})]}),F.nodes.map(({node:e,x:n,y:r})=>{let i=Q[e.status],a=e.refs?.issueId?w[e.refs.issueId]:null,o=e.refs?.taskId?parseInt(e.refs.taskId,10):null,s=o==null?void 0:T.find(e=>e.id===o)?.title,c=o==null?void 0:L.get(o);return(0,P.jsxs)(`article`,{className:t(`group absolute flex flex-col justify-between rounded-md border border-l-[3px] bg-background/95 p-2`,`shadow-sm transition-all hover:-translate-y-px hover:border-border hover:shadow-md hover:bg-background`,i.accent),style:{left:n,top:r,width:K,height:q},title:e.scopeBlurb||e.label,children:[(0,P.jsx)(`div`,{className:`truncate text-xs font-semibold leading-tight text-foreground`,children:e.label}),(e.scopeBlurb||e.id)&&(0,P.jsx)(`div`,{className:`truncate text-[10px] leading-tight text-muted-foreground`,children:e.scopeBlurb||e.id}),(a||o!=null)&&(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:[a&&(0,P.jsx)(C,{issueRef:a,compact:!0,className:`max-w-full`}),o!=null&&(0,P.jsx)(D,{id:o,title:s,onClick:()=>E(o),className:`max-w-full`}),c&&(0,P.jsx)(B,{runId:c,label:`run`})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1.5`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 shrink-0 rounded-full`,i.dot)}),(0,P.jsx)(`span`,{className:t(`text-[10px] font-medium`,i.text),children:i.label})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,P.jsx)(le,{owner:e.ownerRef}),e.lane&&(0,P.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted/70 px-1 py-px text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.lane})]})]})]},e.id)})]})}),!M&&(0,P.jsx)(re,{plan:a})]})}function pe({agentId:e}){let n=l(e=>e.openTaskDetailById),r=l(e=>e.sessionTasksCollapsed),i=l(e=>e.setSessionTasksCollapsed),a=l(e=>e.deliverableTasks),[o,s]=(0,j.useState)([]),[c,u]=(0,j.useState)(!1);(0,j.useEffect)(()=>{let t=!1;return h(`GET`,`/task-entities?createdBy=`+encodeURIComponent(e)+`&limit=500`).then(e=>{t||s(e)}).catch(()=>{}),()=>{t=!0}},[e]);let d=new Map(o.map(e=>[e.id,e]));for(let t of a)t.createdBy===e&&(!d.has(t.id)||Number(t.updatedAt)>=Number(d.get(t.id).updatedAt))&&d.set(t.id,t);let f=[...d.values()];if(f.length===0)return null;let p=f.filter($).length,m=se(f,c);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":!r,"aria-label":r?`Expand session tasks`:`Collapse session tasks`,className:t(`flex w-full min-w-0 items-center gap-2 text-left`,!r&&`mb-1.5`),children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(v,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`span`,{className:`flex-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Tasks from this session (`,m.length,`)`]}),(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:r?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),!r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(me,{tasks:m,onOpen:n}),p>0&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>u(!c),className:`mt-1.5 rounded border border-border bg-muted/30 px-2 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground`,"aria-pressed":c,children:c?`Hide ${p} closed`:`+ ${p} closed`})]})]})}function me({tasks:e,onOpen:t}){return(0,P.jsx)(`div`,{className:`space-y-2`,children:[{label:`In progress`,tasks:e.filter(e=>e.status===`in_progress`||e.status===`claimed`)},{label:`Needs validation`,tasks:e.filter(e=>e.status===`validating`)},{label:`Waiting`,tasks:e.filter(e=>![`in_progress`,`claimed`,`validating`].includes(e.status)&&!$(e))},{label:`Closed`,tasks:e.filter($)}].filter(e=>e.tasks.length).map(e=>(0,P.jsxs)(`section`,{"aria-label":e.label,children:[(0,P.jsxs)(`h3`,{className:`mb-1 text-[10px] text-muted-foreground`,children:[e.label,` (`,e.tasks.length,`)`]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tasks.map(e=>(0,P.jsx)(D,{id:e.id,title:e.title,status:e.status,onClick:()=>t(e.id),compact:!0},e.id))})]},e.label))})}export{pe as n,N as r,fe as t};
2
- //# sourceMappingURL=PlanGraphPanel-3TlIQpjk.js.map
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Ct as i,St as a,d as o,f as s,p as c,t as l}from"./store-DKPDIZBe.js";import"./provider-display-BEeLXC_D.js";import{ct as u,et as d,h as f,v as p,vt as m}from"./display-CDeH4I8T.js";import{t as h}from"./api-CIIVBtAV.js";import{i as ee,n as g,r as _,t as v}from"./list-todo-9qT0fgxZ.js";import{t as y}from"./archive-CIuPSvmx.js";import{t as b}from"./check-B3M9Ug1P.js";import{t as x}from"./chevron-down-BoG3JCZn.js";import{t as S}from"./chevron-up-Bv3yC5ma.js";import{t as C}from"./issue-ref-chip-CeWBNWn7.js";import{t as w}from"./circle-UESLMi2-.js";import{t as te}from"./git-branch-yxhV0m8E.js";import{r as T}from"./workflow-marker-X8wxyhzC.js";import{t as E}from"./x-Bge17hWJ.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{t as O}from"./agent-name-CcY3Aijy.js";var k=[`reserved`,`running`,`escalated`,`ci-blocked`];function A(e){return k.includes(e)}var j=e(n(),1);function M(e){if(typeof window>`u`)return()=>{};let t=window.matchMedia(m);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function N(){return(0,j.useSyncExternalStore)(M,()=>typeof window<`u`&&window.matchMedia(m).matches,()=>!1)}var P=r(),F={open:{label:`open`,className:`border-border bg-muted/40 text-muted-foreground`},"conformance-pending":{label:`conformance pending`,className:`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`},done:{label:`done`,className:`border-tone-success/40 bg-tone-success/10 text-tone-success-fg`}};function I({completion:e}){let n=F[e];return(0,P.jsx)(`span`,{className:t(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] font-medium`,n.className),children:n.label})}function ne({plan:e,onArchive:t}){let n=e.nodes.length;if(!n||e.nodes.some(e=>e.status!==`landed`))return null;let r=`${n} node${n===1?``:`s`}`;return e.completion===`conformance-pending`?(0,P.jsxs)(`div`,{role:`status`,className:`mb-2 rounded-md border border-tone-warning/30 bg-tone-warning/10 px-2.5 py-1.5 text-[11px] text-tone-warning-fg`,children:[`All `,r,` landed — conformance pending. The plan is not done until its acceptance check passes.`]}):e.completion&&e.completion!==`done`?null:(0,P.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md border border-tone-success/30 bg-tone-success/10 px-2.5 py-1.5`,children:[(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-tone-success-fg`,children:[e.completion===`done`?`Acceptance passed`:`All ${r} landed`,` — archive this plan?`]}),(0,P.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded border border-tone-success/40 bg-tone-success/15 px-2 py-0.5 text-[10px] font-medium text-tone-success-fg hover:bg-tone-success/20 hover:text-tone-success-fg`,children:`Archive plan`})]})}function L({check:e}){let t=`command`in e;return(0,P.jsx)(`code`,{className:`block max-w-full truncate rounded-sm bg-muted/60 px-1 py-px font-mono text-[10px] text-muted-foreground`,title:t?e.command:e.path,children:t?`$ ${e.command}`:e.path})}function re({plan:e}){let n=e.acceptance??[];if(!n.length)return null;let r=e.conformance,i=r?r.planVersion!==e.version:!1,a=new Map(r?.items.map(e=>[e.id,e])??[]),o=n.filter(e=>a.get(e.id)?.status===`met`).length;return(0,P.jsxs)(`section`,{"aria-label":`Plan acceptance`,className:`mt-2 rounded-md border border-border bg-background/60 px-2.5 py-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,P.jsx)(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Acceptance`}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:r?`${o}/${n.length} met`:`${n.length} item${n.length===1?``:`s`} · not checked yet`})]}),r&&(0,P.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{children:`Last verdict`}),(0,P.jsx)(`span`,{className:t(`rounded-sm px-1 py-px font-semibold uppercase tracking-wide`,r.verdict===`pass`?`bg-tone-success/15 text-tone-success-fg`:`bg-tone-danger/15 text-tone-danger-fg`),children:r.verdict}),(0,P.jsxs)(`span`,{children:[`on main `,(0,P.jsx)(`code`,{className:`font-mono`,children:r.mainSha.slice(0,9)})]}),(0,P.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`by `,r.by]}),(0,P.jsx)(`span`,{title:p(r.at),children:d(Date.now(),r.at)}),i&&(0,P.jsxs)(`span`,{className:`rounded-sm bg-tone-warning/15 px-1 py-px text-tone-warning-fg`,title:`The plan changed after this verdict; a new check is needed.`,children:[`stale · v`,r.planVersion,`, plan now v`,e.version]})]}),(0,P.jsx)(`ul`,{className:`max-h-48 space-y-1 overflow-auto`,children:n.map(e=>{let n=a.get(e.id);return(0,P.jsxs)(`li`,{className:t(`flex min-w-0 gap-1.5`,i&&`opacity-70`),children:[(0,P.jsx)(`span`,{className:`mt-px shrink-0`,"aria-label":n?.status??`not checked`,children:n?.status===`met`?(0,P.jsx)(b,{className:`h-3.5 w-3.5 text-tone-success-fg`}):n?.status===`unmet`?(0,P.jsx)(E,{className:`h-3.5 w-3.5 text-tone-danger-fg`}):(0,P.jsx)(w,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,P.jsxs)(`div`,{className:`text-[11px] leading-snug text-foreground`,children:[(0,P.jsx)(`span`,{className:`mr-1.5 font-mono text-[10px] text-muted-foreground`,children:e.id}),e.text]}),e.check&&(0,P.jsx)(L,{check:e.check}),n?.note&&(0,P.jsx)(`div`,{className:`text-[10px] leading-snug text-muted-foreground`,children:n.note})]})]},e.id)})})]})}function ie({listId:e,plans:n,shownId:r,open:i,onToggle:a}){let o=n.findIndex(e=>e.id===r)+1;return(0,P.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":i,"aria-controls":e,"aria-label":`Switch plan (${n.length} active)`,title:`${n.length} active plans`,className:t(`flex h-6 shrink-0 items-center gap-0.5 rounded border border-border px-1.5 text-[10px] font-medium tabular-nums`,`text-muted-foreground hover:bg-muted/60 hover:text-foreground`,i&&`bg-muted/60 text-foreground`),children:[o>0?`${o}/${n.length}`:n.length,(0,P.jsx)(_,{className:`h-3 w-3`})]})}function R({listId:e,plans:n,shownId:r,onChoose:a,className:o}){let s=i();return(0,P.jsx)(`ul`,{id:e,"aria-label":`Active plans`,className:t(`overflow-hidden rounded-md border border-border bg-background/95`,o),children:n.map(e=>{let n=e.id===r,i=`${e.nodeCount} node${e.nodeCount===1?``:`s`}`;return(0,P.jsx)(`li`,{className:`border-b border-border last:border-b-0`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),"aria-current":n?`true`:void 0,className:t(`flex min-h-11 w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left sm:min-h-0`,n?`bg-muted/50`:`hover:bg-muted/40`),children:[(0,P.jsx)(b,{className:t(`h-3.5 w-3.5 shrink-0 text-foreground`,!n&&`invisible`),"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-[12px] font-medium leading-tight text-foreground`,children:e.title||`Untitled plan`}),(0,P.jsxs)(`span`,{className:`block truncate text-[10px] leading-tight text-muted-foreground`,children:[i,` · updated `,d(s,e.updatedAt)]})]}),e.completion&&(0,P.jsx)(I,{completion:e.completion})]})},e.id)})})}function z(e){return new Map((e.dispatch?.slots??[]).flatMap(e=>e.runId?[[e.taskId,e.runId]]:[]))}function B({runId:e,label:n,className:r}){let i=l(e=>e.showWorkflowRun);return(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void i(e),title:`Open workflow run ${e}`,"aria-label":`Open workflow run ${e}`,className:t(`wf-marker inline-flex min-w-0 items-center gap-0.5 rounded-sm border border-border/70 px-1 py-px text-[9px] font-medium text-muted-foreground hover:text-foreground`,r),children:[(0,P.jsx)(T,{className:`h-2.5 w-2.5 shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:n??e})]})}function ae({plan:e}){let t=e.dispatch;if(!t)return null;let n=t.slots.filter(e=>A(e.status)).length;return(0,P.jsxs)(`div`,{"data-testid":`plan-dispatch`,className:`mb-2 flex flex-wrap items-center gap-1.5 text-[10px] text-muted-foreground`,children:[(0,P.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`Autopilot `,t.state]}),(0,P.jsxs)(`span`,{children:[n,`/`,t.concurrency,` running`]}),t.slots.filter(e=>e.ciBlock).map(e=>(0,P.jsxs)(`span`,{className:`text-tone-warning-fg`,title:e.ciBlock.sha,children:[`T`,e.taskId,` CI blocked · `,e.ciBlock.sha.slice(0,12),` · `,e.ciBlock.incidentIds.join(`, `),` · `,e.ciBlock.retriedAt===void 0?`retry on clearance`:`exact SHA retried; awaiting pass`]},e.taskId)),t.audit&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`audit T`,t.audit.taskId,t.audit.verdict?` · ${t.audit.verdict}`:``,t.audit.runId&&(0,P.jsx)(B,{runId:t.audit.runId,label:`audit run`})]})]})}var V=4,H={satisfied:`text-tone-success-fg`,waiting:`text-tone-warning-fg`,unreachable:`text-tone-danger-fg`};function U(e){return e.verdict.state===`unreachable`?`unreachable · ${e.verdict.reason}`:e.verdict.state}function W({entry:e,now:n,nodeLabels:r}){let i=l(e=>e.openTaskDetailById),a=e.waitingSince===void 0?``:f(n,e.waitingSince);return(0,P.jsxs)(`li`,{"data-testid":`plan-external`,"data-verdict":e.verdict.state,title:e.projectId?`Project ${e.projectId}`:void 0,className:`min-w-0 rounded-md border border-dashed border-border bg-background/60 px-2 py-1.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(e.taskId),className:`flex w-full min-w-0 items-baseline gap-1.5 text-left`,title:`Open T${e.taskId}`,children:[(0,P.jsxs)(`span`,{className:`shrink-0 text-[11px] font-semibold tabular-nums text-foreground`,children:[`T`,e.taskId]}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-muted-foreground`,children:e.title??`title hidden`})]}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`font-medium`,H[e.verdict.state]),children:U(e)}),(0,P.jsxs)(`span`,{children:[`stage `,e.stage]}),(0,P.jsxs)(`span`,{children:[`needs `,e.requiredStage]}),a&&(0,P.jsxs)(`span`,{title:`How long this plan has waited on it`,children:[`waiting `,a]}),(0,P.jsxs)(`span`,{className:`truncate`,children:[`→ `,e.dependents.map(e=>r.get(e)??e).join(`, `)]})]})]})}function G({plan:e}){let[t,n]=(0,j.useState)(!1),r=a(e=>e.now),i=e.external;if(!i?.length)return null;let o=e.externalCount??i.length,s=t?i:i.slice(0,V),c=new Map(e.nodes.map(e=>[e.id,e.label])),l=i.length-s.length,u=o-i.length;return(0,P.jsxs)(`div`,{"data-testid":`plan-externals`,className:`mb-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3`}),(0,P.jsxs)(`span`,{children:[`Waits on other work (`,o,`)`]})]}),(0,P.jsx)(`ul`,{className:`grid gap-1.5 sm:grid-cols-2`,children:s.map(e=>(0,P.jsx)(W,{entry:e,now:r,nodeLabels:c},e.taskId))}),(l>0||t&&i.length>V||u>0)&&(0,P.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(l>0||t)&&i.length>V&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(!t),"aria-expanded":t,className:`rounded border border-border bg-muted/30 px-1.5 py-0.5 font-medium hover:bg-muted/50 hover:text-foreground`,children:t?`Show fewer`:`+ ${l} more`}),u>0&&(0,P.jsxs)(`span`,{children:[u,` more not listed`]})]})]})}var K=196,q=84,J=52,Y=16,X=14,Z=[`landed`,`in-progress`,`pending`,`blocked`],Q={landed:{label:`landed`,dot:`bg-tone-success`,accent:`border-l-tone-success`,text:`text-tone-success-fg`,wire:`#34d399`},"in-progress":{label:`in progress`,dot:`bg-tone-sky`,accent:`border-l-tone-sky`,text:`text-tone-sky-fg`,wire:`#38bdf8`},pending:{label:`pending`,dot:`bg-tone-warning`,accent:`border-l-tone-warning`,text:`text-tone-warning-fg`,wire:`#fbbf24`},blocked:{label:`blocked`,dot:`bg-tone-danger`,accent:`border-l-tone-danger`,text:`text-tone-danger-fg`,wire:`#f87171`}},oe=new Set([...u,`completed`]);function $(e){return oe.has(e.status)}function se(e,t){return t?e:e.filter(e=>!$(e))}function ce(e){return e?e.label||(e.policyName?`policy:${e.policyName}`:e.agentId||``):``}function le({owner:e}){let t=l(t=>e?.agentId?t.agentsById[e.agentId]:void 0),n=ce(e);return!t&&!n?null:(0,P.jsx)(O,{agent:t,fallback:n,className:`text-[10px] text-muted-foreground`})}function ue(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=new Map(e.nodes.map((e,t)=>[e.id,t])),r=new Map,i=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.edges)!t.has(n.from)||!t.has(n.to)||(r.set(n.from,[...r.get(n.from)??[],n.to]),i.set(n.to,(i.get(n.to)??0)+1));let a=new Map(e.nodes.map(e=>[e.id,0])),o=e.nodes.filter(e=>(i.get(e.id)??0)===0).map(e=>e.id),s=new Set;for(;o.length;){let e=o.shift();s.add(e);let t=a.get(e)??0;for(let n of r.get(e)??[])a.set(n,Math.max(a.get(n)??0,t+1)),i.set(n,(i.get(n)??0)-1),(i.get(n)??0)===0&&o.push(n)}let c=Math.max(0,...Array.from(a.values()))+1;for(let t of e.nodes)s.has(t.id)||a.set(t.id,c++);let l=new Map;for(let t of e.nodes){let e=a.get(t.id)??0;l.set(e,[...l.get(e)??[],t])}let u=[...l.entries()].sort(([e],[t])=>e-t),d=Math.max(1,...u.map(([,e])=>e.length)),f=[];u.forEach(([e,t],r)=>{let i=[...t].sort((e,t)=>(e.lane||``).localeCompare(t.lane||``)||(n.get(e.id)??0)-(n.get(t.id)??0)),a=(d-i.length)*100/2;i.forEach((t,n)=>{f.push({node:t,layer:e,x:X+r*248,y:X+a+n*100})})});let p=u.length;return{nodes:f,width:Math.max(320,X*2+p*K+Math.max(0,p-1)*J),height:Math.max(112,X*2+d*q+Math.max(0,d-1)*Y)}}function de(e,t){let n=e.x+K,r=e.y+q/2,i=t.x,a=t.y+q/2,o=n+Math.max(20,(i-n)/2);return`M ${n} ${r} C ${o} ${r}, ${o} ${a}, ${i} ${a}`}function fe({threadId:e,teamId:n,channel:r}){let i=n?s(n,r):e?o(e,r):``,a=l(e=>n?c(e,i):i?e.plansByThread[i]:null),u=l(e=>n?e.planListsByTeam[i]?.plans:void 0),d=l(e=>e.fetchPlan),f=l(e=>e.fetchTeamPlanList),p=l(e=>e.chooseTeamPlan),[m,h]=(0,j.useState)(!1),g=(0,j.useId)(),_=l(e=>e.setPlanArchived),v=l(e=>e.planCollapsed),b=l(e=>e.setPlanCollapsed),w=l(e=>e.issueRefsById),T=l(e=>e.deliverableTasks),E=l(e=>e.openTaskDetailById),O=N(),[k,A]=(0,j.useState)(!1),M=v??O;(0,j.useEffect)(()=>{if(n){d({teamId:n,channel:r}),f({teamId:n,channel:r});return}e&&d({threadId:e,channel:r})},[r,d,f,n,e]);let F=(0,j.useMemo)(()=>a?ue(a):null,[a]),L=(0,j.useMemo)(()=>a?z(a):new Map,[a]),V=(0,j.useMemo)(()=>new Map(F?.nodes.map(e=>[e.node.id,e])??[]),[F]),H=(0,j.useMemo)(()=>{if(!a)return[];let e=new Map;for(let t of a.nodes)e.set(t.status,(e.get(t.status)??0)+1);return Z.filter(t=>e.has(t)).map(t=>({status:t,count:e.get(t)??0}))},[a]);if(!a||!F)return null;if(a.archived&&!k)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`flex min-w-0 items-center gap-2 text-left text-muted-foreground hover:text-foreground`,"aria-expanded":`false`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold uppercase tracking-wider`,children:`Show archived plan (1)`}),(0,P.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`})]})});if(a.archived)return(0,P.jsx)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(y,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-muted-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:`Archived plan`})]}),(0,P.jsx)(`span`,{className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:`archived`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>A(!1),className:`shrink-0 rounded border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground`,"aria-expanded":`true`,children:`Hide`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!1),title:`Unarchive plan`,"aria-label":`Unarchive plan`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(ee,{className:`h-3.5 w-3.5`})})]})});let U=a.nodes.length,W=H.find(e=>e.status===`landed`)?.count??0,J=`${U} node${U===1?``:`s`}${W>0?` · ${W} landed`:``}`,Y=n&&u&&u.length>1?u:null,X=!!(Y&&m);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsx)(ne,{plan:a,onArchive:()=>void _(a.id,!0)}),(0,P.jsx)(ae,{plan:a}),(0,P.jsxs)(`div`,{className:t(`flex min-w-0 items-center gap-2`,(!M||X)&&`mb-2`),children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(te,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-foreground`,children:a.title||`Plan`}),(0,P.jsx)(`div`,{className:`truncate text-[11px] leading-tight text-muted-foreground`,children:M?J:a.objective||J})]})]}),H.length>0&&(0,P.jsx)(`div`,{className:`hidden shrink-0 items-center gap-2.5 sm:flex`,children:H.map(({status:e,count:n})=>(0,P.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 rounded-full`,Q[e].dot)}),(0,P.jsx)(`span`,{className:t(`font-medium tabular-nums`,Q[e].text),children:n}),(0,P.jsx)(`span`,{children:Q[e].label})]},e))}),a.completion&&(0,P.jsx)(I,{completion:a.completion}),Y&&(0,P.jsx)(ie,{listId:g,plans:Y,shownId:a.id,open:m,onToggle:()=>h(!m)}),(0,P.jsxs)(`span`,{className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,children:[`v`,a.version]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _(a.id,!0),title:`Archive plan`,"aria-label":`Archive plan`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:(0,P.jsx)(y,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>b(!M),"aria-expanded":!M,"aria-label":M?`Expand plan graph`:`Collapse plan graph`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:M?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),Y&&X&&(0,P.jsx)(R,{listId:g,className:M?void 0:`mb-2`,plans:Y,shownId:a.id,onChoose:e=>{h(!1),p({teamId:n,channel:r},e)}}),!M&&(0,P.jsx)(G,{plan:a}),M?null:a.nodes.length===0?(0,P.jsx)(`div`,{className:`rounded-md border border-dashed border-border px-3 py-3 text-center text-xs text-muted-foreground`,children:`No nodes yet — the plan graph fills in as the team is composed.`}):(0,P.jsx)(`div`,{className:`max-h-[min(46vh,360px)] overflow-auto`,children:(0,P.jsxs)(`div`,{className:`relative`,style:{width:F.width,height:F.height},children:[(0,P.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0`,width:F.width,height:F.height,"aria-hidden":`true`,children:[(0,P.jsx)(`defs`,{children:Z.map(e=>(0,P.jsx)(`marker`,{id:`plan-arrow-${e}`,viewBox:`0 0 8 8`,refX:`6.5`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,P.jsx)(`path`,{d:`M0 0 L8 4 L0 8 z`,fill:Q[e].wire})},e))}),a.edges.map(e=>{let t=V.get(e.from),n=V.get(e.to);if(!t||!n)return null;let r=Q[t.node.status];return(0,P.jsx)(`path`,{d:de(t,n),stroke:r.wire,strokeOpacity:.7,strokeWidth:2,fill:`none`,strokeLinecap:`round`,markerEnd:`url(#plan-arrow-${t.node.status})`},`${e.from}->${e.to}`)})]}),F.nodes.map(({node:e,x:n,y:r})=>{let i=Q[e.status],a=e.refs?.issueId?w[e.refs.issueId]:null,o=e.refs?.taskId?parseInt(e.refs.taskId,10):null,s=o==null?void 0:T.find(e=>e.id===o)?.title,c=o==null?void 0:L.get(o);return(0,P.jsxs)(`article`,{className:t(`group absolute flex flex-col justify-between rounded-md border border-l-[3px] bg-background/95 p-2`,`shadow-sm transition-all hover:-translate-y-px hover:border-border hover:shadow-md hover:bg-background`,i.accent),style:{left:n,top:r,width:K,height:q},title:e.scopeBlurb||e.label,children:[(0,P.jsx)(`div`,{className:`truncate text-xs font-semibold leading-tight text-foreground`,children:e.label}),(e.scopeBlurb||e.id)&&(0,P.jsx)(`div`,{className:`truncate text-[10px] leading-tight text-muted-foreground`,children:e.scopeBlurb||e.id}),(a||o!=null)&&(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-1`,children:[a&&(0,P.jsx)(C,{issueRef:a,compact:!0,className:`max-w-full`}),o!=null&&(0,P.jsx)(D,{id:o,title:s,onClick:()=>E(o),className:`max-w-full`}),c&&(0,P.jsx)(B,{runId:c,label:`run`})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1.5`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,P.jsx)(`span`,{className:t(`h-1.5 w-1.5 shrink-0 rounded-full`,i.dot)}),(0,P.jsx)(`span`,{className:t(`text-[10px] font-medium`,i.text),children:i.label})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,P.jsx)(le,{owner:e.ownerRef}),e.lane&&(0,P.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted/70 px-1 py-px text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.lane})]})]})]},e.id)})]})}),!M&&(0,P.jsx)(re,{plan:a})]})}function pe({agentId:e}){let n=l(e=>e.openTaskDetailById),r=l(e=>e.sessionTasksCollapsed),i=l(e=>e.setSessionTasksCollapsed),a=l(e=>e.deliverableTasks),[o,s]=(0,j.useState)([]),[c,u]=(0,j.useState)(!1);(0,j.useEffect)(()=>{let t=!1;return h(`GET`,`/task-entities?createdBy=`+encodeURIComponent(e)+`&limit=500`).then(e=>{t||s(e)}).catch(()=>{}),()=>{t=!0}},[e]);let d=new Map(o.map(e=>[e.id,e]));for(let t of a)t.createdBy===e&&(!d.has(t.id)||Number(t.updatedAt)>=Number(d.get(t.id).updatedAt))&&d.set(t.id,t);let f=[...d.values()];if(f.length===0)return null;let p=f.filter($).length,m=se(f,c);return(0,P.jsxs)(`section`,{className:`shrink-0 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":!r,"aria-label":r?`Expand session tasks`:`Collapse session tasks`,className:t(`flex w-full min-w-0 items-center gap-2 text-left`,!r&&`mb-1.5`),children:[(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted/60`,children:(0,P.jsx)(v,{className:`h-3 w-3 text-muted-foreground`})}),(0,P.jsxs)(`span`,{className:`flex-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Tasks from this session (`,m.length,`)`]}),(0,P.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted/60 hover:text-foreground`,children:r?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(S,{className:`h-3.5 w-3.5`})})]}),!r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(me,{tasks:m,onOpen:n}),p>0&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>u(!c),className:`mt-1.5 rounded border border-border bg-muted/30 px-2 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground`,"aria-pressed":c,children:c?`Hide ${p} closed`:`+ ${p} closed`})]})]})}function me({tasks:e,onOpen:t}){return(0,P.jsx)(`div`,{className:`space-y-2`,children:[{label:`In progress`,tasks:e.filter(e=>e.status===`in_progress`||e.status===`claimed`)},{label:`Needs validation`,tasks:e.filter(e=>e.status===`validating`)},{label:`Waiting`,tasks:e.filter(e=>![`in_progress`,`claimed`,`validating`].includes(e.status)&&!$(e))},{label:`Closed`,tasks:e.filter($)}].filter(e=>e.tasks.length).map(e=>(0,P.jsxs)(`section`,{"aria-label":e.label,children:[(0,P.jsxs)(`h3`,{className:`mb-1 text-[10px] text-muted-foreground`,children:[e.label,` (`,e.tasks.length,`)`]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tasks.map(e=>(0,P.jsx)(D,{id:e.id,title:e.title,status:e.status,onClick:()=>t(e.id),compact:!0},e.id))})]},e.label))})}export{pe as n,N as r,fe as t};
2
+ //# sourceMappingURL=PlanGraphPanel-Dqiroy06.js.map
@@ -1,5 +1,5 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{d as a,t as o}from"./store-DcClXLH0.js";import{O as s,S as c,y as l}from"./provider-display-DsuWMvVL.js";import{B as u,E as d,F as f,W as p,Y as m,_ as h,f as g,j as _,mt as v,tt as y,z as b}from"./display-BrKWFGJz.js";import{n as x,t as S}from"./radio-Bn0_qc0G.js";import{t as C}from"./brain-CagXMEKE.js";import{t as w}from"./check-B3M9Ug1P.js";import{t as T}from"./chevron-down-BoG3JCZn.js";import{t as E}from"./chevron-right-iljytE0x.js";import{t as D}from"./chevron-up-Bv3yC5ma.js";import{t as O}from"./circle-alert-CryagaZd.js";import{t as k}from"./circle-check-CkUkN96J.js";import{t as ee}from"./circle-UESLMi2-.js";import{t as te}from"./clock-BWPPBh1_.js";import{t as ne}from"./file-pen-Crunre5f.js";import{t as A}from"./file-text-CKuoMR2U.js";import{t as re}from"./list-checks-CwnS3hly.js";import{t as ie}from"./plus-D5Ek4e2S.js";import{t as ae}from"./plug-vIyO9_P8.js";import{t as oe}from"./search-DjzbnTbf.js";import{t as se}from"./sparkles-CzwR10ZU.js";import{t as ce}from"./agent-type-icon-LrUEU3lB.js";import{t as le}from"./users-C7B3u9jv.js";import{t as j}from"./wrench-C7-4CgnY.js";import{t as ue}from"./agent-name-DKbiIhBo.js";import{t as de}from"./code-preview-p1NnmqK0.js";import{t as M}from"./formatted-body-CQBwc1fb.js";var fe=t(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),N=t(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),pe=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),me=t(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),he=t(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ge=t(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),P=t(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),F=t(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),I=t(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),L=e(r(),1);function _e(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function ve(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function ye(e,t){return e.filter(e=>e.status===`online`&&p(t,e.baseDir)).sort((e,t)=>b(t.baseDir).length-b(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function be(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function xe(){return typeof window<`u`&&!!window.getSelection()?.toString()}function Se(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var Ce=[`👍`,`❤️`,`✅`,`👀`];function we(e,t=v){let n=new Map;for(let r of e.reactions||[]){let e=u(r.emoji),i=n.get(e)??{emoji:e,count:0,mine:!1,actors:[]};i.count+=1,i.mine=i.mine||r.actorId===t,i.actors.push(r.actorId),n.set(e,i)}return[...n.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function Te(e){return _(e)}function Ee(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>!s(e));if(i||a){let e=i?r:n.find(e=>!s(e));return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:N}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:N};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:te};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:O}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:w}}function De(e){let t=y(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,y(t.updatedAt||t.createdAt)),t)}function Oe(e){return e?e.messages.reduce((e,t)=>Math.max(e,De(t)),0):0}function ke(e,t,n){return(e-t)*n}function Ae(e){if(!e)return 0;let t=0;for(let n of e.messages)d(n)&&(t=Math.max(t,y(n.createdAt)));return t}function R(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function je(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Me(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let o=i.filter(e=>e.threadId).reverse(),s=o.find(e=>!!r[a(e.threadId,e.channel)])??o[0];return s?.threadId?{threadId:s.threadId,...s.channel?{channel:s.channel}:{}}:null}var Ne={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},Pe=new Set(Object.keys(Ne)),Fe=3e3;function z(e){return new Date(e.occurredAt??e.createdAt).getTime()}function B(e){return typeof e.seq==`number`&&Number.isFinite(e.seq)?e.seq:void 0}function Ie(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:z(e),turnId:typeof t.turnId==`string`?t.turnId:void 0,...t.type===`tool`?{category:t.toolCategory??`generic`,...t.status===`running`||t.status===`completed`||t.status===`failed`||t.status===`cancelled`?{status:t.status}:{},...t.params===void 0?{}:{params:t.params}}:{}}}function Le(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:z(e)}}function Re(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`relay-injection`)return null;let n=t.relayInjection&&typeof t.relayInjection==`object`&&!Array.isArray(t.relayInjection)?t.relayInjection:{},r=c(n.category)?n.category:`context`,i=typeof n.timestamp==`number`&&Number.isFinite(n.timestamp)?n.timestamp:z(e),a=n.detail&&typeof n.detail==`object`&&!Array.isArray(n.detail)?n.detail:{};return{id:e.id,category:r,summary:typeof n.summary==`string`&&n.summary.trim()?n.summary:e.body,detail:a,agentId:typeof n.agentId==`string`&&n.agentId?n.agentId:e.from,timestamp:i}}function ze(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`prompt-resolution`)return null;let n=t.promptResolution&&typeof t.promptResolution==`object`&&!Array.isArray(t.promptResolution)?t.promptResolution:{},r=n.kind===`questions`||n.kind===`plan`||n.kind===`command`||n.kind===`tool`?n.kind:`tool`,i=typeof n.title==`string`&&n.title.trim()?n.title:`Prompt resolved`,a=typeof n.decisionLabel==`string`&&n.decisionLabel.trim()?n.decisionLabel:typeof t.label==`string`&&t.label.trim()?t.label:`Resolved`,o=n.answers&&typeof n.answers==`object`&&!Array.isArray(n.answers)?n.answers:{};return{id:e.id,title:i,kind:r,body:typeof n.promptBody==`string`?n.promptBody:typeof n.body==`string`?n.body:e.body,toolName:typeof n.toolName==`string`&&n.toolName.trim()?n.toolName:i,decisionLabel:a,questions:Be(n.questions,o,a),timestamp:z(e)}}function Be(e,t,n){let r=(Array.isArray(e)?e:[]).map((e,r)=>{let i=e&&typeof e==`object`&&!Array.isArray(e)?e:{},a=typeof i.question==`string`&&i.question.trim()?i.question.trim():typeof i.header==`string`&&i.header.trim()?i.header.trim():`Question ${r+1}`,o=t[a]??t[String(i.question??``)]??t[String(i.header??``)];return{question:a,answer:typeof o==`string`&&o.trim()?o.trim():n}});return r.length?r:Object.entries(t).map(([e,t])=>({question:e,answer:t}))}function V(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function H(e){return e.kind===`system`&&e.from===`system`}var Ve=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function U(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function He(e){let t=e.filter(e=>Pe.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=Fe)||n.push(e);return n}function Ue(e){if(!l(e.payload))return null;let{windowId:t,groupOrder:n,source:r}=e.payload.finality,i=e.payload.session??e.payload.responseCapture;return{msg:e,windowId:t,groupOrder:n,source:r,confidence:i?.confidence===`definitive`||i?.confidence===`reconstructed`?i.confidence:void 0}}function We(e){let t=new Map;if(e.forEach((e,n)=>{if(e.type!==`message`)return;let r=Ue(e.msg);if(!r)return;let i=t.get(r.windowId)??[];i.push(n),t.set(r.windowId,i)}),t.size===0)return e;let n=new Map,r=new Set;for(let[i,a]of t){let t=new Set(a.map(t=>e[t].msg.id)),o=a.filter(n=>{let r=e[n].msg.sourceMessageId;return!(typeof r==`number`&&t.has(r))}),s=o.length>0?o:a,c=s.map(t=>Ue(e[t].msg)).sort((e,t)=>e.groupOrder-t.groupOrder),l=Math.min(...s),u=Math.min(...s.map(t=>z(e[t].msg)));n.set(l,{type:`work-final`,keyMessageId:e[l].msg.id,windowId:i,members:c,timestamp:u});for(let e of a)e!==l&&r.add(e)}let i=[];return e.forEach((e,t)=>{r.has(t)||i.push(n.get(t)??e)}),i}function Ge(e,t,n,r=[],i){let a=i?.historyStart!==!1,o=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,y(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;o.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)o.push({ts:y(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&o.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;o.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let c=i?.spawnedBy?.agentId,u=null,d=1/0;if(a)for(let t of e){if(t.id<0||t.kind===`session`||H(t)||_(t)||!(s(t.from)||c!==void 0&&t.from===c)||!f(t).trim())continue;let e=z(t);e<d&&(d=e,u=t.id)}let p=new Map,h=new Map,g=[],v=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n={id:t.id,body:t.body.trim()},r=h.get(e.turnId)??[];r.push(n),h.set(e.turnId,r),g.push(n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=p.get(e.turnId)??[];n.push(t.body.trim()),p.set(e.turnId,n)}}let b=new Map;for(let[e,t]of p){let n=(h.get(e)??[]).map(e=>e.body);b.set(e,t.map(e=>V(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=V(t.body,(h.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&v.set(t.id,n)}let x=new Set;for(let[e,t]of b){let n=h.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!x.has(r.id)&&m(e,r.body)){x.add(r.id);break}}}let S=[],C=new Map;for(let t of e){if(!l(t.payload))continue;let e=f(t).trim();if(!e)continue;S.push(e);let n=C.get(t.from)??new Set;n.add(e),C.set(t.from,n)}for(let e of g)x.has(e.id)||S.some(t=>m(t,e.body))&&x.add(e.id);let w=new Map,T=[];for(let t of e){if(i?.include&&t.id!==u&&!i.include(t))continue;if(H(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(Ve.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=z(t);if(!r){o.push({ts:i,seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let a=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=w.get(r);if(s)s.entry.status=a,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i,s.seq=B(t),s.id=t.id;else{let e={ts:i,seq:B(t),id:t.id,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:a,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};w.set(r,e),o.push(e)}continue}o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let e=Le(t);if(e){T.push(e);continue}let n=Ie(t);if(n){if(n.kind===`narration`&&x.has(n.id))continue;o.push({ts:n.ts,seq:B(t),id:t.id,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}let r=Re(t);if(r){o.push({ts:r.timestamp,seq:B(t),id:t.id,entry:{type:`relay-injection`,event:r}});continue}let a=ze(t);if(a){o.push({ts:a.timestamp,seq:B(t),id:t.id,entry:{type:`prompt-resolution`,event:a}});continue}if(!l(t.payload)&&C.get(t.from)?.has(f(t).trim()))continue;if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`&&!l(t.payload)){let e=v.get(t.id);if(e&&e!==t.body){o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`message`,msg:{...t,body:e}}});continue}}}let s=t.id===u?`initial-prompt`:`message`;o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:s,msg:t}})}for(let e of He([...t,...T]))o.push({ts:e.timestamp,entry:{type:`status`,event:e}});for(let e of i?.effortChanges??[])o.push({ts:e.at,entry:{type:`effort-change`,change:e}});let E={created:0,date:1,"import-boundary":2,"imported-message":3,"initial-prompt":4,message:4,activity:4,notice:4,"agent-action":4,"relay-injection":4,"prompt-resolution":4,status:5,"effort-change":4,"work-final":4};o.sort((e,t)=>{let n=e.ts-t.ts;return n===0?e.seq!==void 0&&t.seq!==void 0&&e.seq!==t.seq?e.seq-t.seq:E[e.entry.type]-E[t.entry.type]||(e.id??0)-(t.id??0):n});let D=a?0:o.findIndex(e=>e.id!==void 0),O=[],k=a||D<0?``:U(o[D].ts);for(let{ts:e,entry:t}of D<0?[]:o.slice(D,i?.historyEnd===!1?o.map(e=>e.id!==void 0).lastIndexOf(!0)+1:o.length)){if(t.type===`created`){O.push(t);continue}let n=U(e);if(n!==k&&(O.push({type:`date`,date:n,timestamp:e}),k=n),t.type===`activity`){let e=O[O.length-1];if(e&&e.type===`activity`&&Qe(e,t)){e.steps.push(...t.steps);continue}}O.push(t)}return We(O)}function W(e){return e.type===`message`||e.type===`initial-prompt`?`msg-${e.msg.id}`:e.type===`notice`?`notice-${e.msg.id}`:e.type===`relay-injection`?`relay-injection-${e.event.id}`:e.type===`prompt-resolution`?`prompt-resolution-${e.event.id}`:e.type===`agent-action`?`agent-action-${e.direction}-${e.agentId}`:e.type===`activity`?`act-${e.steps[0]?.id??e.timestamp}`:e.type===`import-boundary`?`import-${e.history.id}`:e.type===`imported-message`?`import-msg-${e.history.id}-${e.entry.originalMessageId}-${e.entry.position}`:e.type===`status`?`status-${e.event.id}`:e.type===`effort-change`?`effort-${e.change.commandId}`:e.type===`date`?`date-${e.date}`:e.type===`work-final`?`msg-${e.keyMessageId??Math.min(...e.members.map(e=>e.msg.id))}`:`created-${e.timestamp}`}function Ke(e,t){if(e===t)return!0;if(e.type!==t.type)return!1;switch(e.type){case`message`:case`initial-prompt`:case`notice`:return e.msg===t.msg;case`relay-injection`:return e.event===t.event;case`prompt-resolution`:return e.event===t.event;case`agent-action`:{let n=t;return e.direction===n.direction&&e.agentId===n.agentId&&e.provider===n.provider&&e.status===n.status&&e.reason===n.reason&&e.timestamp===n.timestamp}case`activity`:{let n=t;return e.steps===n.steps&&e.timestamp===n.timestamp}case`import-boundary`:{let n=t;return e.history===n.history&&e.timestamp===n.timestamp}case`imported-message`:{let n=t;return e.history===n.history&&e.entry===n.entry}case`status`:return e.event===t.event;case`effort-change`:return e.change===t.change;case`date`:{let n=t;return e.date===n.date&&e.timestamp===n.timestamp}case`created`:return e.timestamp===t.timestamp;case`work-final`:{let n=t;return e.windowId===n.windowId&&e.members===n.members&&e.timestamp===n.timestamp}}}function qe(e){return e.type===`initial-prompt`?[`initprompt-${e.msg.id}`]:e.type===`work-final`?[`work-final-${e.windowId}`]:[]}function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Je(e){if(e.type===`message`||e.type===`initial-prompt`||e.type===`notice`){let t=G(e.msg.id);return t===null?[]:[t]}if(e.type===`relay-injection`||e.type===`prompt-resolution`)return[e.event.id];if(e.type===`activity`)return e.steps.map(e=>e.id).filter(Number.isFinite);if(e.type===`imported-message`){let t=G(e.entry.message?.id);return t===null?[]:[t]}return e.type===`work-final`?e.members.map(e=>e.msg.id).filter(e=>G(e)!==null):[]}function K(e){let t=Je(e);return t.length?{messageId:Math.min(...t),endMessageId:Math.max(...t)}:null}function Ye(e,t,n){let r=[...t].sort((e,t)=>e.dataIndex-t.dataIndex),i=r.findIndex(e=>e.bottom>n+1);if(i<0)return null;let a=t=>e[r[t].dataIndex],o=e=>{let t=a(e);return!!t&&K(t)!==null},s=-1;o(i)&&(s=i);for(let e=i-1;s<0&&e>=0;--e)o(e)&&(s=e);for(let e=i+1;s<0&&e<r.length;e+=1)o(e)&&(s=e);if(s<0){let e=a(i);return{topKey:e?W(e):null,offset:Math.max(0,Math.round(n-r[i].top))}}let c=a(s),l=K(c);return{topKey:W(c),anchorMessageId:l.messageId,anchorEndMessageId:l.endMessageId,offset:Math.round(n-r[s].top)}}function Xe(e,t){let n=G(t.messageId);if(n!==null){let r=G(t.endMessageId),i=r!==null&&r>=n?r:n,a=-1,o=-1/0;for(let t=0;t<e.length;t+=1){let r=Je(e[t]);if(r.some(e=>e>=n&&e<=i))return t;let s=r.filter(e=>e<=n).sort((e,t)=>t-e)[0];s!==void 0&&s>o&&(o=s,a=t)}if(a>=0)return a}if(t.topKey){let n=e.findIndex(e=>W(e)===t.topKey||qe(e).includes(t.topKey));if(n>=0)return n}return-1}function Ze(e){return e.type===`message`||e.type===`initial-prompt`||e.type===`notice`?(e.msg.subject?`${e.msg.subject} `:``)+f(e.msg):e.type===`imported-message`?f(e.entry.message):e.type===`activity`?e.steps.map(e=>[e.label,e.text].filter(Boolean).join(` `)).join(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{d as a,t as o}from"./store-DKPDIZBe.js";import{O as s,S as c,y as l}from"./provider-display-BEeLXC_D.js";import{B as u,E as d,F as f,W as p,Y as m,_ as h,f as g,j as _,mt as v,tt as y,z as b}from"./display-CDeH4I8T.js";import{n as x,t as S}from"./radio-Bn0_qc0G.js";import{t as C}from"./brain-CagXMEKE.js";import{t as w}from"./check-B3M9Ug1P.js";import{t as T}from"./chevron-down-BoG3JCZn.js";import{t as E}from"./chevron-right-iljytE0x.js";import{t as D}from"./chevron-up-Bv3yC5ma.js";import{t as O}from"./circle-alert-CryagaZd.js";import{t as k}from"./circle-check-CkUkN96J.js";import{t as ee}from"./circle-UESLMi2-.js";import{t as te}from"./clock-BWPPBh1_.js";import{t as ne}from"./file-pen-Crunre5f.js";import{t as A}from"./file-text-CKuoMR2U.js";import{t as re}from"./list-checks-CwnS3hly.js";import{t as ie}from"./plus-D5Ek4e2S.js";import{t as ae}from"./plug-vIyO9_P8.js";import{t as oe}from"./search-DjzbnTbf.js";import{t as se}from"./sparkles-CzwR10ZU.js";import{t as ce}from"./agent-type-icon-CY113sp-.js";import{t as le}from"./users-C7B3u9jv.js";import{t as j}from"./wrench-C7-4CgnY.js";import{t as ue}from"./agent-name-CcY3Aijy.js";import{t as de}from"./code-preview-CzrZfr9U.js";import{t as M}from"./formatted-body-MLtodyPp.js";var fe=t(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),N=t(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),pe=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),me=t(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),he=t(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ge=t(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),P=t(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),F=t(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),I=t(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),L=e(r(),1);function _e(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function ve(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function ye(e,t){return e.filter(e=>e.status===`online`&&p(t,e.baseDir)).sort((e,t)=>b(t.baseDir).length-b(e.baseDir).length)[0]||e.find(e=>e.status===`online`)}function be(){return typeof window<`u`&&window.matchMedia(`(min-width: 1280px)`).matches}function xe(){return typeof window<`u`&&!!window.getSelection()?.toString()}function Se(e){let t=e.payload?.attachments;return Array.isArray(t)?t.filter(e=>!!(e&&typeof e==`object`&&typeof e.artifactId==`string`)):[]}var Ce=[`👍`,`❤️`,`✅`,`👀`];function we(e,t=v){let n=new Map;for(let r of e.reactions||[]){let e=u(r.emoji),i=n.get(e)??{emoji:e,count:0,mine:!1,actors:[]};i.count+=1,i.mine=i.mine||r.actorId===t,i.actors.push(r.actorId),n.set(e,i)}return[...n.values()].sort((e,t)=>t.count-e.count||e.emoji.localeCompare(t.emoji))}function Te(e){return _(e)}function Ee(e,t){let n=e.readBy||[],r=e.resolvedToAgent||t||e.to,i=r?n.includes(r):!1,a=n.some(e=>!s(e));if(i||a){let e=i?r:n.find(e=>!s(e));return{label:`read`,title:e?`Read by ${e}`:`Read by agent`,tone:`ok`,icon:N}}if(e.deliveryStatus===`delivered`)return{label:`delivered`,title:`Delivered to agent inbox`,tone:`ok`,icon:N};if(e.deliveryStatus===`queued`)return{label:`queued`,title:`Queued until the target agent is available`,tone:`warn`,icon:te};if(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`){let t=e.deliveryPoisonReason||e.deliveryLastError||e.deliveryStatus;return{label:e.deliveryStatus,title:t,tone:`danger`,icon:O}}return{label:`sent`,title:`Accepted by Relay`,tone:`muted`,icon:w}}function De(e){let t=y(e.createdAt);return(e.reactions||[]).reduce((e,t)=>Math.max(e,y(t.updatedAt||t.createdAt)),t)}function Oe(e){return e?e.messages.reduce((e,t)=>Math.max(e,De(t)),0):0}function ke(e,t,n){return(e-t)*n}function Ae(e){if(!e)return 0;let t=0;for(let n of e.messages)d(n)&&(t=Math.max(t,y(n.createdAt)));return t}function R(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function je(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Me(e,t,n,r){if(e?.teamId)return{teamId:e.teamId};let i=[...t];n&&!i.some(e=>e.id===n.id)&&i.push(n);let o=i.filter(e=>e.threadId).reverse(),s=o.find(e=>!!r[a(e.threadId,e.channel)])??o[0];return s?.threadId?{threadId:s.threadId,...s.channel?{channel:s.channel}:{}}:null}var Ne={online:`came online`,offline:`went offline`,shutdown:`shut down`,restarted:`restarted`,"compaction-requested":`compaction requested`,compacting:`compaction started`,compacted:`context compacted`,"compaction-stalled":`compaction stalled — may need manual intervention`,"clear-requested":`clear requested`,"clearing-context":`clear started`,"context-cleared":`context cleared`,"clear-stalled":`context clear stalled — may need manual intervention`,"shutting-down":`shutting down`},Pe=new Set(Object.keys(Ne)),Fe=3e3;function z(e){return new Date(e.occurredAt??e.createdAt).getTime()}function B(e){return typeof e.seq==`number`&&Number.isFinite(e.seq)?e.seq:void 0}function Ie(e){if(e.kind!==`session`)return null;let t=e.payload?.session;return!t||t.type!==`narration`&&t.type!==`reasoning`&&t.type!==`tool`?null:{id:e.id,kind:t.type,label:typeof t.label==`string`?t.label:void 0,text:e.body,ts:z(e),turnId:typeof t.turnId==`string`?t.turnId:void 0,...t.type===`tool`?{category:t.toolCategory??`generic`,...t.status===`running`||t.status===`completed`||t.status===`failed`||t.status===`cancelled`?{status:t.status}:{},...t.params===void 0?{}:{params:t.params}}:{}}}function Le(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`notice`)return null;let n=typeof t.label==`string`&&t.label?t.label:`compacted`;return{id:`notice-${e.id}`,status:n,timestamp:z(e)}}function Re(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`relay-injection`)return null;let n=t.relayInjection&&typeof t.relayInjection==`object`&&!Array.isArray(t.relayInjection)?t.relayInjection:{},r=c(n.category)?n.category:`context`,i=typeof n.timestamp==`number`&&Number.isFinite(n.timestamp)?n.timestamp:z(e),a=n.detail&&typeof n.detail==`object`&&!Array.isArray(n.detail)?n.detail:{};return{id:e.id,category:r,summary:typeof n.summary==`string`&&n.summary.trim()?n.summary:e.body,detail:a,agentId:typeof n.agentId==`string`&&n.agentId?n.agentId:e.from,timestamp:i}}function ze(e){if(e.kind!==`session`)return null;let t=e.payload?.session;if(t?.type!==`prompt-resolution`)return null;let n=t.promptResolution&&typeof t.promptResolution==`object`&&!Array.isArray(t.promptResolution)?t.promptResolution:{},r=n.kind===`questions`||n.kind===`plan`||n.kind===`command`||n.kind===`tool`?n.kind:`tool`,i=typeof n.title==`string`&&n.title.trim()?n.title:`Prompt resolved`,a=typeof n.decisionLabel==`string`&&n.decisionLabel.trim()?n.decisionLabel:typeof t.label==`string`&&t.label.trim()?t.label:`Resolved`,o=n.answers&&typeof n.answers==`object`&&!Array.isArray(n.answers)?n.answers:{};return{id:e.id,title:i,kind:r,body:typeof n.promptBody==`string`?n.promptBody:typeof n.body==`string`?n.body:e.body,toolName:typeof n.toolName==`string`&&n.toolName.trim()?n.toolName:i,decisionLabel:a,questions:Be(n.questions,o,a),timestamp:z(e)}}function Be(e,t,n){let r=(Array.isArray(e)?e:[]).map((e,r)=>{let i=e&&typeof e==`object`&&!Array.isArray(e)?e:{},a=typeof i.question==`string`&&i.question.trim()?i.question.trim():typeof i.header==`string`&&i.header.trim()?i.header.trim():`Question ${r+1}`,o=t[a]??t[String(i.question??``)]??t[String(i.header??``)];return{question:a,answer:typeof o==`string`&&o.trim()?o.trim():n}});return r.length?r:Object.entries(t).map(([e,t])=>({question:e,answer:t}))}function V(e,t){let n=e.trim();for(let e of t){let t=e.trim();if(t){if(n===t)break;n.startsWith(`${t}\n\n`)&&(n=n.slice(t.length+2).trimStart())}}return n.trim()||e.trim()}function H(e){return e.kind===`system`&&e.from===`system`}var Ve=new Set([`agent.ready`,`agent.exited`,`agent.spawn_failed`]);function U(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function He(e){let t=e.filter(e=>Pe.has(e.status)).slice().sort((e,t)=>e.timestamp-t.timestamp),n=[];for(let e of t)n.some(t=>t.id===e.id)||n.some(t=>t.status===e.status&&Math.abs(t.timestamp-e.timestamp)<=Fe)||n.push(e);return n}function Ue(e){if(!l(e.payload))return null;let{windowId:t,groupOrder:n,source:r}=e.payload.finality,i=e.payload.session??e.payload.responseCapture;return{msg:e,windowId:t,groupOrder:n,source:r,confidence:i?.confidence===`definitive`||i?.confidence===`reconstructed`?i.confidence:void 0}}function We(e){let t=new Map;if(e.forEach((e,n)=>{if(e.type!==`message`)return;let r=Ue(e.msg);if(!r)return;let i=t.get(r.windowId)??[];i.push(n),t.set(r.windowId,i)}),t.size===0)return e;let n=new Map,r=new Set;for(let[i,a]of t){let t=new Set(a.map(t=>e[t].msg.id)),o=a.filter(n=>{let r=e[n].msg.sourceMessageId;return!(typeof r==`number`&&t.has(r))}),s=o.length>0?o:a,c=s.map(t=>Ue(e[t].msg)).sort((e,t)=>e.groupOrder-t.groupOrder),l=Math.min(...s),u=Math.min(...s.map(t=>z(e[t].msg)));n.set(l,{type:`work-final`,keyMessageId:e[l].msg.id,windowId:i,members:c,timestamp:u});for(let e of a)e!==l&&r.add(e)}let i=[];return e.forEach((e,t)=>{r.has(t)||i.push(n.get(t)??e)}),i}function Ge(e,t,n,r=[],i){let a=i?.historyStart!==!1,o=[];for(let e of r){let t=e.entries.reduce((e,t)=>Math.min(e,y(t.originalCreatedAt)),1/0),n=Number.isFinite(t)?t-1:e.importedAt;o.push({ts:n,entry:{type:`import-boundary`,history:e,timestamp:n}});for(let t of e.entries)o.push({ts:y(t.originalCreatedAt),entry:{type:`imported-message`,history:e,entry:t}})}if(n){let e=new Date(n).getTime();Number.isFinite(e)&&o.push({ts:e,entry:{type:`created`,timestamp:e}})}if(i?.spawnedBy){let e=n?new Date(n).getTime():0,t=Number.isFinite(e)?e:0;o.push({ts:t,entry:{type:`agent-action`,direction:`spawned-by`,agentId:i.spawnedBy.agentId,provider:i.spawnedBy.provider,status:`ready`,timestamp:t}})}let c=i?.spawnedBy?.agentId,u=null,d=1/0;if(a)for(let t of e){if(t.id<0||t.kind===`session`||H(t)||_(t)||!(s(t.from)||c!==void 0&&t.from===c)||!f(t).trim())continue;let e=z(t);e<d&&(d=e,u=t.id)}let p=new Map,h=new Map,g=[],v=new Map;for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type===`narration`&&typeof e.turnId==`string`){let n={id:t.id,body:t.body.trim()},r=h.get(e.turnId)??[];r.push(n),h.set(e.turnId,r),g.push(n)}else if(e?.type===`response`&&typeof e.turnId==`string`){let n=p.get(e.turnId)??[];n.push(t.body.trim()),p.set(e.turnId,n)}}let b=new Map;for(let[e,t]of p){let n=(h.get(e)??[]).map(e=>e.body);b.set(e,t.map(e=>V(e,n)))}for(let t of e){if(t.kind!==`session`)continue;let e=t.payload?.session;if(e?.type!==`response`||typeof e.turnId!=`string`)continue;let n=V(t.body,(h.get(e.turnId)??[]).map(e=>e.body));n&&n!==t.body&&v.set(t.id,n)}let x=new Set;for(let[e,t]of b){let n=h.get(e)??[];for(let e of t)for(let t=n.length-1;t>=0;t--){let r=n[t];if(!x.has(r.id)&&m(e,r.body)){x.add(r.id);break}}}let S=[],C=new Map;for(let t of e){if(!l(t.payload))continue;let e=f(t).trim();if(!e)continue;S.push(e);let n=C.get(t.from)??new Set;n.add(e),C.set(t.from,n)}for(let e of g)x.has(e.id)||S.some(t=>m(t,e.body))&&x.add(e.id);let w=new Map,T=[];for(let t of e){if(i?.include&&t.id!==u&&!i.include(t))continue;if(H(t)){let e=typeof t.payload?.kind==`string`?t.payload.kind:``;if(Ve.has(e)){let n=t.payload,r=typeof n.agentId==`string`?n.agentId:``,i=z(t);if(!r){o.push({ts:i,seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let a=e===`agent.ready`?`ready`:e===`agent.exited`?`exited`:`failed`,s=w.get(r);if(s)s.entry.status=a,typeof n.reason==`string`&&(s.entry.reason=n.reason),s.entry.timestamp=i,s.ts=i,s.seq=B(t),s.id=t.id;else{let e={ts:i,seq:B(t),id:t.id,entry:{type:`agent-action`,direction:`spawned-child`,agentId:r,provider:typeof n.provider==`string`?n.provider:void 0,status:a,reason:typeof n.reason==`string`?n.reason:void 0,timestamp:i}};w.set(r,e),o.push(e)}continue}o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`notice`,msg:t}});continue}let e=Le(t);if(e){T.push(e);continue}let n=Ie(t);if(n){if(n.kind===`narration`&&x.has(n.id))continue;o.push({ts:n.ts,seq:B(t),id:t.id,entry:{type:`activity`,steps:[n],timestamp:n.ts}});continue}let r=Re(t);if(r){o.push({ts:r.timestamp,seq:B(t),id:t.id,entry:{type:`relay-injection`,event:r}});continue}let a=ze(t);if(a){o.push({ts:a.timestamp,seq:B(t),id:t.id,entry:{type:`prompt-resolution`,event:a}});continue}if(!l(t.payload)&&C.get(t.from)?.has(f(t).trim()))continue;if(t.kind===`session`){let e=t.payload?.session;if(e?.type===`response`&&typeof e.turnId==`string`&&!l(t.payload)){let e=v.get(t.id);if(e&&e!==t.body){o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:`message`,msg:{...t,body:e}}});continue}}}let s=t.id===u?`initial-prompt`:`message`;o.push({ts:z(t),seq:B(t),id:t.id,entry:{type:s,msg:t}})}for(let e of He([...t,...T]))o.push({ts:e.timestamp,entry:{type:`status`,event:e}});for(let e of i?.effortChanges??[])o.push({ts:e.at,entry:{type:`effort-change`,change:e}});let E={created:0,date:1,"import-boundary":2,"imported-message":3,"initial-prompt":4,message:4,activity:4,notice:4,"agent-action":4,"relay-injection":4,"prompt-resolution":4,status:5,"effort-change":4,"work-final":4};o.sort((e,t)=>{let n=e.ts-t.ts;return n===0?e.seq!==void 0&&t.seq!==void 0&&e.seq!==t.seq?e.seq-t.seq:E[e.entry.type]-E[t.entry.type]||(e.id??0)-(t.id??0):n});let D=a?0:o.findIndex(e=>e.id!==void 0),O=[],k=a||D<0?``:U(o[D].ts);for(let{ts:e,entry:t}of D<0?[]:o.slice(D,i?.historyEnd===!1?o.map(e=>e.id!==void 0).lastIndexOf(!0)+1:o.length)){if(t.type===`created`){O.push(t);continue}let n=U(e);if(n!==k&&(O.push({type:`date`,date:n,timestamp:e}),k=n),t.type===`activity`){let e=O[O.length-1];if(e&&e.type===`activity`&&Qe(e,t)){e.steps.push(...t.steps);continue}}O.push(t)}return We(O)}function W(e){return e.type===`message`||e.type===`initial-prompt`?`msg-${e.msg.id}`:e.type===`notice`?`notice-${e.msg.id}`:e.type===`relay-injection`?`relay-injection-${e.event.id}`:e.type===`prompt-resolution`?`prompt-resolution-${e.event.id}`:e.type===`agent-action`?`agent-action-${e.direction}-${e.agentId}`:e.type===`activity`?`act-${e.steps[0]?.id??e.timestamp}`:e.type===`import-boundary`?`import-${e.history.id}`:e.type===`imported-message`?`import-msg-${e.history.id}-${e.entry.originalMessageId}-${e.entry.position}`:e.type===`status`?`status-${e.event.id}`:e.type===`effort-change`?`effort-${e.change.commandId}`:e.type===`date`?`date-${e.date}`:e.type===`work-final`?`msg-${e.keyMessageId??Math.min(...e.members.map(e=>e.msg.id))}`:`created-${e.timestamp}`}function Ke(e,t){if(e===t)return!0;if(e.type!==t.type)return!1;switch(e.type){case`message`:case`initial-prompt`:case`notice`:return e.msg===t.msg;case`relay-injection`:return e.event===t.event;case`prompt-resolution`:return e.event===t.event;case`agent-action`:{let n=t;return e.direction===n.direction&&e.agentId===n.agentId&&e.provider===n.provider&&e.status===n.status&&e.reason===n.reason&&e.timestamp===n.timestamp}case`activity`:{let n=t;return e.steps===n.steps&&e.timestamp===n.timestamp}case`import-boundary`:{let n=t;return e.history===n.history&&e.timestamp===n.timestamp}case`imported-message`:{let n=t;return e.history===n.history&&e.entry===n.entry}case`status`:return e.event===t.event;case`effort-change`:return e.change===t.change;case`date`:{let n=t;return e.date===n.date&&e.timestamp===n.timestamp}case`created`:return e.timestamp===t.timestamp;case`work-final`:{let n=t;return e.windowId===n.windowId&&e.members===n.members&&e.timestamp===n.timestamp}}}function qe(e){return e.type===`initial-prompt`?[`initprompt-${e.msg.id}`]:e.type===`work-final`?[`work-final-${e.windowId}`]:[]}function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Je(e){if(e.type===`message`||e.type===`initial-prompt`||e.type===`notice`){let t=G(e.msg.id);return t===null?[]:[t]}if(e.type===`relay-injection`||e.type===`prompt-resolution`)return[e.event.id];if(e.type===`activity`)return e.steps.map(e=>e.id).filter(Number.isFinite);if(e.type===`imported-message`){let t=G(e.entry.message?.id);return t===null?[]:[t]}return e.type===`work-final`?e.members.map(e=>e.msg.id).filter(e=>G(e)!==null):[]}function K(e){let t=Je(e);return t.length?{messageId:Math.min(...t),endMessageId:Math.max(...t)}:null}function Ye(e,t,n){let r=[...t].sort((e,t)=>e.dataIndex-t.dataIndex),i=r.findIndex(e=>e.bottom>n+1);if(i<0)return null;let a=t=>e[r[t].dataIndex],o=e=>{let t=a(e);return!!t&&K(t)!==null},s=-1;o(i)&&(s=i);for(let e=i-1;s<0&&e>=0;--e)o(e)&&(s=e);for(let e=i+1;s<0&&e<r.length;e+=1)o(e)&&(s=e);if(s<0){let e=a(i);return{topKey:e?W(e):null,offset:Math.max(0,Math.round(n-r[i].top))}}let c=a(s),l=K(c);return{topKey:W(c),anchorMessageId:l.messageId,anchorEndMessageId:l.endMessageId,offset:Math.round(n-r[s].top)}}function Xe(e,t){let n=G(t.messageId);if(n!==null){let r=G(t.endMessageId),i=r!==null&&r>=n?r:n,a=-1,o=-1/0;for(let t=0;t<e.length;t+=1){let r=Je(e[t]);if(r.some(e=>e>=n&&e<=i))return t;let s=r.filter(e=>e<=n).sort((e,t)=>t-e)[0];s!==void 0&&s>o&&(o=s,a=t)}if(a>=0)return a}if(t.topKey){let n=e.findIndex(e=>W(e)===t.topKey||qe(e).includes(t.topKey));if(n>=0)return n}return-1}function Ze(e){return e.type===`message`||e.type===`initial-prompt`||e.type===`notice`?(e.msg.subject?`${e.msg.subject} `:``)+f(e.msg):e.type===`imported-message`?f(e.entry.message):e.type===`activity`?e.steps.map(e=>[e.label,e.text].filter(Boolean).join(` `)).join(`
2
2
  `):e.type===`relay-injection`?`${e.event.category} ${e.event.summary}\n${JSON.stringify(e.event.detail)}`:e.type===`prompt-resolution`?[e.event.title,e.event.decisionLabel,e.event.body,...e.event.questions.map(e=>`${e.question} ${e.answer}`)].filter(Boolean).join(`
3
3
  `):e.type===`work-final`?e.members.map(e=>f(e.msg)).join(`
4
4
  `):e.type===`effort-change`?`Effort ${e.change.previousEffort} → ${e.change.effort} ${e.change.reason??``}`:``}function Qe(e,t){let n=e.steps[e.steps.length-1]?.turnId,r=t.steps[0]?.turnId;return n&&r?n===r:!n&&!r}var q=i(),$e=5;function J(e,t=0){if(t>=$e)return e;if(typeof e==`string`){let n=e.trim();if(!(n.startsWith(`{`)&&n.endsWith(`}`)||n.startsWith(`[`)&&n.endsWith(`]`)))return e;try{return J(JSON.parse(n),t+1)}catch{return e}}if(Array.isArray(e))return e.map(e=>J(e,t+1));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=J(i,t+1);return n}return e}function et(e){try{return JSON.stringify(J(e),null,2)}catch{return typeof e==`string`?e:String(e)}}function Y({value:e,compact:t=!0,className:n}){return(0,q.jsx)(`div`,{className:n,children:(0,q.jsx)(de,{content:(0,L.useMemo)(()=>et(e),[e]),path:`payload.json`,mediaType:`application/json`,compact:t})})}function X({id:e,icon:t,label:r,summary:i,trailing:a,children:s,tone:c,defaultExpanded:l=!1,expanded:u,onExpandedChange:d,wrapHeader:f=!1,className:p}){let m=u!==void 0,[h,g]=(0,L.useState)(l),_=o(t=>e?t.chatExpandedItems.includes(e):!1),v=o(e=>e.toggleChatItemExpanded),y=m?u:e?_:h;function b(){m?d?.(!y):e?v(e):g(e=>!e)}let x=(t||r)&&(0,q.jsxs)(`span`,{className:n(`flex gap-1.5`,f?`min-w-0 max-w-full items-start`:`shrink-0 items-center`),children:[t&&(0,q.jsx)(t,{className:n(`h-3.5 w-3.5 shrink-0`,f&&`mt-px`)}),r&&(0,q.jsx)(`span`,{className:n(`font-medium`,!f&&`shrink-0`),children:r})]});return(0,q.jsxs)(`div`,{className:n(`w-full rounded-lg border px-2.5 py-1.5 text-xs shadow-sm`,f&&`@container/ci`,c,p),children:[(0,q.jsxs)(`button`,{type:`button`,className:n(`flex w-full min-w-0 items-center gap-1.5 text-left`,f&&`relative flex-wrap gap-y-1 pr-5`),"aria-expanded":y,onClick:b,children:[x,(0,q.jsx)(`span`,{className:n(`min-w-0 flex-1 truncate text-foreground/80`,f&&`@max-[30rem]/ci:basis-full`),children:i}),a&&(0,q.jsx)(`span`,{className:n(`text-muted-foreground/60`,f?`min-w-0`:`shrink-0`),children:a}),(0,q.jsx)(E,{className:n(`h-3.5 w-3.5 transition-transform`,f?`absolute right-0 top-[3px]`:`shrink-0`,y&&`rotate-90`)})]}),y&&(0,q.jsx)(`div`,{className:`mt-2`,children:s})]})}function Z(e,t=0){return typeof e==`number`&&Number.isFinite(e)?e:t}function Q(e,t=``){return typeof e==`string`?e:t}function tt(e,t){return e===`memory`&&!!t&&typeof t==`object`&&t.source===`memory-preamble`}function nt(e){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.scopes)?e.scopes:[],r=Array.isArray(e.filtered)?e.filtered:[],i=Array.isArray(e.instructionSlugs)?e.instructionSlugs:[];return{event:Q(e.event)||void 0,skipped:Q(e.skipped)||void 0,projectMemoryEnabled:typeof e.projectMemoryEnabled==`boolean`?e.projectMemoryEnabled:void 0,tokens:Z(e.tokens),omitted:Z(e.omitted),omittedByReason:e.omittedByReason??void 0,demoted:Z(e.demoted),demotedByReason:e.demotedByReason??void 0,budgets:e.budgets??void 0,instructionTokens:Z(e.instructionTokens),instructionSlugs:i.map(e=>{let t=e??{};return{slug:Q(t.slug,`(unnamed)`),resolved:Q(t.resolved)||void 0,status:Q(t.status,`unknown`),tokens:Z(t.tokens)}}),entries:t.map(e=>{let t=e??{};return{id:Q(t.id)||void 0,title:Q(t.title,`(untitled)`),cell:Q(t.cell,`—`),kind:Q(t.kind)||void 0,tier:t.tier===`pinned`?`pinned`:`indexed`,tokens:Z(t.tokens),fullTokens:typeof t.fullTokens==`number`?t.fullTokens:void 0,rendered:t.rendered===!0,demoted:t.demoted===!0,demotedReason:t.demotedReason===`total`?`total`:t.demotedReason===`budget`?`budget`:void 0,omittedReason:t.omittedReason===`index`?`index`:void 0}}),scopes:n.map(e=>{let t=e??{};return{cell:Q(t.cell,`—`),budget:Z(t.budget),candidates:Z(t.candidates),rendered:Z(t.rendered),tokens:Z(t.tokens),omitted:Z(t.omitted)}}),filtered:r.map(e=>{let t=e??{};return{id:Q(t.id)||void 0,title:Q(t.title)||void 0,cell:Q(t.cell,`—`),reason:Q(t.reason,`unknown`)}}),content:Q(e.content)||void 0,injectedCount:typeof e.injectedCount==`number`?e.injectedCount:void 0,pinnedTokens:typeof e.pinnedTokens==`number`?e.pinnedTokens:void 0,indexedTokens:typeof e.indexedTokens==`number`?e.indexedTokens:void 0,filteredCount:typeof e.filteredCount==`number`?e.filteredCount:void 0,entriesTotal:typeof e.entriesTotal==`number`?e.entriesTotal:void 0,contentTruncated:e.contentTruncated===!0||void 0}}var rt={status:`not active`,sensitive:`sensitive — never injected`,never:`retrieval-only (inject:never)`,expired:`expired`,audience:`addressed to other profiles`},it={budget:`demoted — over its cell budget`,total:`demoted — over the whole-block cap`};function $({label:e,value:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,q.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:t})]})}function at({detail:e}){let t=nt(e),n=t.entries.filter(e=>e.rendered),r=t.entries.filter(e=>!e.rendered),i=t.injectedCount??n.length,a=t.pinnedTokens??n.filter(e=>e.tier===`pinned`).reduce((e,t)=>e+t.tokens,0),o=t.indexedTokens??n.filter(e=>e.tier===`indexed`).reduce((e,t)=>e+t.tokens,0),s=t.filteredCount??t.filtered.length,c=t.entriesTotal??t.entries.length,l=Math.max(0,c-t.entries.length),u=Math.max(0,s-t.filtered.length);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-border/60 bg-background/75 p-3 text-xs`,children:[t.skipped&&(0,q.jsxs)(`div`,{className:`rounded border border-tone-warning/25 bg-tone-warning/10 px-2 py-1 text-tone-warning-fg`,children:[`not injected — `,t.skipped===`unchanged`?`the resolved set is unchanged since the last injection, so the block already in context was not re-sent`:t.skipped===`inject-unsupported`?`this provider does not accept context injection; the spawn-time block is all it has`:`nothing resolved for this identity`]}),t.projectMemoryEnabled===!1&&(0,q.jsx)(`div`,{className:`w-fit rounded-full border border-tone-warning/25 bg-tone-warning/10 px-2 py-0.5 text-[10px] font-medium text-tone-warning-fg`,children:`Project memory excluded · Project Instructions is off`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,q.jsx)($,{label:`Total cost`,value:`${t.tokens+t.instructionTokens}t`}),t.instructionSlugs.length>0&&(0,q.jsx)($,{label:`Instructions`,value:[`${t.instructionTokens}t`,t.instructionSlugs.filter(e=>e.status!==`rendered`).map(e=>`${e.slug} ${e.status}`).join(` · `)].filter(Boolean).join(` · `)}),(0,q.jsx)($,{label:`Injected`,value:`${i} ${i===1?`entry`:`entries`}`}),(0,q.jsx)($,{label:`Pinned / indexed`,value:`${a}t / ${o}t`}),t.budgets?.total?(0,q.jsx)($,{label:`Block cap`,value:t.budgets.baseReserved?`${t.budgets.total}t · ${t.budgets.baseReserved}t base reserve`:`${t.budgets.total}t`}):null,t.demoted?(0,q.jsx)($,{label:`Demoted to index`,value:[`${t.demoted}`,t.demotedByReason?.budget?`${t.demotedByReason.budget} cell`:``,t.demotedByReason?.total?`${t.demotedByReason.total} cap`:``].filter(Boolean).join(` · `)}):null,t.omitted>0&&(0,q.jsx)($,{label:`Omitted`,value:[`${t.omitted}`,t.omittedByReason?.index?`${t.omittedByReason.index} index cap`:``].filter(Boolean).join(` · `)}),s>0&&(0,q.jsx)($,{label:`Not injectable`,value:`${s}`})]}),t.filtered.length>0&&(0,q.jsxs)(`details`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-[10px] uppercase tracking-wide text-muted-foreground`,children:[`Filtered before budgeting (`,s,`)`]}),(0,q.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[t.filtered.map((e,t)=>(0,q.jsxs)(`span`,{className:`rounded border border-border/60 bg-muted/40 px-2 py-0.5 text-muted-foreground`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.title??e.id??`(withheld)`}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.cell}),` · `,rt[e.reason]??e.reason]},e.id??`${e.reason}-${t}`)),u>0&&(0,q.jsxs)(`span`,{className:`rounded border border-dashed border-border/60 px-2 py-0.5 text-muted-foreground/80`,children:[`… `,u,` more`]})]})]}),t.scopes.length>0&&(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.scopes.map(e=>(0,q.jsxs)(`span`,{className:`rounded border border-border/60 bg-muted/40 px-2 py-0.5 tabular-nums`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:e.cell}),` `,e.rendered,`/`,e.candidates,` · `,e.tokens,`t`,(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`/`,e.budget,`t`]})]},e.cell))}),t.entries.length>0&&(0,q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,q.jsxs)(`table`,{className:`w-full min-w-[24rem] border-collapse text-left`,children:[(0,q.jsx)(`thead`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{className:`py-1 pr-2 font-normal`,children:`Entry`}),(0,q.jsx)(`th`,{className:`py-1 pr-2 font-normal`,children:`Cell`}),(0,q.jsx)(`th`,{className:`py-1 pr-2 font-normal`,children:`Tier`}),(0,q.jsx)(`th`,{className:`py-1 pr-2 text-right font-normal`,children:`Tokens`})]})}),(0,q.jsxs)(`tbody`,{children:[[...n,...r].map((e,t)=>(0,q.jsxs)(`tr`,{className:e.rendered?``:`text-muted-foreground/70 line-through decoration-muted-foreground/40`,children:[(0,q.jsxs)(`td`,{className:`py-0.5 pr-2`,children:[e.title,e.rendered&&e.demoted&&e.demotedReason&&(0,q.jsxs)(`span`,{className:`ml-1 no-underline text-tone-sky-fg`,children:[`(`,it[e.demotedReason],`)`]}),!e.rendered&&(0,q.jsx)(`span`,{className:`ml-1 no-underline text-tone-warning-fg`,children:`(omitted — over the index cap)`})]}),(0,q.jsx)(`td`,{className:`py-0.5 pr-2`,children:e.cell}),(0,q.jsx)(`td`,{className:`py-0.5 pr-2`,children:e.tier}),(0,q.jsxs)(`td`,{className:`py-0.5 pr-2 text-right tabular-nums`,children:[e.tokens,`t`,e.tier===`indexed`&&e.fullTokens?(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` / `,e.fullTokens,`t full`]}):null]})]},e.id??`${e.title}-${t}`)),l>0&&(0,q.jsx)(`tr`,{className:`text-muted-foreground/70`,children:(0,q.jsxs)(`td`,{className:`py-0.5 pr-2`,colSpan:4,children:[`… `,l,` more`]})})]})]})}),t.content&&(0,q.jsxs)(`details`,{children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:[`Injected block`,t.contentTruncated?` (truncated)`:``]}),(0,q.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded border border-border/60 bg-muted/30 p-2`,children:t.content})]})]})}var ot={online:`text-tone-success-fg`,offline:`text-tone-neutral-fg`,shutdown:`text-tone-neutral-fg`,restarted:`text-tone-info-fg`,"compaction-requested":`text-tone-neutral-fg`,compacting:`text-tone-warning-fg`,compacted:`text-tone-warning-fg`,"compaction-stalled":`text-tone-danger-fg`,"clear-requested":`text-tone-neutral-fg`,"clearing-context":`text-tone-warning-fg`,"context-cleared":`text-tone-warning-fg`,"clear-stalled":`text-tone-danger-fg`,"shutting-down":`text-tone-neutral-fg`};function st(e){let t=new Date,[n,r,i]=e.split(`-`).map(Number),a=new Date(n,r-1,i);if(e===U(t.getTime()))return`Today`;let o=new Date(t);return o.setDate(o.getDate()-1),e===U(o.getTime())?`Yesterday`:a.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,year:a.getFullYear()===t.getFullYear()?void 0:`numeric`})}function ct({event:e}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(ee,{className:n(`w-2 h-2 fill-current`,ot[e.status]||`text-tone-neutral-fg`)}),(0,q.jsx)(`span`,{children:Ne[e.status]||e.status}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:R(e.timestamp)})]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function lt({agentId:e,fallbackLabel:t,className:r,noIcon:i}){let a=o(t=>t.agentsById[e])||null,s=o(e=>e.openInboxThread),c=o(e=>e.switchView),l=a?g(a):t||e;return(0,q.jsxs)(`button`,{type:`button`,className:n(`inline-flex max-w-full items-center gap-1 rounded px-1 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground`,r),onClick:t=>{t.stopPropagation(),s(e),c(`chat`)},title:`Open chat for ${l}`,children:[!i&&(0,q.jsx)(ce,{agent:a,className:`w-4 h-4 text-[10px]`}),i?(0,q.jsx)(ue,{agent:a,fallback:l,className:`max-w-[160px]`}):(0,q.jsx)(`span`,{className:`max-w-[160px] truncate`,children:l})]})}var ut={"spawned-child":{ready:`spawned`,exited:`spawned · exited`,failed:`spawn failed`},"spawned-by":{ready:`spawned by`,exited:`spawned by`,failed:`spawned by`}},dt={"spawned-child-ready":ie,"spawned-child-exited":P,"spawned-child-failed":O,"spawned-by-ready":x,"spawned-by-exited":x,"spawned-by-failed":x},ft={"spawned-child-ready":`text-tone-success-fg`,"spawned-child-exited":`text-tone-neutral-fg`,"spawned-child-failed":`text-tone-danger-fg`,"spawned-by-ready":`text-tone-info-fg`,"spawned-by-exited":`text-tone-info-fg`,"spawned-by-failed":`text-tone-info-fg`};function pt({entry:e}){let t=`${e.direction}-${e.status}`,r=ut[e.direction]?.[e.status]??e.direction,i=dt[t]??S,a=ft[t]??`text-muted-foreground`,o=e.status===`failed`;return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`div`,{className:n(`flex items-center gap-1.5 rounded-full border bg-muted/30 px-2.5 py-1 text-xs`,o?`border-tone-danger/30`:`border-border`),children:[(0,q.jsx)(i,{className:n(`h-3 w-3 shrink-0`,a)}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:r}),(0,q.jsx)(lt,{agentId:e.agentId}),e.reason&&o&&(0,q.jsxs)(`span`,{className:`text-tone-danger-fg max-w-[120px] truncate`,title:e.reason,children:[`— `,e.reason]}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0`,children:R(e.timestamp)})]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}var mt={memory:C,"memory-area":F,instructions:A,tools:j,comms:S,knowledge:fe,context:he},ht={memory:`border-tone-success/25 bg-tone-success/10 text-tone-success-fg`,"memory-area":`border-tone-success/25 bg-tone-success/10 text-tone-success-fg`,instructions:`border-tone-sky/25 bg-tone-sky/10 text-tone-sky-fg`,tools:`border-tone-warning/25 bg-tone-warning/10 text-tone-warning-fg`,comms:`border-tone-violet/25 bg-tone-violet/10 text-tone-violet-fg`,knowledge:`border-tone-cyan/25 bg-tone-cyan/10 text-tone-cyan-fg`,context:`border-tone-neutral/25 bg-tone-neutral/10 text-tone-neutral-fg`};function gt({entry:e}){let t=e.event,n=mt[t.category]??se,r=ht[t.category]??ht.context,i=tt(t.category,t.detail);return(0,q.jsx)(`div`,{className:`flex justify-center py-2 my-1`,children:(0,q.jsx)(X,{id:`relay-injection-${t.id}`,icon:n,label:t.category,summary:t.summary,trailing:R(t.timestamp),tone:r,className:`max-w-[85%] md:max-w-[75%]`,children:i?(0,q.jsx)(at,{detail:t.detail}):(0,q.jsx)(Y,{value:t.detail,className:`max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75`,compact:!0})})})}var _t={"mcp-tool-search":oe,"mcp-tool-call":ae,"cli-bash":I,edit:ne,read:A,plan:re,"ask-user-question":pe,"agent-spawn":le,generic:j},vt={"mcp-tool-search":`border-tone-sky/25 bg-tone-sky/10 text-tone-sky-fg`,"mcp-tool-call":`border-tone-violet/25 bg-tone-violet/10 text-tone-violet-fg`,"cli-bash":`border-tone-success/25 bg-tone-success/10 text-tone-success-fg`,edit:`border-tone-warning/25 bg-tone-warning/10 text-tone-warning-fg`,read:`border-tone-cyan/25 bg-tone-cyan/10 text-tone-cyan-fg`,plan:`border-tone-indigo/25 bg-tone-indigo/10 text-tone-indigo-fg`,"ask-user-question":`border-tone-rose/25 bg-tone-rose/10 text-tone-rose-fg`,"agent-spawn":`border-tone-orange/25 bg-tone-orange/10 text-tone-orange-fg`,generic:`border-tone-neutral/25 bg-tone-neutral/10 text-tone-neutral-fg`};function yt(e){let t=(e.label??``).trim(),n=e.text.trim();return t&&n&&n!==t?`${t} — ${n}`:t||n||`tool`}function bt(e){let t={tool:e.label||`tool`,category:e.category??`generic`};return e.status&&(t.status=e.status),e.text.trim()&&(t.command=e.text),e.params!==void 0&&(t.params=e.params),t}var xt={failed:`border-tone-danger/30 bg-tone-danger/10 text-tone-danger-fg`,cancelled:`border-tone-neutral/30 bg-tone-neutral/10 text-tone-neutral-fg`};function St({step:e}){let t=e.category??`generic`,n=_t[t]??j,r=e.status&&xt[e.status]||vt[t]||vt.generic,i=e.status===`failed`?`${t} · failed`:e.status===`cancelled`?`${t} · cancelled`:t;return(0,q.jsx)(X,{id:`tool-step-${e.id}`,icon:n,label:i,summary:yt(e),tone:r,children:(0,q.jsx)(Y,{value:bt(e),className:`max-h-72 overflow-auto rounded-md border border-border/60 bg-background/75`,compact:!0})})}function Ct({blockedLabel:e,onInterrupt:t,activityKey:n}){return e?(0,q.jsx)(`div`,{className:`flex justify-start mb-3 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-tone-danger/30 px-4`,children:[(0,q.jsx)(O,{className:`w-3.5 h-3.5 text-tone-danger-fg`}),(0,q.jsxs)(`span`,{className:`text-xs text-tone-danger-fg`,children:[`blocked: `,e]})]})}):(0,q.jsx)(`div`,{className:`flex justify-start mb-3 animate-in fade-in slide-in-from-bottom-1 duration-150`,children:(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded-2xl rounded-bl-sm bg-card ring-1 ring-foreground/10 px-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tone-yellow motion-safe:animate-[pulse_1.4s_ease-in-out_3]`}),(0,q.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tone-yellow motion-safe:animate-[pulse_1.4s_ease-in-out_0.2s_3]`}),(0,q.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-tone-yellow motion-safe:animate-[pulse_1.4s_ease-in-out_0.4s_3]`})]},n??void 0),(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`working`}),t&&(0,q.jsxs)(`button`,{onClick:t,title:`Interrupt`,className:`ml-1 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs text-muted-foreground hover:text-tone-danger-fg hover:bg-tone-danger/10 transition-colors`,children:[(0,q.jsx)(me,{className:`w-3.5 h-3.5`}),`Stop`]})]})})}function wt({entry:e}){let{event:t}=e,n=t.kind===`questions`,r=n?t.title:t.kind===`plan`?`Plan prompt`:`${t.toolName} permission`;return(0,q.jsx)(`div`,{className:`flex justify-center py-1.5`,children:(0,q.jsxs)(`div`,{className:`w-full max-w-2xl rounded-md border border-border bg-muted/20 px-3 py-2 text-sm`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(k,{className:`h-3.5 w-3.5 text-tone-success-fg`}),(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),(0,q.jsx)(`span`,{children:t.decisionLabel}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground/60`,children:R(t.timestamp)})]}),n&&t.questions.length>0?(0,q.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:t.questions.map((e,t)=>(0,q.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.question}),(0,q.jsx)(`div`,{className:`text-sm text-foreground`,children:e.answer})]},`${e.question}-${t}`))}):t.body.trim()?(0,q.jsx)(`div`,{className:`mt-2 max-h-48 overflow-auto rounded border border-border/70 bg-background/40 px-2 py-1.5 text-sm`,children:(0,q.jsx)(M,{text:t.body})}):null]})})}function Tt({date:e}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-3 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:st(e)}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Et({timestamp:e}){let t=new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`});return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`span`,{className:`text-xs text-muted-foreground/60`,children:[`created `,t]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Dt({history:e}){let t=e.sourceAgentLabel||e.sourcePeerId,n=e.entries.length;return(0,q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-2 my-1`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-full border border-dashed border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,q.jsx)(ge,{className:`h-3 w-3`}),(0,q.jsxs)(`span`,{children:[`forked history from `,t]}),(0,q.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[n,` `,n===1?`entry`:`entries`]})]}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Ot({entry:e,sourceLabel:t,issueRepo:r}){let i=e.message,a=f(i),o=s(e.originalFrom);return(0,q.jsx)(`div`,{className:n(`flex mb-3 opacity-80`,o?`justify-end`:`justify-start`),children:(0,q.jsx)(`div`,{className:`max-w-full md:max-w-[75%]`,children:(0,q.jsxs)(`div`,{className:n(`rounded-2xl border border-dashed px-3.5 py-2 text-sm select-text`,o?`border-primary/25 bg-primary/10 text-foreground rounded-br-sm`:`border-border bg-card/70 rounded-bl-sm`),children:[(0,q.jsxs)(`div`,{className:n(`mb-1 text-[10px] uppercase tracking-normal`,o?`text-primary/70`:`text-muted-foreground`),children:[`forked history · `,o?`you`:t||e.originalFrom]}),(0,q.jsx)(M,{text:a,rawBody:i.body,issueRepo:r,className:`leading-relaxed`}),(0,q.jsxs)(`p`,{className:n(`mt-1 flex items-center justify-end gap-1.5 text-xs`,o?`text-primary/60`:`text-muted-foreground`),children:[(0,q.jsx)(`span`,{className:`opacity-40`,children:h(e.originalMessageId)}),(0,q.jsx)(`span`,{children:R(e.originalCreatedAt)})]})]})})})}function kt({msg:e,issueRepo:t}){let n=f(e),r=R(e.occurredAt??e.createdAt);return(0,q.jsx)(`div`,{"data-msg-id":e.id,className:`mb-3`,children:(0,q.jsxs)(`div`,{className:`rounded-xl border border-primary/30 bg-primary/[0.06] px-3.5 py-2.5 shadow-sm`,children:[(0,q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-primary/80`,children:[(0,q.jsx)(se,{className:`h-3.5 w-3.5`}),(0,q.jsx)(`span`,{children:`Initial prompt`}),(0,q.jsx)(`span`,{className:`ml-auto text-[10px] font-normal normal-case text-muted-foreground/60`,children:r})]}),(0,q.jsx)(M,{text:n,rawBody:e.body,issueRepo:t,className:`text-sm leading-relaxed text-foreground`})]})})}function At({scrollEl:e,timeline:t,issueRepo:r,onScrollToOriginal:i}){let[a,o]=(0,L.useState)(!0),[c,l]=(0,L.useState)(!0),[u,d]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=(0,L.useMemo)(()=>{for(let e=t.length-1;e>=0;e--){let n=t[e];if(!(!n||n.type!==`message`&&n.type!==`initial-prompt`)&&s(n.msg.from))return{id:n.msg.id,body:f(n.msg),rawBody:n.msg.body,key:W(n)}}return null},[t]);if((0,L.useEffect)(()=>{if(!y||!e){o(!0);return}let t=null,n=null,r=()=>{l(e.scrollTop<(u?.offsetHeight??0));let r=e.querySelector(`[data-msg-id="${y.id}"]`);if(!r){t?.disconnect(),t=null,n=null,o(!1);return}let i=r.getBoundingClientRect(),a=e.getBoundingClientRect();v(i.top<a.top),r!==n&&(t?.disconnect(),n=r,t=new IntersectionObserver(([e])=>{e&&o(e.isIntersecting)},{root:e,threshold:0}),t.observe(r))};return r(),e.addEventListener(`scroll`,r,{passive:!0}),()=>{t?.disconnect(),e.removeEventListener(`scroll`,r)}},[y?.id,e,u]),!y||!y.body.trim())return null;let b=p?.id===y.id&&p.value,x=h?.id!==y.id||h.value;function S(){y&&i?.(y.key)}let C=_?`↑`:`↓`,w=a||c;return x?(0,q.jsx)(`div`,{ref:d,"aria-hidden":w,className:n(`absolute inset-x-0 top-0 z-10 flex border-b border-border bg-card/90 backdrop-blur`,w&&`invisible`),children:(0,q.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-1 text-[11px] text-primary/60 hover:text-primary transition-colors`,onClick:()=>g({id:y.id,value:!1}),children:[(0,q.jsx)(`span`,{children:`Your prompt`}),(0,q.jsx)(T,{className:`w-3 h-3`})]})}):(0,q.jsxs)(`section`,{ref:d,"aria-hidden":w,className:n(`absolute inset-x-0 top-0 z-10 flex flex-col border-b border-border bg-card/90 px-3 py-2 backdrop-blur`,w&&`invisible`),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mb-0.5`,children:[(0,q.jsx)(`span`,{className:`font-medium text-primary/70`,children:`Your prompt`}),(0,q.jsxs)(`button`,{type:`button`,className:`ml-auto hover:text-foreground transition-colors`,onClick:S,children:[C,` scroll to original`]}),(0,q.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors`,onClick:()=>g({id:y.id,value:!0}),title:`Minimize`,children:(0,q.jsx)(D,{className:`w-3 h-3`})})]}),(0,q.jsx)(`div`,{className:n(`cursor-pointer`,b?`max-h-48 overflow-y-auto`:`line-clamp-2`),onClick:()=>m({id:y.id,value:!b}),children:(0,q.jsx)(M,{text:y.body,rawBody:y.rawBody,issueRepo:r,className:`text-sm text-foreground leading-snug`})})]})}var jt=(0,L.memo)(At);export{Ae as A,I as B,Ze as C,we as D,ke as E,Me as F,me as G,P as H,_e as I,fe as J,pe as K,je as L,ye as M,Ee as N,xe as O,ve as P,be as R,W as S,R as T,ge as U,F as V,he as W,Ye as _,Tt as a,Ke as b,kt as c,ct as d,jt as f,Ge as g,Y as h,Et as i,Se as j,Te as k,wt as l,X as m,lt as n,Dt as o,St as p,N as q,Ct as r,Ot as s,pt as t,gt as u,H as v,Ce as w,K as x,Xe as y,Oe as z};
5
- //# sourceMappingURL=TraceView-Wimm0Czv.js.map
5
+ //# sourceMappingURL=TraceView-DYU962-H.js.map