@hearsay-tools/squawk 0.19.0-pr4422.8646 → 0.19.0-pr4422.8653.2
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.
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/server.d.ts +66 -66
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-B4-jlaqq.js → accounts-section-D1zUOGzb.js} +1 -1
- package/web/dist/assets/activity-motion-DKQsSiK6.js +1 -0
- package/web/dist/assets/{activity-route-DAt_K4X3.js → activity-route-fRsdRyzI.js} +1 -1
- package/web/dist/assets/{agent-config-section-FsEMuG1z.js → agent-config-section-BoeuyX6v.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BZlhsUPl.js → agent-defaults-section-DzqMFFPr.js} +1 -1
- package/web/dist/assets/{appearance-BBOJlpSp.js → appearance-Dmvj5Y_w.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BhXuetKp.js → archive-on-merge-field-CRGCTE05.js} +1 -1
- package/web/dist/assets/{automations-route-BaEYW5pJ.js → automations-route-Htjf-5la.js} +1 -1
- package/web/dist/assets/{commit-list-BIGuQrI4.js → commit-list-ZFFnxm_Y.js} +1 -1
- package/web/dist/assets/{diff-controls-kCKa9447.js → diff-controls-Sp_ZhYsW.js} +1 -1
- package/web/dist/assets/diff-hOrgpufS.js +3 -0
- package/web/dist/assets/{diff-view-DdYRjo1X.js → diff-view-DAuFvkVe.js} +1 -1
- package/web/dist/assets/{file-preview-CinwHna7.js → file-preview-DmtWCxjd.js} +1 -1
- package/web/dist/assets/{folder-browser-ZdEyXXrb.js → folder-browser-D_V807qp.js} +1 -1
- package/web/dist/assets/{git-toolbar-SXM-XPkM.js → git-toolbar-DAYZlAtW.js} +1 -1
- package/web/dist/assets/{github-BtWZcEFg.js → github-iwGsnQ9e.js} +1 -1
- package/web/dist/assets/{global-activity-route-Da-rSkw3.js → global-activity-route-VN9AtX9z.js} +1 -1
- package/web/dist/assets/{image-preview-C0aqy7fc.js → image-preview-Blq5ega2.js} +1 -1
- package/web/dist/assets/{index-CF5VtPMz.js → index-V7mPM8_i.js} +5 -5
- package/web/dist/assets/label-C6BpWk0J.js +1 -0
- package/web/dist/assets/{markdown-Bje51qa0.js → markdown-BNgZx1Qw.js} +1 -1
- package/web/dist/assets/{notifications-section-CGi3XMVo.js → notifications-section-vwz3Ac0V.js} +1 -1
- package/web/dist/assets/{open-in-menu-D8XMVD0h.js → open-in-menu-BkmmqWdB.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Dde0g_MD.js → preview-pane-connected-BuFRiE_Q.js} +1 -1
- package/web/dist/assets/{project-location-722wqssG.js → project-location-Z28U6-d1.js} +1 -1
- package/web/dist/assets/{projects-section-MAcGI5Xj.js → projects-section-BsbHgKBU.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-M2n2Gu70.js → prompt-templates-section-BMON7HON.js} +1 -1
- package/web/dist/assets/{queries-FJ1HTyY4.js → queries-BwJVP1so.js} +1 -1
- package/web/dist/assets/{reference-chip-BUPuAPEE.js → reference-chip-uLQTF-sm.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CLfJlV5F.js → remote-settings-notice-By8FlGex.js} +1 -1
- package/web/dist/assets/{repo-git-D6xvMdBL.js → repo-git-BA5-AI3D.js} +1 -1
- package/web/dist/assets/{report-reader-CNKaclYI.js → report-reader-COxakC1t.js} +1 -1
- package/web/dist/assets/{report-selection-cyUF2D6N.js → report-selection-DBM7S3ha.js} +1 -1
- package/web/dist/assets/{reports-BeAOxRH0.js → reports-Jh4Gofdq.js} +1 -1
- package/web/dist/assets/{resources-section-BACzhHmC.js → resources-section-Vmy2Idkz.js} +1 -1
- package/web/dist/assets/{review-panel-BzQlWe3U.js → review-panel-CMgEoI0r.js} +1 -1
- package/web/dist/assets/run-detail-refresh-YR2-iM4z.js +1 -0
- package/web/dist/assets/{run-header-DoUA1jfy.js → run-header-D6yMABMw.js} +1 -1
- package/web/dist/assets/{select-Baxx1iJv.js → select-DN6L68mS.js} +1 -1
- package/web/dist/assets/{session-context-section-f_qm-UeH.js → session-context-section-D9VJDjIN.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-CH8kKWUG.js → settings-agent-picker-DunygjC_.js} +1 -1
- package/web/dist/assets/{settings-shell-B7oXxeOo.js → settings-shell--IqqKF7N.js} +1 -1
- package/web/dist/assets/{sidebar-section-JQDhdAJS.js → sidebar-section-BqbMPhmc.js} +1 -1
- package/web/dist/assets/{skills-BIABmuXe.js → skills-Br7KtvAE.js} +1 -1
- package/web/dist/assets/{task-changes-XpXh8tVh.js → task-changes-DBeE9e44.js} +1 -1
- package/web/dist/assets/{task-commits-DmRXQ-Rt.js → task-commits-BlCpSQlf.js} +1 -1
- package/web/dist/assets/{task-files-WfMErvzk.js → task-files-SpH-60SN.js} +1 -1
- package/web/dist/assets/{task-github-item-Dh2ZFusm.js → task-github-item-Y3iJL8ft.js} +1 -1
- package/web/dist/assets/{task-groups-Oj9z8ujW.js → task-groups-BSovus2j.js} +1 -1
- package/web/dist/assets/{task-thread-BrtZBgWd.js → task-thread-BwRa4jlG.js} +1 -1
- package/web/dist/assets/{tasks-table-KyeMHnsT.js → tasks-table-C-wxALy6.js} +1 -1
- package/web/dist/assets/{thread-state-U6FlmGsu.js → thread-state-DeoWu7Kt.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-BvG0GkP0.js → use-hand-to-agent-state-DTcb7MfW.js} +1 -1
- package/web/dist/assets/{workflows-D3eyOnPL.js → workflows-Cnapwpgb.js} +1 -1
- package/web/dist/assets/{workspace-tools-C-q5Y_Ql.js → workspace-tools-DqQBPMHi.js} +1 -1
- package/web/dist/assets/{worktrees-section-BD_4rSs1.js → worktrees-section-C4ivelpI.js} +1 -1
- package/web/dist/index.html +10 -9
- package/web/dist/assets/activity-motion-QPoyJEfx.js +0 -1
- package/web/dist/assets/diff-C5ahCZHi.js +0 -3
- package/web/dist/assets/label-BlDjXC47.js +0 -1
|
@@ -315,19 +315,6 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
|
|
|
315
315
|
} & {
|
|
316
316
|
"/repo/commit/:sha": {
|
|
317
317
|
$get: {
|
|
318
|
-
output: string;
|
|
319
|
-
outputFormat: "text";
|
|
320
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
321
|
-
input: {
|
|
322
|
-
query: {
|
|
323
|
-
structured?: string | undefined;
|
|
324
|
-
};
|
|
325
|
-
} & {
|
|
326
|
-
param: {
|
|
327
|
-
sha: string;
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
} | {
|
|
331
318
|
output: {
|
|
332
319
|
error: string;
|
|
333
320
|
code?: "invalid_input" | undefined;
|
|
@@ -391,6 +378,19 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
|
|
|
391
378
|
sha: string;
|
|
392
379
|
};
|
|
393
380
|
};
|
|
381
|
+
} | {
|
|
382
|
+
output: string;
|
|
383
|
+
outputFormat: "text";
|
|
384
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
385
|
+
input: {
|
|
386
|
+
query: {
|
|
387
|
+
structured?: string | undefined;
|
|
388
|
+
};
|
|
389
|
+
} & {
|
|
390
|
+
param: {
|
|
391
|
+
sha: string;
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
394
|
};
|
|
395
395
|
};
|
|
396
396
|
} & {
|
package/dist/server/server.d.ts
CHANGED
|
@@ -4724,19 +4724,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4724
4724
|
} & {
|
|
4725
4725
|
"/repo/commit/:sha": {
|
|
4726
4726
|
$get: {
|
|
4727
|
-
output: string;
|
|
4728
|
-
outputFormat: "text";
|
|
4729
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4730
|
-
input: {
|
|
4731
|
-
query: {
|
|
4732
|
-
structured?: string | undefined;
|
|
4733
|
-
};
|
|
4734
|
-
} & {
|
|
4735
|
-
param: {
|
|
4736
|
-
sha: string;
|
|
4737
|
-
};
|
|
4738
|
-
};
|
|
4739
|
-
} | {
|
|
4740
4727
|
output: {
|
|
4741
4728
|
error: string;
|
|
4742
4729
|
code?: "invalid_input" | undefined;
|
|
@@ -4800,6 +4787,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4800
4787
|
sha: string;
|
|
4801
4788
|
};
|
|
4802
4789
|
};
|
|
4790
|
+
} | {
|
|
4791
|
+
output: string;
|
|
4792
|
+
outputFormat: "text";
|
|
4793
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4794
|
+
input: {
|
|
4795
|
+
query: {
|
|
4796
|
+
structured?: string | undefined;
|
|
4797
|
+
};
|
|
4798
|
+
} & {
|
|
4799
|
+
param: {
|
|
4800
|
+
sha: string;
|
|
4801
|
+
};
|
|
4802
|
+
};
|
|
4803
4803
|
};
|
|
4804
4804
|
};
|
|
4805
4805
|
} & {
|
|
@@ -19294,20 +19294,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19294
19294
|
} & {
|
|
19295
19295
|
"/runs/:id/handoff": {
|
|
19296
19296
|
$get: {
|
|
19297
|
-
output:
|
|
19298
|
-
|
|
19299
|
-
|
|
19297
|
+
output: {
|
|
19298
|
+
error: string;
|
|
19299
|
+
};
|
|
19300
|
+
outputFormat: "json";
|
|
19301
|
+
status: 404;
|
|
19300
19302
|
input: {
|
|
19301
19303
|
param: {
|
|
19302
19304
|
id: string;
|
|
19303
19305
|
};
|
|
19304
19306
|
};
|
|
19305
19307
|
} | {
|
|
19306
|
-
output:
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
outputFormat: "json";
|
|
19310
|
-
status: 404;
|
|
19308
|
+
output: string;
|
|
19309
|
+
outputFormat: "text";
|
|
19310
|
+
status: 200;
|
|
19311
19311
|
input: {
|
|
19312
19312
|
param: {
|
|
19313
19313
|
id: string;
|
|
@@ -19345,20 +19345,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19345
19345
|
} & {
|
|
19346
19346
|
"/runs/:id/diff": {
|
|
19347
19347
|
$get: {
|
|
19348
|
-
output:
|
|
19349
|
-
|
|
19350
|
-
|
|
19348
|
+
output: {
|
|
19349
|
+
error: string;
|
|
19350
|
+
};
|
|
19351
|
+
outputFormat: "json";
|
|
19352
|
+
status: 404 | 409;
|
|
19351
19353
|
input: {
|
|
19352
19354
|
param: {
|
|
19353
19355
|
id: string;
|
|
19354
19356
|
};
|
|
19355
19357
|
};
|
|
19356
19358
|
} | {
|
|
19357
|
-
output:
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
outputFormat: "json";
|
|
19361
|
-
status: 404 | 409;
|
|
19359
|
+
output: string;
|
|
19360
|
+
outputFormat: "text";
|
|
19361
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
19362
19362
|
input: {
|
|
19363
19363
|
param: {
|
|
19364
19364
|
id: string;
|
|
@@ -19451,9 +19451,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19451
19451
|
status: 404 | 409;
|
|
19452
19452
|
input: {
|
|
19453
19453
|
param: {
|
|
19454
|
-
id: string;
|
|
19455
|
-
} & {
|
|
19456
19454
|
sha: string;
|
|
19455
|
+
} & {
|
|
19456
|
+
id: string;
|
|
19457
19457
|
};
|
|
19458
19458
|
};
|
|
19459
19459
|
} | {
|
|
@@ -19482,9 +19482,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19482
19482
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
19483
19483
|
input: {
|
|
19484
19484
|
param: {
|
|
19485
|
-
id: string;
|
|
19486
|
-
} & {
|
|
19487
19485
|
sha: string;
|
|
19486
|
+
} & {
|
|
19487
|
+
id: string;
|
|
19488
19488
|
};
|
|
19489
19489
|
};
|
|
19490
19490
|
};
|
|
@@ -21493,19 +21493,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21493
21493
|
} & {
|
|
21494
21494
|
"/repo/commit/:sha": {
|
|
21495
21495
|
$get: {
|
|
21496
|
-
output: string;
|
|
21497
|
-
outputFormat: "text";
|
|
21498
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21499
|
-
input: {
|
|
21500
|
-
query: {
|
|
21501
|
-
structured?: string | undefined;
|
|
21502
|
-
};
|
|
21503
|
-
} & {
|
|
21504
|
-
param: {
|
|
21505
|
-
sha: string;
|
|
21506
|
-
};
|
|
21507
|
-
};
|
|
21508
|
-
} | {
|
|
21509
21496
|
output: {
|
|
21510
21497
|
error: string;
|
|
21511
21498
|
code?: "invalid_input" | undefined;
|
|
@@ -21569,6 +21556,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21569
21556
|
sha: string;
|
|
21570
21557
|
};
|
|
21571
21558
|
};
|
|
21559
|
+
} | {
|
|
21560
|
+
output: string;
|
|
21561
|
+
outputFormat: "text";
|
|
21562
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21563
|
+
input: {
|
|
21564
|
+
query: {
|
|
21565
|
+
structured?: string | undefined;
|
|
21566
|
+
};
|
|
21567
|
+
} & {
|
|
21568
|
+
param: {
|
|
21569
|
+
sha: string;
|
|
21570
|
+
};
|
|
21571
|
+
};
|
|
21572
21572
|
};
|
|
21573
21573
|
};
|
|
21574
21574
|
} & {
|
|
@@ -36063,20 +36063,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36063
36063
|
} & {
|
|
36064
36064
|
"/runs/:id/handoff": {
|
|
36065
36065
|
$get: {
|
|
36066
|
-
output:
|
|
36067
|
-
|
|
36068
|
-
|
|
36066
|
+
output: {
|
|
36067
|
+
error: string;
|
|
36068
|
+
};
|
|
36069
|
+
outputFormat: "json";
|
|
36070
|
+
status: 404;
|
|
36069
36071
|
input: {
|
|
36070
36072
|
param: {
|
|
36071
36073
|
id: string;
|
|
36072
36074
|
};
|
|
36073
36075
|
};
|
|
36074
36076
|
} | {
|
|
36075
|
-
output:
|
|
36076
|
-
|
|
36077
|
-
|
|
36078
|
-
outputFormat: "json";
|
|
36079
|
-
status: 404;
|
|
36077
|
+
output: string;
|
|
36078
|
+
outputFormat: "text";
|
|
36079
|
+
status: 200;
|
|
36080
36080
|
input: {
|
|
36081
36081
|
param: {
|
|
36082
36082
|
id: string;
|
|
@@ -36114,20 +36114,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36114
36114
|
} & {
|
|
36115
36115
|
"/runs/:id/diff": {
|
|
36116
36116
|
$get: {
|
|
36117
|
-
output:
|
|
36118
|
-
|
|
36119
|
-
|
|
36117
|
+
output: {
|
|
36118
|
+
error: string;
|
|
36119
|
+
};
|
|
36120
|
+
outputFormat: "json";
|
|
36121
|
+
status: 404 | 409;
|
|
36120
36122
|
input: {
|
|
36121
36123
|
param: {
|
|
36122
36124
|
id: string;
|
|
36123
36125
|
};
|
|
36124
36126
|
};
|
|
36125
36127
|
} | {
|
|
36126
|
-
output:
|
|
36127
|
-
|
|
36128
|
-
|
|
36129
|
-
outputFormat: "json";
|
|
36130
|
-
status: 404 | 409;
|
|
36128
|
+
output: string;
|
|
36129
|
+
outputFormat: "text";
|
|
36130
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
36131
36131
|
input: {
|
|
36132
36132
|
param: {
|
|
36133
36133
|
id: string;
|
|
@@ -36220,9 +36220,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36220
36220
|
status: 404 | 409;
|
|
36221
36221
|
input: {
|
|
36222
36222
|
param: {
|
|
36223
|
-
id: string;
|
|
36224
|
-
} & {
|
|
36225
36223
|
sha: string;
|
|
36224
|
+
} & {
|
|
36225
|
+
id: string;
|
|
36226
36226
|
};
|
|
36227
36227
|
};
|
|
36228
36228
|
} | {
|
|
@@ -36251,9 +36251,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36251
36251
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
36252
36252
|
input: {
|
|
36253
36253
|
param: {
|
|
36254
|
-
id: string;
|
|
36255
|
-
} & {
|
|
36256
36254
|
sha: string;
|
|
36255
|
+
} & {
|
|
36256
|
+
id: string;
|
|
36257
36257
|
};
|
|
36258
36258
|
};
|
|
36259
36259
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hearsay-tools/squawk",
|
|
3
|
-
"version": "0.19.0-pr4422.
|
|
3
|
+
"version": "0.19.0-pr4422.8653.2",
|
|
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",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@babel/parser": "^8.0.8",
|
|
71
71
|
"@babel/types": "^8.0.8",
|
|
72
|
-
"@open-mercato/cezar-api-client": "0.19.0-pr4422.
|
|
73
|
-
"@open-mercato/cezar-contract": "0.19.0-pr4422.
|
|
72
|
+
"@open-mercato/cezar-api-client": "0.19.0-pr4422.8653.2",
|
|
73
|
+
"@open-mercato/cezar-contract": "0.19.0-pr4422.8653.2",
|
|
74
74
|
"@types/node": "^24.19.1",
|
|
75
75
|
"@types/ws": "^8.18.1",
|
|
76
76
|
"esbuild": "^0.28.1",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "0fc093d472d70e78908544c7d821c87906ecfd13"
|
|
91
91
|
}
|
|
@@ -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,Ct as i,Dt as a,Gt as o,It as s,Nt as c,Qt as l,Xt as u,Yt as d,dn as f,dt as p,mt as m,on as h,pt as g,rn as _,ut as v,wt as y,yt as b}from"./queries-FJ1HTyY4.js";import{Fn as x,Fr as S,In as C,hi as w,ii as T,n as E,sn as ee,zn as D}from"./toaster-UvSCLhYx.js";import{f as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as k}from"./design-icons-CzEoMH9c.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-ZdEyXXrb.js";import{t as A}from"./button-B7MKxYjT.js";import{t as re}from"./badge-DQ3U69Ht.js";import{a as ie,i as ae,o as oe,r as j,s as M,t as N}from"./dialog-B531GGAo.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{n as F}from"./agents-settings-path-7X6_cvUg.js";import{t as I}from"./centered-state-V15AR_qo.js";import{Bt as L,Gt as R,Ht as z,Kt as B,Ut as V,Vt as H,Wt as U,j as W,k as G,qt as K}from"./index-CF5VtPMz.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-CH8kKWUG.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-CLfJlV5F.js";var fe=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),pe=`~/.claude-second`;function me({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=_().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[p,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=g.trim();return(0,X.jsx)(N,{open:e,onOpenChange:t,children:(0,X.jsxs)(j,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(M,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:d,onChange:e=>f(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:u(i,e)},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>h(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:g,placeholder:l(i,d)?.accountFolderExample??pe,onChange:e=>{v(e.target.value),c(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{c(e),v(e.path),x.reset()},onEnter:e=>{o(e),c(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),c(null),b(!1),E(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function he(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var _e={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function ve(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>he(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=f({mutationFn:t=>ge(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function ye({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function be({runner:e}){let t=ve(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${_e[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(ye,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var xe={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Se(){let e=p(),t=_();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(I,{icon:(0,X.jsx)(fe,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Te,{data:e.data,runners:t.data})}function Ce(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function we(){let{hash:e}=O();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function Te({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return we(),ue(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(le,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:de}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Ae,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(je,{runners:t}),r===null?null:(0,X.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(L,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(V,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(U,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),E(`Removed ${e.label}`)},onError:e=>E(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Ee({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Oe,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}var De=/^mock \(\w*DRY_RUN=1\)$/;function Oe({version:e}){return De.test(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function ke({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Z({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(ke,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Ae({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${F(l)}-title`,m=i&&o?(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Ee,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:F(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Z,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(be,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function je({runners:e}){let[t,n]=(0,Y.useState)(null),a=w(),c=s(),l=i(),u=h(r(e)),p=f({mutationFn:e=>ee(e),onSuccess:e=>a.setQueryData(o.config,e),onError:e=>E(e.message,{tone:`danger`})});if(c.data===void 0)return null;let m=se([],e),g=c.data.agentDefaults.runner??`claude`,_=d(t??g,r(e))??t??g,v=c.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(ce,{rows:m,runner:g,accountFor:()=>null,providerStatus:l,disabled:p.isPending,onPick:e=>{e!==g&&p.mutate({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,value:_,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===_).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(k,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsxs)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:v[t.id]??``,disabled:p.isPending,onChange:e=>p.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-64 max-w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[W(t.id,e,u[t.id]?.data,[v[t.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,X.jsx)(Q,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Q({runner:e,runners:t,catalog:n}){let r=G(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Me({account:e,runners:t,status:n,editable:r}){let i=g();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&l(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&l(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>E(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>E(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Ne(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${u(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=S(e),o=y(),s=v(a,e.status===void 0),c=e.status??s.data?.status,l=c?xe[c.status]:void 0,u=Ne(e,t,c,n),d=u?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(P,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":u.slot,className:`text-foreground`,children:u.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(P,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),f=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`discovered`}):null]}),m=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ce(e.configDir)}):null,h=u?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:u.guidance}):null,g=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,_=n&&!e.isDefault?(0,X.jsx)(Pe,{account:e,onRemove:r}):null,b=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[p,d]}),m,h,g]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Z,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[f,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[b,_?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:_}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[b,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[f,_]})]})}function Pe({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=c();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>E(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{Se as GlobalAgentsSection};
|
|
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,Ct as i,Dt as a,Gt as o,It as s,Nt as c,Qt as l,Xt as u,Yt as d,dn as f,dt as p,mt as m,on as h,pt as g,rn as _,ut as v,wt as y,yt as b}from"./queries-BwJVP1so.js";import{Fn as x,Fr as S,In as C,hi as w,ii as T,n as E,sn as ee,zn as D}from"./toaster-UvSCLhYx.js";import{f as O}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as k}from"./design-icons-CzEoMH9c.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./folder-browser-D_V807qp.js";import{t as A}from"./button-B7MKxYjT.js";import{t as re}from"./badge-DQ3U69Ht.js";import{a as ie,i as ae,o as oe,r as j,s as M,t as N}from"./dialog-B531GGAo.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{n as F}from"./agents-settings-path-7X6_cvUg.js";import{t as I}from"./centered-state-V15AR_qo.js";import{Bt as L,Gt as R,Ht as z,Kt as B,Ut as V,Vt as H,Wt as U,j as W,k as G,qt as K}from"./index-V7mPM8_i.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-DunygjC_.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-By8FlGex.js";var fe=te(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),pe=`~/.claude-second`;function me({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=_().data,[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(r??n[0]??`claude`),[p,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=m(),S=g.trim();return(0,X.jsx)(N,{open:e,onOpenChange:t,children:(0,X.jsxs)(j,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(M,{children:`Add agent account`}),(0,X.jsx)(ae,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:d,onChange:e=>f(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:u(i,e)},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:p,placeholder:`Work`,onChange:e=>h(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:g,placeholder:l(i,d)?.accountFolderExample??pe,onChange:e=>{v(e.target.value),c(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ne,{path:a,selected:s,onSelect:e=>{c(e),v(e.path),x.reset()},onEnter:e=>{o(e),c(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(ie,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(A,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:d,configDir:S,...p.trim()?{label:p.trim()}:{}},{onSuccess:()=>{t(!1),h(``),v(``),c(null),b(!1),E(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function he(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var _e={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function ve(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>he(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=f({mutationFn:t=>ge(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function ye({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(A,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function be({runner:e}){let t=ve(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${_e[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(ye,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var xe={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Se(){let e=p(),t=_();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(I,{icon:(0,X.jsx)(fe,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Te,{data:e.data,runners:t.data})}function Ce(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function we(){let{hash:e}=O();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function Te({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return we(),ue(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(le,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:de}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Ae,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:s},r.id))}),(0,X.jsx)(je,{runners:t}),r===null?null:(0,X.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(L,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(V,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(K,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(U,{children:[`This only forgets the account. Nothing in `,o?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:c.isPending,onClick:()=>{let e=o;e&&c.mutate(e.id,{onSuccess:()=>{s(null),E(`Removed ${e.label}`)},onError:e=>E(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Ee({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Oe,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}var De=/^mock \(\w*DRY_RUN=1\)$/;function Oe({version:e}){return De.test(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function ke({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Z({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(ke,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Ae({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${F(l)}-title`,m=i&&o?(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Ee,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:F(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Z,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(be,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function je({runners:e}){let[t,n]=(0,Y.useState)(null),a=w(),c=s(),l=i(),u=h(r(e)),p=f({mutationFn:e=>ee(e),onSuccess:e=>a.setQueryData(o.config,e),onError:e=>E(e.message,{tone:`danger`})});if(c.data===void 0)return null;let m=se([],e),g=c.data.agentDefaults.runner??`claude`,_=d(t??g,r(e))??t??g,v=c.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(ce,{rows:m,runner:g,accountFor:()=>null,providerStatus:l,disabled:p.isPending,onPick:e=>{e!==g&&p.mutate({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,value:_,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===_).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(k,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsxs)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:v[t.id]??``,disabled:p.isPending,onChange:e=>p.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-64 max-w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[W(t.id,e,u[t.id]?.data,[v[t.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,X.jsx)(Q,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Q({runner:e,runners:t,catalog:n}){let r=G(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Me({account:e,runners:t,status:n,editable:r}){let i=g();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&l(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,r&&n&&n.status!==`connected`&&l(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:i.isPending,onClick:()=>i.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>E(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>E(e instanceof x&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Ne(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${u(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=S(e),o=y(),s=v(a,e.status===void 0),c=e.status??s.data?.status,l=c?xe[c.status]:void 0,u=Ne(e,t,c,n),d=u?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(P,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":u.slot,className:`text-foreground`,children:u.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(P,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),f=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(re,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`discovered`}):null]}),m=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ce(e.configDir)}):null,h=u?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:u.guidance}):null,g=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,_=n&&!e.isDefault?(0,X.jsx)(Pe,{account:e,onRemove:r}):null,b=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[p,d]}),m,h,g]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Z,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[f,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[b,_?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:_}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[b,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[f,_]})]})}function Pe({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=c();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(A,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>E(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{Se as GlobalAgentsSection};
|
|
@@ -0,0 +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"./utils-DSMR_WLb.js";import{Ht as i,Rt as a,Wt as o,Xt as s,ct as c,dn as l,q as u,rn as d,un as f}from"./queries-BwJVP1so.js";import{En as p,Fn as m,Hr as h,In as g,Ln as ee,Mn as te,Ot as ne,Ur as re,Wr as ie,Zr as ae,bn as _,br as v,hi as y,ii as b,kn as x,n as S,ti as oe,tr as se,tt as C,zn as ce}from"./toaster-UvSCLhYx.js";import{B as w,F as T,G as le,I as E,J as ue,N as D,P as de,S as fe,T as pe,W as O,Y as me,j as k,z as A}from"./live-protocol-DMhTnCmf.js";import{n as j}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as he}from"./run-detail-refresh-YR2-iM4z.js";import{ft as ge,t as _e}from"./design-icons-CzEoMH9c.js";import{t as ve}from"./createLucideIcon-BHp8sXmF.js";import{a as ye,n as be,r as xe}from"./review-panel-CMgEoI0r.js";import{t as Se}from"./arrow-right-Dh_Lx3um.js";import{t as Ce}from"./arrow-up-right-DKGzsMqY.js";import{t as we}from"./bot-TkDIw4y-.js";import{t as Te}from"./external-link-BE6y205O.js";import{t as Ee}from"./info-DA1x_4bz.js";import{t as De}from"./message-square-B-MD-8rD.js";import{a as Oe,o as ke,r as Ae}from"./tool-display-B9NN44oU.js";import{t as M}from"./button-B7MKxYjT.js";import{i as je,r as Me,t as Ne}from"./popover-BPgUYFyu.js";import{t as N}from"./project-router-B8blqSVo.js";import"./attention-CXG_AzDe.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{c as Pe,i as Fe,l as Ie,o as Le,r as Re,s as ze}from"./report-selection-DBM7S3ha.js";import"./page-shell-7pLJMOgh.js";import{$t as Be}from"./index-V7mPM8_i.js";import{t as Ve}from"./textarea-vJt9undk.js";var He=ve(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),F=e(t(),1),I=n(),L=me(),R=A().int().nonnegative(),z=O().min(1),Ue=w({title:O().max(160),toolKind:k([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:k([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:L,endedAt:L.optional()}).strict(),We=k([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Ge=w({checks:D(w({name:O().max(100),bucket:We}).strict()).max(100),counts:w({pass:R,fail:R,pending:R,skipping:R,cancel:R}).strict(),truncated:E(!0).optional()}).strict(),Ke=T(`kind`,[w({kind:E(`human`),since:L,detail:w({question:O().max(500).optional(),reason:k([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:A().int().positive().optional()}).strict()}).strict(),w({kind:E(`usage-limit`),detail:w({resumeAt:O()}).strict()}).strict(),w({kind:E(`workers`),since:L,deadline:L.optional(),detail:w({owed:R,total:R,settled:R,replies:E(!0).optional(),mode:fe.optional(),recipientRunIds:D(z)}).strict()}).strict(),w({kind:E(`peers`),since:L,deadline:L,detail:w({peerRunIds:D(z)}).strict()}).strict(),w({kind:E(`subagents`),since:L,deadline:L,detail:w({running:R}).strict()}).strict(),w({kind:E(`pr`),since:L,deadline:L,detail:w({number:A().int().positive(),target:se,checks:Ge.shape.checks.optional(),counts:Ge.shape.counts.optional(),truncated:E(!0).optional()}).strict()}).strict(),w({kind:E(`process`),since:L,deadline:L,detail:w({pid:A().int(),note:O().optional()}).strict()}).strict(),w({kind:E(`plugin`),since:L,deadline:L.optional(),detail:w({pluginKind:O().min(1).max(64),summary:O().max(256)}).strict()}).strict(),w({kind:E(`timer`),since:L,deadline:L,detail:w({wakeAt:L,note:O().optional()}).strict()}).strict()]),qe={runId:z,title:O(),status:v,rung:k(p),runner:oe.optional(),model:O().optional(),currentStepId:O().optional(),createdAt:O().optional(),startedAt:O().optional(),finishedAt:O().optional(),wait:Ke.optional(),tool:Ue.optional(),rate:D(R).length(30),error:O().max(200).optional()},Je=w({...qe,revision:R,collected:de()}).strict(),Ye=w({...qe,workers:D(Je)}).strict(),Xe=w({requestId:ue(),relationship:k([`family`,`peer`]),senderRunId:z,recipientRunId:z,text:O().max(500),senderTitle:O().optional(),recipientTitle:O().optional(),createdAt:L,deadline:L.optional()}).strict(),Ze=w({requestId:ue(),senderRunId:z,recipientRunId:z,status:pe.shape.status,observedAt:L}).strict(),Qe=w({generatedAt:L,projects:D(w({projectId:O(),name:O(),loaded:de(),unavailable:w({status:le([E(404),E(409),E(503)]),error:O()}).strict().optional(),inReview:R,tasks:D(Ye),requests:D(Xe),closed:D(Ze)}).strict())}).strict();w({project:le([E(`default`),O().regex(_)]).optional()});var $e=5e3,et=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],tt=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,nt=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,rt=`the Squawk server answered /workspace/activity with an unexpected body`;function it(e){let t=Qe.safeParse(e);if(!t.success)throw new m(200,rt);return t.data}async function at(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return it(await ce(await g.api.v1.workspace.activity.$get({query:n},ee(t)),`/workspace/activity`))}function ot(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var st=new Date(0).toISOString();function ct(e){return e!==void 0&&e!==st&&!Number.isNaN(Date.parse(e))}var lt=new Set([404,409,503]);function ut(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??st,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function dt(e,t){return new m(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var ft=(e,t)=>e.kind===`project`&<.has(t.status)?t.status:void 0;function pt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,F.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,F.useMemo)(()=>et(n),[n]),o=y(),s=b({queryKey:r,queryFn:async({signal:e})=>{let t=o.getQueryData(r);try{return ot(t,await at(n,{signal:e}))}catch(e){let r=e instanceof m?ft(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return ut(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,F.useEffect)(()=>{let e=!0,t=t=>{o.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let i=ft(n,t);if(i!==void 0&&n.kind===`project`){o.setQueryData(r,e=>ut(e,n.projectId,i,t.message));return}let a=o.getQueryCache().find({queryKey:r,exact:!0});a?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:a.state.errorUpdateCount+1,fetchStatus:`idle`})})},s=n=>{let i;try{i=it(n)}catch(e){t(e);return}o.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&o.setQueryData(r,e=>ot(e,i))})},l=a(tt(n),s),u=i($e),d,f=()=>{let e=h()===`finite`&&u!==!1;e&&!d?d=c({path:nt(n),intervalMs:u},(e,n)=>{n===void 0?s(e):t(dt(e,n))}):!e&&d&&(d(),d=void 0)};f();let p=ie(f);return()=>{e=!1,p(),d?.(),l()}},[o,r,n]),s}var mt=e=>String(e).padStart(2,`0`);function B(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}:${mt(r)}:${mt(i)}`:`${r}:${mt(i)}`}function V(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r>=24)return`${Math.floor(r/24)}d`;let i=n%60;return r<6&&i>0?`${r}h ${i}m`:`${r}h`}function H(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var ht=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function U(e){let t=Date.parse(e);return Number.isNaN(t)?e:ht.format(t)}var gt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),_t=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`});function W(e){let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?String(e):`${gt.format(t)}, ${_t.format(t)} ${yt()}`}function vt(e){let t=Math.max(0,Math.floor(e/1e3));return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function yt(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var bt=new Set([`queued`,`running`,`waiting`]),xt={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},St={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},G=e=>bt.has(e),Ct=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,K=e=>x(e.rung).tone,wt=(e,t=`Deadline`)=>e?`${t} ${U(e)}`:void 0;function Tt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${Ct(t.length,`task`)}`}function Et(e,t){let n=e.tool,r={verb:`Running`,tone:K(e),icon:`tool`},i=n?.endedAt!==void 0&&H(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${V(H(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 Dt(e,t){let n={verb:`Needs you`,tone:K(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 · ${Ct(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function Ot(e){return{verb:`Needs you`,tone:K(e),icon:`user`,main:`Permission`,action:`open`}}function kt(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:K(e),since:t.since};if(o){let e=c.length>0?Tt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...q(`detail`,wt(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${At[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...q(`detail`,wt(t.deadline))}}var At={one:`One`,any:`Any`,all:`All`};function jt(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 Mt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function Nt(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=Mt.reduce((e,t)=>e+i(t),0),o=Mt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var Pt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function Ft(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=Pt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=Nt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function It(e,t){let n={tone:K(e),since:t.since,...q(`detail`,wt(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:jt(t),...q(`checks`,r),...q(`overflow`,Nt(t)),...q(`checkSummary`,Ft(t))}}function q(e,t){return t===void 0?{}:{[e]:t}}function Lt(e,t,n){let r=K(e);switch(t.kind){case`workers`:return kt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:Tt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${U(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:Ct(t.detail.running,`native subagent`),detail:`Deadline ${U(t.deadline)}`};case`pr`:return It(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 ${B(H(t.since,n.now))} · deadline ${U(t.deadline)}`};case`plugin`:return{verb:`Waiting`,tone:r,icon:`timer`,since:t.since,main:t.detail.summary,...q(`detail`,wt(t.deadline))};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${U(t.detail.wakeAt)} · in ${B(-H(t.detail.wakeAt,n.now))}`};case`usage-limit`:return Rt(e,t.detail.resumeAt,n);case`human`:return}}function Rt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${U(t)} · in ${B(r-n.now)}`;return{verb:`Paused`,tone:K(e),icon:`pause`,main:`Usage limit`,detail:i}}function zt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:K(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${V(H(n,t.now))}`}:{}}}function Bt(e,t){return{verb:xt[e.status]??e.status,tone:K(e),icon:St[e.status]??`done`,main:t}}function Vt(e,t){return G(e.status)?Ht(e,t):Bt(e,Ct(e.workers.filter(e=>G(e.status)).length,`live worker`))}function Ht(e,t){let n=e.wait;switch(e.rung){case`running`:return Et(e,t);case`needs-permission`:return Ot(e);case`needs-you`:return Dt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?Rt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:K(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return zt(e,t);default:return(n&&Lt(e,n,t))??zt(e,t)}}function Ut(e,t,n){if(n!==void 0&&G(e.status))return{verb:`Asks parent`,tone:K(e),main:`“${n}”`,asks:!0};let r=Wt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Wt(e,t){switch(e.status){case`done`:return Bt(e,e.collected?`Collected`:`Ready to collect`);case`review`:return Bt(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return Bt(e,e.error??xt[e.status]??e.status);default:return Ht({...e,workers:[]},t)}}var Gt={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 Kt({tone:e,className:t,children:n,...i}){return(0,I.jsx)(`span`,{...i,className:r(`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 qt={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`},Jt={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`};function Yt(e,t){let n=x(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:Qt(e,t)??n.label}}var Xt=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function Zt(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function Qt(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!Zt(n))return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return Xt(`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 Xt(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return Xt(`waiting for`,n.detail.running,`subagent`)}function $t(e,t){if(G(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function J({run:e,role:t}){let{tone:n,shape:i,label:a}=Yt(e,t);return(0,I.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,$t(e,i)),children:(0,I.jsx)(P,{tone:n,shape:i,role:`img`,"aria-label":a})})}var en={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},tn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function nn({checks:e,overflow:t,passed:n,className:i}){return(0,I.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i??r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,I.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,en[e.bucket],tn(e.bucket,n.has(e.name)))},e.name)),t?(0,I.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,I.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,en[t.bucket])}),`+`,t.count]}):null]})}function rn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,I.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:r(`block h-4 w-[62px] shrink-0`,t),children:[n>0?(0,I.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}):null,e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,I.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var an=`inline-flex min-w-0 items-center rounded-md border px-3 py-1 text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function on({scope:e,projectId:t,projectName:n}){let i=e=>r(an,e?`border-border bg-card text-foreground shadow-xs`:`border-transparent text-muted-foreground hover:text-foreground`);return(0,I.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`inline-flex max-w-full rounded-lg border border-border bg-muted/60 p-1`,children:[t===null?null:(0,I.jsx)(j,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:i(e===`project`),children:(0,I.jsx)(`span`,{className:`max-w-40 truncate`,title:n??t,children:n??t})}),(0,I.jsx)(j,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:i(e===`all`),children:`All projects`})]})}function sn({grouped:e,onToggle:t}){return(0,I.jsxs)(`button`,{type:`button`,"data-slot":`activity-group-toggle`,"aria-pressed":e,onClick:t,className:r(`inline-flex h-9 items-center gap-1.5 rounded-lg border px-2.5 text-[12px] font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,e?`border-accent-text/60 bg-accent-strong/10 text-foreground`:`border-border bg-card text-muted-foreground hover:text-foreground`),children:[(0,I.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`}),(0,I.jsx)(`span`,{children:`Group by project`})]})}function cn(){let e=`flex items-center gap-2`;return(0,I.jsxs)(Ne,{children:[(0,I.jsx)(je,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,"data-slot":`activity-legend`,"aria-label":`Activity legend`,className:`inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,I.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5`}),(0,I.jsx)(`span`,{children:`Legend`})]})}),(0,I.jsx)(Me,{align:`end`,className:`w-80 text-[12px] text-muted-foreground`,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.jsx)(`p`,{className:`text-[11px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:`Activity legend`}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(P,{tone:`pending`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{className:`text-foreground`,children:`Needs answer`}),` — waiting for your reply`]})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(P,{tone:`info`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{className:`text-foreground`,children:`Needs review`}),` — ready for diff review or PR`]})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(P,{tone:`danger`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{className:`text-foreground`,children:`Failed`}),` — stopped with an error`]})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(P,{tone:`running`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{className:`text-foreground`,children:`Working`}),` — running tools right now`]})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(P,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{className:`text-foreground`,children:`Ring`}),` — waiting on CI, peer, or timer`]})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(P,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`strong`,{className:`text-foreground`,children:`Robot`}),` — waiting on its own workers`]})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(rn,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),(0,I.jsx)(`span`,{children:`Heartbeat: tool calls, last 30 s`})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,I.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 4`,className:`stroke-message-peer-accent`})}),(0,I.jsx)(`span`,{children:`Open peer request (task → task)`})]}),(0,I.jsxs)(`div`,{className:e,children:[(0,I.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,I.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,I.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]}),(0,I.jsx)(`span`,{children:`Waiting for a peer to write`})]})]})})]})}function ln({scope:e,projectId:t,projectName:n,grouped:r,onToggleGroup:i}){return(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(cn,{}),i?(0,I.jsx)(sn,{grouped:!!r,onToggle:i}):null,(0,I.jsx)(on,{scope:e,projectId:t,projectName:n})]})}function un({now:e,updatedAt:t,stale:n}){let i=t!==void 0&&!Number.isNaN(Date.parse(t));return(0,I.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":n?`true`:void 0,title:W(e),className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground tabular-nums`,children:[(0,I.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!n&&`activity-pulse`),children:(0,I.jsx)(P,{tone:n?`neutral`:`success`,"aria-hidden":`true`})}),(0,I.jsx)(`b`,{className:r(`font-semibold`,n?`text-muted-foreground`:`text-success`),children:n?`Not updating`:`Live`}),i?(0,I.jsxs)(`span`,{children:[`· updated `,vt(H(t,e))]}):null]})}function dn({name:e,now:t,updatedAt:n,stale:r=!1,scopeSwitch:i}){return{title:`Activity`,scope:e,subtitle:t===void 0?void 0:(0,I.jsx)(un,{now:t,updatedAt:n,stale:r}),secondaryActions:i}}function fn({primary:e=!1}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(M,{variant:e?`primary`:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,I.jsx)(N,{to:`/new`,children:`New task`})}),(0,I.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,I.jsx)(N,{to:`/`,children:`View tasks`})})]})}function pn({value:e,bump:t}){return(0,I.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Y({icon:e,count:t,label:n,bump:r}){return(0,I.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,I.jsx)(pn,{value:t,bump:r}),` `,n]})}function mn({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,I.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(Y,{icon:(0,I.jsx)(P,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,I.jsx)(Y,{icon:(0,I.jsx)(P,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,I.jsx)(Y,{icon:(0,I.jsx)(P,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,I.jsx)(Y,{icon:(0,I.jsx)(P,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,I.jsx)(Y,{icon:(0,I.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,I.jsx)(Y,{icon:(0,I.jsx)(De,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,I.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,I.jsxs)(N,{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 transition-colors hover:border-accent-text/40 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,I.jsx)(P,{tone:`info`,"aria-hidden":`true`}),(0,I.jsx)(pn,{value:e.inReview,bump:r(`inReview`)}),` in review`,(0,I.jsx)(Ce,{"aria-hidden":`true`,className:`size-3 text-soft-foreground`})]})})]})}function hn(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function gn(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 X(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var _n=(e,t)=>X(e,t.senderRunId,t.senderTitle),vn=(e,t)=>X(e,t.recipientRunId,t.recipientTitle),yn=(e,t)=>`wait:${e}:${t}`;function Z(e){let t=[];for(let n of e){let e=n.wait;if(!(!G(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:yn(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function bn(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function xn(e,t){return t.filter(t=>t.waiterRunId===e)}function Sn(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${vn(n,r)}`),r.recipientRunId===e&&i.push(`${_n(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${X(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${X(n,t.waiterRunId)} waits for you to write`);return i}function Cn(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function wn(e,t){let n=-H(e,t);return n>=1e3?`reply due in ${B(n)}`:`reply overdue`}function Tn(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function En(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Dn[On(e,t)]}}var Dn={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function On(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 kn=new Set([`queued`,`waiting-for-capacity`]);function An(e){if(G(e.status))return te(e.rung)?`needsYou`:e.rung===`running`?`working`:kn.has(e.rung)?`queued`:`waiting`}function jn(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=An(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>G(e.status)).length}}return t}function Mn(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 Nn({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var Q={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},$={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Pn=(e,t)=>`${e}\n${t}`;function Fn(e,t){let n=Pn(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var In=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})}},Ln={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Rn(e,t){let n=Ln[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},Q.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},Q.workerHold+Q.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},Q.workerHold)}function zn(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},Q.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},Q.comet)}function Bn(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`},Q.fade);return}let a=Q.comet+Q.replied+Q.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`},Q.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},Q.comet+Q.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},Q.comet)}function Vn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:x(t.task.rung).tone},Q.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},Q.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},Q.workerEnter);case`worker-settled`:return Rn(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},Q.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},Q.cardLeave);case`check-passed`:return e.timed(`checks`,Pn(t.runId,t.name),{},Q.check);case`request-opened`:return zn(e,t.request);case`request-closed`:return Bn(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},Q.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},Q.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},Q.fade)}}function Hn(e,t,n){let r=new In(t);if(!n)for(let t of e)Vn(r,t);return{changes:r.changes,timers:r.timers}}function Un(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 Wn(e,t){return t.reduce(Un,e)}function Gn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}function Kn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Tn(e,t),l=xn(e,n);return c.length===0&&l.length===0?null:(0,I.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,vn(r,e)]})},e.requestId)),l.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,X(r,e.peerRunId)]})},e.id))]})}var qn=e=>`/tasks/${encodeURIComponent(e)}`;function Jn({texts:e}){return e.length===0?null:(0,I.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,I.jsx)(`li`,{children:e},t))})}var Yn={compact:{base:`relative flex flex-wrap items-center gap-x-2 gap-y-0.5 rounded-md px-2 py-1 text-[12px] text-muted-foreground`,asks:`border-l-2 border-dashed border-message-inbound-accent bg-message-inbound-bg`,shape:void 0,title:`min-w-0 truncate text-[12px] font-medium text-foreground`,line:`truncate text-[11.5px] text-muted-foreground tabular-nums`,main:`text-foreground`},card:{base:`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`,asks:`-mx-1.5 bg-message-inbound-bg px-1.5`,shape:`mt-[3px]`,title:`min-w-0 truncate text-[12.5px] font-medium text-foreground`,line:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,main:void 0}};function Xn({to:e,title:t,global:n}){let r=`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`;return n?(0,I.jsx)(j,{to:e,className:r,children:t}):(0,I.jsx)(N,{to:e,className:r,children:t})}function Zn({worker:e,parentId:t,requests:n,index:i,ctx:a,motion:o,href:c,global:l=!1,compact:u=!1}){let f=Ut(e,a,Cn(e.runId,t,n)?.text),p=o.workerHold[e.runId],m=d().data,h=u?Yn.compact:Yn.card,g=[e.runner?s(m,e.runner):void 0,e.model].filter(Boolean).join(` · `);return(0,I.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":f.asks?`true`:void 0,"data-hold":p?.phase,className:r(h.base,f.asks&&h.asks,e.runId in o.workerEnter&&`activity-row-enter`,p?.phase===`fold`&&`activity-row-fold`),children:[p?(0,I.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,Jt[p.tone])},p.key):null,(0,I.jsx)(`span`,{className:h.shape,children:(0,I.jsx)(J,{run:e,role:`worker`})}),(0,I.jsxs)(`span`,{className:h.title,children:[(0,I.jsx)(Xn,{to:c??qn(e.runId),title:e.title,global:l}),g?(0,I.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:g}):null]}),(0,I.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:h.line,children:[(0,I.jsx)(`b`,{className:r(`font-semibold`,Gt[f.tone]),children:f.verb}),` · `,(0,I.jsx)(`span`,{className:r(h.main,f.mono&&`font-mono`),children:f.main})]}),(0,I.jsx)(Jn,{texts:Sn(e.runId,n,i)})]})}function Qn({workers:e}){return(0,I.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,I.jsx)(J,{run:e,role:`worker`},e.runId)),(0,I.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function $n({task:e,requests:t,index:n,ctx:r,dense:i=!1,motion:a,projectId:o,global:s=!1,compact:c=!1}){let l=e=>e in a.workerHold,u=e.workers.filter(e=>G(e.status)||e.status===`review`||l(e.runId)),d=Nn(Mn(e,l));if(u.length===0&&!d)return null;let f=e=>s&&o?`/p/${encodeURIComponent(o)}/tasks/${encodeURIComponent(e)}`:qn(e);return c?(0,I.jsxs)(`div`,{className:`ml-4 border-l border-border pl-3`,children:[u.length>0?(0,I.jsx)(`ul`,{"data-slot":`activity-workers`,className:`flex flex-col gap-0.5`,children:u.map(i=>(0,I.jsx)(Zn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a,href:f(i.runId),global:s,compact:!0},i.runId))}):null,d?(0,I.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1 px-2 text-[11px] text-muted-foreground`,children:d}):null]}):(0,I.jsxs)(I.Fragment,{children:[u.length>0&&i?(0,I.jsx)(Qn,{workers:u}):null,u.length>0&&!i?(0,I.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:u.map(i=>(0,I.jsx)(Zn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,d?(0,I.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:d}):null]})}function er(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function tr({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,I.jsxs)(I.Fragment,{children:[n?(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,I.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,qt[i.tone])},i.key):null]})}var nr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function rr(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)nr(n)&&t.push(n);return t}var ir=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function ar({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 or=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function sr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,or(r)-n);return e.reverse?1-i:i}var cr=`http://www.w3.org/2000/svg`,lr=[0,.03,.06,.09,.12],ur=[4.5,3.5,3,2.5,2],dr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function fr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(cr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(cr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${dr[t.tone]} opacity-35`),r.append(i),lr.forEach((e,n)=>{let i=document.createElementNS(cr,`circle`);i.setAttribute(`r`,String(ur[n])),i.setAttribute(`class`,n===0?`fill-foreground`:dr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function pr(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();fr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(sr(r,n,lr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var mr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),hr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function gr(e,t,n){let r=F.useRef(null),i=F.useRef(void 0),a=F.useRef(new Set);return F.useEffect(()=>{let e=r.current;if(!e)return;let t=ar({frame:mr,cancel:hr,draw:(t,n)=>pr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),F.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:Q.comet}))},[e,t,n]),r}var _r=`activity-layout-settled`;function vr(e,t,n,r,i,a=!1){let[o,s]=F.useState([]);return F.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?yr(i,o):void 0;i.addEventListener(_r,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(_r,o),c?.()}},[e,t,n,r,i,a]),o}function yr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...rr(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)}}function br(e,t){if(e.deadline!==void 0)return xr(e.createdAt,e.deadline,t)}function xr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function Sr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function Cr(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var wr=(e,t)=>e.closing[t]?.phase??`open`;function Tr(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}function Er({id:e}){return(0,I.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,I.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}function Dr(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of gn(r))n.set(e,t);return n}var Or={"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 kr(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} ${Or[t??``]??`closed`}`}var Ar={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},jr=e=>e.relationship===`peer`?`peer`:`family`;function Mr(e,t,n){let r=(e,n)=>X(t,e,n);switch(e.kind){case`request-opened`:return{tone:jr(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:kr(e.request,e.status,r)};case`rung-changed`:return{tone:x(e.task.rung).tone,text:`${e.task.title}: ${Vt(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=Ar[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:x(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 Nr(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function Pr(e){return Math.max(0,Math.floor(e/1e3))<5?`now`:V(e)}var Fr=`rounded-xl border border-border bg-card px-3.5 py-3`,Ir=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function Lr({request:e,index:t,now:n,motion:i}){let{kind:a,relation:o}=En(e,t),s=br(e,n),c=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,I.jsxs)(`li`,{"data-slot":i===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":i===`fold`||void 0,className:r(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,i===`enter`&&`activity-row-enter`,i===`fold`&&`activity-row-fold`),children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:_n(t,e)}),(0,I.jsx)(Se,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:vn(t,e)}),(0,I.jsx)(`span`,{className:r(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,c),children:a})]}),(0,I.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,I.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,I.jsxs)(`span`,{children:[o,` · open `,B(H(e.createdAt,n))]}),e.deadline?(0,I.jsx)(`span`,{className:`ml-auto`,children:wn(e.deadline,n)}):null]}),s===void 0?null:(0,I.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,I.jsx)(`span`,{className:r(`block h-full bg-current`,c),style:{width:`${Math.round(s*100)}%`}})})]})}var Rr={...Jt,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function zr({feed:e,now:t}){return(0,I.jsxs)(`section`,{"data-slot":`activity-just-now`,className:Fr,children:[(0,I.jsx)(`h2`,{className:Ir,children:`Just now`}),(0,I.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,I.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:r(`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,I.jsx)(`span`,{"aria-hidden":`true`,className:r(`size-[7px] -translate-y-px rounded-full`,Rr[e.tone])}),(0,I.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,I.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:Pr(t-e.at)})]},e.id))})]})}function Br({requests:e,closing:t=[],index:n,now:i,feed:a=[],motion:o=$,columnGap:s}){let c=e.length>0||t.length>0,l=a.length>0;return!c&&!l?null:(0,I.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,style:s===void 0?void 0:{columnGap:s},className:r(`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start items-start gap-4`,c&&l&&`md:grid-cols-2`),children:[c?(0,I.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:Fr,children:[(0,I.jsxs)(`h2`,{className:Ir,children:[`Open requests `,(0,I.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),(0,I.jsxs)(`ul`,{children:[e.map(e=>(0,I.jsx)(Lr,{request:e,index:n,now:i,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,I.jsx)(Lr,{request:e,index:n,now:i,motion:`fold`},e.requestId))]})]}):null,l?(0,I.jsx)(zr,{feed:a,now:i}):null]})}var Vr=new Set;function Hr(e){let[t,n]=F.useState({}),r=t.pointer??t.focus,i=F.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:F.useMemo(()=>r===void 0?Vr:bn(r,e),[r,e]),active:F.useMemo(()=>r===void 0?Vr:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}function Ur(e,t,n=Z(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:Gn(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}var Wr=24,Gr=22,Kr=4,qr=10;function Jr(e,t,n,r=$){let i=[],a=(e,t)=>{let r=n.get(e);return r!==void 0&&r===n.get(t)};for(let t of e){if(t.relationship!==`peer`||!a(t.senderRunId,t.recipientRunId))continue;let e=r.closing[t.requestId];i.push({kind:`request`,id:t.requestId,from:t.senderRunId,to:t.recipientRunId,createdAt:t.createdAt,...e?{closing:!0,replied:e.replied}:{}})}for(let e of t)a(e.peerRunId,e.waiterRunId)&&i.push({kind:`wait`,id:e.id,from:e.peerRunId,to:e.waiterRunId,since:e.since,...e.id in r.waitsClosing?{closing:!0}:{}});if(i.length===0)return{edges:i,gutterWidth:0};let o=Math.min(Kr,i.length);return{edges:i,gutterWidth:Math.min(116,46+(o-1)*Gr)}}function Yr(e,t,n){let r=new Set;if(!e)return r;for(let n of t)n.relationship===`peer`&&(n.senderRunId===e||n.recipientRunId===e)&&(r.add(n.senderRunId),r.add(n.recipientRunId));for(let t of n)(t.peerRunId===e||t.waiterRunId===e)&&(r.add(t.peerRunId),r.add(t.waiterRunId));return r}function Xr(e,t){return e.map(e=>{let n=t.get(e.from),r=t.get(e.to);if(!(!n||!r))return{edge:e,start:n,end:r,span:Math.abs(r.y-n.y)}}).filter(e=>e!==void 0).sort((e,t)=>e.span-t.span).map(({edge:e,start:t,end:n},r)=>{let i=r%Kr,a=Math.max(10,Math.min(t.x,n.x)-Wr-i*Gr),o=n.y-t.y,s=o>=0?1:-1,c=Math.min(qr,Math.abs(o)/2,Math.max(2,t.x-a-2)),l=e.kind===`request`?n.x-2:n.x-6;return{edge:e,path:[`M ${t.x} ${t.y}`,`L ${a+c} ${t.y}`,`Q ${a} ${t.y} ${a} ${t.y+s*c}`,`L ${a} ${n.y-s*c}`,`Q ${a} ${n.y} ${a+c} ${n.y}`,`L ${l} ${n.y}`].join(` `),laneX:a,labelY:t.y+o*(.5+(r%2==0?-.06:.08)),endX:n.x-4,endY:n.y}})}function Zr(e){let t=new Map,n=e.getBoundingClientRect();for(let r of e.querySelectorAll(`[data-activity-row]`)){let e=r.getAttribute(`data-activity-row`);if(!e)continue;let i=r.getBoundingClientRect();t.set(e,{x:i.left-n.left,y:i.top-n.top+Math.min(i.height/2,24)})}return t}function Qr({stage:e,edges:t,active:n,now:i,layoutKey:a,motion:o=$,paused:s=!1}){let c=F.useId(),[l,u]=F.useState([]);F.useLayoutEffect(()=>{if(!e||t.length===0){u([]);return}let n=()=>u(Xr(t,Zr(e)));if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e,t,a]);let d=F.useMemo(()=>new Set(l.filter(e=>e.edge.kind===`request`).map(e=>e.edge.id)),[l]),f=gr(o.comets,d,s);return(0,I.jsxs)(`div`,{"data-slot":`activity-margin-arcs`,"aria-hidden":`true`,className:r(`pointer-events-none absolute inset-0 z-[5] hidden overflow-visible`,t.length>0&&`md:block`),children:[(0,I.jsxs)(`svg`,{className:`size-full overflow-visible`,children:[(0,I.jsx)(`defs`,{children:(0,I.jsx)(`marker`,{id:c,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,I.jsx)(`path`,{d:`M0 1 L7 4 L0 7 z`,className:`fill-message-peer-accent`})})}),l.map(e=>{let{edge:t}=e,i=n!==void 0&&(t.from===n||t.to===n),a=n!==void 0&&!i,o=t.kind===`request`?r(`fill-none stroke-message-peer-accent transition-opacity`,!t.closing&&`activity-march`,t.closing&&`activity-line-out`):r(`fill-none stroke-message-peer-accent transition-opacity`,!t.closing&&`activity-drift`,t.closing&&`activity-line-out`);return(0,I.jsxs)(`g`,{opacity:a?.22:i?1:.82,children:[(0,I.jsx)(`path`,{d:e.path,"data-request":t.kind===`request`?t.id:void 0,"data-wait":t.kind===`wait`?t.id:void 0,strokeWidth:i?2.4:1.8,strokeDasharray:t.kind===`request`?t.replied?void 0:`6 4`:`0 7`,strokeLinecap:t.kind===`wait`?`round`:void 0,markerEnd:t.kind===`request`?`url(#${c})`:void 0,className:o}),t.kind===`wait`?(0,I.jsx)(`circle`,{cx:e.endX,cy:e.endY,r:`3.2`,strokeWidth:`1.7`,className:`fill-card stroke-message-peer-accent`}):null]},`${t.kind}:${t.id}`)}),(0,I.jsx)(`g`,{ref:f})]}),l.map(e=>{let{edge:t}=e,a=n!==void 0&&(t.from===n||t.to===n),o=n!==void 0&&!a,s=B(H(t.kind===`request`?t.createdAt:t.since,i));return(0,I.jsx)(`span`,{style:{left:e.laneX,top:e.labelY},className:r(`absolute -translate-x-1/2 -translate-y-1/2 rounded-full border border-message-peer-accent/60 bg-card px-1.5 py-0.5 text-[10px] font-semibold whitespace-nowrap text-message-peer-accent tabular-nums shadow-xs transition-opacity`,t.kind===`wait`&&`border-dashed`,o&&`opacity-25`),children:t.kind===`request`?`Req · ${s}`:`Wait · ${s}`},`label:${t.kind}:${t.id}`)})]})}var $r={permission:0,answer:1,respond:2,review:3,failed:4},ei={running:0,waiting:1,queued:2,retained:3},ti=new Set([`queued`,`waiting-for-capacity`]);function ni(e){return e.status===`review`||e.status===`failed`||e.rung===`failed`||G(e.status)&&te(e.rung)}function ri(e){let{task:t}=e,n=t.wait?.kind===`human`?t.wait:void 0;if(n?.detail.reason===`question`)return{...e,kind:`answer`,stateLabel:`Needs answer`,tone:`pending`,blockingReason:n.detail.question??`The agent asked a question and is waiting for your answer.`,ageSince:n.since,actionLabel:`Answer`};if(n?.detail.reason===`budget`){let t=n.detail.queuedMessages;return{...e,kind:`respond`,stateLabel:`Needs you`,tone:`pending`,blockingReason:t?`Automatic wakes used up · ${t} queued ${t===1?`message`:`messages`} waiting.`:`Automatic wakes used up.`,ageSince:n.since,actionLabel:`Respond`}}return{...e,kind:`respond`,stateLabel:`Needs you`,tone:`pending`,blockingReason:`Your turn to reply or finish the task.`,ageSince:n?.since??t.startedAt??t.createdAt,actionLabel:`Respond`}}function ii(e,t){let n={runId:t.runId,projectId:e.projectId,projectName:e.name,task:t},r=t.finishedAt??t.startedAt??t.createdAt;if(t.rung===`needs-permission`){let e=t.wait&&`since`in t.wait?t.wait.since:void 0;return{...n,kind:`permission`,stateLabel:`Needs permission`,tone:`pending`,blockingReason:`Waiting for permission approval before continuing.`,ageSince:e??t.startedAt??t.createdAt,actionLabel:`Open task`}}return t.status===`review`||t.rung===`needs-review`?{...n,kind:`review`,stateLabel:`Needs review`,tone:`info`,blockingReason:`Changes are ready for review before anything lands.`,ageSince:r,actionLabel:`Review`}:t.status===`failed`||t.rung===`failed`?{...n,kind:`failed`,stateLabel:`Failed`,tone:`danger`,blockingReason:t.error??`Task stopped with an error.`,ageSince:r,actionLabel:`Inspect`}:ri(n)}function ai(e){return G(e.status)?e.rung===`running`?`running`:ti.has(e.rung)?`queued`:`waiting`:`retained`}var oi=e=>{if(!e)return 1/0;let t=Date.parse(e);return Number.isNaN(t)?1/0:t};function si(e){let t=[],n=[];for(let r of e)for(let e of r.tasks)ni(e)?t.push(ii(r,e)):n.push({runId:e.runId,projectId:r.projectId,projectName:r.name,task:e,tier:ai(e)});return t.sort((e,t)=>$r[e.kind]-$r[t.kind]||oi(e.ageSince)-oi(t.ageSince)||e.runId.localeCompare(t.runId)),n.sort((e,t)=>ei[e.tier]-ei[t.tier]),{attention:t,working:n}}function ci(e,t){let n=new Map;for(let t of e){let e=n.get(t.projectId);e?e.items.push(t):n.set(t.projectId,{projectId:t.projectId,projectName:t.projectName,items:[t]})}let r=new Map(t.map((e,t)=>[e,t]));return[...n.values()].sort((e,t)=>(r.get(e.projectId)??2**53-1)-(r.get(t.projectId)??2**53-1)||e.projectName.localeCompare(t.projectName))}function li(e,t,n,r){let i=new Map;for(let n of t)n.relationship===`peer`&&n.recipientRunId===e&&i.set(n.senderRunId,X(r,n.senderRunId,n.senderTitle));for(let t of n)t.peerRunId===e&&i.set(t.waiterRunId,X(r,t.waiterRunId));let a=[...i.values()];if(a.length!==0)return a.length===1?`Unblocks ${a[0]}`:a.length===2?`Unblocks ${a[0]} + ${a[1]}`:`Unblocks ${a[0]} + ${a.length-1} more`}function ui(e,t){if(e===void 0)return;let n=t.filter(t=>!e.has(t.runId));if(n.length!==0)return n.length===1?`New item needs your decision: ${n[0].task.title}`:`${n.length} new items need your decision`}var di={permission:`border-l-pending`,answer:`border-l-pending`,respond:`border-l-pending`,review:`border-l-info`,failed:`border-l-danger`},fi=`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`,pi=[],mi=[],hi=new Map;function gi(e,t,n){return n?`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`:`/tasks/${encodeURIComponent(t)}`}function _i({items:e,grouped:t,projectOrder:n,countSuffix:r,renderItems:i}){return t?(0,I.jsx)(`div`,{className:`flex flex-col gap-3`,children:ci(e,n).map(e=>(0,I.jsxs)(`div`,{"data-slot":`activity-project-group`,"data-project":e.projectId,className:`flex flex-col gap-2`,children:[(0,I.jsxs)(`h3`,{className:`flex items-center gap-2 text-[12.5px] font-semibold text-foreground`,children:[(0,I.jsx)(`span`,{children:e.projectName}),(0,I.jsxs)(`span`,{className:`text-[11.5px] font-normal text-muted-foreground tabular-nums`,children:[e.items.length,` `,r]})]}),i(e.items)]},e.projectId))}):(0,I.jsx)(I.Fragment,{children:i(e)})}var vi={permission:`text-foreground`,answer:`text-foreground`,respond:`text-foreground`,review:`text-muted-foreground`,failed:`font-mono text-[12px] text-signal-word-red`};function yi({href:e,title:t,global:n}){let r=`hover:underline focus-visible:outline-2 focus-visible:outline-ring`;return n?(0,I.jsx)(j,{to:e,className:r,children:t}):(0,I.jsx)(N,{to:e,className:r,children:t})}function bi({record:e,href:t,global:n,selected:r,onTriage:i}){return e.kind===`permission`?(0,I.jsx)(M,{asChild:!0,size:`sm`,variant:`primary`,className:`min-h-9 max-md:min-h-11 max-md:flex-1`,children:n?(0,I.jsx)(j,{to:t,children:e.actionLabel}):(0,I.jsx)(N,{to:t,children:e.actionLabel})}):(0,I.jsx)(M,{type:`button`,size:`sm`,variant:e.kind===`answer`||e.kind===`respond`?`primary`:`outline`,"data-slot":`activity-triage-trigger`,"aria-expanded":r,className:`min-h-9 max-md:min-h-11 max-md:flex-1`,onClick:t=>i(e,t.currentTarget),children:e.actionLabel})}function xi({record:e,requests:t,waits:n,index:i,now:a,global:o,selected:c,linked:l,motion:u,onHover:f,onTriage:p}){let m=d().data,{task:h}=e,g=[h.runner?s(m,h.runner):void 0,h.model,h.currentStepId?`step ${h.currentStepId}`:void 0].filter(Boolean).join(` · `),ee=li(e.runId,t,n,i),te=gi(e.projectId,e.runId,o),ne={now:a,titleOf:e=>i.get(e)?.title??`Unreadable task`},re=h.workers.length>0;return(0,I.jsxs)(`article`,{"data-activity-row":e.runId,"data-activity-card":e.runId,"data-slot":`activity-decision`,"data-decision-kind":e.kind,"data-rung":h.rung,"data-selected":c?`true`:void 0,"data-linked":l?`true`:void 0,...er(e.runId,f),className:r(`relative grid min-w-0 grid-cols-1 items-center gap-3 rounded-xl border border-border border-l-[3px] bg-card px-4 py-3 transition-colors md:grid-cols-[minmax(0,1fr)_auto] md:gap-x-4`,di[e.kind],c&&`border-accent-text bg-accent-strong/[0.06]`,l&&`outline-2 outline-offset-1 outline-message-peer-accent`,e.runId in u.entering&&`activity-card-enter`),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsxs)(`span`,{className:r(`inline-flex items-center gap-1.5 text-[12px] font-semibold`,Gt[e.tone]),children:[(0,I.jsx)(J,{run:h,role:`root`}),(0,I.jsx)(`span`,{"data-slot":`activity-verb`,children:e.stateLabel})]}),(0,I.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-semibold text-foreground`,children:(0,I.jsx)(yi,{href:te,title:h.title,global:o})}),(0,I.jsx)(`span`,{"data-slot":`activity-project-badge`,className:`inline-flex shrink-0 items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:e.projectName}),e.ageSince?(0,I.jsx)(`span`,{"data-slot":`activity-age`,title:W(e.ageSince),className:`text-[12px] text-muted-foreground tabular-nums`,children:V(H(e.ageSince,a))}):null]}),(0,I.jsx)(`p`,{"data-slot":`activity-main`,className:r(`line-clamp-3 break-words text-[13px] leading-relaxed`,vi[e.kind]),children:e.blockingReason}),g||ee?(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11.5px] text-muted-foreground`,children:[g?(0,I.jsx)(`span`,{children:g}):null,ee?(0,I.jsxs)(`span`,{"data-slot":`activity-unblocks`,className:`font-medium text-message-peer-accent`,children:[`· `,ee]}):null]}):null,(0,I.jsx)(Kn,{runId:e.runId,requests:t,waits:n,index:i,link:o?j:N,pathOf:t=>o?`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(t)}`:`/tasks/${encodeURIComponent(t)}`,className:`mt-1 flex flex-col gap-0.5 md:hidden`,linkClassName:fi})]}),(0,I.jsx)(`div`,{className:`flex items-center gap-2 max-md:w-full`,children:(0,I.jsx)(bi,{record:e,href:te,global:o,selected:c,onTriage:p})}),re?(0,I.jsx)(`div`,{className:`min-w-0 md:col-span-2`,children:(0,I.jsx)($n,{task:h,requests:t,index:i,ctx:ne,motion:u,projectId:e.projectId,global:o,compact:!0})}):null,(0,I.jsx)(Jn,{texts:Sn(e.runId,t,i,n)})]})}function Si({items:e,requestsByProject:t,waitsByProject:n,indexByProject:r,now:i,global:a,grouped:o,projectOrder:s,selectedRunId:c,linkedIds:l,motion:u=$,onHover:d,onTriage:f}){return e.length===0?null:(0,I.jsxs)(`section`,{"data-slot":`activity-attention`,"aria-label":`Needs your decision`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`,children:`Needs your decision`}),(0,I.jsx)(`span`,{"data-slot":`activity-attention-count`,className:`inline-flex items-center rounded-full bg-inbox-count px-2 py-0.5 text-[11.5px] font-semibold text-inbox-count-foreground tabular-nums`,children:e.length}),(0,I.jsx)(`span`,{className:`ml-auto hidden text-[12px] text-muted-foreground sm:inline`,children:`Resolve inline without leaving the queue`})]}),(0,I.jsx)(_i,{items:e,grouped:o,projectOrder:s,countSuffix:`waiting`,renderItems:e=>(0,I.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:e.map(e=>(0,I.jsx)(xi,{record:e,requests:t.get(e.projectId)??pi,waits:n.get(e.projectId)??mi,index:r.get(e.projectId)??hi,now:i,global:a,selected:c===e.runId,linked:l.has(e.runId),motion:u,onHover:d,onTriage:f},e.runId))})})]})}function Ci(e){return`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.runId)}`}function wi(e){return{...e.id===void 0?{}:{id:e.id},header:e.header,question:e.question,...e.options===void 0?{}:{options:e.options.map(e=>({label:e.label,...e.description===void 0?{}:{description:e.description}}))},...e.multiSelect===void 0?{}:{multiSelect:e.multiSelect},...e.allowFreeText===void 0?{}:{allowFreeText:e.allowFreeText}}}function Ti(e,t){let n=Oe(t);if(!n)return;let r=Ae(n);if(r)return{kind:`ask`,id:r.id,questions:r.questions.map(wi),...r.context===void 0?{}:{context:r.context},resolved:!1,...e.delegation?.role===`worker`?{parentRunId:e.delegation.parentRunId}:{}}}function Ei({run:e,projectId:t,prompt:n,onResolved:r}){let i=Be(e,t),a=xe(e.id,{projectId:t,onSuccess:r}),[o,s]=(0,F.useState)(``),c=async()=>{let e=o.trim();e&&await i.send(e)===void 0&&(s(``),r())};return(0,I.jsxs)(`div`,{"data-slot":`activity-quick-reply`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-3.5`,children:[(0,I.jsx)(`p`,{className:`text-[13px] text-foreground`,children:n}),(0,I.jsx)(Ve,{"aria-label":`Reply to task`,placeholder:`Write your reply…`,rows:3,value:o,disabled:i.isPending||i.blockedBy!==void 0,onChange:e=>s(e.target.value),className:`bg-background text-base md:text-[13px]`}),i.reason?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason}):null,i.error?(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:i.error}):null,(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(M,{type:`button`,size:`sm`,variant:`primary`,className:`min-h-11`,disabled:i.isPending||i.blockedBy!==void 0||o.trim().length===0,onClick:()=>void c(),children:`Send reply`}),e.finishBlocked===null?(0,I.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11`,disabled:a.isPending,onClick:()=>a.mutate(),children:`Finish task`}):null]})]})}function Di({record:e,run:t,onResolved:n}){let r=b({queryKey:[`activity-triage`,`history-context`,e.projectId,e.runId,e.ageSince??``,e.blockingReason],queryFn:({signal:t})=>ne(e.runId,{projectId:e.projectId,signal:t}),staleTime:0,gcTime:0,refetchOnMount:`always`});if(r.isPending)return(0,I.jsx)(`p`,{"data-slot":`triage-loading`,className:`text-xs text-muted-foreground`,children:`Loading question…`});let i=r.data?Ti(t,r.data.contextEvents):void 0;return i?(0,I.jsx)(ye,{ask:i,run:t,projectId:e.projectId,onAnswered:n}):(0,I.jsx)(Ei,{run:t,projectId:e.projectId,prompt:e.blockingReason,onResolved:n})}function Oi({record:e,run:t,onResolved:n}){let r=y(),i=Be(t,e.projectId),[a,s]=(0,F.useState)(``),c=l({mutationFn:()=>C(f(e.runId,{projectId:e.projectId}),!0),onSuccess:()=>{S(`Failed task archived.`),r.invalidateQueries({queryKey:o.runs.all}),n()},onError:e=>S(e.message,{tone:`danger`})}),u=async()=>{let e=a.trim()||`Continue and resolve the failure.`;await i.send(e)===void 0&&(S(`Task resumed.`),n())},d=t.error??e.blockingReason;return(0,I.jsxs)(`div`,{"data-slot":`activity-failed-triage`,className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`rounded-lg border border-danger/40 bg-card-2 p-3.5`,children:[(0,I.jsx)(`p`,{className:`text-xs font-semibold text-signal-word-red`,children:`Failure details`}),(0,I.jsx)(`pre`,{className:`mt-2 overflow-x-auto font-mono text-xs whitespace-pre-wrap text-foreground`,children:d})]}),i.mode===`unavailable`?null:(0,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.jsx)(`label`,{htmlFor:`activity-retry-note`,className:`text-xs font-medium text-foreground`,children:`Retry instruction (optional)`}),(0,I.jsx)(Ve,{id:`activity-retry-note`,rows:2,placeholder:`Leave blank to continue and resolve the failure…`,value:a,disabled:i.isPending||i.blockedBy!==void 0,onChange:e=>s(e.target.value),className:`bg-card text-base md:text-[13px]`}),i.reason?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason}):null,i.error?(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:i.error}):null]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i.mode===`unavailable`?null:(0,I.jsxs)(M,{type:`button`,size:`sm`,variant:`primary`,className:`min-h-11`,disabled:i.isPending||i.blockedBy!==void 0,onClick:()=>void u(),children:[(0,I.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5`}),`Retry task`]}),(0,I.jsxs)(M,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11`,disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,I.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5`}),`Archive`]})]})]})}function ki(e){let{task:t}=e,n=t.workers.map(e=>`${e.runId}:${e.status}`).join(`,`);return`${t.status}|${t.rung}|${t.finishedAt??``}|${t.error??``}|${e.ageSince??``}|${n}`}function Ai({record:e,onResolved:t}){let n=y(),r=u(e.projectId,e.runId,!0,{staleTime:0,refetchOnMount:`always`}),i=ki(e),a=(0,F.useRef)(i);if((0,F.useEffect)(()=>{if(a.current===i)return;a.current=i;let t=!1,r=[e.projectId,`runs`,`detail`,e.runId];return he(n,r),n.cancelQueries({queryKey:r,exact:!0}).then(()=>{t||n.refetchQueries({queryKey:r,exact:!0,type:`active`})}),e.kind===`review`&&n.invalidateQueries({queryKey:[e.projectId,`runs`,`diff`,e.runId],exact:!0}),()=>{t=!0}},[i,n,e.kind,e.projectId,e.runId]),(0,F.useEffect)(()=>{let t=[e.projectId,`runs`,`detail`,e.runId];return re(()=>(he(n,t),n.cancelQueries({queryKey:t,exact:!0}).then(()=>n.refetchQueries({queryKey:t,exact:!0,type:`active`}))))},[n,e.projectId,e.runId]),r.isPending)return(0,I.jsx)(`p`,{"data-slot":`triage-loading`,className:`text-xs text-muted-foreground`,children:`Loading task details…`});if(r.isError||!r.data)return(0,I.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 text-xs text-danger`,children:[(0,I.jsxs)(`p`,{children:[`Could not load task details: `,r.error?.message??`task unavailable`,`.`]}),(0,I.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11 self-start`,onClick:()=>void r.refetch(),children:`Retry`})]});let o=r.data;return e.kind===`answer`?(0,I.jsx)(Di,{record:e,run:o,onResolved:t}):e.kind===`review`?(0,I.jsx)(be,{run:o,projectId:e.projectId,onResolved:t}):e.kind===`failed`?(0,I.jsx)(Oi,{record:e,run:o,onResolved:t}):(0,I.jsx)(Ei,{run:o,projectId:e.projectId,prompt:e.blockingReason,onResolved:t})}function ji({record:e,resolved:t=!1,now:n,onClose:i,onResolved:a,onRestoreFocus:o}){let s=y();return(0,I.jsx)(Fe,{open:e!==null,onOpenChange:e=>{e||i()},children:(0,I.jsx)(Le,{side:`right`,showCloseButton:!1,"data-slot":`activity-triage-drawer`,onCloseAutoFocus:e=>{o&&(e.preventDefault(),o())},className:`flex h-full w-full flex-col gap-0 p-0 sm:max-w-lg`,children:e?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(Pe,{className:`flex-row items-start justify-between gap-3 border-b border-border bg-card px-4 py-3.5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:r(`text-xs font-semibold`,Gt[e.tone]),children:e.stateLabel}),(0,I.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:e.projectName}),e.ageSince?(0,I.jsx)(`span`,{title:W(e.ageSince),className:`text-xs text-muted-foreground tabular-nums`,children:V(H(e.ageSince,n))}):null]}),(0,I.jsx)(Ie,{className:`mt-1 truncate text-[16px] leading-snug`,children:e.task.title}),(0,I.jsxs)(ze,{className:`sr-only`,children:[`Resolve `,e.stateLabel.toLowerCase(),` for `,e.task.title,` without leaving Live Activity.`]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,I.jsx)(M,{asChild:!0,size:`sm`,variant:`ghost`,className:`min-h-11 px-2.5 text-xs`,children:(0,I.jsxs)(j,{to:Ci(e),children:[`Open task`,(0,I.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,I.jsx)(M,{type:`button`,size:`icon`,variant:`ghost`,"aria-label":`Close triage drawer`,className:`size-11`,onClick:i,children:(0,I.jsx)(ge,{"aria-hidden":`true`,className:`size-4`})})]})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:t?(0,I.jsxs)(`div`,{"data-slot":`activity-triage-resolved`,role:`status`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-4 text-[13px] text-muted-foreground`,children:[(0,I.jsx)(`p`,{className:`text-foreground`,children:`This task no longer needs your decision.`}),(0,I.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,className:`min-h-11 self-start`,onClick:i,children:`Close`})]}):(0,I.jsx)(Ai,{record:e,onResolved:()=>{e&&(s.invalidateQueries({queryKey:[`workspace`,`activity`]}),s.invalidateQueries({queryKey:[`activity-triage`,`history-context`,e.projectId,e.runId]}),s.invalidateQueries({queryKey:[e.projectId,`runs`,`detail`,e.runId],exact:!0}),a(e.runId))}},`${e.projectId}:${e.runId}:${e.kind}`)})]}):null})})}function Mi({record:e,requests:t,waits:n,index:i,ctx:a,global:o,linked:s,motion:c,onHover:l}){let{task:u}=e,d=Vt(u,a),f=gi(e.projectId,e.runId,o),p=u.startedAt??d.since??u.createdAt,m=c.slides[u.runId]?.key,h=Fn(c,u.runId);return(0,I.jsxs)(`article`,{"data-activity-row":e.runId,"data-activity-card":e.runId,"data-slot":`activity-working-row`,"data-rung":u.rung,"data-linked":s?`true`:void 0,...er(e.runId,l),className:r(`relative flex min-w-0 flex-col gap-1.5 px-3.5 py-2.5 transition-colors first:rounded-t-xl last:rounded-b-xl`,s&&`bg-message-peer-bg outline-2 outline-offset-1 outline-message-peer-accent`,e.runId in c.entering&&`activity-card-enter`),children:[(0,I.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2.5 gap-y-1 md:grid-cols-[14px_minmax(0,1.25fr)_minmax(0,1.45fr)_auto_auto]`,children:[(0,I.jsx)(J,{run:u,role:`root`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(`h3`,{className:`min-w-0 truncate text-[13px] font-semibold text-foreground`,children:o?(0,I.jsx)(j,{to:f,className:`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:u.title}):(0,I.jsx)(N,{to:f,className:`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:u.title})}),(0,I.jsx)(`span`,{"data-slot":`activity-project-badge`,className:`inline-flex shrink-0 items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:e.projectName}),u.currentStepId?(0,I.jsxs)(`span`,{"data-slot":`activity-step`,className:`hidden shrink-0 text-[11px] text-muted-foreground sm:inline`,children:[`step `,u.currentStepId]}):null]}),(0,I.jsxs)(`div`,{className:`col-span-2 col-start-2 flex min-w-0 items-center gap-2 text-[12px] text-muted-foreground md:col-span-1 md:col-start-3`,children:[(0,I.jsx)(`span`,{"data-slot":`activity-verb`,className:r(`shrink-0 font-semibold`,Gt[d.tone]),children:d.verb}),(0,I.jsx)(`span`,{"data-slot":`activity-main`,className:r(`min-w-0 truncate text-foreground`,d.mono&&`font-mono text-[11.5px]`,m!==void 0&&`activity-slide`),children:d.main},m??`still`),d.checks&&d.checks.length>0?(0,I.jsx)(nn,{checks:d.checks.slice(0,12),passed:h,className:`hidden w-16 shrink-0 items-center gap-[2px] sm:inline-flex`}):null,d.checkSummary?(0,I.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:d.checkSummary}):null]}),(0,I.jsx)(rn,{rate:u.rate,className:`hidden h-3.5 w-[52px] md:block`}),p?(0,I.jsx)(`span`,{"data-slot":`activity-elapsed`,title:W(p),className:`col-start-3 row-start-1 justify-self-end text-[12px] text-muted-foreground tabular-nums md:col-start-5`,children:V(H(p,a.now))}):(0,I.jsx)(`span`,{className:`col-start-3 row-start-1 md:col-start-5`})]}),(0,I.jsx)(Jn,{texts:Sn(e.runId,t,i,n)}),(0,I.jsx)(Kn,{runId:e.runId,requests:t,waits:n,index:i,link:o?j:N,pathOf:t=>gi(e.projectId,t,o),className:`ml-6 flex flex-col gap-0.5 md:hidden`,linkClassName:fi}),(0,I.jsx)($n,{task:e.task,requests:t,index:i,ctx:a,motion:c,projectId:e.projectId,global:o,compact:!0})]})}function Ni({items:e,requestsByProject:t,waitsByProject:n,indexByProject:r,now:i,global:a,grouped:o,projectOrder:s,linkedIds:c,motion:l=$,onHover:u}){return e.length===0?null:(0,I.jsxs)(`section`,{"data-slot":`activity-working`,"aria-label":`Working and active tasks`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`,children:`Working & active`}),(0,I.jsx)(`span`,{"data-slot":`activity-working-count`,className:`inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-[11.5px] font-semibold text-foreground tabular-nums`,children:e.length}),(0,I.jsx)(`span`,{className:`ml-auto hidden text-[12px] text-muted-foreground sm:inline`,children:`Live tool activity, waits, and worker trees`})]}),(0,I.jsx)(_i,{items:e,grouped:o,projectOrder:s,countSuffix:`active`,renderItems:e=>(0,I.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-card`,children:e.map(e=>{let o=r.get(e.projectId)??hi,s={now:i,titleOf:e=>o.get(e)?.title??`Unreadable task`};return(0,I.jsx)(Mi,{record:e,requests:t.get(e.projectId)??pi,waits:n.get(e.projectId)??mi,index:o,ctx:s,global:a,linked:c.has(e.runId),motion:l,onHover:u},e.runId)})})})]})}function Pi(e){let t=new Map;for(let n of e)for(let[e,r]of gn(n))t.set(e,r);return t}function Fi({projects:e,now:t,global:n,grouped:r,projectOrder:i,motion:a=$,feed:o=[],still:s=!1,paused:c=!1,emptyMessage:l}){let[u,d]=F.useState(null),[f,p]=F.useState(null),m=F.useRef(null),[h,g]=F.useState({}),[ee,te]=F.useState(void 0),ne=F.useRef(void 0),re=F.useMemo(()=>Pi(e),[e]),ie=F.useMemo(()=>new Map(e.map(e=>[e.projectId,gn(e)])),[e]),ae=F.useMemo(()=>new Map(e.map(e=>[e.projectId,e.requests])),[e]),_=F.useMemo(()=>new Map(e.map(e=>[e.projectId,Z(e.tasks)])),[e]),{attention:v,working:y}=F.useMemo(()=>si(e),[e]);F.useEffect(()=>{let e=ui(ne.current,v);ne.current=new Set(v.map(e=>e.runId)),e&&te(e)},[v]);let b=F.useMemo(()=>e.flatMap(e=>e.requests),[e]),x=F.useMemo(()=>e.flatMap(e=>Z(e.tasks)),[e]),S=F.useMemo(()=>{let t=[],n=[],r=[];for(let i of e){let e=Z(i.tasks),o=Ur(i,a,e);t.push(...o.requests),n.push(...o.folding),r.push(...Gn(i.projectId,e,a))}return{requests:t,folding:n,waits:r}},[e,a]),oe=F.useMemo(()=>[...b,...S.requests],[b,S.requests]),se=F.useMemo(()=>[...x,...S.waits],[x,S.waits]),C=F.useMemo(()=>new Map([...v.map(e=>[e.runId,e.projectId]),...y.map(e=>[e.runId,e.projectId])]),[v,y]),{edges:ce,gutterWidth:w}=F.useMemo(()=>Jr(oe,se,C,a),[oe,se,C,a]),T=h.pointer??h.focus,le=F.useMemo(()=>{if(!T)return new Set;let e=C.get(T);return e?Yr(T,ae.get(e)??[],_.get(e)??[]):new Set},[T,ae,C,_]),E=F.useCallback((e,t)=>{g(n=>{if(n[e]===t)return n;let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},[]),ue=F.useMemo(()=>f?v.find(e=>e.runId===f.runId&&e.projectId===f.projectId)??null:null,[v,f]),D=ue??f?.snapshot??null,de=f!==null&&ue===null,fe=F.useCallback((e,t)=>{m.current=t,p({projectId:e.projectId,runId:e.runId,snapshot:e})},[]),pe=F.useCallback(()=>{let e=m.current;if(e&&e.isConnected){e.focus({preventScroll:!0});return}(u?.querySelector(`[data-slot="activity-triage-trigger"]`))?.focus({preventScroll:!0})},[u]),O=F.useCallback(()=>p(null),[]),me=F.useCallback(()=>p(null),[]),k=`${r}:${v.map(e=>e.runId).join(`,`)}:${y.map(e=>e.runId).join(`,`)}:${ce.map(e=>e.id).join(`,`)}`,A=v.length===0&&y.length===0;return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,I.jsx)(`p`,{"data-slot":`activity-announcement`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:ee??``}),A&&l?(0,I.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:l}):null,A?null:(0,I.jsxs)(`div`,{ref:d,"data-slot":`activity-stage`,"data-has-arcs":w>0?`true`:void 0,style:w>0?{"--activity-arc-gutter":`${w}px`}:void 0,className:w>0?`relative flex min-w-0 flex-col gap-6 md:pl-(--activity-arc-gutter)`:`relative flex min-w-0 flex-col gap-6`,children:[(0,I.jsx)(Qr,{stage:u,edges:ce,active:T,now:t,layoutKey:k,motion:a,paused:c||s}),(0,I.jsx)(Si,{items:v,requestsByProject:ae,waitsByProject:_,indexByProject:ie,now:t,global:n,grouped:r,projectOrder:i,selectedRunId:D?.runId,linkedIds:le,motion:a,onHover:E,onTriage:fe}),(0,I.jsx)(Ni,{items:y,requestsByProject:ae,waitsByProject:_,indexByProject:ie,now:t,global:n,grouped:r,projectOrder:i,linkedIds:le,motion:a,onHover:E})]}),(0,I.jsx)(Br,{requests:b,closing:S.folding,index:re,now:t,feed:o,motion:a}),(0,I.jsx)(ji,{record:D,resolved:de,now:t,onClose:O,onResolved:me,onRestoreFocus:pe})]})}var Ii=e=>new Map(e.map(e=>[e.runId,e])),Li=e=>e!==void 0&&hn(e)===void 0;function Ri(e,t,n,r){let i=Ii(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&G(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&G(a.status)&&!G(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function zi(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 Bi=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Vi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),Bi(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),Ri(e,t,n,r),zi(e,t,n,r)}function Hi(e,t,n){let r=Ii(e.tasks),i=Ii(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Vi(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 Ui(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}:{}})}}function Wi(e,t,n){let r=Z(e.tasks),i=Z(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Gi=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Ki(e,t,n){let r=jn(e),i=jn(t);for(let e of Gi)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function qi(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);!Li(t)||!Li(e)||(Hi(t,e,r),Ui(t,e,r),Wi(t,e,r))}return Ki(e.projects,t.projects,r),n}function Ji(e){return{input:e,reconcile:!1,seq:0,motion:$,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Yi(e){let{plan:t,...n}=e;return{...n,motion:$,epoch:e.epoch+1}}function Xi(e,t,n){let r=qi(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=Dr(t,n),o=r.flatMap(e=>Mr(e,a,i)??[]),s=e.seq+o.length+1,c=Hn(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?Nr(e.feed,o,i,e.seq+1):e.feed,motion:Wn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Zi(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}:Xi(r,n,t)}function Qi(e,t){let n=e.input;if(t.scope!==n.scope)return{...Ji(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={...Yi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Yi(r)),Zi(r,t.snapshot)}var $i=`(prefers-reduced-motion: reduce)`,ea=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia($i):void 0;function ta(e){let t=ea();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function na(){return ea()?.matches??!1}function ra(){return(0,F.useSyncExternalStore)(ta,na,()=>!1)}function ia(e,t){let n=F.useRef(new Set);F.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),F.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:Wn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function aa(e,t){let n=ra(),r=ae(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=F.useState(()=>Ji(i)),s=Qi(a,i);return s!==a&&o(s),ia(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function oa(e,t){let n=Re(1e3),[r,i]=F.useState({offset:0}),a=r.offset;return ct(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{J as A,gn as C,mn as D,fn as E,W as F,H as I,V as L,G as M,Vt as N,dn as O,B as P,pt as R,hn as S,ln as T,$ as _,Er as a,X as b,Tr as c,gr as d,ir as f,Kn as g,er as h,Hr as i,Kt as j,rn as k,Cr as l,Jn as m,aa as n,Sr as o,tr as p,Fi as r,wr as s,oa as t,vr as u,Gn as v,jn as w,Z as x,Sn as y};
|
|
@@ -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{c as r}from"./utils-DSMR_WLb.js";import{D as i,E as a,O as o,R as s,S as c,T as l,n as u,r as d,t as f,w as p}from"./activity-motion-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{D as i,E as a,O as o,R as s,S as c,T as l,n as u,r as d,t as f,w as p}from"./activity-motion-DKQsSiK6.js";import{t as m}from"./button-B7MKxYjT.js";import{s as h}from"./project-router-B8blqSVo.js";import{d as g,i as _,n as v,t as y}from"./page-shell-7pLJMOgh.js";import{at as b}from"./index-V7mPM8_i.js";var x=e(t(),1),S=n();function C(){let e=r(),t=s({kind:`project`,projectId:e}),n=h(),[C,w]=x.useState(!1),T=f(t.data?.generatedAt,t.dataUpdatedAt),{motion:E,feed:D,reduced:O,paused:k}=u(t.data,e),A=t.data?.projects[0];if(t.isPending)return(0,S.jsx)(b,{});let j=A?c(A):void 0;return A?(0,S.jsxs)(_,{route:`activity`,density:g(A.tasks.length),headerSpacing:`compact`,rootProps:{"data-activity-paused":k?`true`:void 0},bodyClassName:`gap-3.5`,header:o({name:A.name,now:T,updatedAt:t.data?.generatedAt,stale:t.isError,scopeSwitch:(0,S.jsx)(l,{scope:`project`,projectId:n??A.projectId,projectName:A.name,grouped:C,onToggleGroup:()=>w(e=>!e)})}),sparseFooter:!j&&A.tasks.length>0?(0,S.jsx)(v,{summary:`${A.tasks.length} active ${A.tasks.length===1?`task`:`tasks`} in ${A.name}. Start more work in parallel or inspect all tasks.`,actions:(0,S.jsx)(a,{})}):void 0,children:[(0,S.jsx)(i,{summary:p([A]),tasksTo:`/`,bumps:E.bumps}),j?(0,S.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:j}):A.tasks.length===0&&A.requests.length===0&&D.length===0?(0,S.jsx)(y,{slot:`activity-empty`,title:`No active work in this project.`,description:`Tasks waiting for your decision or actively running will appear here live.`,actions:(0,S.jsx)(a,{primary:!0})}):(0,S.jsx)(d,{projects:[A],now:T,global:!1,grouped:C,projectOrder:[A.projectId],motion:E,feed:D,still:O,paused:k,emptyMessage:`No active work in this project.`})]}):(0,S.jsx)(_,{route:`activity`,density:`empty`,header:o({name:n??`project`,scopeSwitch:(0,S.jsx)(l,{scope:`project`,projectId:n})}),children:(0,S.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,S.jsx)(m,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})})}export{C as ProjectActivityRoute};
|