@humwick/server 0.130.3 → 0.130.4

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 (112) hide show
  1. package/docs/openapi.json +103 -1
  2. package/package.json +6 -6
  3. package/public/assets/{MessageBubble-Bq9kr21N.js → MessageBubble-BOkmEvgZ.js} +2 -2
  4. package/public/assets/{PlanGraphPanel-Dqiroy06.js → PlanGraphPanel-BkaDJp0r.js} +2 -2
  5. package/public/assets/{TraceView-DYU962-H.js → TraceView-B99Uu2yT.js} +2 -2
  6. package/public/assets/{VaultDecisionCard-DhPfzioE.js → VaultDecisionCard-DUIfTTFF.js} +2 -2
  7. package/public/assets/{activity-DzCcQTee.js → activity-ZIX0N1El.js} +2 -2
  8. package/public/assets/{agent-lineage-SgDt9i3T.js → agent-lineage-kq9TPYFw.js} +2 -2
  9. package/public/assets/agent-liveness-DSQY1Aa_.js +2 -0
  10. package/public/assets/{agent-name-CcY3Aijy.js → agent-name-C_7F4DFR.js} +2 -2
  11. package/public/assets/{agent-profiles-cxtRBn6O.js → agent-profiles-BNOcrGcY.js} +2 -2
  12. package/public/assets/{agent-project-badge-DGYbIhaI.js → agent-project-badge-B6yAh70a.js} +2 -2
  13. package/public/assets/{agent-tools-DHbftV0N.js → agent-tools-CcrhmOzF.js} +2 -2
  14. package/public/assets/{agent-type-icon-CY113sp-.js → agent-type-icon-CXSLrKiq.js} +2 -2
  15. package/public/assets/{agents-BPzY7IlQ.js → agents-DIZG97_X.js} +2 -2
  16. package/public/assets/{analytics-DENFPv_a.js → analytics-rasmoPjR.js} +2 -2
  17. package/public/assets/{artifact-viewer-KRvSc7sl.js → artifact-viewer-tBpTrEPb.js} +2 -2
  18. package/public/assets/{artifacts-C9gSmL3s.js → artifacts-BNkrynP1.js} +2 -2
  19. package/public/assets/{artifacts-DT-HkI5O.js → artifacts-Bjq-ZyBA.js} +2 -2
  20. package/public/assets/{automation-BsmjQhKD.js → automation-Cx422L3L.js} +2 -2
  21. package/public/assets/{backlog-8NYH_62t.js → backlog-RuFQ8PUu.js} +2 -2
  22. package/public/assets/{busy-health-D3hwvYb4.js → busy-health-BvNQ9g5x.js} +2 -2
  23. package/public/assets/{channels-DCJ5WL7O.js → channels-DNbKAS0I.js} +2 -2
  24. package/public/assets/{chat-DAIl357U.js → chat-Bp3Fx73h.js} +2 -2
  25. package/public/assets/{code-preview-CzrZfr9U.js → code-preview-KIRZA6cz.js} +2 -2
  26. package/public/assets/{connectors-xTxtlyou.js → connectors-k7vO4vvc.js} +2 -2
  27. package/public/assets/{cosmos-BpebFLK2.js → cosmos-BuVoq1aw.js} +2 -2
  28. package/public/assets/{crate-agent-BHvI5wXC.js → crate-agent-irqlt4NH.js} +2 -2
  29. package/public/assets/{dependency-graph-DGT0o3wJ.js → dependency-graph-D_rurNBz.js} +2 -2
  30. package/public/assets/{deploys-hqWOHSHE.js → deploys-yzZqIpxE.js} +2 -2
  31. package/public/assets/{display-CDeH4I8T.js → display-BemJG1f_.js} +2 -2
  32. package/public/assets/{files-BTeGVmTg.js → files-DXWcrxOz.js} +2 -2
  33. package/public/assets/{fleet-DgXtNgCa.js → fleet-TEuOCZXE.js} +2 -2
  34. package/public/assets/{fleet-metrics-BHEt5yc_.js → fleet-metrics-BGoDAFI-.js} +2 -2
  35. package/public/assets/{formatted-body-impl-CAe664Z8.js → formatted-body-impl-BB9eq9nN.js} +2 -2
  36. package/public/assets/{formatted-body-MLtodyPp.js → formatted-body-qy2nTD_1.js} +3 -3
  37. package/public/assets/{host-providers-dialog-mapF4Fj9.js → host-providers-dialog-BGPHxuwT.js} +2 -2
  38. package/public/assets/{index-CqqgOI5R.js → index-BC5XZc0z.js} +5 -5
  39. package/public/assets/{index-MYAIwYTX.css → index-D8Rp9pz2.css} +1 -1
  40. package/public/assets/{insights-DNyf7IzF.js → insights-C-KQG0h-.js} +2 -2
  41. package/public/assets/{integrations-DlYOHq7T.js → integrations-ClPRPyKU.js} +2 -2
  42. package/public/assets/{issue-ref-chip-CeWBNWn7.js → issue-ref-chip-DbH8J9Ak.js} +2 -2
  43. package/public/assets/{log-viewer-Cib8nqdE.js → log-viewer-PH4zVn24.js} +2 -2
  44. package/public/assets/{maintenance-DSn1cPm7.js → maintenance-5lV43uTL.js} +2 -2
  45. package/public/assets/{managed-agents-C3CkM81m.js → managed-agents-BdgU35aX.js} +2 -2
  46. package/public/assets/{markdown-preview-W4VQQPAv.js → markdown-preview-DNT4OUwQ.js} +3 -3
  47. package/public/assets/{markdown-preview-impl-CMsTdhjq.js → markdown-preview-impl-CnCcPy0A.js} +2 -2
  48. package/public/assets/{memory-BV17qtO4.js → memory--GgWH1gH.js} +2 -2
  49. package/public/assets/{messages-Bm_1AqSA.js → messages-CzFl_97O.js} +2 -2
  50. package/public/assets/{orchestrators-Dg-vfP09.js → orchestrators-CVvJVkzv.js} +2 -2
  51. package/public/assets/overview-DsrZvE86.js +2 -0
  52. package/public/assets/{pairs-8o9nuG3V.js → pairs-D2d0d2py.js} +2 -2
  53. package/public/assets/{profile-icon-BsRyBMea.js → profile-icon-_SMuSbYF.js} +2 -2
  54. package/public/assets/{project-profile-instructions-DETKFn_E.js → project-profile-instructions-Apn15y43.js} +2 -2
  55. package/public/assets/{projects-M_m6AHws.js → projects-D3B6kto5.js} +2 -2
  56. package/public/assets/{prompt-settings-C_mNCgeL.js → prompt-settings-DnPB6Ez6.js} +2 -2
  57. package/public/assets/provider-display-bWwiuedV.js +2 -0
  58. package/public/assets/{registry-DDHHHE5N.js → registry-D790cIhN.js} +2 -2
  59. package/public/assets/{run-card-Dt4I4jaP.js → run-card-BCro-Odj.js} +2 -2
  60. package/public/assets/{secrets-BkVwxI5O.js → secrets-CVXvfvbU.js} +2 -2
  61. package/public/assets/{service-access-settings-Crq-6a-B.js → service-access-settings-D3Xxqb9w.js} +2 -2
  62. package/public/assets/{settings-CYcavMFu.js → settings-CoUC7Jci.js} +2 -2
  63. package/public/assets/{shipping-H6gzEeZB.js → shipping-D_Lp9n_J.js} +2 -2
  64. package/public/assets/{stats-BJVeWkpV.js → stats-CXiNjB9S.js} +2 -2
  65. package/public/assets/{status-dot-BcHyw1Vw.js → status-dot-C703YIy1.js} +2 -2
  66. package/public/assets/store-BgDALGIX.js +9 -0
  67. package/public/assets/{tasks-qJjlQPpx.js → tasks-DO0WpJCx.js} +2 -2
  68. package/public/assets/{teams-Cd5Sk1uX.js → teams-FGkdi_tL.js} +2 -2
  69. package/public/assets/{terminal-viewer-CpY5_m7W.js → terminal-viewer-Dh8dSC7e.js} +3 -3
  70. package/public/assets/{terminal-viewer-impl-DI_2llFR.js → terminal-viewer-impl-B5Zriip3.js} +2 -2
  71. package/public/assets/{use-agent-terminal-0yJA_buM.js → use-agent-terminal-CRUVDvLC.js} +2 -2
  72. package/public/assets/{use-decisions-uJXHf34W.js → use-decisions-CoaqRh4l.js} +2 -2
  73. package/public/assets/{use-project-list-CpWl6eHQ.js → use-project-list-X-BgT53X.js} +2 -2
  74. package/public/assets/{use-selectors-BdxBW8mL.js → use-selectors-0X_UZkk-.js} +2 -2
  75. package/public/assets/{user-avatar-3IndfpOc.js → user-avatar-CkLhVBGu.js} +2 -2
  76. package/public/assets/{versioned-prompt-editor-CIVg7XB1.js → versioned-prompt-editor-BkTi7eim.js} +2 -2
  77. package/public/assets/{work-queue-B9rnLwHZ.js → work-queue-DDOLEyKo.js} +2 -2
  78. package/public/assets/{workflow-marker-X8wxyhzC.js → workflow-marker-CzOsB8BM.js} +2 -2
  79. package/public/assets/{workflows-o5YyMFW7.js → workflows-DJilvmRM.js} +2 -2
  80. package/public/assets/{workspaces-CzEGoAng.js → workspaces-CHcfbLR3.js} +2 -2
  81. package/public/cosmos.html +4 -4
  82. package/public/index.html +29 -29
  83. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  84. package/runner/src/adapters/claude-api.ts +1 -1
  85. package/runner/src/provider-setup.ts +2 -2
  86. package/src/auth/login-link.ts +35 -0
  87. package/src/cli/index.ts +7 -1
  88. package/src/cli/init.ts +53 -0
  89. package/src/cli/orchestrator.ts +1 -7
  90. package/src/cli/setup.ts +6 -4
  91. package/src/db/spawn-delegation.ts +2 -1
  92. package/src/db/workflow-execution.ts +3 -3
  93. package/src/dev.ts +4 -13
  94. package/src/init.ts +299 -0
  95. package/src/invite-link.ts +16 -9
  96. package/src/routes/auth.ts +30 -2
  97. package/src/routes/host-providers.ts +18 -0
  98. package/src/routes/index.ts +5 -2
  99. package/src/routes/orchestrator-bootstrap.ts +2 -0
  100. package/src/routes/secrets-backup.ts +2 -3
  101. package/src/routes/secrets-import.ts +2 -3
  102. package/src/routes/secrets-vault.ts +5 -7
  103. package/src/runtime-install.ts +30 -0
  104. package/src/server.ts +4 -4
  105. package/src/services/auth-context.ts +6 -0
  106. package/src/services/provider-api-key.ts +73 -0
  107. package/src/setup.ts +47 -8
  108. package/src/utils.ts +7 -0
  109. package/public/assets/agent-liveness-Bq-s73jW.js +0 -2
  110. package/public/assets/overview-DcYCrvlr.js +0 -2
  111. package/public/assets/provider-display-BEeLXC_D.js +0 -2
  112. package/public/assets/store-DKPDIZBe.js +0 -9
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.3",
5
+ "version": "0.130.4",
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",
@@ -328,6 +328,62 @@
328
328
  ]
