@wjarka/cezarion 0.17.0-pr2755.4621 → 0.17.0-pr2757.4627

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 (30) hide show
  1. package/README.md +2 -2
  2. package/dist/detached-process.d.ts +1 -1
  3. package/dist/server/server.d.ts +60 -60
  4. package/dist/workflows/run-states.d.ts +1 -1
  5. package/package.json +3 -3
  6. package/web/dist/assets/{activity-motion-Ch0PoZJR.js → activity-motion-NzxJ71zi.js} +2 -2
  7. package/web/dist/assets/{activity-route-CQPkXxJ2.js → activity-route-Bh7yNDK5.js} +1 -1
  8. package/web/dist/assets/{commit-diff-panel-UwU29VK_.js → commit-diff-panel-ScemGCmt.js} +1 -1
  9. package/web/dist/assets/{diff-CQdcUei8.js → diff-DqUE5TL5.js} +2 -2
  10. package/web/dist/assets/{diff-view-BH7MnYEM.js → diff-view-76XFFi9N.js} +1 -1
  11. package/web/dist/assets/{git-toolbar-BIctOY7_.js → git-toolbar-BYYLBaEs.js} +1 -1
  12. package/web/dist/assets/{github-BtPVrHZu.js → github-D5JZzvGs.js} +1 -1
  13. package/web/dist/assets/global-activity-route-D3BT_zHO.js +1 -0
  14. package/web/dist/assets/{index-B98HIjrF.js → index-Df3em9PF.js} +3 -3
  15. package/web/dist/assets/{preview-pane-connected-Dfc9BAkc.js → preview-pane-connected-BqwwsZSL.js} +1 -1
  16. package/web/dist/assets/{repo-git-BmaBIIo9.js → repo-git-DcuVN5vq.js} +1 -1
  17. package/web/dist/assets/{report-reader-BflKmitB.js → report-reader-CqbZoKe9.js} +1 -1
  18. package/web/dist/assets/{reports-D0VRvzsA.js → reports-DRwV6OJ2.js} +1 -1
  19. package/web/dist/assets/{run-header-p5pX7Js3.js → run-header-CPZQRp1f.js} +1 -1
  20. package/web/dist/assets/{skills-BLI5ZUXe.js → skills-TQ7FeCDg.js} +1 -1
  21. package/web/dist/assets/{task-changes-nzP5M4TF.js → task-changes-DeDj9_Ik.js} +1 -1
  22. package/web/dist/assets/{task-commits-IDq_lfu-.js → task-commits-CJnIT11n.js} +1 -1
  23. package/web/dist/assets/{task-files-DKCWoClo.js → task-files-h5cyCYaK.js} +1 -1
  24. package/web/dist/assets/{task-github-item-D-HcRSL8.js → task-github-item-D0Wo31zI.js} +1 -1
  25. package/web/dist/assets/{task-thread-BJuTSmY_.js → task-thread-DmfO1oPj.js} +1 -1
  26. package/web/dist/assets/{thread-state-DWNsDveq.js → thread-state-k4xYkIgi.js} +1 -1
  27. package/web/dist/assets/{use-hand-to-agent-state-Ds1bv9Yr.js → use-hand-to-agent-state-Drccyozp.js} +1 -1
  28. package/web/dist/assets/{workflows-BWyhlz9X.js → workflows-CXTkLv75.js} +1 -1
  29. package/web/dist/index.html +1 -1
  30. package/web/dist/assets/global-activity-route-BOg5DOZ-.js +0 -1
package/README.md CHANGED
@@ -1762,8 +1762,8 @@ For iteration, run affected test files or `npm run test:changed` (inspect with
1762
1762
  `-- --plan`; override the local main comparison with `-- --base=<ref>`).
1763
1763
  The changed-test command includes staged, unstaged and untracked changes and
1764
1764
  falls back to full Vitest on shared/configuration/unknown input or missing Git