329
329
  }
330
330
  },
331
+ "/api/auth/login-links": {
332
+ "post": {
333
+ "operationId": "postLoginLinkRoute",
334
+ "summary": "Post Login Link",
335
+ "tags": [
336
+ "Other"
337
+ ],
338
+ "responses": {
339
+ "200": {
340
+ "description": "Success",
341
+ "content": {
342
+ "application/json": {}
343
+ }
344
+ }
345
+ },
346
+ "security": [
347
+ {
348
+ "bearerAuth": []
349
+ },
350
+ {
351
+ "tokenHeader": []
352
+ },
353
+ {
354
+ "tokenQuery": []
355
+ }
356
+ ]
357
+ }
358
+ },
359
+ "/api/auth/login-links/redeem": {
360
+ "post": {
361
+ "operationId": "postRedeemLoginLinkRoute",
362
+ "summary": "Post Redeem Login Link",
363
+ "tags": [
364
+ "Other"
365
+ ],
366
+ "responses": {
367
+ "200": {
368
+ "description": "Success",
369
+ "content": {
370
+ "application/json": {}
371
+ }
372
+ }
373
+ },
374
+ "security": [
375
+ {
376
+ "bearerAuth": []
377
+ },
378
+ {
379
+ "tokenHeader": []
380
+ },
381
+ {
382
+ "tokenQuery": []
383
+ }
384
+ ]
385
+ }
386
+ },
331
387
  "/api/users/invites": {
332
388
  "post": {
333
389
  "operationId": "postUserInvite",
@@ -5299,6 +5355,52 @@
5299
5355
  ]
5300
5356
  }