1765
- history. It is not a substitute for final verification. See `.ai/skills/validation/SKILL.md`
1766
- for targeted browser commands and the final-gate/evidence-reuse policy.
1765
+ history. It is not a substitute for final verification. See [AGENTS.md § Validation](AGENTS.md#validation)
1766
+ for targeted browser commands and the [CI guide](docs/sdlc/ci.md) for the final-gate/evidence-reuse policy.
1767
1767
 
1768
1768
  `npm run typecheck` checks all four workspaces from source without writing build
1769
1769
  output. `npm run typecheck:web` checks the cockpit and reads the server route types
@@ -3,7 +3,7 @@ import type { DatabaseSync } from 'node:sqlite';
3
3
  /**
4
4
  * Starts a process that outlives the call that started it, and later stops it
5
5
  * (hearsay-tools/cezarion#1717, hearsay-tools/cezarion#1815). It holds the Process exits cases
6
- * of .ai/skills/load-bearing-change § Case tables, so a caller that starts through it owns only its own handle and
6
+ * of .ai/specs/TEMPLATE.md § Case tables, so a caller that starts through it owns only its own handle and
7
7
  * the phases of its own start.
8
8
  *
9
9
  * A started process leads its own process group (on POSIX), and its start identity is recorded:
@@ -5112,19 +5112,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5112
5112
  } & {
5113
5113
  "/repo/commit/:sha": {
5114
5114
  $get: {
5115
- output: string;
5116
- outputFormat: "text";
5117
- status: import("hono/utils/http-status").ContentfulStatusCode;
5118
- input: {
5119
- query: {
5120
- structured?: string | undefined;
5121
- };
5122
- } & {
5123
- param: {
5124
- sha: string;
5125
- };
5126
- };
5127
- } | {
5128
5115
  output: {
5129
5116
  error: string;
5130
5117
  code?: "invalid_input" | undefined;
@@ -5188,6 +5175,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
5188
5175
  sha: string;
5189
5176
  };
5190
5177
  };
5178
+ } | {
5179
+ output: string;
5180
+ outputFormat: "text";
5181
+ status: import("hono/utils/http-status").ContentfulStatusCode;
5182
+ input: {
5183
+ query: {
5184
+ structured?: string | undefined;
5185
+ };
5186
+ } & {
5187
+ param: {
5188
+ sha: string;
5189
+ };
5190
+ };
5191
5191
  };
5192
5192
  };
5193
5193
  } & {
@@ -18485,20 +18485,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18485
18485
  } & {
18486
18486
  "/runs/:id/handoff": {
18487
18487
  $get: {
18488
- output: string;
18489
- outputFormat: "text";
18490
- status: 200;
18488
+ output: {
18489
+ error: string;
18490
+ };
18491
+ outputFormat: "json";
18492
+ status: 404;
18491
18493
  input: {
18492
18494
  param: {
18493
18495
  id: string;
18494
18496
  };
18495
18497
  };
18496
18498
  } | {
18497
- output: {
18498
- error: string;
18499
- };
18500
- outputFormat: "json";
18501
- status: 404;
18499
+ output: string;
18500
+ outputFormat: "text";
18501
+ status: 200;
18502
18502
  input: {
18503
18503
  param: {
18504
18504
  id: string;
@@ -18536,15 +18536,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18536
18536
  } & {
18537
18537
  "/runs/:id/diff": {
18538
18538
  $get: {
18539
- output: string;
18540
- outputFormat: "text";
18541
- status: import("hono/utils/http-status").ContentfulStatusCode;
18542
- input: {
18543
- param: {
18544
- id: string;
18545
- };
18546
- };
18547
- } | {
18548
18539
  output: {
18549
18540
  error: string;
18550
18541
  };
@@ -18566,6 +18557,15 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18566
18557
  id: string;
18567
18558
  };
18568
18559
  };
18560
+ } | {
18561
+ output: string;
18562
+ outputFormat: "text";
18563
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18564
+ input: {
18565
+ param: {
18566
+ id: string;
18567
+ };
18568
+ };
18569
18569
  };
18570
18570
  };
18571
18571
  } & {
@@ -21110,19 +21110,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21110
21110
  } & {
21111
21111
  "/repo/commit/:sha": {
21112
21112
  $get: {
21113
- output: string;
21114
- outputFormat: "text";
21115
- status: import("hono/utils/http-status").ContentfulStatusCode;
21116
- input: {
21117
- query: {
21118
- structured?: string | undefined;
21119
- };
21120
- } & {
21121
- param: {
21122
- sha: string;
21123
- };
21124
- };
21125
- } | {
21126
21113
  output: {
21127
21114
  error: string;
21128
21115
  code?: "invalid_input" | undefined;
@@ -21186,6 +21173,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21186
21173
  sha: string;
21187
21174
  };
21188
21175
  };
21176
+ } | {
21177
+ output: string;
21178
+ outputFormat: "text";
21179
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21180
+ input: {
21181
+ query: {
21182
+ structured?: string | undefined;
21183
+ };
21184
+ } & {
21185
+ param: {
21186
+ sha: string;
21187
+ };
21188
+ };
21189
21189
  };
21190
21190
  };
21191
21191
  } & {
@@ -34483,20 +34483,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34483
34483
  } & {
34484
34484
  "/runs/:id/handoff": {
34485
34485
  $get: {
34486
- output: string;
34487
- outputFormat: "text";
34488
- status: 200;
34486
+ output: {
34487
+ error: string;
34488
+ };
34489
+ outputFormat: "json";
34490
+ status: 404;
34489
34491
  input: {
34490
34492
  param: {
34491
34493
  id: string;
34492
34494
  };
34493
34495
  };
34494
34496
  } | {
34495
- output: {
34496
- error: string;
34497
- };
34498
- outputFormat: "json";
34499
- status: 404;
34497
+ output: string;
34498
+ outputFormat: "text";
34499
+ status: 200;
34500
34500
  input: {
34501
34501
  param: {
34502
34502
  id: string;
@@ -34534,15 +34534,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34534
34534
  } & {
34535
34535
  "/runs/:id/diff": {
34536
34536
  $get: {
34537
- output: string;
34538
- outputFormat: "text";
34539
- status: import("hono/utils/http-status").ContentfulStatusCode;
34540
- input: {
34541
- param: {
34542
- id: string;
34543
- };
34544
- };
34545
- } | {
34546
34537
  output: {
34547
34538
  error: string;
34548
34539
  };
@@ -34564,6 +34555,15 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34564
34555
  id: string;
34565
34556
  };
34566
34557
  };
34558
+ } | {
34559
+ output: string;
34560
+ outputFormat: "text";
34561
+ status: import("hono/utils/http-status").ContentfulStatusCode;
34562
+ input: {
34563
+ param: {
34564
+ id: string;
34565
+ };
34566
+ };
34567
34567
  };
34568
34568
  };
34569
34569
  } & {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Every run state, every trigger out of it and every wait kind, as data (hearsay-tools/cezarion#1804).
3
- * This file is the Transitions out table of .ai/skills/load-bearing-change § Case tables: a change that adds or changes
3
+ * This file is the Transitions out table of .ai/specs/TEMPLATE.md § Case tables: a change that adds or changes
4
4
  * a run state declares its triggers here first.
5
5
  *
6
6
  * Two levels. An exit (`RUN_EXITS`, in `runs/run-exits.ts`) is one kind of status write, with the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjarka/cezarion",
3
- "version": "0.17.0-pr2755.4621",
3
+ "version": "0.17.0-pr2757.4627",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,8 +57,8 @@
57
57
  "devDependencies": {
58
58
  "@babel/parser": "^8.0.8",
59
59
  "@babel/types": "^8.0.8",
60
- "@open-mercato/cezar-api-client": "0.17.0-pr2755.4621",
61
- "@open-mercato/cezar-contract": "0.17.0-pr2755.4621",
60
+ "@open-mercato/cezar-api-client": "0.17.0-pr2757.4627",
61
+ "@open-mercato/cezar-contract": "0.17.0-pr2757.4627",
62
62
  "@types/node": "^24.19.1",
63
63
  "@types/ws": "^8.18.1",
64
64
  "esbuild": "^0.28.1",
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r,t as i,u as a}from"./button-RJMdCnZw.js";import{En as o,Kn as s,Mn as c,Rn as l,Sr as u,Vn as d,Vr as f,i as p,kr as ee,p as te,rr as ne,wr as re,zt as ie}from"./project-scope-context-DFjJ4Dzo.js";import{t as ae}from"./useQuery-BGIo-SEb.js";import{$ as oe,A as se,Q as ce,V as le,Y as m,Z as h,dt as ue,et as g,nt as _,ot as v,q as de,rt as y,st as fe,ut as pe}from"./live-protocol-ai7TG3jr.js";import{i as me,n as he,t as ge}from"./ws-BZNDvStH.js";import{t as b}from"./createLucideIcon-BHp8sXmF.js";import{n as _e,r as ve,t as ye}from"./hourglass-B0lPAJvT.js";import{t as be}from"./eye-B8okNWXU.js";import{t as xe}from"./message-square-B-MD-8rD.js";import{t as x}from"./project-router-DQWY9FSQ.js";import{Mt as Se,at as S,en as C}from"./index-B98HIjrF.js";var Ce=b(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),we=b(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Te=b(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ee=b(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),De=b(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),Oe=b(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),ke=b(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ae=b(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),je=b(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),w=e(t(),1),T=n(),E=ue(),D=_().int().nonnegative(),O=v().min(1),Me=y({title:v().max(160),toolKind:m([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:m([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:E,endedAt:E.optional()}).strict(),Ne=m([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Pe=y({checks:h(y({name:v().max(100),bucket:Ne}).strict()).max(100),counts:y({pass:D,fail:D,pending:D,skipping:D,cancel:D}).strict(),truncated:g(!0).optional()}).strict(),Fe=oe(`kind`,[y({kind:g(`human`),since:E,detail:y({question:v().max(500).optional(),reason:m([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:_().int().positive().optional()}).strict()}).strict(),y({kind:g(`usage-limit`),detail:y({resumeAt:v()}).strict()}).strict(),y({kind:g(`workers`),since:E,deadline:E.optional(),detail:y({owed:D,total:D,settled:D,replies:g(!0).optional(),mode:se.optional(),recipientRunIds:h(O)}).strict()}).strict(),y({kind:g(`peers`),since:E,deadline:E,detail:y({peerRunIds:h(O)}).strict()}).strict(),y({kind:g(`subagents`),since:E,deadline:E,detail:y({running:D}).strict()}).strict(),y({kind:g(`pr`),since:E,deadline:E,detail:y({number:_().int().positive(),target:ne,checks:Pe.shape.checks.optional(),counts:Pe.shape.counts.optional(),truncated:g(!0).optional()}).strict()}).strict(),y({kind:g(`process`),since:E,deadline:E,detail:y({pid:_().int(),note:v().optional()}).strict()}).strict(),y({kind:g(`timer`),since:E,deadline:E,detail:y({wakeAt:E,note:v().optional()}).strict()}).strict()]),Ie={runId:O,title:v(),status:s,rung:m(l),runner:de.optional(),model:v().optional(),currentStepId:v().optional(),startedAt:v().optional(),wait:Fe.optional(),tool:Me.optional(),rate:h(D).length(30),error:v().max(200).optional()},Le=y({...Ie,revision:D,collected:ce()}).strict(),Re=y({...Ie,workers:h(Le)}).strict(),ze=y({requestId:pe(),relationship:m([`family`,`peer`]),senderRunId:O,recipientRunId:O,text:v().max(500),senderTitle:v().optional(),recipientTitle:v().optional(),createdAt:E,deadline:E.optional()}).strict(),Be=y({requestId:pe(),senderRunId:O,recipientRunId:O,status:le.shape.status,observedAt:E}).strict(),Ve=y({generatedAt:E,projects:h(y({projectId:v(),name:v(),loaded:ce(),unavailable:y({status:fe([g(404),g(409),g(503)]),error:v()}).strict().optional(),inReview:D,tasks:h(Re),requests:h(ze),closed:h(Be)}).strict())}).strict();y({project:fe([g(`default`),v().regex(c)]).optional()});var He=5e3,Ue=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],We=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ge=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ke=`the cezar server answered /workspace/activity with an unexpected body`;function qe(e){let t=Ve.safeParse(e);if(!t.success)throw new p(200,Ke);return t.data}async function Je(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return qe(await o(await te.api.v1.workspace.activity.$get({query:n},ie(t)),`/workspace/activity`))}function Ye(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Xe=new Date(0).toISOString();function Ze(e){return e!==void 0&&e!==Xe&&!Number.isNaN(Date.parse(e))}var Qe=new Set([404,409,503]);function $e(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Xe,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function et(e,t){return new p(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var tt=(e,t)=>e.kind===`project`&&Qe.has(t.status)?t.status:void 0;function nt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,w.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,w.useMemo)(()=>Ue(n),[n]),i=f(),a=ae({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Ye(t,await Je(n,{signal:e}))}catch(e){let r=e instanceof p?tt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return $e(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,w.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=tt(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>$e(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=qe(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Ye(e,a))})},o=ge(We(n),a),s=he(He),c,l=()=>{let e=u()===`finite`&&s!==!1;e&&!c?c=me({path:Ge(n),intervalMs:s},(e,n)=>{n===void 0?a(e):t(et(e,n))}):!e&&c&&(c(),c=void 0)};l();let d=re(l);return()=>{e=!1,d(),c?.(),o()}},[i,r,n]),a}var k=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${k(r)}:${k(i)}`:`${r}:${k(i)}`}function rt(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${k(n%60)} min`}function j(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var it=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function M(e){let t=Date.parse(e);return Number.isNaN(t)?e:it.format(t)}function at(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var ot=new Set([`queued`,`running`,`waiting`]),st={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ct={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},N=e=>ot.has(e),P=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,F=e=>d(e.rung).tone,lt=(e,t=`Deadline`)=>e?`${t} ${M(e)}`:void 0;function ut(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${P(t.length,`task`)}`}function dt(e,t){let n=e.tool,r={verb:`Doing`,tone:F(e),icon:`tool`},i=n?.endedAt!==void 0&&j(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${rt(j(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function ft(e,t){let n={verb:`Needs you`,tone:F(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${P(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function pt(e){return{verb:`Needs you`,tone:F(e),icon:`user`,main:`Permission`,action:`open`}}function mt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:F(e),since:t.since};if(o){let e=c.length>0?ut(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...I(`detail`,lt(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${ht[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...I(`detail`,lt(t.deadline))}}var ht={one:`One`,any:`Any`,all:`All`};function gt(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var _t=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function vt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=_t.reduce((e,t)=>e+i(t),0),o=_t.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var yt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function bt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=yt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=vt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function xt(e,t){let n={tone:F(e),since:t.since,...I(`detail`,lt(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:gt(t),...I(`checks`,r),...I(`overflow`,vt(t)),...I(`checkSummary`,bt(t))}}function I(e,t){return t===void 0?{}:{[e]:t}}function St(e,t,n){let r=F(e);switch(t.kind){case`workers`:return mt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:ut(`For`,t.detail.peerRunIds,n),detail:`Deadline ${M(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:P(t.detail.running,`native subagent`),detail:`Deadline ${M(t.deadline)}`};case`pr`:return xt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(j(t.since,n.now))} · deadline ${M(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${M(t.detail.wakeAt)} · in ${A(-j(t.detail.wakeAt,n.now))}`};case`usage-limit`:return Ct(e,t.detail.resumeAt,n);case`human`:return}}function Ct(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${M(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`,detail:i}}function wt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:F(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${rt(j(n,t.now))}`}:{}}}function L(e,t){return{verb:st[e.status]??e.status,tone:F(e),icon:ct[e.status]??`done`,main:t}}function R(e,t){return N(e.status)?Tt(e,t):L(e,P(e.workers.filter(e=>N(e.status)).length,`live worker`))}function Tt(e,t){let n=e.wait;switch(e.rung){case`running`:return dt(e,t);case`needs-permission`:return pt(e);case`needs-you`:return ft(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?Ct(e,n.detail.resumeAt,t):{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return wt(e,t);default:return(n&&St(e,n,t))??wt(e,t)}}function Et(e,t,n){if(n!==void 0&&N(e.status))return{verb:`Asks parent`,tone:F(e),main:`“${n}”`,asks:!0};let r=Dt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Dt(e,t){switch(e.status){case`done`:return L(e,e.collected?`Collected`:`Ready to collect`);case`review`:return L(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return L(e,e.error??st[e.status]??e.status);default:return Tt({...e,workers:[]},t)}}function Ot(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function kt(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function z(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var B=(e,t)=>z(e,t.senderRunId,t.senderTitle),V=(e,t)=>z(e,t.recipientRunId,t.recipientTitle);function H(e,t,n){let r=[];for(let i of t)i.senderRunId===e&&r.push(`Waiting for a reply from ${V(n,i)}`),i.recipientRunId===e&&r.push(`${B(n,i)} waits for your reply`);return r}function At(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function jt(e,t){let n=-j(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Mt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Nt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Pt[Ft(e,t)]}}var Pt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Ft(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var It=new Set([`needs-you`,`needs-permission`]),Lt=new Set([`queued`,`waiting-for-capacity`]);function Rt(e){if(N(e.status))return It.has(e.rung)?`needsYou`:e.rung===`running`?`working`:Lt.has(e.rung)?`queued`:`waiting`}function U(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Rt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>N(e.status)).length}}return t}function zt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Bt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var W={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},G={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},comets:{},bumps:{},slides:{},checks:{}},Vt=(e,t)=>`${e}\n${t}`;function Ht(e,t){let n=Vt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Ut=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Wt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Gt(e,t){let n=Wt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.workerHold+W.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},W.workerHold)}function Kt(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},W.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},W.comet)}function qt(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},W.fade);return}let a=W.comet+W.replied+W.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},W.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},W.comet+W.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},W.comet)}function Jt(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:d(t.task.rung).tone},W.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},W.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},W.workerEnter);case`worker-settled`:return Gt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},W.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},W.cardLeave);case`check-passed`:return e.timed(`checks`,Vt(t.runId,t.name),{},W.check);case`request-opened`:return Kt(e,t.request);case`request-closed`:return qt(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},W.bump)}}function Yt(e,t,n){let r=new Ut(t);if(!n)for(let t of e)Jt(r,t);return{changes:r.changes,timers:r.timers}}function Xt(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function Zt(e,t){return t.reduce(Xt,e)}var Qt={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function $t({tone:e,className:t,children:n,...r}){return(0,T.jsx)(`span`,{...r,className:a(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var en={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},tn={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},nn={tool:je,user:Ae,workers:C,reply:xe,peer:De,subagents:C,ci:Ee,merge:Te,command:ke,timer:we,pause:Oe,queued:ye,review:be,failed:_e,done:ve,cancelled:Ce};function rn(e,t){let n=d(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:on(e,t)??n.label}}var an=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function on(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`)return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return an(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return an(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return an(`waiting for`,n.detail.running,`subagent`)}function sn(e,t){if(N(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function K({run:e,role:t}){let{tone:n,shape:r,label:i}=rn(e,t);return(0,T.jsx)(`span`,{"data-activity-anchor":e.runId,className:a(`inline-flex size-[12px] shrink-0 items-center justify-center`,sn(e,r)),children:(0,T.jsx)(S,{tone:n,shape:r,role:`img`,"aria-label":i})})}var cn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},ln=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function un({checks:e,overflow:t,passed:n}){return(0,T.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:a(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,T.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:a(`h-[5px] min-w-px flex-1 rounded-[2px]`,cn[e.bucket],ln(e.bucket,n.has(e.name)))},e.name)),t?(0,T.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`i`,{className:a(`h-[5px] w-2 rounded-[2px]`,cn[t.bucket])}),`+`,t.count]}):null]})}function dn({value:e,ink:t}){return(0,T.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:a(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var fn=new Set;function pn({box:e,now:t,dense:n,motion:r={}}){let i=nn[e.icon],o=Qt[e.tone];return(0,T.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[r.sweep?(0,T.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,T.jsx)(i,{"aria-hidden":`true`,className:a(`mt-px size-[15px]`,o)}),(0,T.jsxs)($t,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,T.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,T.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:A(j(e.since,t))}):null]}),(0,T.jsx)(`span`,{"data-slot":`activity-main`,className:a(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,r.slideKey!==void 0&&`activity-slide`),children:e.main},r.slideKey??`still`),e.checks?(0,T.jsx)(un,{checks:e.checks,overflow:e.overflow,passed:r.passed??fn}):null,e.checkSummary?(0,T.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,T.jsx)(dn,{value:e.bar,ink:o}),e.detail&&!n?(0,T.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function mn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),r=Math.max(4,...e);return(0,T.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:a(`block h-4 w-[62px] shrink-0`,t),children:[(0,T.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/r*14);return(0,T.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var q=e=>`/tasks/${encodeURIComponent(e)}`;function hn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?rt(j(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function gn({texts:e}){return e.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))})}function _n({worker:e,parentId:t,requests:n,index:r,ctx:i,motion:o}){let s=Et(e,i,At(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,T.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:a(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:a(`activity-row-flash`,tn[c.tone])},c.key):null,(0,T.jsx)(`span`,{className:`mt-[3px]`,children:(0,T.jsx)(K,{run:e,role:`worker`})}),(0,T.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,T.jsx)(x,{to:q(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,T.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,T.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`b`,{className:a(`font-semibold`,Qt[s.tone]),children:s.verb}),` · `,(0,T.jsx)(`span`,{className:a(s.mono&&`font-mono`),children:s.main})]}),(0,T.jsx)(gn,{texts:H(e.runId,n,r)})]})}function vn({workers:e}){return(0,T.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,T.jsx)(K,{run:e,role:`worker`},e.runId)),(0,T.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function yn({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>N(e.status)||e.status===`review`||o(e.runId)),c=Bt(zt(e,o));return(0,T.jsxs)(T.Fragment,{children:[s.length>0&&i?(0,T.jsx)(vn,{workers:s}):null,s.length>0&&!i?(0,T.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,T.jsx)(_n,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,T.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}function bn({task:e,requests:t,index:n}){let r=Mt(e.runId,t);return r.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-peer-links`,className:`mt-2 flex flex-col gap-1`,children:r.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(x,{to:q(e.recipientRunId),className:`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:[`→ `,V(n,e)]})},e.requestId))})}function xn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Sn({task:e,motion:t,glow:n}){let r=t.flash[e.runId];return(0,T.jsxs)(T.Fragment,{children:[n?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,r?(0,T.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":r.tone,"aria-hidden":`true`,className:a(`activity-flash`,en[r.tone])},r.key):null]})}function Cn({task:e,requests:t,index:n,ctx:r,dense:o,narrow:s,motion:c=G,ghost:l=!1}){let u=R(e,r),d=l?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},f={sweep:e.rung===`running`&&N(e.status),slideKey:c.slides[e.runId]?.key,passed:Ht(c,e.runId)};return(0,T.jsxs)(`article`,{...d,"data-flip":e.runId,"data-rung":e.rung,className:a(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,u.action?`border-pending`:`border-border`,xn(e,c,l)),children:[(0,T.jsx)(Sn,{task:e,motion:c,glow:u.action!==void 0&&!l}),(0,T.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(K,{run:e,role:`root`}),(0,T.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,T.jsx)(x,{to:q(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,T.jsx)(mn,{rate:e.rate})]}),(0,T.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:hn(e,r.now)}),(0,T.jsx)(gn,{texts:H(e.runId,t,n)}),(0,T.jsx)(pn,{box:u,now:r.now,dense:o,motion:f}),u.action?(0,T.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,T.jsx)(i,{asChild:!0,size:`sm`,variant:u.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,T.jsx)(x,{to:q(e.runId),children:u.action===`answer`?`Answer`:`Open task`})})}):null,s?(0,T.jsx)(bn,{task:e,requests:t,index:n}):null,(0,T.jsx)(yn,{task:e,requests:t,index:n,ctx:r,dense:o,motion:c})]})}function wn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Tn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function En(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Tn(o,r).push(e),s.add(e));return o}function Dn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var On=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function kn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var An=(e,...t)=>e.filter(e=>!t.some(t=>jn(e,t))),jn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Mn=e=>Math.round(e*10)/10,J=e=>`${Mn(e.x)} ${Mn(e.y)}`;function Nn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Pn(e,t=8){let n=Nn(e),r=n[0];if(!r)return``;let i=`M${J(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${J(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${J(c(r,a,s))} Q ${J(r)}, ${J(c(r,o,s))}`}return i}function Fn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function In(e){return{rows:Fn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Fn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var Y=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),X=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Ln(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Rn(e,t,n,r=0){let i=In(n),a=Y(i.rows,e=>e.top,e.y),o=Y(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?X(i,a):X(i,a-1))+r/2,d=(s?X(i,o-1):X(i,o))+r/2,f=Ln(i,Y(i.cols,e=>e.left,e.x),Y(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},ee={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},ee],label:{x:(c+f)/2,y:u}}}var zn=15;function Bn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-zn,e.y+e.h+zn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Vn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Bn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),zn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function Hn(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
2
- `);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function Un(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var Wn=e=>Math.round(e*10)/10,Z=e=>`${Wn(e.x)} ${Wn(e.y)}`;function Gn(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function Kn(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Z({x:o,y:i})} C ${Z({x:o+s,y:i})}, ${Z({x:o+s,y:a})}, ${Z({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function qn(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return Kn(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(kn(On({x:c,y:a},{x:l,y:o}),An(n,e,t))){let i=Vn({x:c,y:a},{x:l,y:o},96,An(n,e,t),r);return{d:Pn(i.points),label:i.label}}return{d:`M${Z({x:c,y:a})} C ${Z({x:c+u,y:a})}, ${Z({x:l-u,y:o})}, ${Z({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function Jn(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?Yn(a,n.y0+i,n.y1-i):a}var Yn=(e,t,n)=>Math.max(t,Math.min(n,e));function Xn(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:Jn(i,n)};return{d:Pn(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function Zn(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Z(i)} C ${Z({x:o,y:i.y})}, ${Z({x:o,y:a.y})}, ${Z(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function Qn(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(kn(On({x:i,y:s},{x:a,y:c}),An(n,e,t))){let i=Rn(e,t,n,r);return{d:Pn(i.points),label:i.label}}return{d:`M${Z({x:i,y:s})} C ${Z({x:i,y:s+l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Z({x:i,y:o})} C ${Z({x:i,y:c-l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function $n(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function er(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function tr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function nr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of er(e,t.w+r))for(let e of tr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var rr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function ir(e,t,n){let r=e!==void 0&&rr(e,n),i=t!==void 0&&rr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var ar=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function or(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)ar(n)&&t.push(n);return t}function sr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function cr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of or(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=sr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var lr={w:88,h:40};function ur(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,$n(i.getBoundingClientRect(),n))}return r}function dr(e,t,n,r,i){let a=t.get(e.senderRunId),o=t.get(e.recipientRunId),s={requestId:e.requestId,kind:`peer`},c=i.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},l=(e,t)=>({side:Gn(e,t,i.width),labelHeight:lr.h,lane:r??0,view:c,...t?{other:t}:{}});switch(ir(a,o,c)){case`both`:return a&&o?{...s,...qn(a,o,[...t.values()],r,Gn(a,void 0,i.width))}:void 0;case`sender`:return a?{...s,...Xn(a,`sender`,l(a,o)),away:V(n,e)}:void 0;case`recipient`:return o?{...s,...Xn(o,`recipient`,l(o,a)),away:B(n,e)}:void 0;case`none`:return}}function fr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function pr(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function mr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!rr(s,a)))return{requestId:e.requestId,kind:`family`,...Zn(c,l,s,i)}}function hr(e,t,n,{peers:r,frame:i={width:e.clientWidth}}){let a=ur(e,`data-activity-card`),o=ur(e,`data-activity-anchor`),s=Hn(t),c=[];for(let e of t){let t=s.get(e.requestId),l=e.relationship===`peer`?r?dr(e,a,n,t,i):void 0:mr(e,a,o,n,t,i.view);l&&c.push(l)}let l=fr(a,i.width),u=nr(c.filter(e=>e.kind===`peer`).map(e=>({id:e.requestId,at:pr(e.label,l)})),lr,i.view);return c.map(e=>({...e,label:u.get(e.requestId)??e.label}))}function gr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.requestId===r.requestId&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function _r({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var vr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function yr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,vr(r)-n);return e.reverse?1-i:i}var br=`http://www.w3.org/2000/svg`,xr=[0,.03,.06,.09,.12],Sr=[4.5,3.5,3,2.5,2],Cr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function wr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(br,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(br,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Cr[t.tone]} opacity-35`),r.append(i),xr.forEach((e,n)=>{let i=document.createElementNS(br,`circle`);i.setAttribute(`r`,String(Sr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Cr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Tr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();wr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(yr(r,n,xr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var Er=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Dr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function Or(e,t,n){let r=w.useRef(null),i=w.useRef(void 0),a=w.useRef(new Set);return w.useEffect(()=>{let e=r.current;if(!e)return;let t=_r({frame:Er,cancel:Dr,draw:(t,n)=>Tr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),w.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:W.comet}))},[e,t,n]),r}function kr(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Ar(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var jr=`activity-layout-settled`;function Mr(e,t,n,r){let i=w.useRef(void 0),a=w.useRef(new Set);w.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Ar(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of kr(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Nr(n,a.current,o)}}),w.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Nr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(jr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function Pr(e,t,n,r,i,a=!1){let[o,s]=w.useState([]);return w.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Fr(i,o):void 0;i.addEventListener(jr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(jr,o),c?.()}},[e,t,n,r,i,a]),o}function Fr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...or(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var Ir=28;function Lr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Ir?`${t.slice(0,Ir-1).trimEnd()}…`:t}function Rr(e,t){if(e.deadline===void 0)return;let n=Date.parse(e.createdAt),r=Date.parse(e.deadline);return Number.isNaN(n)||Number.isNaN(r)||r<=n?1:Math.min(1,Math.max(0,(t-n)/(r-n)))}function zr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return a(`activity-march`,t&&`activity-line-in`)}function Br({line:e,request:t,now:n,phase:r,replied:i}){let o=Rr(t,n);return(0,T.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":r,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:lr.w},className:a(`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`,i?`border-success`:`border-message-peer-accent`,r===`fade`&&`activity-line-out`),children:[(0,T.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[i?(0,T.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,T.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(j(t.createdAt,n))})]}),(0,T.jsx)(`span`,{className:`block truncate`,children:e.away??Lr(t.text)}),o===void 0||i?null:(0,T.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var Vr=(e,t)=>e.closing[t]?.phase??`open`;function Hr(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}function Ur({line:e,motion:t}){let n=Vr(t,e.requestId);return(0,T.jsx)(`path`,{"data-request":e.requestId,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:a(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,zr(n,e.requestId in t.opening))})}function Wr({requests:e,index:t,peers:n,layoutKey:r,now:i,motion:a=G,paused:o=!1}){let s=w.useRef(null),c=Pr(s,w.useCallback(r=>hr(r,e,t,{peers:n,frame:{width:r.clientWidth,view:cr(r)}}),[e,t,n]),gr,`[data-activity-card]`,r,!0),l=w.useMemo(()=>new Set(c.map(e=>e.requestId)),[c]),u=Or(a.comets,l,o),d=new Map(e.map(e=>[e.requestId,e]));return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`svg`,{ref:s,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,T.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})})]}),c.map(e=>(0,T.jsx)(Ur,{line:e,motion:a},e.requestId)),(0,T.jsx)(`g`,{ref:u,"data-slot":`activity-comets`})]}),c.map(e=>{let t=d.get(e.requestId);return e.kind===`peer`&&t?(0,T.jsx)(Br,{line:e,request:t,now:i,phase:Vr(a,e.requestId),replied:Hr(a,e.requestId)},e.requestId):null})]})}function Gr(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of kt(r))n.set(e,t);return n}var Kr={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function qr(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${Kr[t??``]??`closed`}`}var Jr={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},Yr=e=>e.relationship===`peer`?`peer`:`family`;function Xr(e,t,n){let r=(e,n)=>z(t,e,n);switch(e.kind){case`request-opened`:return{tone:Yr(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:qr(e.request,e.status,r)};case`rung-changed`:return{tone:d(e.task.rung).tone,text:`${e.task.title}: ${R(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=Jr[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:d(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function Zr(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function Qr(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var $r=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),ei=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function ti({scope:e,projectId:t}){let n=e=>a(ei,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,T.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,T.jsx)(r,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:n(e===`project`),children:`This project`}),(0,T.jsx)(r,{to:`/activity`,"aria-current":e===`all`?`page`:void 0,className:n(e===`all`),children:`All projects`})]})}function ni({now:e,stale:t}){return(0,T.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`span`,{"data-tone":`success`,className:a(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,T.jsx)(S,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,T.jsx)(`b`,{className:a(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),$r.format(e),` `,at()]})}function ri({name:e,now:t,stale:n=!1,children:r}){return(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,T.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,T.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,T.jsx)(ni,{now:t,stale:n}),r]})}function ii({value:e,bump:t}){return(0,T.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:a(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Q({icon:e,count:t,label:n,bump:r}){return(0,T.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,T.jsx)(ii,{value:t,bump:r}),` `,n]})}function ai({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,T.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,T.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,T.jsxs)(x,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,T.jsx)(S,{tone:`info`,"aria-hidden":`true`}),(0,T.jsx)(ii,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var $=e=>new Map(e.map(e=>[e.runId,e])),oi=e=>e!==void 0&&Ot(e)===void 0;function si(e,t,n,r){let i=$(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&N(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&N(a.status)&&!N(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function ci(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var li=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function ui(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),li(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),si(e,t,n,r),ci(e,t,n,r)}function di(e,t,n){let r=$(e.tasks),i=$(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?ui(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function fi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}var pi=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function mi(e,t,n){let r=U(e),i=U(t);for(let e of pi)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function hi(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!oi(t)||!oi(e)||(di(t,e,r),fi(t,e,r))}return mi(e.projects,t.projects,r),n}function gi(e){return{input:e,reconcile:!1,seq:0,motion:G,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function _i(e){let{plan:t,...n}=e;return{...n,motion:G,epoch:e.epoch+1}}function vi(e,t,n){let r=hi(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=Gr(t,n),o=r.flatMap(e=>Xr(e,a,i)??[]),s=e.seq+o.length+1,c=Yt(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?Zr(e.feed,o,i,e.seq+1):e.feed,motion:Zt(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function yi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:vi(r,n,t)}function bi(e,t){let n=e.input;if(t.scope!==n.scope)return{...gi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={..._i(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=_i(r)),yi(r,t.snapshot)}var xi=`(prefers-reduced-motion: reduce)`,Si=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(xi):void 0;function Ci(e){let t=Si();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function wi(){return Si()?.matches??!1}function Ti(){return(0,w.useSyncExternalStore)(Ci,wi,()=>!1)}function Ei(e,t){let n=w.useRef(new Set);w.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),w.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:Zt(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Di(e,t){let n=Ti(),r=ee(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=w.useState(()=>gi(i)),s=bi(a,i);return s!==a&&o(s),Ei(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Oi(e,t){let n=Se(1e3),[r,i]=w.useState({offset:0}),a=r.offset;return Ze(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{Nt as A,N as B,Sn as C,tn as D,K as E,jt as F,nt as G,M as H,kt as I,B as L,z as M,Ot as N,$t as O,V as P,Mt as R,Cn as S,mn as T,A as U,R as V,j as W,Hn as _,ai as a,En as b,zr as c,Rr as d,Pr as f,$n as g,Qn as h,ti as i,H as j,G as k,Vr as l,Or as m,Di as n,Qr as o,Mr as p,ri as r,Wr as s,Oi as t,Hr as u,Un as v,gn as w,Dn as x,wn as y,U as z};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r,t as i,u as a}from"./button-RJMdCnZw.js";import{En as o,Kn as s,Mn as c,Rn as l,Sr as u,Vn as d,Vr as f,i as p,kr as ee,p as te,rr as ne,wr as re,zt as ie}from"./project-scope-context-DFjJ4Dzo.js";import{t as ae}from"./useQuery-BGIo-SEb.js";import{$ as oe,A as se,Q as ce,V as le,Y as m,Z as h,dt as ue,et as g,nt as _,ot as v,q as de,rt as y,st as fe,ut as pe}from"./live-protocol-ai7TG3jr.js";import{i as me,n as he,t as ge}from"./ws-BZNDvStH.js";import{t as b}from"./createLucideIcon-BHp8sXmF.js";import{n as _e,r as ve,t as ye}from"./hourglass-B0lPAJvT.js";import{t as be}from"./eye-B8okNWXU.js";import{t as xe}from"./message-square-B-MD-8rD.js";import{t as x}from"./project-router-DQWY9FSQ.js";import{Mt as Se,at as S,en as C}from"./index-Df3em9PF.js";var Ce=b(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),we=b(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Te=b(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ee=b(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),De=b(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),Oe=b(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),ke=b(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ae=b(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),je=b(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),w=e(t(),1),T=n(),E=ue(),D=_().int().nonnegative(),O=v().min(1),Me=y({title:v().max(160),toolKind:m([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:m([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:E,endedAt:E.optional()}).strict(),Ne=m([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Pe=y({checks:h(y({name:v().max(100),bucket:Ne}).strict()).max(100),counts:y({pass:D,fail:D,pending:D,skipping:D,cancel:D}).strict(),truncated:g(!0).optional()}).strict(),Fe=oe(`kind`,[y({kind:g(`human`),since:E,detail:y({question:v().max(500).optional(),reason:m([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:_().int().positive().optional()}).strict()}).strict(),y({kind:g(`usage-limit`),detail:y({resumeAt:v()}).strict()}).strict(),y({kind:g(`workers`),since:E,deadline:E.optional(),detail:y({owed:D,total:D,settled:D,replies:g(!0).optional(),mode:se.optional(),recipientRunIds:h(O)}).strict()}).strict(),y({kind:g(`peers`),since:E,deadline:E,detail:y({peerRunIds:h(O)}).strict()}).strict(),y({kind:g(`subagents`),since:E,deadline:E,detail:y({running:D}).strict()}).strict(),y({kind:g(`pr`),since:E,deadline:E,detail:y({number:_().int().positive(),target:ne,checks:Pe.shape.checks.optional(),counts:Pe.shape.counts.optional(),truncated:g(!0).optional()}).strict()}).strict(),y({kind:g(`process`),since:E,deadline:E,detail:y({pid:_().int(),note:v().optional()}).strict()}).strict(),y({kind:g(`timer`),since:E,deadline:E,detail:y({wakeAt:E,note:v().optional()}).strict()}).strict()]),Ie={runId:O,title:v(),status:s,rung:m(l),runner:de.optional(),model:v().optional(),currentStepId:v().optional(),startedAt:v().optional(),wait:Fe.optional(),tool:Me.optional(),rate:h(D).length(30),error:v().max(200).optional()},Le=y({...Ie,revision:D,collected:ce()}).strict(),Re=y({...Ie,workers:h(Le)}).strict(),ze=y({requestId:pe(),relationship:m([`family`,`peer`]),senderRunId:O,recipientRunId:O,text:v().max(500),senderTitle:v().optional(),recipientTitle:v().optional(),createdAt:E,deadline:E.optional()}).strict(),Be=y({requestId:pe(),senderRunId:O,recipientRunId:O,status:le.shape.status,observedAt:E}).strict(),Ve=y({generatedAt:E,projects:h(y({projectId:v(),name:v(),loaded:ce(),unavailable:y({status:fe([g(404),g(409),g(503)]),error:v()}).strict().optional(),inReview:D,tasks:h(Re),requests:h(ze),closed:h(Be)}).strict())}).strict();y({project:fe([g(`default`),v().regex(c)]).optional()});var He=5e3,Ue=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],We=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ge=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ke=`the cezar server answered /workspace/activity with an unexpected body`;function qe(e){let t=Ve.safeParse(e);if(!t.success)throw new p(200,Ke);return t.data}async function Je(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return qe(await o(await te.api.v1.workspace.activity.$get({query:n},ie(t)),`/workspace/activity`))}function Ye(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Xe=new Date(0).toISOString();function Ze(e){return e!==void 0&&e!==Xe&&!Number.isNaN(Date.parse(e))}var Qe=new Set([404,409,503]);function $e(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Xe,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function et(e,t){return new p(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var tt=(e,t)=>e.kind===`project`&&Qe.has(t.status)?t.status:void 0;function nt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,w.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,w.useMemo)(()=>Ue(n),[n]),i=f(),a=ae({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Ye(t,await Je(n,{signal:e}))}catch(e){let r=e instanceof p?tt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return $e(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,w.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=tt(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>$e(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=qe(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Ye(e,a))})},o=ge(We(n),a),s=he(He),c,l=()=>{let e=u()===`finite`&&s!==!1;e&&!c?c=me({path:Ge(n),intervalMs:s},(e,n)=>{n===void 0?a(e):t(et(e,n))}):!e&&c&&(c(),c=void 0)};l();let d=re(l);return()=>{e=!1,d(),c?.(),o()}},[i,r,n]),a}var k=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${k(r)}:${k(i)}`:`${r}:${k(i)}`}function rt(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${k(n%60)} min`}function j(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var it=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function M(e){let t=Date.parse(e);return Number.isNaN(t)?e:it.format(t)}function at(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var ot=new Set([`queued`,`running`,`waiting`]),st={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ct={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},N=e=>ot.has(e),P=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,F=e=>d(e.rung).tone,lt=(e,t=`Deadline`)=>e?`${t} ${M(e)}`:void 0;function ut(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${P(t.length,`task`)}`}function dt(e,t){let n=e.tool,r={verb:`Doing`,tone:F(e),icon:`tool`},i=n?.endedAt!==void 0&&j(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${rt(j(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function ft(e,t){let n={verb:`Needs you`,tone:F(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${P(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function pt(e){return{verb:`Needs you`,tone:F(e),icon:`user`,main:`Permission`,action:`open`}}function mt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:F(e),since:t.since};if(o){let e=c.length>0?ut(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...I(`detail`,lt(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${ht[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...I(`detail`,lt(t.deadline))}}var ht={one:`One`,any:`Any`,all:`All`};function gt(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var _t=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function vt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=_t.reduce((e,t)=>e+i(t),0),o=_t.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var yt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function bt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=yt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=vt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function xt(e,t){let n={tone:F(e),since:t.since,...I(`detail`,lt(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:gt(t),...I(`checks`,r),...I(`overflow`,vt(t)),...I(`checkSummary`,bt(t))}}function I(e,t){return t===void 0?{}:{[e]:t}}function St(e,t,n){let r=F(e);switch(t.kind){case`workers`:return mt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:ut(`For`,t.detail.peerRunIds,n),detail:`Deadline ${M(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:P(t.detail.running,`native subagent`),detail:`Deadline ${M(t.deadline)}`};case`pr`:return xt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(j(t.since,n.now))} · deadline ${M(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${M(t.detail.wakeAt)} · in ${A(-j(t.detail.wakeAt,n.now))}`};case`usage-limit`:return Ct(e,t.detail.resumeAt,n);case`human`:return}}function Ct(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${M(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`,detail:i}}function wt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:F(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${rt(j(n,t.now))}`}:{}}}function L(e,t){return{verb:st[e.status]??e.status,tone:F(e),icon:ct[e.status]??`done`,main:t}}function R(e,t){return N(e.status)?Tt(e,t):L(e,P(e.workers.filter(e=>N(e.status)).length,`live worker`))}function Tt(e,t){let n=e.wait;switch(e.rung){case`running`:return dt(e,t);case`needs-permission`:return pt(e);case`needs-you`:return ft(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?Ct(e,n.detail.resumeAt,t):{verb:`Paused`,tone:F(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return wt(e,t);default:return(n&&St(e,n,t))??wt(e,t)}}function Et(e,t,n){if(n!==void 0&&N(e.status))return{verb:`Asks parent`,tone:F(e),main:`“${n}”`,asks:!0};let r=Dt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Dt(e,t){switch(e.status){case`done`:return L(e,e.collected?`Collected`:`Ready to collect`);case`review`:return L(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return L(e,e.error??st[e.status]??e.status);default:return Tt({...e,workers:[]},t)}}function Ot(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function kt(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function z(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var B=(e,t)=>z(e,t.senderRunId,t.senderTitle),V=(e,t)=>z(e,t.recipientRunId,t.recipientTitle);function H(e,t,n){let r=[];for(let i of t)i.senderRunId===e&&r.push(`Waiting for a reply from ${V(n,i)}`),i.recipientRunId===e&&r.push(`${B(n,i)} waits for your reply`);return r}function At(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function jt(e,t){let n=-j(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Mt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Nt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Pt[Ft(e,t)]}}var Pt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Ft(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var It=new Set([`needs-you`,`needs-permission`]),Lt=new Set([`queued`,`waiting-for-capacity`]);function Rt(e){if(N(e.status))return It.has(e.rung)?`needsYou`:e.rung===`running`?`working`:Lt.has(e.rung)?`queued`:`waiting`}function U(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Rt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>N(e.status)).length}}return t}function zt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Bt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var W={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},G={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},comets:{},bumps:{},slides:{},checks:{}},Vt=(e,t)=>`${e}\n${t}`;function Ht(e,t){let n=Vt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Ut=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Wt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Gt(e,t){let n=Wt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},W.workerHold+W.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},W.workerHold)}function Kt(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},W.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},W.comet)}function qt(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},W.fade);return}let a=W.comet+W.replied+W.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},W.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},W.comet+W.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},W.comet)}function Jt(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:d(t.task.rung).tone},W.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},W.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},W.workerEnter);case`worker-settled`:return Gt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},W.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},W.cardLeave);case`check-passed`:return e.timed(`checks`,Vt(t.runId,t.name),{},W.check);case`request-opened`:return Kt(e,t.request);case`request-closed`:return qt(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},W.bump)}}function Yt(e,t,n){let r=new Ut(t);if(!n)for(let t of e)Jt(r,t);return{changes:r.changes,timers:r.timers}}function Xt(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function Zt(e,t){return t.reduce(Xt,e)}var Qt={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function $t({tone:e,className:t,children:n,...r}){return(0,T.jsx)(`span`,{...r,className:a(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var en={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},tn={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},nn={tool:je,user:Ae,workers:C,reply:xe,peer:De,subagents:C,ci:Ee,merge:Te,command:ke,timer:we,pause:Oe,queued:ye,review:be,failed:_e,done:ve,cancelled:Ce};function rn(e,t){let n=d(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:on(e,t)??n.label}}var an=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function on(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`)return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return an(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return an(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return an(`waiting for`,n.detail.running,`subagent`)}function sn(e,t){if(N(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function K({run:e,role:t}){let{tone:n,shape:r,label:i}=rn(e,t);return(0,T.jsx)(`span`,{"data-activity-anchor":e.runId,className:a(`inline-flex size-[12px] shrink-0 items-center justify-center`,sn(e,r)),children:(0,T.jsx)(S,{tone:n,shape:r,role:`img`,"aria-label":i})})}var cn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},ln=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function un({checks:e,overflow:t,passed:n}){return(0,T.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:a(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,T.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:a(`h-[5px] min-w-px flex-1 rounded-[2px]`,cn[e.bucket],ln(e.bucket,n.has(e.name)))},e.name)),t?(0,T.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`i`,{className:a(`h-[5px] w-2 rounded-[2px]`,cn[t.bucket])}),`+`,t.count]}):null]})}function dn({value:e,ink:t}){return(0,T.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:a(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var fn=new Set;function pn({box:e,now:t,dense:n,motion:r={}}){let i=nn[e.icon],o=Qt[e.tone];return(0,T.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[r.sweep?(0,T.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,T.jsx)(i,{"aria-hidden":`true`,className:a(`mt-px size-[15px]`,o)}),(0,T.jsxs)($t,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,T.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,T.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:A(j(e.since,t))}):null]}),(0,T.jsx)(`span`,{"data-slot":`activity-main`,className:a(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,r.slideKey!==void 0&&`activity-slide`),children:e.main},r.slideKey??`still`),e.checks?(0,T.jsx)(un,{checks:e.checks,overflow:e.overflow,passed:r.passed??fn}):null,e.checkSummary?(0,T.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,T.jsx)(dn,{value:e.bar,ink:o}),e.detail&&!n?(0,T.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function mn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),r=Math.max(4,...e);return(0,T.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:a(`block h-4 w-[62px] shrink-0`,t),children:[(0,T.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/r*14);return(0,T.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var q=e=>`/tasks/${encodeURIComponent(e)}`;function hn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?rt(j(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function gn({texts:e}){return e.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))})}function _n({worker:e,parentId:t,requests:n,index:r,ctx:i,motion:o}){let s=Et(e,i,At(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,T.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:a(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:a(`activity-row-flash`,tn[c.tone])},c.key):null,(0,T.jsx)(`span`,{className:`mt-[3px]`,children:(0,T.jsx)(K,{run:e,role:`worker`})}),(0,T.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,T.jsx)(x,{to:q(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,T.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,T.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`b`,{className:a(`font-semibold`,Qt[s.tone]),children:s.verb}),` · `,(0,T.jsx)(`span`,{className:a(s.mono&&`font-mono`),children:s.main})]}),(0,T.jsx)(gn,{texts:H(e.runId,n,r)})]})}function vn({workers:e}){return(0,T.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,T.jsx)(K,{run:e,role:`worker`},e.runId)),(0,T.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function yn({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>N(e.status)||e.status===`review`||o(e.runId)),c=Bt(zt(e,o));return(0,T.jsxs)(T.Fragment,{children:[s.length>0&&i?(0,T.jsx)(vn,{workers:s}):null,s.length>0&&!i?(0,T.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,T.jsx)(_n,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,T.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}function bn({task:e,requests:t,index:n}){let r=Mt(e.runId,t);return r.length===0?null:(0,T.jsx)(`ul`,{"data-slot":`activity-peer-links`,className:`mt-2 flex flex-col gap-1`,children:r.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(x,{to:q(e.recipientRunId),className:`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:[`→ `,V(n,e)]})},e.requestId))})}function xn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Sn({task:e,motion:t,glow:n}){let r=t.flash[e.runId];return(0,T.jsxs)(T.Fragment,{children:[n?(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,r?(0,T.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":r.tone,"aria-hidden":`true`,className:a(`activity-flash`,en[r.tone])},r.key):null]})}function Cn({task:e,requests:t,index:n,ctx:r,dense:o,narrow:s,motion:c=G,ghost:l=!1}){let u=R(e,r),d=l?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},f={sweep:e.rung===`running`&&N(e.status),slideKey:c.slides[e.runId]?.key,passed:Ht(c,e.runId)};return(0,T.jsxs)(`article`,{...d,"data-flip":e.runId,"data-rung":e.rung,className:a(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,u.action?`border-pending`:`border-border`,xn(e,c,l)),children:[(0,T.jsx)(Sn,{task:e,motion:c,glow:u.action!==void 0&&!l}),(0,T.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(K,{run:e,role:`root`}),(0,T.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,T.jsx)(x,{to:q(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,T.jsx)(mn,{rate:e.rate})]}),(0,T.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:hn(e,r.now)}),(0,T.jsx)(gn,{texts:H(e.runId,t,n)}),(0,T.jsx)(pn,{box:u,now:r.now,dense:o,motion:f}),u.action?(0,T.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,T.jsx)(i,{asChild:!0,size:`sm`,variant:u.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,T.jsx)(x,{to:q(e.runId),children:u.action===`answer`?`Answer`:`Open task`})})}):null,s?(0,T.jsx)(bn,{task:e,requests:t,index:n}):null,(0,T.jsx)(yn,{task:e,requests:t,index:n,ctx:r,dense:o,motion:c})]})}function wn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Tn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function En(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Tn(o,r).push(e),s.add(e));return o}function Dn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var On=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function kn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var An=(e,...t)=>e.filter(e=>!t.some(t=>jn(e,t))),jn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Mn=e=>Math.round(e*10)/10,J=e=>`${Mn(e.x)} ${Mn(e.y)}`;function Nn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Pn(e,t=8){let n=Nn(e),r=n[0];if(!r)return``;let i=`M${J(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${J(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${J(c(r,a,s))} Q ${J(r)}, ${J(c(r,o,s))}`}return i}function Fn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function In(e){return{rows:Fn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Fn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var Y=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),X=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Ln(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Rn(e,t,n,r=0){let i=In(n),a=Y(i.rows,e=>e.top,e.y),o=Y(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?X(i,a):X(i,a-1))+r/2,d=(s?X(i,o-1):X(i,o))+r/2,f=Ln(i,Y(i.cols,e=>e.left,e.x),Y(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},ee={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},ee],label:{x:(c+f)/2,y:u}}}var zn=15;function Bn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-zn,e.y+e.h+zn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Vn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Bn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),zn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function Hn(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
2
+ `);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function Un(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var Wn=e=>Math.round(e*10)/10,Z=e=>`${Wn(e.x)} ${Wn(e.y)}`;function Gn(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function Kn(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Z({x:o,y:i})} C ${Z({x:o+s,y:i})}, ${Z({x:o+s,y:a})}, ${Z({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function qn(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return Kn(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(kn(On({x:c,y:a},{x:l,y:o}),An(n,e,t))){let i=Vn({x:c,y:a},{x:l,y:o},96,An(n,e,t),r);return{d:Pn(i.points),label:i.label}}return{d:`M${Z({x:c,y:a})} C ${Z({x:c+u,y:a})}, ${Z({x:l-u,y:o})}, ${Z({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function Jn(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?Yn(a,n.y0+i,n.y1-i):a}var Yn=(e,t,n)=>Math.max(t,Math.min(n,e));function Xn(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:Jn(i,n)};return{d:Pn(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function Zn(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Z(i)} C ${Z({x:o,y:i.y})}, ${Z({x:o,y:a.y})}, ${Z(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function Qn(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(kn(On({x:i,y:s},{x:a,y:c}),An(n,e,t))){let i=Rn(e,t,n,r);return{d:Pn(i.points),label:i.label}}return{d:`M${Z({x:i,y:s})} C ${Z({x:i,y:s+l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Z({x:i,y:o})} C ${Z({x:i,y:c-l})}, ${Z({x:a,y:c-l})}, ${Z({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function $n(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function er(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function tr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function nr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of er(e,t.w+r))for(let e of tr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var rr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function ir(e,t,n){let r=e!==void 0&&rr(e,n),i=t!==void 0&&rr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var ar=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function or(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)ar(n)&&t.push(n);return t}function sr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function cr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of or(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=sr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var lr={w:88,h:40};function ur(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,$n(i.getBoundingClientRect(),n))}return r}function dr(e,t,n,r,i){let a=t.get(e.senderRunId),o=t.get(e.recipientRunId),s={requestId:e.requestId,kind:`peer`},c=i.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},l=(e,t)=>({side:Gn(e,t,i.width),labelHeight:lr.h,lane:r??0,view:c,...t?{other:t}:{}});switch(ir(a,o,c)){case`both`:return a&&o?{...s,...qn(a,o,[...t.values()],r,Gn(a,void 0,i.width))}:void 0;case`sender`:return a?{...s,...Xn(a,`sender`,l(a,o)),away:V(n,e)}:void 0;case`recipient`:return o?{...s,...Xn(o,`recipient`,l(o,a)),away:B(n,e)}:void 0;case`none`:return}}function fr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function pr(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function mr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!rr(s,a)))return{requestId:e.requestId,kind:`family`,...Zn(c,l,s,i)}}function hr(e,t,n,{peers:r,frame:i={width:e.clientWidth}}){let a=ur(e,`data-activity-card`),o=ur(e,`data-activity-anchor`),s=Hn(t),c=[];for(let e of t){let t=s.get(e.requestId),l=e.relationship===`peer`?r?dr(e,a,n,t,i):void 0:mr(e,a,o,n,t,i.view);l&&c.push(l)}let l=fr(a,i.width),u=nr(c.filter(e=>e.kind===`peer`).map(e=>({id:e.requestId,at:pr(e.label,l)})),lr,i.view);return c.map(e=>({...e,label:u.get(e.requestId)??e.label}))}function gr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.requestId===r.requestId&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function _r({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var vr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function yr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,vr(r)-n);return e.reverse?1-i:i}var br=`http://www.w3.org/2000/svg`,xr=[0,.03,.06,.09,.12],Sr=[4.5,3.5,3,2.5,2],Cr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function wr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(br,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(br,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Cr[t.tone]} opacity-35`),r.append(i),xr.forEach((e,n)=>{let i=document.createElementNS(br,`circle`);i.setAttribute(`r`,String(Sr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Cr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Tr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();wr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(yr(r,n,xr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var Er=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Dr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function Or(e,t,n){let r=w.useRef(null),i=w.useRef(void 0),a=w.useRef(new Set);return w.useEffect(()=>{let e=r.current;if(!e)return;let t=_r({frame:Er,cancel:Dr,draw:(t,n)=>Tr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),w.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:W.comet}))},[e,t,n]),r}function kr(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Ar(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var jr=`activity-layout-settled`;function Mr(e,t,n,r){let i=w.useRef(void 0),a=w.useRef(new Set);w.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Ar(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of kr(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Nr(n,a.current,o)}}),w.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Nr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(jr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function Pr(e,t,n,r,i,a=!1){let[o,s]=w.useState([]);return w.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Fr(i,o):void 0;i.addEventListener(jr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(jr,o),c?.()}},[e,t,n,r,i,a]),o}function Fr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...or(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var Ir=28;function Lr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Ir?`${t.slice(0,Ir-1).trimEnd()}…`:t}function Rr(e,t){if(e.deadline===void 0)return;let n=Date.parse(e.createdAt),r=Date.parse(e.deadline);return Number.isNaN(n)||Number.isNaN(r)||r<=n?1:Math.min(1,Math.max(0,(t-n)/(r-n)))}function zr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return a(`activity-march`,t&&`activity-line-in`)}function Br({line:e,request:t,now:n,phase:r,replied:i}){let o=Rr(t,n);return(0,T.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":r,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:lr.w},className:a(`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`,i?`border-success`:`border-message-peer-accent`,r===`fade`&&`activity-line-out`),children:[(0,T.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[i?(0,T.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,T.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,T.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(j(t.createdAt,n))})]}),(0,T.jsx)(`span`,{className:`block truncate`,children:e.away??Lr(t.text)}),o===void 0||i?null:(0,T.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,T.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var Vr=(e,t)=>e.closing[t]?.phase??`open`;function Hr(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}function Ur({line:e,motion:t}){let n=Vr(t,e.requestId);return(0,T.jsx)(`path`,{"data-request":e.requestId,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:a(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,zr(n,e.requestId in t.opening))})}function Wr({requests:e,index:t,peers:n,layoutKey:r,now:i,motion:a=G,paused:o=!1}){let s=w.useRef(null),c=Pr(s,w.useCallback(r=>hr(r,e,t,{peers:n,frame:{width:r.clientWidth,view:cr(r)}}),[e,t,n]),gr,`[data-activity-card]`,r,!0),l=w.useMemo(()=>new Set(c.map(e=>e.requestId)),[c]),u=Or(a.comets,l,o),d=new Map(e.map(e=>[e.requestId,e]));return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`svg`,{ref:s,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,T.jsxs)(`defs`,{children:[(0,T.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,T.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,T.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})})]}),c.map(e=>(0,T.jsx)(Ur,{line:e,motion:a},e.requestId)),(0,T.jsx)(`g`,{ref:u,"data-slot":`activity-comets`})]}),c.map(e=>{let t=d.get(e.requestId);return e.kind===`peer`&&t?(0,T.jsx)(Br,{line:e,request:t,now:i,phase:Vr(a,e.requestId),replied:Hr(a,e.requestId)},e.requestId):null})]})}function Gr(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of kt(r))n.set(e,t);return n}var Kr={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function qr(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${Kr[t??``]??`closed`}`}var Jr={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},Yr=e=>e.relationship===`peer`?`peer`:`family`;function Xr(e,t,n){let r=(e,n)=>z(t,e,n);switch(e.kind){case`request-opened`:return{tone:Yr(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:qr(e.request,e.status,r)};case`rung-changed`:return{tone:d(e.task.rung).tone,text:`${e.task.title}: ${R(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=Jr[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:d(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function Zr(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function Qr(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var $r=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),ei=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function ti({scope:e,projectId:t}){let n=e=>a(ei,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,T.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,T.jsx)(r,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:n(e===`project`),children:`This project`}),(0,T.jsx)(r,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:n(e===`all`),children:`All projects`})]})}function ni({now:e,stale:t}){return(0,T.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,T.jsx)(`span`,{"data-tone":`success`,className:a(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,T.jsx)(S,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,T.jsx)(`b`,{className:a(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),$r.format(e),` `,at()]})}function ri({name:e,now:t,stale:n=!1,children:r}){return(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,T.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,T.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,T.jsx)(ni,{now:t,stale:n}),r]})}function ii({value:e,bump:t}){return(0,T.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:a(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Q({icon:e,count:t,label:n,bump:r}){return(0,T.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,T.jsx)(ii,{value:t,bump:r}),` `,n]})}function ai({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,T.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(S,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,T.jsx)(Q,{icon:(0,T.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,T.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,T.jsxs)(x,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,T.jsx)(S,{tone:`info`,"aria-hidden":`true`}),(0,T.jsx)(ii,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var $=e=>new Map(e.map(e=>[e.runId,e])),oi=e=>e!==void 0&&Ot(e)===void 0;function si(e,t,n,r){let i=$(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&N(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&N(a.status)&&!N(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function ci(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var li=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function ui(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),li(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),si(e,t,n,r),ci(e,t,n,r)}function di(e,t,n){let r=$(e.tasks),i=$(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?ui(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function fi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}var pi=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function mi(e,t,n){let r=U(e),i=U(t);for(let e of pi)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function hi(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!oi(t)||!oi(e)||(di(t,e,r),fi(t,e,r))}return mi(e.projects,t.projects,r),n}function gi(e){return{input:e,reconcile:!1,seq:0,motion:G,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function _i(e){let{plan:t,...n}=e;return{...n,motion:G,epoch:e.epoch+1}}function vi(e,t,n){let r=hi(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=Gr(t,n),o=r.flatMap(e=>Xr(e,a,i)??[]),s=e.seq+o.length+1,c=Yt(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?Zr(e.feed,o,i,e.seq+1):e.feed,motion:Zt(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function yi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:vi(r,n,t)}function bi(e,t){let n=e.input;if(t.scope!==n.scope)return{...gi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={..._i(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=_i(r)),yi(r,t.snapshot)}var xi=`(prefers-reduced-motion: reduce)`,Si=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(xi):void 0;function Ci(e){let t=Si();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function wi(){return Si()?.matches??!1}function Ti(){return(0,w.useSyncExternalStore)(Ci,wi,()=>!1)}function Ei(e,t){let n=w.useRef(new Set);w.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),w.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:Zt(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Di(e,t){let n=Ti(),r=ee(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=w.useState(()=>gi(i)),s=bi(a,i);return s!==a&&o(s),Ei(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Oi(e,t){let n=Se(1e3),[r,i]=w.useState({offset:0}),a=r.offset;return Ze(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{Nt as A,N as B,Sn as C,tn as D,K as E,jt as F,nt as G,M as H,kt as I,B as L,z as M,Ot as N,$t as O,V as P,Mt as R,Cn as S,mn as T,A as U,R as V,j as W,Hn as _,ai as a,En as b,zr as c,Rr as d,Pr as f,$n as g,Qn as h,ti as i,H as j,G as k,Vr as l,Or as m,Di as n,Qr as o,Mr as p,ri as r,Wr as s,Oi as t,Hr as u,Un as v,gn as w,Dn as x,wn as y,U as z};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,t as i,u as a}from"./button-RJMdCnZw.js";import{t as o}from"./arrow-right-Dh_Lx3um.js";import{A as s,D as c,F as l,G as u,H as d,I as f,L as p,M as m,N as h,P as g,S as _,T as v,U as y,W as b,a as x,b as S,d as C,i as w,k as T,n as E,o as D,p as O,r as k,s as A,t as j,x as M,y as N,z as P}from"./activity-motion-Ch0PoZJR.js";import{s as F}from"./project-router-DQWY9FSQ.js";import{Pt as I,at as L}from"./index-B98HIjrF.js";var R=e(t(),1),z=n(),B=`rounded-xl border border-border bg-card px-3.5 py-3`,V=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function H({request:e,index:t,now:n,motion:r}){let{kind:i,relation:c}=s(e,t),u=C(e,n),d=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,z.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:a(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:p(t,e)}),(0,z.jsx)(o,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:g(t,e)}),(0,z.jsx)(`span`,{className:a(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,d),children:i})]}),(0,z.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,z.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[c,` · open `,y(b(e.createdAt,n))]}),e.deadline?(0,z.jsx)(`span`,{className:`ml-auto`,children:l(e.deadline,n)}):null]}),u===void 0?null:(0,z.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,z.jsx)(`span`,{className:a(`block h-full bg-current`,d),style:{width:`${Math.round(u*100)}%`}})})]})}function U({className:e}){return(0,z.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,z.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function W(){let e=`flex items-center gap-2`;return(0,z.jsxs)(`div`,{"data-slot":`activity-legend`,className:a(B,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,z.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(L,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(L,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(L,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(v,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(U,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(U,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,z.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var G={...c,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function K({feed:e,now:t,watchingSince:n}){return(0,z.jsxs)(`section`,{"data-slot":`activity-just-now`,className:B,children:[(0,z.jsx)(`h2`,{className:V,children:`Just now`}),e.length>0?(0,z.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,z.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:a(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:a(`size-[7px] -translate-y-px rounded-full`,G[e.tone])}),(0,z.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,z.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:D(t-e.at)})]},e.id))}):null,(0,z.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,d(n)]})]})}function q({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=T}){return(0,z.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,z.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:B,children:[(0,z.jsxs)(`h2`,{className:V,children:[`Open requests `,(0,z.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,z.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,z.jsxs)(`ul`,{children:[e.map(e=>(0,z.jsx)(H,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,z.jsx)(H,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,z.jsx)(K,{feed:a,now:r,watchingSince:i}),(0,z.jsx)(W,{})]})}function J(e){let[t,n]=R.useState(0);return R.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function Y(e,t,n){let[r,i]=R.useState(void 0),a=S(r,e,t,n);return M(r,a)||i(a),a}function X(e,t){let n=new Set(e.tasks.map(e=>e.runId)),r=new Set(e.requests.map(e=>e.requestId)),i=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!r.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!n.has(t.task.runId)).map(e=>e.task),requests:i.map(e=>e.request),folding:i.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function Z({project:e,now:t,watchingSince:n,motion:r=T,feed:i,still:a=!1,paused:o=!1}){let s=R.useRef(null),c=N(J(s)),l=R.useMemo(()=>f(e),[e]),u=R.useMemo(()=>X(e,r),[e,r]),d=R.useMemo(()=>[...e.requests,...u.requests],[e.requests,u.requests]),p=new Map([...u.cards,...e.tasks].map(e=>[e.runId,e])),h=new Set(u.cards.map(e=>e.runId)),g=e=>1+.35*(p.get(e)?.workers.length??0),v=Y([...p.keys()],c,g),y=c===1,b=e.tasks.length>12,x={now:t,titleOf:e=>m(l,e)},S=v.map(e=>e.join(`,`)).join(`|`),C=`${e.tasks.length}:${c}:${b}:${S}:${d.map(e=>e.requestId).join(`,`)}`;return O(s,`data-flip`,S,!a&&!o),(0,z.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,z.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,z.jsxs)(`div`,{ref:s,"data-slot":`activity-graph`,"data-columns":c,"data-dense":b?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${c}, minmax(0, 1fr))`,columnGap:y?0:96},children:[v.map((t,n)=>(0,z.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=p.get(t);return n?(0,z.jsx)(_,{task:n,requests:e.requests,index:l,ctx:x,dense:b,narrow:y,motion:r,ghost:h.has(t)},t):null})},n)),(0,z.jsx)(A,{requests:d,index:l,peers:!y,layoutKey:C,now:t,motion:r,paused:o||a})]})]}),(0,z.jsx)(q,{requests:e.requests,closing:u.folding,index:l,now:t,watchingSince:n,feed:i,motion:r})]})}function Q(){let e=r(),t=u({kind:`project`,projectId:e}),n=F(),[a]=R.useState(()=>new Date().toISOString()),o=j(t.data?.generatedAt,t.dataUpdatedAt),{motion:s,feed:c,reduced:l,paused:d}=E(t.data,e),f=t.data?.projects[0];if(t.isPending)return(0,z.jsx)(I,{});let p=f?h(f):void 0;return f?(0,z.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":d?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,z.jsx)(k,{name:f.name,now:o,stale:t.isError,children:(0,z.jsx)(w,{scope:`project`,projectId:n??f.projectId})}),(0,z.jsx)(x,{summary:P([f]),tasksTo:`/`,bumps:s.bumps}),p?(0,z.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:p}):(0,z.jsx)(Z,{project:f,now:o,watchingSince:a,motion:s,feed:c,still:l,paused:d})]}):(0,z.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,z.jsx)(k,{name:n??`project`,children:(0,z.jsx)(w,{scope:`project`,projectId:n})}),(0,z.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{Q as ProjectActivityRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,t as i,u as a}from"./button-RJMdCnZw.js";import{t as o}from"./arrow-right-Dh_Lx3um.js";import{A as s,D as c,F as l,G as u,H as d,I as f,L as p,M as m,N as h,P as g,S as _,T as v,U as y,W as b,a as x,b as S,d as C,i as w,k as T,n as E,o as D,p as O,r as k,s as A,t as j,x as M,y as N,z as P}from"./activity-motion-NzxJ71zi.js";import{s as F}from"./project-router-DQWY9FSQ.js";import{Pt as I,at as L}from"./index-Df3em9PF.js";var R=e(t(),1),z=n(),B=`rounded-xl border border-border bg-card px-3.5 py-3`,V=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function H({request:e,index:t,now:n,motion:r}){let{kind:i,relation:c}=s(e,t),u=C(e,n),d=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,z.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:a(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:p(t,e)}),(0,z.jsx)(o,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:g(t,e)}),(0,z.jsx)(`span`,{className:a(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,d),children:i})]}),(0,z.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,z.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[c,` · open `,y(b(e.createdAt,n))]}),e.deadline?(0,z.jsx)(`span`,{className:`ml-auto`,children:l(e.deadline,n)}):null]}),u===void 0?null:(0,z.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,z.jsx)(`span`,{className:a(`block h-full bg-current`,d),style:{width:`${Math.round(u*100)}%`}})})]})}function U({className:e}){return(0,z.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,z.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function W(){let e=`flex items-center gap-2`;return(0,z.jsxs)(`div`,{"data-slot":`activity-legend`,className:a(B,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,z.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(L,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(L,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(L,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(v,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(U,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(U,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,z.jsxs)(`div`,{className:e,children:[(0,z.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,z.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var G={...c,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function K({feed:e,now:t,watchingSince:n}){return(0,z.jsxs)(`section`,{"data-slot":`activity-just-now`,className:B,children:[(0,z.jsx)(`h2`,{className:V,children:`Just now`}),e.length>0?(0,z.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,z.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:a(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:a(`size-[7px] -translate-y-px rounded-full`,G[e.tone])}),(0,z.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,z.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:D(t-e.at)})]},e.id))}):null,(0,z.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,d(n)]})]})}function q({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=T}){return(0,z.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,z.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:B,children:[(0,z.jsxs)(`h2`,{className:V,children:[`Open requests `,(0,z.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,z.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,z.jsxs)(`ul`,{children:[e.map(e=>(0,z.jsx)(H,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,z.jsx)(H,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,z.jsx)(K,{feed:a,now:r,watchingSince:i}),(0,z.jsx)(W,{})]})}function J(e){let[t,n]=R.useState(0);return R.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function Y(e,t,n){let[r,i]=R.useState(void 0),a=S(r,e,t,n);return M(r,a)||i(a),a}function X(e,t){let n=new Set(e.tasks.map(e=>e.runId)),r=new Set(e.requests.map(e=>e.requestId)),i=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!r.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!n.has(t.task.runId)).map(e=>e.task),requests:i.map(e=>e.request),folding:i.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function Z({project:e,now:t,watchingSince:n,motion:r=T,feed:i,still:a=!1,paused:o=!1}){let s=R.useRef(null),c=N(J(s)),l=R.useMemo(()=>f(e),[e]),u=R.useMemo(()=>X(e,r),[e,r]),d=R.useMemo(()=>[...e.requests,...u.requests],[e.requests,u.requests]),p=new Map([...u.cards,...e.tasks].map(e=>[e.runId,e])),h=new Set(u.cards.map(e=>e.runId)),g=e=>1+.35*(p.get(e)?.workers.length??0),v=Y([...p.keys()],c,g),y=c===1,b=e.tasks.length>12,x={now:t,titleOf:e=>m(l,e)},S=v.map(e=>e.join(`,`)).join(`|`),C=`${e.tasks.length}:${c}:${b}:${S}:${d.map(e=>e.requestId).join(`,`)}`;return O(s,`data-flip`,S,!a&&!o),(0,z.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,z.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,z.jsxs)(`div`,{ref:s,"data-slot":`activity-graph`,"data-columns":c,"data-dense":b?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${c}, minmax(0, 1fr))`,columnGap:y?0:96},children:[v.map((t,n)=>(0,z.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=p.get(t);return n?(0,z.jsx)(_,{task:n,requests:e.requests,index:l,ctx:x,dense:b,narrow:y,motion:r,ghost:h.has(t)},t):null})},n)),(0,z.jsx)(A,{requests:d,index:l,peers:!y,layoutKey:C,now:t,motion:r,paused:o||a})]})]}),(0,z.jsx)(q,{requests:e.requests,closing:u.folding,index:l,now:t,watchingSince:n,feed:i,motion:r})]})}function Q(){let e=r(),t=u({kind:`project`,projectId:e}),n=F(),[a]=R.useState(()=>new Date().toISOString()),o=j(t.data?.generatedAt,t.dataUpdatedAt),{motion:s,feed:c,reduced:l,paused:d}=E(t.data,e),f=t.data?.projects[0];if(t.isPending)return(0,z.jsx)(I,{});let p=f?h(f):void 0;return f?(0,z.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":d?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,z.jsx)(k,{name:f.name,now:o,stale:t.isError,children:(0,z.jsx)(w,{scope:`project`,projectId:n??f.projectId})}),(0,z.jsx)(x,{summary:P([f]),tasksTo:`/`,bumps:s.bumps}),p?(0,z.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:p}):(0,z.jsx)(Z,{project:f,now:o,watchingSince:a,motion:s,feed:c,still:l,paused:d})]}):(0,z.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,z.jsx)(k,{name:n??`project`,children:(0,z.jsx)(w,{scope:`project`,projectId:n})}),(0,z.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{Q as ProjectActivityRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./button-RJMdCnZw.js";import{i}from"./project-scope-context-DFjJ4Dzo.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-7vfelV7P.js";import{u as l}from"./control-locations-SzZ8gyme.js";import{t as u}from"./project-router-DQWY9FSQ.js";import{t as d}from"./centered-state-dmABwupF.js";import{Y as f,h as p}from"./index-B98HIjrF.js";import{t as m}from"./diff-CQdcUei8.js";var h=e(t(),1),g=n();function _({commit:e,sha:t,backTo:n,backLabel:_,slot:v,className:y,diffClassName:b}){let x=p(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":t,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(r,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:n,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(f,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./button-RJMdCnZw.js";import{i}from"./project-scope-context-DFjJ4Dzo.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-7vfelV7P.js";import{u as l}from"./control-locations-SzZ8gyme.js";import{t as u}from"./project-router-DQWY9FSQ.js";import{t as d}from"./centered-state-dmABwupF.js";import{Y as f,h as p}from"./index-Df3em9PF.js";import{t as m}from"./diff-DqUE5TL5.js";var h=e(t(),1),g=n();function _({commit:e,sha:t,backTo:n,backLabel:_,slot:v,className:y,diffClassName:b}){let x=p(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":t,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(r,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:n,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(f,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-BH7MnYEM.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/button-RJMdCnZw.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/markdown-CYkWwCze.js","assets/alert-dialog-D5mmm9BZ.js","assets/es2015-VrVcR1vD.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/index-B98HIjrF.js","assets/project-scope-context-DFjJ4Dzo.js","assets/live-protocol-ai7TG3jr.js","assets/useInfiniteQuery-HtyVqdKz.js","assets/queries-Cgys1fiN.js","assets/useQuery-BGIo-SEb.js","assets/ws-BZNDvStH.js","assets/toaster-BWMQArHJ.js","assets/cez-idle-D3aj_9lp.js","assets/dropdown-menu-B2Hg08ap.js","assets/design-icons-DmYTv2r1.js","assets/github-sidebar-model-DssVqUad.js","assets/popover-DV9NKc0j.js","assets/textarea-CMbcARwO.js","assets/project-router-DQWY9FSQ.js","assets/agent-accounts-ZGHdsjYE.js","assets/skills-DFBiAuJG.js","assets/skills-workflows-C21NystW.css","assets/loader-circle-CZkGEdoI.js","assets/nav-row-styles-D4xk5Osn.js","assets/control-locations-SzZ8gyme.js","assets/centered-state-dmABwupF.js","assets/sortable.esm-zp_qkYGV.js","assets/index-DZItIsRv.css","assets/lib-BQXq3kEf.js","assets/image-preview-BmcpjY75.js","assets/zoomable-image-DefjK4q5.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{u as r}from"./button-RJMdCnZw.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{Y as a}from"./index-B98HIjrF.js";import{n as o,t as s}from"./image-preview-BmcpjY75.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-BH7MnYEM.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-76XFFi9N.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/button-RJMdCnZw.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/markdown-CYkWwCze.js","assets/alert-dialog-D5mmm9BZ.js","assets/es2015-VrVcR1vD.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/index-Df3em9PF.js","assets/project-scope-context-DFjJ4Dzo.js","assets/live-protocol-ai7TG3jr.js","assets/useInfiniteQuery-HtyVqdKz.js","assets/queries-Cgys1fiN.js","assets/useQuery-BGIo-SEb.js","assets/ws-BZNDvStH.js","assets/toaster-BWMQArHJ.js","assets/cez-idle-D3aj_9lp.js","assets/dropdown-menu-B2Hg08ap.js","assets/design-icons-DmYTv2r1.js","assets/github-sidebar-model-DssVqUad.js","assets/popover-DV9NKc0j.js","assets/textarea-CMbcARwO.js","assets/project-router-DQWY9FSQ.js","assets/agent-accounts-ZGHdsjYE.js","assets/skills-DFBiAuJG.js","assets/skills-workflows-C21NystW.css","assets/loader-circle-CZkGEdoI.js","assets/nav-row-styles-D4xk5Osn.js","assets/control-locations-SzZ8gyme.js","assets/centered-state-dmABwupF.js","assets/sortable.esm-zp_qkYGV.js","assets/index-DZItIsRv.css","assets/lib-BQXq3kEf.js","assets/image-preview-BmcpjY75.js","assets/zoomable-image-DefjK4q5.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{u as r}from"./button-RJMdCnZw.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{Y as a}from"./index-Df3em9PF.js";import{n as o,t as s}from"./image-preview-BmcpjY75.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-76XFFi9N.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
3
  `).map((e,t)=>(0,l.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{u as t};