5301
5357
  },
5358
+ "/api/orchestrators/{id}/host-providers/{provider}/api-key": {
5359
+ "post": {
5360
+ "operationId": "postHostProviderApiKeyRoute",
5361
+ "summary": "Post Host Provider Api Key",
5362
+ "tags": [
5363
+ "Orchestrators"
5364
+ ],
5365
+ "parameters": [
5366
+ {
5367
+ "name": "id",
5368
+ "in": "path",
5369
+ "required": true,
5370
+ "schema": {
5371
+ "type": "string"
5372
+ }
5373
+ },
5374
+ {
5375
+ "name": "provider",
5376
+ "in": "path",
5377
+ "required": true,
5378
+ "schema": {
5379
+ "type": "string"
5380
+ }
5381
+ }
5382
+ ],
5383
+ "responses": {
5384
+ "200": {
5385
+ "description": "Success",
5386
+ "content": {
5387
+ "application/json": {}
5388
+ }
5389
+ }
5390
+ },
5391
+ "security": [
5392
+ {
5393
+ "bearerAuth": []
5394
+ },
5395
+ {
5396
+ "tokenHeader": []
5397
+ },
5398
+ {
5399
+ "tokenQuery": []
5400
+ }
5401
+ ]
5402
+ }
5403
+ },
5302
5404
  "/api/orchestrators/{id}/sessions": {
5303
5405
  "get": {
5304
5406
  "operationId": "getOrchestratorSessions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humwick/server",
3
- "version": "0.130.3",
3
+ "version": "0.130.4",
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.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",
87
+ "@humwick/channels-host": "0.130.4",
88
+ "@humwick/kernel": "0.130.4",
89
+ "@humwick/offload": "0.130.4",
90
+ "@humwick/providers": "0.104.10",
91
+ "@humwick/sdk": "0.2.139",
92
92
  "ajv": "^8.20.0",
93
93
  "@modelcontextprotocol/sdk": "1.32.0",
94
94
  "express": "^5.2.1",
@@ -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-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(`
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-BgDALGIX.js";import{O as c}from"./provider-display-bWwiuedV.js";import{o as l}from"./artifacts-Bjq-ZyBA.js";import{F as u,J as d,S as f,_ as p,p as ee}from"./display-BemJG1f_.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-B99Uu2yT.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-CXSLrKiq.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-qy2nTD_1.js";import{t as ce}from"./user-avatar-CkLhVBGu.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-Bq9kr21N.js.map
4
+ //# sourceMappingURL=MessageBubble-BOkmEvgZ.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-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
+ 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-BgDALGIX.js";import"./provider-display-bWwiuedV.js";import{ct as u,et as d,h as f,v as p,vt as m}from"./display-BemJG1f_.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-DbH8J9Ak.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-CzOsB8BM.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-C_7F4DFR.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-BkaDJp0r.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-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(`
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-BgDALGIX.js";import{O as s,S as c,y as l}from"./provider-display-bWwiuedV.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-BemJG1f_.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-CXSLrKiq.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-C_7F4DFR.js";import{t as de}from"./code-preview-KIRZA6cz.js";import{t as M}from"./formatted-body-qy2nTD_1.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-DYU962-H.js.map
5
+ //# sourceMappingURL=TraceView-B99Uu2yT.js.map
@@ -1,2 +1,2 @@
1
- import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{Ct as n,X as r,Z as i,q as a,t as o}from"./store-DKPDIZBe.js";import{et as s,h as c,v as l}from"./display-CDeH4I8T.js";import{s as u}from"./api-CIIVBtAV.js";import{t as d}from"./external-link-BRfu-fHG.js";import{t as f}from"./key-round-CcSxl5qr.js";import{t as p}from"./lock-BW8MPKw_.js";import{t as m}from"./x-Bge17hWJ.js";import{t as h}from"./button-Do6Z3vvn.js";import{t as g}from"./badge-DqJRtj_p.js";import{t as _}from"./agent-name-CcY3Aijy.js";import{t as v}from"./formatted-body-MLtodyPp.js";var y=t();function b({decision:t,className:b}){let x=n(),S=o(e=>e.agentsById[t.filedBy]),C=o(e=>e.declineVaultRequest),{name:w,scope:T}=i(t.title),E=a(t,x);return(0,y.jsxs)(`div`,{"data-testid":`decision-card-${t.id}`,"data-kind":`vault`,className:e(`rounded-xl bg-card ring-1 ring-tone-sky/40 px-3.5 py-3 text-sm`,b),children:[(0,y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,y.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-tone-sky-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`font-medium text-foreground break-words`,children:[`Set secret `,(0,y.jsx)(`code`,{className:`break-all`,children:w})]}),(0,y.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,y.jsx)(g,{variant:`outline`,className:`h-4 border-tone-sky/50 px-1 text-[10px] text-tone-sky-fg`,children:`Secret`}),(0,y.jsx)(g,{variant:`outline`,className:`h-4 px-1 text-[10px]`,children:T}),(0,y.jsxs)(`span`,{children:[`#`,t.id]}),(0,y.jsxs)(`span`,{children:[`· asked by `,(0,y.jsx)(_,{agent:S,fallback:t.filedBy})]}),(0,y.jsxs)(`span`,{children:[`· `,s(x,t.createdAt)]}),t.expiresAt!==void 0&&t.status===`open`&&(0,y.jsxs)(`span`,{"data-testid":`vault-expiry`,title:l(t.expiresAt),className:E?`text-tone-warning-fg`:void 0,children:[`· `,E?`expired ${s(x,t.expiresAt)}`:`expires in ${c(t.expiresAt,x)}`]})]})]})]}),t.context&&(0,y.jsx)(v,{text:t.context,rawBody:t.context,className:`mt-2 text-[13px] leading-relaxed text-foreground/90`}),(0,y.jsxs)(`p`,{className:`mt-2 flex items-start gap-1.5 text-xs text-muted-foreground`,children:[(0,y.jsx)(p,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,y.jsx)(`span`,{children:`Enter the value on the one-time page. It does not go through chat and the agent never sees it.`})]}),(0,y.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[t.formUrl&&t.status===`open`&&!E?(0,y.jsxs)(`a`,{href:r(t.formUrl,u()),target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex h-11 w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:h-8 sm:w-auto`,children:[(0,y.jsx)(d,{className:`h-3.5 w-3.5`}),`Open secure form`]}):(0,y.jsx)(`p`,{"data-testid":`vault-form-unavailable`,className:`text-xs text-tone-warning-fg`,children:E?`This request expired. Ask the agent to request the secret again.`:t.status===`open`?`The form link is only shown to the operator token.`:`This request is closed.`}),t.status===`open`&&(0,y.jsxs)(h,{type:`button`,variant:`ghost`,onClick:()=>{C(t.id)},className:`h-11 w-full text-muted-foreground sm:h-8 sm:w-auto`,children:[(0,y.jsx)(m,{className:`h-3.5 w-3.5`}),`Decline`]})]})]})}export{b as t};
2
- //# sourceMappingURL=VaultDecisionCard-DhPfzioE.js.map
1
+ import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{Ct as n,X as r,Z as i,q as a,t as o}from"./store-BgDALGIX.js";import{et as s,h as c,v as l}from"./display-BemJG1f_.js";import{s as u}from"./api-CIIVBtAV.js";import{t as d}from"./external-link-BRfu-fHG.js";import{t as f}from"./key-round-CcSxl5qr.js";import{t as p}from"./lock-BW8MPKw_.js";import{t as m}from"./x-Bge17hWJ.js";import{t as h}from"./button-Do6Z3vvn.js";import{t as g}from"./badge-DqJRtj_p.js";import{t as _}from"./agent-name-C_7F4DFR.js";import{t as v}from"./formatted-body-qy2nTD_1.js";var y=t();function b({decision:t,className:b}){let x=n(),S=o(e=>e.agentsById[t.filedBy]),C=o(e=>e.declineVaultRequest),{name:w,scope:T}=i(t.title),E=a(t,x);return(0,y.jsxs)(`div`,{"data-testid":`decision-card-${t.id}`,"data-kind":`vault`,className:e(`rounded-xl bg-card ring-1 ring-tone-sky/40 px-3.5 py-3 text-sm`,b),children:[(0,y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,y.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-tone-sky-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`font-medium text-foreground break-words`,children:[`Set secret `,(0,y.jsx)(`code`,{className:`break-all`,children:w})]}),(0,y.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,y.jsx)(g,{variant:`outline`,className:`h-4 border-tone-sky/50 px-1 text-[10px] text-tone-sky-fg`,children:`Secret`}),(0,y.jsx)(g,{variant:`outline`,className:`h-4 px-1 text-[10px]`,children:T}),(0,y.jsxs)(`span`,{children:[`#`,t.id]}),(0,y.jsxs)(`span`,{children:[`· asked by `,(0,y.jsx)(_,{agent:S,fallback:t.filedBy})]}),(0,y.jsxs)(`span`,{children:[`· `,s(x,t.createdAt)]}),t.expiresAt!==void 0&&t.status===`open`&&(0,y.jsxs)(`span`,{"data-testid":`vault-expiry`,title:l(t.expiresAt),className:E?`text-tone-warning-fg`:void 0,children:[`· `,E?`expired ${s(x,t.expiresAt)}`:`expires in ${c(t.expiresAt,x)}`]})]})]})]}),t.context&&(0,y.jsx)(v,{text:t.context,rawBody:t.context,className:`mt-2 text-[13px] leading-relaxed text-foreground/90`}),(0,y.jsxs)(`p`,{className:`mt-2 flex items-start gap-1.5 text-xs text-muted-foreground`,children:[(0,y.jsx)(p,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,y.jsx)(`span`,{children:`Enter the value on the one-time page. It does not go through chat and the agent never sees it.`})]}),(0,y.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[t.formUrl&&t.status===`open`&&!E?(0,y.jsxs)(`a`,{href:r(t.formUrl,u()),target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex h-11 w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 sm:h-8 sm:w-auto`,children:[(0,y.jsx)(d,{className:`h-3.5 w-3.5`}),`Open secure form`]}):(0,y.jsx)(`p`,{"data-testid":`vault-form-unavailable`,className:`text-xs text-tone-warning-fg`,children:E?`This request expired. Ask the agent to request the secret again.`:t.status===`open`?`The form link is only shown to the operator token.`:`This request is closed.`}),t.status===`open`&&(0,y.jsxs)(h,{type:`button`,variant:`ghost`,onClick:()=>{C(t.id)},className:`h-11 w-full text-muted-foreground sm:h-8 sm:w-auto`,children:[(0,y.jsx)(m,{className:`h-3.5 w-3.5`}),`Decline`]})]})]})}export{b as t};
2
+ //# sourceMappingURL=VaultDecisionCard-DUIfTTFF.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{t as i,wt as a}from"./store-DKPDIZBe.js";import{et as o,mt as s,v as c}from"./display-CDeH4I8T.js";import{t as l}from"./scroll-area-CIN4KQse.js";import{t as u}from"./activity-TMzFOdh2.js";import{t as d}from"./radio-Bn0_qc0G.js";import{K as f,a as p,d as m,g as h,t as g}from"./TraceView-DYU962-H.js";import{t as _}from"./braces-BOks9SsY.js";import{t as v}from"./clipboard-list-W2YeUsxT.js";import{n as y,t as b}from"./flame-CxBuz46L.js";import{t as x}from"./link-6RR7Hy3-.js";import{t as S}from"./message-circle-wjztgHBe.js";import{t as C}from"./message-square-reply-B9Z4cbQx.js";import{n as w}from"./agent-type-icon-CY113sp-.js";import{t as T}from"./button-Do6Z3vvn.js";import{t as E}from"./badge-DqJRtj_p.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{n as O}from"./agent-name-CcY3Aijy.js";import{r as k,t as A}from"./card-C4QJ4hCW.js";import{i as j,n as M,t as N}from"./MessageBubble-Bq9kr21N.js";var P=e(n(),1),F=r(),I={question:f,reply:C,message:S,operator:w,pair:x,task:v,state:d},L={question:`bg-tone-info/10 text-tone-info-fg border-tone-info/20`,reply:`bg-tone-success/10 text-tone-success-fg border-tone-success/20`,message:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,operator:`bg-tone-purple/10 text-tone-purple-fg border-tone-purple/20`,pair:`bg-tone-yellow/10 text-tone-yellow-fg border-tone-yellow/20`,task:`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/20`,state:`bg-tone-cyan/10 text-tone-cyan-fg border-tone-cyan/20`},R=[`question`,`reply`,`message`,`operator`,`pair`,`task`,`state`],z=[`chat`,`session`,`system`,`task`];function B(e){let t=e?.surface;if(!t||typeof t!=`object`)return null;let n=t,r=[];return typeof n.component==`string`&&r.push(n.component),typeof n.view==`string`&&n.view!==n.component&&r.push(n.view),typeof n.session==`string`&&r.push(`tab ${n.session.slice(0,6)}`),typeof n.client==`string`&&r.push(`client ${n.client.slice(0,6)}`),r.length?r.join(` · `):null}function V({entry:e,agentsById:t}){if(e.type===`notice`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(M,{msg:e.msg})});if(e.type===`agent-action`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(g,{entry:e})});if(e.type===`activity`)return(0,F.jsx)(`div`,{className:`px-1 opacity-60`,children:(0,F.jsx)(j,{steps:e.steps,showReasoning:!1})});if(e.type===`status`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(m,{event:e.event})});if(e.type===`date`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(p,{date:e.date})});if(e.type===`created`||e.type===`import-boundary`||e.type===`imported-message`||e.type!==`message`)return null;let{msg:n}=e;return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 mb-0.5`,children:[(0,F.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[140px]`,title:n.from,children:(0,F.jsx)(O,{target:n.from,agentsById:t})}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`→`}),(0,F.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[140px]`,title:n.to,children:(0,F.jsx)(O,{target:n.to,agentsById:t})}),(0,F.jsx)(E,{variant:`outline`,className:`text-[10px] px-1 py-0 shrink-0 ml-1`,children:n.kind})]}),(0,F.jsx)(N,{msg:n,peer:s})]})}function H(){let e=i(e=>e.messages),t=i(e=>e.agentsById),[n,r]=(0,P.useState)(``),[a,o]=(0,P.useState)(``),s=(0,P.useMemo)(()=>{let t=e;if(n){let e=n.toLowerCase();t=t.filter(t=>t.from.toLowerCase().includes(e)||t.to.toLowerCase().includes(e))}return a&&(t=t.filter(e=>e.kind===a)),t},[e,n,a]),c=(0,P.useMemo)(()=>h(s,[]),[s]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`input`,{type:`text`,className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm w-44`,placeholder:`Filter by agent…`,value:n,onChange:e=>r(e.target.value)}),(0,F.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:a,onChange:e=>o(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`All kinds`}),z.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]}),(0,F.jsx)(E,{variant:`secondary`,className:`ml-auto`,children:s.length})]}),(0,F.jsx)(l,{className:`h-[calc(100dvh-13rem)]`,children:(0,F.jsxs)(`div`,{className:`space-y-1 pr-2`,children:[c.length===0&&(0,F.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No messages yet`}),c.map((e,n)=>(0,F.jsx)(V,{entry:e,agentsById:t},n))]})})]})}function U(){let e=a(),t=i(e=>e.activityFilter),n=i(e=>e.activityEvents),r=i(e=>e.operatorActivity),s=i(e=>e.set),d=i(e=>e.openActivityItem),f=i(e=>e.openTaskDetailById),p=i(e=>e.exportActivity),m=(0,P.useMemo)(()=>{let e=[...n,...r],t=new Set,i=[];for(let n of e){let e=n.clientId||String(n.id);t.has(e)||(t.add(e),i.push(n))}return i.map(e=>({...e,ts:e.ts??new Date(e.createdAt).getTime()})).sort((e,t)=>(t.ts??0)-(e.ts??0))},[n,r]),h=(0,P.useMemo)(()=>t?m.filter(e=>e.kind===t):m,[m,t]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:t,onChange:e=>s({activityFilter:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`All types`}),R.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]}),(0,F.jsxs)(T,{size:`sm`,variant:`outline`,onClick:()=>p(`markdown`),children:[(0,F.jsx)(y,{className:`w-4 h-4 mr-1`}),` Markdown`]}),(0,F.jsxs)(T,{size:`sm`,variant:`outline`,onClick:()=>p(`json`),children:[(0,F.jsx)(_,{className:`w-4 h-4 mr-1`}),` JSON`]}),(0,F.jsx)(E,{variant:`secondary`,className:`ml-auto`,children:h.length})]}),(0,F.jsx)(l,{className:`h-[calc(100dvh-13rem)]`,children:(0,F.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[h.length===0&&(0,F.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No activity yet`}),h.map(t=>{let n=I[t.kind]||u,r=L[t.kind]||L.message,i=B(t.metadata);return(0,F.jsx)(A,{className:`cursor-pointer hover:bg-accent/40 transition-colors`,onClick:()=>d(t),children:(0,F.jsxs)(k,{className:`p-3 flex gap-3`,children:[(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center w-7 h-7 rounded-md border shrink-0 mt-0.5 ${r}`,children:(0,F.jsx)(n,{className:`w-3.5 h-3.5`})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-sm truncate`,children:t.title}),(0,F.jsx)(E,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${r}`,children:t.kind}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground ml-auto shrink-0`,title:c(t.ts??t.createdAt),children:o(e,t.ts??t.createdAt)})]}),t.body&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:t.body}),t.meta&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-0.5 font-mono truncate`,children:t.meta}),i&&(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground/60 mt-0.5 truncate`,title:i,children:[(0,F.jsx)(`span`,{className:`opacity-70`,children:`via`}),` `,i]}),t.taskId!=null&&(0,F.jsx)(`div`,{className:`mt-1`,children:(0,F.jsx)(D,{id:t.taskId,onClick:()=>f(t.taskId)})})]})]})},t.clientId||t.id)})]})})]})}function W(){let[e,n]=(0,P.useState)(`firehose`);return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`firehose`?(0,F.jsx)(b,{className:`w-5 h-5 text-muted-foreground`}):(0,F.jsx)(u,{className:`w-5 h-5 text-muted-foreground`}),(0,F.jsx)(`h2`,{className:`text-lg font-semibold`,children:e===`firehose`?`Firehose`:`Events`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-input overflow-hidden`,children:[(0,F.jsx)(`button`,{className:t(`px-3 py-1.5 text-sm transition-colors`,e===`firehose`?`bg-primary text-primary-foreground`:`hover:bg-accent`),onClick:()=>n(`firehose`),children:`Firehose`}),(0,F.jsx)(`button`,{className:t(`px-3 py-1.5 text-sm transition-colors`,e===`events`?`bg-primary text-primary-foreground`:`hover:bg-accent`),onClick:()=>n(`events`),children:`Events`})]})]}),e===`firehose`?(0,F.jsx)(H,{}):(0,F.jsx)(U,{})]})}export{W as ActivityView};
2
- //# sourceMappingURL=activity-DzCcQTee.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{t as i,wt as a}from"./store-BgDALGIX.js";import{et as o,mt as s,v as c}from"./display-BemJG1f_.js";import{t as l}from"./scroll-area-CIN4KQse.js";import{t as u}from"./activity-TMzFOdh2.js";import{t as d}from"./radio-Bn0_qc0G.js";import{K as f,a as p,d as m,g as h,t as g}from"./TraceView-B99Uu2yT.js";import{t as _}from"./braces-BOks9SsY.js";import{t as v}from"./clipboard-list-W2YeUsxT.js";import{n as y,t as b}from"./flame-CxBuz46L.js";import{t as x}from"./link-6RR7Hy3-.js";import{t as S}from"./message-circle-wjztgHBe.js";import{t as C}from"./message-square-reply-B9Z4cbQx.js";import{n as w}from"./agent-type-icon-CXSLrKiq.js";import{t as T}from"./button-Do6Z3vvn.js";import{t as E}from"./badge-DqJRtj_p.js";import{t as D}from"./task-chip-CYj0mpoL.js";import{n as O}from"./agent-name-C_7F4DFR.js";import{r as k,t as A}from"./card-C4QJ4hCW.js";import{i as j,n as M,t as N}from"./MessageBubble-BOkmEvgZ.js";var P=e(n(),1),F=r(),I={question:f,reply:C,message:S,operator:w,pair:x,task:v,state:d},L={question:`bg-tone-info/10 text-tone-info-fg border-tone-info/20`,reply:`bg-tone-success/10 text-tone-success-fg border-tone-success/20`,message:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,operator:`bg-tone-purple/10 text-tone-purple-fg border-tone-purple/20`,pair:`bg-tone-yellow/10 text-tone-yellow-fg border-tone-yellow/20`,task:`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/20`,state:`bg-tone-cyan/10 text-tone-cyan-fg border-tone-cyan/20`},R=[`question`,`reply`,`message`,`operator`,`pair`,`task`,`state`],z=[`chat`,`session`,`system`,`task`];function B(e){let t=e?.surface;if(!t||typeof t!=`object`)return null;let n=t,r=[];return typeof n.component==`string`&&r.push(n.component),typeof n.view==`string`&&n.view!==n.component&&r.push(n.view),typeof n.session==`string`&&r.push(`tab ${n.session.slice(0,6)}`),typeof n.client==`string`&&r.push(`client ${n.client.slice(0,6)}`),r.length?r.join(` · `):null}function V({entry:e,agentsById:t}){if(e.type===`notice`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(M,{msg:e.msg})});if(e.type===`agent-action`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(g,{entry:e})});if(e.type===`activity`)return(0,F.jsx)(`div`,{className:`px-1 opacity-60`,children:(0,F.jsx)(j,{steps:e.steps,showReasoning:!1})});if(e.type===`status`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(m,{event:e.event})});if(e.type===`date`)return(0,F.jsx)(`div`,{className:`px-1`,children:(0,F.jsx)(p,{date:e.date})});if(e.type===`created`||e.type===`import-boundary`||e.type===`imported-message`||e.type!==`message`)return null;let{msg:n}=e;return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 mb-0.5`,children:[(0,F.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[140px]`,title:n.from,children:(0,F.jsx)(O,{target:n.from,agentsById:t})}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`→`}),(0,F.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate max-w-[140px]`,title:n.to,children:(0,F.jsx)(O,{target:n.to,agentsById:t})}),(0,F.jsx)(E,{variant:`outline`,className:`text-[10px] px-1 py-0 shrink-0 ml-1`,children:n.kind})]}),(0,F.jsx)(N,{msg:n,peer:s})]})}function H(){let e=i(e=>e.messages),t=i(e=>e.agentsById),[n,r]=(0,P.useState)(``),[a,o]=(0,P.useState)(``),s=(0,P.useMemo)(()=>{let t=e;if(n){let e=n.toLowerCase();t=t.filter(t=>t.from.toLowerCase().includes(e)||t.to.toLowerCase().includes(e))}return a&&(t=t.filter(e=>e.kind===a)),t},[e,n,a]),c=(0,P.useMemo)(()=>h(s,[]),[s]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`input`,{type:`text`,className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm w-44`,placeholder:`Filter by agent…`,value:n,onChange:e=>r(e.target.value)}),(0,F.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:a,onChange:e=>o(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`All kinds`}),z.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]}),(0,F.jsx)(E,{variant:`secondary`,className:`ml-auto`,children:s.length})]}),(0,F.jsx)(l,{className:`h-[calc(100dvh-13rem)]`,children:(0,F.jsxs)(`div`,{className:`space-y-1 pr-2`,children:[c.length===0&&(0,F.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No messages yet`}),c.map((e,n)=>(0,F.jsx)(V,{entry:e,agentsById:t},n))]})})]})}function U(){let e=a(),t=i(e=>e.activityFilter),n=i(e=>e.activityEvents),r=i(e=>e.operatorActivity),s=i(e=>e.set),d=i(e=>e.openActivityItem),f=i(e=>e.openTaskDetailById),p=i(e=>e.exportActivity),m=(0,P.useMemo)(()=>{let e=[...n,...r],t=new Set,i=[];for(let n of e){let e=n.clientId||String(n.id);t.has(e)||(t.add(e),i.push(n))}return i.map(e=>({...e,ts:e.ts??new Date(e.createdAt).getTime()})).sort((e,t)=>(t.ts??0)-(e.ts??0))},[n,r]),h=(0,P.useMemo)(()=>t?m.filter(e=>e.kind===t):m,[m,t]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:t,onChange:e=>s({activityFilter:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`All types`}),R.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]}),(0,F.jsxs)(T,{size:`sm`,variant:`outline`,onClick:()=>p(`markdown`),children:[(0,F.jsx)(y,{className:`w-4 h-4 mr-1`}),` Markdown`]}),(0,F.jsxs)(T,{size:`sm`,variant:`outline`,onClick:()=>p(`json`),children:[(0,F.jsx)(_,{className:`w-4 h-4 mr-1`}),` JSON`]}),(0,F.jsx)(E,{variant:`secondary`,className:`ml-auto`,children:h.length})]}),(0,F.jsx)(l,{className:`h-[calc(100dvh-13rem)]`,children:(0,F.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[h.length===0&&(0,F.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No activity yet`}),h.map(t=>{let n=I[t.kind]||u,r=L[t.kind]||L.message,i=B(t.metadata);return(0,F.jsx)(A,{className:`cursor-pointer hover:bg-accent/40 transition-colors`,onClick:()=>d(t),children:(0,F.jsxs)(k,{className:`p-3 flex gap-3`,children:[(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center w-7 h-7 rounded-md border shrink-0 mt-0.5 ${r}`,children:(0,F.jsx)(n,{className:`w-3.5 h-3.5`})}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-sm truncate`,children:t.title}),(0,F.jsx)(E,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${r}`,children:t.kind}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground ml-auto shrink-0`,title:c(t.ts??t.createdAt),children:o(e,t.ts??t.createdAt)})]}),t.body&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:t.body}),t.meta&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-0.5 font-mono truncate`,children:t.meta}),i&&(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground/60 mt-0.5 truncate`,title:i,children:[(0,F.jsx)(`span`,{className:`opacity-70`,children:`via`}),` `,i]}),t.taskId!=null&&(0,F.jsx)(`div`,{className:`mt-1`,children:(0,F.jsx)(D,{id:t.taskId,onClick:()=>f(t.taskId)})})]})]})},t.clientId||t.id)})]})})]})}function W(){let[e,n]=(0,P.useState)(`firehose`);return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`firehose`?(0,F.jsx)(b,{className:`w-5 h-5 text-muted-foreground`}):(0,F.jsx)(u,{className:`w-5 h-5 text-muted-foreground`}),(0,F.jsx)(`h2`,{className:`text-lg font-semibold`,children:e===`firehose`?`Firehose`:`Events`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-input overflow-hidden`,children:[(0,F.jsx)(`button`,{className:t(`px-3 py-1.5 text-sm transition-colors`,e===`firehose`?`bg-primary text-primary-foreground`:`hover:bg-accent`),onClick:()=>n(`firehose`),children:`Firehose`}),(0,F.jsx)(`button`,{className:t(`px-3 py-1.5 text-sm transition-colors`,e===`events`?`bg-primary text-primary-foreground`:`hover:bg-accent`),onClick:()=>n(`events`),children:`Events`})]})]}),e===`firehose`?(0,F.jsx)(H,{}):(0,F.jsx)(U,{})]})}export{W as ActivityView};
2
+ //# sourceMappingURL=activity-ZIX0N1El.js.map