@hearsay-tools/squawk 0.19.0-pr4422.8653.2 → 0.19.0-pr4422.8708
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/automations/tools.d.ts +8 -8
- package/dist/contract/index.js +55 -14
- package/dist/contract/runs.d.ts +50 -0
- package/dist/contract/workspace-events.d.ts +18 -0
- package/dist/delegation/routes.d.ts +65 -65
- package/dist/delegation/transport.d.ts +14 -14
- package/dist/preview/chromium.d.ts +3 -2
- package/dist/preview/chromium.js +5 -1
- package/dist/preview/chromium.js.map +1 -1
- package/dist/runs/run-database.d.ts +5 -0
- package/dist/runs/run-database.js +5 -0
- package/dist/runs/run-database.js.map +1 -1
- package/dist/runs/run-queries.d.ts +9 -0
- package/dist/runs/run-queries.js +43 -6
- package/dist/runs/run-queries.js.map +1 -1
- package/dist/runs/store.js +1 -0
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/transcript-facts-queue.d.ts +9 -1
- package/dist/runs/transcript-facts-queue.js +43 -10
- package/dist/runs/transcript-facts-queue.js.map +1 -1
- package/dist/runs/transcript-facts-sidecar.d.ts +22 -0
- package/dist/runs/transcript-facts-sidecar.js +58 -0
- package/dist/runs/transcript-facts-sidecar.js.map +1 -0
- package/dist/runs/transcript-facts-topic.d.ts +2 -0
- package/dist/runs/transcript-facts-topic.js +8 -10
- package/dist/runs/transcript-facts-topic.js.map +1 -1
- package/dist/runs/transcript-facts-worker.d.ts +7 -2
- package/dist/runs/transcript-facts-worker.js +8 -5
- package/dist/runs/transcript-facts-worker.js.map +1 -1
- package/dist/runs/transcript-facts.d.ts +4 -0
- package/dist/runs/transcript-facts.js +36 -16
- package/dist/runs/transcript-facts.js.map +1 -1
- package/dist/server/automations-routes.d.ts +150 -150
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +8 -0
- package/dist/server/server.d.ts +88 -64
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server/workspace-routes.d.ts +8 -0
- package/package.json +4 -4
- package/scripts/measure-transcript-facts-health.mjs +10 -5
- package/scripts/measure-transcript-facts-lag.mjs +11 -2
- package/scripts/mock-ci-tool.mjs +4 -5
- package/scripts/transcript-facts-timing.mjs +10 -0
- package/web/dist/assets/{accounts-section-D1zUOGzb.js → accounts-section-De2qXAo-.js} +1 -1
- package/web/dist/assets/activity-motion-EJBR3wlq.js +1 -0
- package/web/dist/assets/{activity-route-fRsdRyzI.js → activity-route-6cQ_MX2v.js} +1 -1
- package/web/dist/assets/{agent-config-section-BoeuyX6v.js → agent-config-section-DFP2-YWs.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-DzqMFFPr.js → agent-defaults-section-D88m66PJ.js} +1 -1
- package/web/dist/assets/{appearance-Dmvj5Y_w.js → appearance-BwV8iZFM.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-CRGCTE05.js → archive-on-merge-field-BzFhSzxv.js} +1 -1
- package/web/dist/assets/attention--Y0CyzCN.js +1 -0
- package/web/dist/assets/{automations-route-Htjf-5la.js → automations-route-Cuz2CxlC.js} +2 -2
- package/web/dist/assets/commit-list-D8yY5bIe.js +1 -0
- package/web/dist/assets/diff-BBr7hIpt.js +3 -0
- package/web/dist/assets/{diff-controls-Sp_ZhYsW.js → diff-controls-PEQLG-Zu.js} +1 -1
- package/web/dist/assets/diff-stat-U7DT4Ilj.js +1 -0
- package/web/dist/assets/{diff-view-DAuFvkVe.js → diff-view-Dma7qveY.js} +1 -1
- package/web/dist/assets/{file-preview-DmtWCxjd.js → file-preview-DXB5mwQq.js} +1 -1
- package/web/dist/assets/{folder-browser-D_V807qp.js → folder-browser-CF2Sk1aR.js} +1 -1
- package/web/dist/assets/git-toolbar-dRjJ3sJQ.js +1 -0
- package/web/dist/assets/github-CLbTpdZ7.js +1 -0
- package/web/dist/assets/{global-activity-route-VN9AtX9z.js → global-activity-route-BXwZUqR8.js} +2 -2
- package/web/dist/assets/image-preview-2S3PEy8S.js +1 -0
- package/web/dist/assets/index-1TLdjVro.css +1 -0
- package/web/dist/assets/index-7Rg7tdSP.js +21 -0
- package/web/dist/assets/{label-C6BpWk0J.js → label-Bgcri58t.js} +1 -1
- package/web/dist/assets/{markdown-BNgZx1Qw.js → markdown-gNAPnLDC.js} +1 -1
- package/web/dist/assets/{notifications-section-vwz3Ac0V.js → notifications-section-CnjarooH.js} +1 -1
- package/web/dist/assets/{open-in-menu-BkmmqWdB.js → open-in-menu-Qylys2X_.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BuFRiE_Q.js → preview-pane-connected-CimzK7Qz.js} +2 -2
- package/web/dist/assets/{project-location-Z28U6-d1.js → project-location-n15GhUq1.js} +1 -1
- package/web/dist/assets/{project-router-B8blqSVo.js → project-router-CT6gVIcC.js} +1 -1
- package/web/dist/assets/{projects-section-BsbHgKBU.js → projects-section-DiaRaoyV.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-BMON7HON.js → prompt-templates-section-5UJStA2u.js} +1 -1
- package/web/dist/assets/{queries-BwJVP1so.js → queries-BddxDJyD.js} +1 -1
- package/web/dist/assets/{reference-chip-uLQTF-sm.js → reference-chip-BGFxuvs6.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-By8FlGex.js → remote-settings-notice-ihbrhzlZ.js} +1 -1
- package/web/dist/assets/repo-git-DaKHEjDf.js +1 -0
- package/web/dist/assets/{report-reader-COxakC1t.js → report-reader-8B7MnBnV.js} +1 -1
- package/web/dist/assets/{report-selection-DBM7S3ha.js → report-selection-BwiY8hK3.js} +1 -1
- package/web/dist/assets/{reports-Jh4Gofdq.js → reports-BeOzwtBO.js} +1 -1
- package/web/dist/assets/{resources-section-Vmy2Idkz.js → resources-section-D2tex4pF.js} +1 -1
- package/web/dist/assets/review-panel-YwUoKsbu.js +8 -0
- package/web/dist/assets/{run-detail-refresh-YR2-iM4z.js → run-detail-refresh-C8P2J7Wq.js} +1 -1
- package/web/dist/assets/{run-header-D6yMABMw.js → run-header-CkhPOV1B.js} +2 -2
- package/web/dist/assets/{select-DN6L68mS.js → select-BXpAjbYk.js} +1 -1
- package/web/dist/assets/{session-context-section-D9VJDjIN.js → session-context-section-DkhGlKdR.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-DunygjC_.js → settings-agent-picker-3cUJmNQz.js} +1 -1
- package/web/dist/assets/{settings-shell--IqqKF7N.js → settings-shell-D--QpDPG.js} +1 -1
- package/web/dist/assets/{sidebar-section-BqbMPhmc.js → sidebar-section-BydWRh8S.js} +1 -1
- package/web/dist/assets/{skills-Br7KtvAE.js → skills-CbEyPyvn.js} +1 -1
- package/web/dist/assets/{tab-link-BkHBgpdC.js → tab-link-DE6t7XkG.js} +1 -1
- package/web/dist/assets/task-changes-BXDJmZkO.js +1 -0
- package/web/dist/assets/task-commits-B4uUhWjt.js +1 -0
- package/web/dist/assets/{task-files-SpH-60SN.js → task-files-vOSCBpIt.js} +1 -1
- package/web/dist/assets/{task-github-item-Y3iJL8ft.js → task-github-item-BIaOF-Ea.js} +1 -1
- package/web/dist/assets/{task-groups-BSovus2j.js → task-groups-CHHLB77I.js} +1 -1
- package/web/dist/assets/task-thread-MKnHdrU1.js +2 -0
- package/web/dist/assets/{tasks-table-C-wxALy6.js → tasks-table-5GNEZlxs.js} +1 -1
- package/web/dist/assets/{thread-state-DeoWu7Kt.js → thread-state-BtUboBbd.js} +1 -1
- package/web/dist/assets/{toaster-UvSCLhYx.js → toaster-C-xqAWVX.js} +2 -2
- package/web/dist/assets/use-hand-to-agent-state-BwQ45AKw.js +1 -0
- package/web/dist/assets/{workflows-Cnapwpgb.js → workflows-DUoxhR8h.js} +3 -3
- package/web/dist/assets/{workspace-tools-DqQBPMHi.js → workspace-tools-dwQmpL6C.js} +1 -1
- package/web/dist/assets/{worktrees-section-C4ivelpI.js → worktrees-section-B9LR3yvO.js} +1 -1
- package/web/dist/index.html +16 -15
- package/web/dist/assets/activity-motion-DKQsSiK6.js +0 -1
- package/web/dist/assets/attention-CXG_AzDe.js +0 -1
- package/web/dist/assets/commit-list-ZFFnxm_Y.js +0 -1
- package/web/dist/assets/diff-hOrgpufS.js +0 -3
- package/web/dist/assets/git-toolbar-DAYZlAtW.js +0 -1
- package/web/dist/assets/github-iwGsnQ9e.js +0 -1
- package/web/dist/assets/image-preview-Blq5ega2.js +0 -1
- package/web/dist/assets/index-Cg3OtikX.css +0 -1
- package/web/dist/assets/index-V7mPM8_i.js +0 -21
- package/web/dist/assets/repo-git-BA5-AI3D.js +0 -1
- package/web/dist/assets/review-panel-CMgEoI0r.js +0 -8
- package/web/dist/assets/task-changes-DBeE9e44.js +0 -1
- package/web/dist/assets/task-commits-BlCpSQlf.js +0 -1
- package/web/dist/assets/task-thread-BwRa4jlG.js +0 -2
- package/web/dist/assets/use-hand-to-agent-state-DTcb7MfW.js +0 -1
package/dist/server/server.d.ts
CHANGED
|
@@ -779,6 +779,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
779
779
|
currentStepId?: string | undefined;
|
|
780
780
|
currentStepBackend?: string | undefined;
|
|
781
781
|
error?: string | undefined;
|
|
782
|
+
statePreview?: {
|
|
783
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
784
|
+
text: string;
|
|
785
|
+
} | undefined;
|
|
782
786
|
worktreePath?: string | undefined;
|
|
783
787
|
projectId: string;
|
|
784
788
|
}[];
|
|
@@ -943,6 +947,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
943
947
|
currentStepId?: string | undefined;
|
|
944
948
|
currentStepBackend?: string | undefined;
|
|
945
949
|
error?: string | undefined;
|
|
950
|
+
statePreview?: {
|
|
951
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
952
|
+
text: string;
|
|
953
|
+
} | undefined;
|
|
946
954
|
worktreePath?: string | undefined;
|
|
947
955
|
projectId: string;
|
|
948
956
|
}[];
|
|
@@ -3069,12 +3077,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
3069
3077
|
output: {
|
|
3070
3078
|
generation: string;
|
|
3071
3079
|
results: ({
|
|
3072
|
-
projectId: string;
|
|
3073
|
-
runId: string;
|
|
3074
|
-
type: "error" | "reset";
|
|
3075
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
3076
|
-
error: string;
|
|
3077
|
-
} | {
|
|
3078
3080
|
projectId: string;
|
|
3079
3081
|
runId: string;
|
|
3080
3082
|
type: "batch";
|
|
@@ -3095,6 +3097,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
3095
3097
|
cursor: string;
|
|
3096
3098
|
afterSeq: number;
|
|
3097
3099
|
hasMore: boolean;
|
|
3100
|
+
} | {
|
|
3101
|
+
projectId: string;
|
|
3102
|
+
runId: string;
|
|
3103
|
+
type: "error" | "reset";
|
|
3104
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
3105
|
+
error: string;
|
|
3098
3106
|
})[];
|
|
3099
3107
|
};
|
|
3100
3108
|
outputFormat: "json";
|
|
@@ -4724,6 +4732,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4724
4732
|
} & {
|
|
4725
4733
|
"/repo/commit/:sha": {
|
|
4726
4734
|
$get: {
|
|
4735
|
+
output: string;
|
|
4736
|
+
outputFormat: "text";
|
|
4737
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4738
|
+
input: {
|
|
4739
|
+
query: {
|
|
4740
|
+
structured?: string | undefined;
|
|
4741
|
+
};
|
|
4742
|
+
} & {
|
|
4743
|
+
param: {
|
|
4744
|
+
sha: string;
|
|
4745
|
+
};
|
|
4746
|
+
};
|
|
4747
|
+
} | {
|
|
4727
4748
|
output: {
|
|
4728
4749
|
error: string;
|
|
4729
4750
|
code?: "invalid_input" | undefined;
|
|
@@ -4787,19 +4808,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4787
4808
|
sha: string;
|
|
4788
4809
|
};
|
|
4789
4810
|
};
|
|
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
4811
|
};
|
|
4804
4812
|
};
|
|
4805
4813
|
} & {
|
|
@@ -8330,6 +8338,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
8330
8338
|
currentStepId?: string | undefined;
|
|
8331
8339
|
currentStepBackend?: string | undefined;
|
|
8332
8340
|
error?: string | undefined;
|
|
8341
|
+
statePreview?: {
|
|
8342
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
8343
|
+
text: string;
|
|
8344
|
+
} | undefined;
|
|
8333
8345
|
worktreePath?: string | undefined;
|
|
8334
8346
|
}[];
|
|
8335
8347
|
outputFormat: "json";
|
|
@@ -8508,6 +8520,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
8508
8520
|
currentStepId?: string | undefined;
|
|
8509
8521
|
currentStepBackend?: string | undefined;
|
|
8510
8522
|
error?: string | undefined;
|
|
8523
|
+
statePreview?: {
|
|
8524
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
8525
|
+
text: string;
|
|
8526
|
+
} | undefined;
|
|
8511
8527
|
worktreePath?: string | undefined;
|
|
8512
8528
|
}[];
|
|
8513
8529
|
nextCursor: string | null;
|
|
@@ -19294,20 +19310,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19294
19310
|
} & {
|
|
19295
19311
|
"/runs/:id/handoff": {
|
|
19296
19312
|
$get: {
|
|
19297
|
-
output:
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
outputFormat: "json";
|
|
19301
|
-
status: 404;
|
|
19313
|
+
output: string;
|
|
19314
|
+
outputFormat: "text";
|
|
19315
|
+
status: 200;
|
|
19302
19316
|
input: {
|
|
19303
19317
|
param: {
|
|
19304
19318
|
id: string;
|
|
19305
19319
|
};
|
|
19306
19320
|
};
|
|
19307
19321
|
} | {
|
|
19308
|
-
output:
|
|
19309
|
-
|
|
19310
|
-
|
|
19322
|
+
output: {
|
|
19323
|
+
error: string;
|
|
19324
|
+
};
|
|
19325
|
+
outputFormat: "json";
|
|
19326
|
+
status: 404;
|
|
19311
19327
|
input: {
|
|
19312
19328
|
param: {
|
|
19313
19329
|
id: string;
|
|
@@ -19345,20 +19361,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19345
19361
|
} & {
|
|
19346
19362
|
"/runs/:id/diff": {
|
|
19347
19363
|
$get: {
|
|
19348
|
-
output:
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
outputFormat: "json";
|
|
19352
|
-
status: 404 | 409;
|
|
19364
|
+
output: string;
|
|
19365
|
+
outputFormat: "text";
|
|
19366
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
19353
19367
|
input: {
|
|
19354
19368
|
param: {
|
|
19355
19369
|
id: string;
|
|
19356
19370
|
};
|
|
19357
19371
|
};
|
|
19358
19372
|
} | {
|
|
19359
|
-
output:
|
|
19360
|
-
|
|
19361
|
-
|
|
19373
|
+
output: {
|
|
19374
|
+
error: string;
|
|
19375
|
+
};
|
|
19376
|
+
outputFormat: "json";
|
|
19377
|
+
status: 404 | 409;
|
|
19362
19378
|
input: {
|
|
19363
19379
|
param: {
|
|
19364
19380
|
id: string;
|
|
@@ -21493,6 +21509,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21493
21509
|
} & {
|
|
21494
21510
|
"/repo/commit/:sha": {
|
|
21495
21511
|
$get: {
|
|
21512
|
+
output: string;
|
|
21513
|
+
outputFormat: "text";
|
|
21514
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
21515
|
+
input: {
|
|
21516
|
+
query: {
|
|
21517
|
+
structured?: string | undefined;
|
|
21518
|
+
};
|
|
21519
|
+
} & {
|
|
21520
|
+
param: {
|
|
21521
|
+
sha: string;
|
|
21522
|
+
};
|
|
21523
|
+
};
|
|
21524
|
+
} | {
|
|
21496
21525
|
output: {
|
|
21497
21526
|
error: string;
|
|
21498
21527
|
code?: "invalid_input" | undefined;
|
|
@@ -21556,19 +21585,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
21556
21585
|
sha: string;
|
|
21557
21586
|
};
|
|
21558
21587
|
};
|
|
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
21588
|
};
|
|
21573
21589
|
};
|
|
21574
21590
|
} & {
|
|
@@ -25099,6 +25115,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
25099
25115
|
currentStepId?: string | undefined;
|
|
25100
25116
|
currentStepBackend?: string | undefined;
|
|
25101
25117
|
error?: string | undefined;
|
|
25118
|
+
statePreview?: {
|
|
25119
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
25120
|
+
text: string;
|
|
25121
|
+
} | undefined;
|
|
25102
25122
|
worktreePath?: string | undefined;
|
|
25103
25123
|
}[];
|
|
25104
25124
|
outputFormat: "json";
|
|
@@ -25277,6 +25297,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
25277
25297
|
currentStepId?: string | undefined;
|
|
25278
25298
|
currentStepBackend?: string | undefined;
|
|
25279
25299
|
error?: string | undefined;
|
|
25300
|
+
statePreview?: {
|
|
25301
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
25302
|
+
text: string;
|
|
25303
|
+
} | undefined;
|
|
25280
25304
|
worktreePath?: string | undefined;
|
|
25281
25305
|
}[];
|
|
25282
25306
|
nextCursor: string | null;
|
|
@@ -36063,20 +36087,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36063
36087
|
} & {
|
|
36064
36088
|
"/runs/:id/handoff": {
|
|
36065
36089
|
$get: {
|
|
36066
|
-
output:
|
|
36067
|
-
|
|
36068
|
-
|
|
36069
|
-
outputFormat: "json";
|
|
36070
|
-
status: 404;
|
|
36090
|
+
output: string;
|
|
36091
|
+
outputFormat: "text";
|
|
36092
|
+
status: 200;
|
|
36071
36093
|
input: {
|
|
36072
36094
|
param: {
|
|
36073
36095
|
id: string;
|
|
36074
36096
|
};
|
|
36075
36097
|
};
|
|
36076
36098
|
} | {
|
|
36077
|
-
output:
|
|
36078
|
-
|
|
36079
|
-
|
|
36099
|
+
output: {
|
|
36100
|
+
error: string;
|
|
36101
|
+
};
|
|
36102
|
+
outputFormat: "json";
|
|
36103
|
+
status: 404;
|
|
36080
36104
|
input: {
|
|
36081
36105
|
param: {
|
|
36082
36106
|
id: string;
|
|
@@ -36114,20 +36138,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36114
36138
|
} & {
|
|
36115
36139
|
"/runs/:id/diff": {
|
|
36116
36140
|
$get: {
|
|
36117
|
-
output:
|
|
36118
|
-
|
|
36119
|
-
|
|
36120
|
-
outputFormat: "json";
|
|
36121
|
-
status: 404 | 409;
|
|
36141
|
+
output: string;
|
|
36142
|
+
outputFormat: "text";
|
|
36143
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
36122
36144
|
input: {
|
|
36123
36145
|
param: {
|
|
36124
36146
|
id: string;
|
|
36125
36147
|
};
|
|
36126
36148
|
};
|
|
36127
36149
|
} | {
|
|
36128
|
-
output:
|
|
36129
|
-
|
|
36130
|
-
|
|
36150
|
+
output: {
|
|
36151
|
+
error: string;
|
|
36152
|
+
};
|
|
36153
|
+
outputFormat: "json";
|
|
36154
|
+
status: 404 | 409;
|
|
36131
36155
|
input: {
|
|
36132
36156
|
param: {
|
|
36133
36157
|
id: string;
|
|
@@ -7,12 +7,6 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
|
|
|
7
7
|
output: {
|
|
8
8
|
generation: string;
|
|
9
9
|
results: ({
|
|
10
|
-
projectId: string;
|
|
11
|
-
runId: string;
|
|
12
|
-
type: "error" | "reset";
|
|
13
|
-
status: 400 | 404 | 409 | 413 | 503;
|
|
14
|
-
error: string;
|
|
15
|
-
} | {
|
|
16
10
|
projectId: string;
|
|
17
11
|
runId: string;
|
|
18
12
|
type: "batch";
|
|
@@ -33,6 +27,12 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
|
|
|
33
27
|
cursor: string;
|
|
34
28
|
afterSeq: number;
|
|
35
29
|
hasMore: boolean;
|
|
30
|
+
} | {
|
|
31
|
+
projectId: string;
|
|
32
|
+
runId: string;
|
|
33
|
+
type: "error" | "reset";
|
|
34
|
+
status: 400 | 404 | 409 | 413 | 503;
|
|
35
|
+
error: string;
|
|
36
36
|
})[];
|
|
37
37
|
};
|
|
38
38
|
outputFormat: "json";
|
|
@@ -531,6 +531,10 @@ export declare function createRunsIndexRoutes(deps: RunsIndexRouteDeps): import(
|
|
|
531
531
|
currentStepId?: string | undefined;
|
|
532
532
|
currentStepBackend?: string | undefined;
|
|
533
533
|
error?: string | undefined;
|
|
534
|
+
statePreview?: {
|
|
535
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
536
|
+
text: string;
|
|
537
|
+
} | undefined;
|
|
534
538
|
worktreePath?: string | undefined;
|
|
535
539
|
projectId: string;
|
|
536
540
|
}[];
|
|
@@ -695,6 +699,10 @@ export declare function createRunsIndexRoutes(deps: RunsIndexRouteDeps): import(
|
|
|
695
699
|
currentStepId?: string | undefined;
|
|
696
700
|
currentStepBackend?: string | undefined;
|
|
697
701
|
error?: string | undefined;
|
|
702
|
+
statePreview?: {
|
|
703
|
+
kind: "ask" | "error" | "permission" | "review";
|
|
704
|
+
text: string;
|
|
705
|
+
} | undefined;
|
|
698
706
|
worktreePath?: string | undefined;
|
|
699
707
|
projectId: string;
|
|
700
708
|
}[];
|
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.8708",
|
|
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.8708",
|
|
73
|
+
"@open-mercato/cezar-contract": "0.19.0-pr4422.8708",
|
|
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": "5c0931a13f30f3d8226085aca472a58d905c92e0"
|
|
91
91
|
}
|
|
@@ -9,9 +9,10 @@ import { tmpdir } from 'node:os';
|
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
11
11
|
import { PerformanceObserver } from 'node:perf_hooks';
|
|
12
|
-
import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming, hookCalls, callsWithin, startThreadWatch, summarizeWaits } from './transcript-facts-timing.mjs';
|
|
12
|
+
import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming, hookCalls, callsWithin, startThreadWatch, summarizeWaits, attachWaitsOverBudget } from './transcript-facts-timing.mjs';
|
|
13
13
|
import { seedColdHistories, verifyFacts } from './transcript-facts-fixture.mjs';
|
|
14
14
|
|
|
15
|
+
const BUDGET_MS = 50;
|
|
15
16
|
const root = mkdtempSync(join(process.platform === 'win32' ? tmpdir() : '/tmp', 'cez-facts-health-'));
|
|
16
17
|
// The experiment has no external peers, credentials, background updater, or real home.
|
|
17
18
|
for (const key of Object.keys(process.env)) if (/^(CEZ|HSQ)_/.test(key)) delete process.env[key];
|
|
@@ -96,6 +97,8 @@ try {
|
|
|
96
97
|
gcObserver = new PerformanceObserver(list => { for (const entry of list.getEntries()) gcPauses.push(entry); });
|
|
97
98
|
gcObserver.observe({ entryTypes: ['gc'] });
|
|
98
99
|
threadWatch = await startThreadWatch();
|
|
100
|
+
// Watch every sample: any one over the budget names what the main thread waited in.
|
|
101
|
+
threadWatch?.watch(true);
|
|
99
102
|
const start = performance.now();
|
|
100
103
|
let end;
|
|
101
104
|
let warming;
|
|
@@ -108,7 +111,6 @@ try {
|
|
|
108
111
|
const measurementStart = pauseStart ?? timingSnapshot();
|
|
109
112
|
const plannedMs = pauseStart ? pauseMs : 0;
|
|
110
113
|
const requestStart = performance.now();
|
|
111
|
-
if (!store) threadWatch?.watch(true);
|
|
112
114
|
const pendingResponse = fetch(endpoint, { signal: AbortSignal.timeout(2_000) });
|
|
113
115
|
// The first request includes synchronous project-open work too.
|
|
114
116
|
if (!store) {
|
|
@@ -121,19 +123,22 @@ try {
|
|
|
121
123
|
const requestEnd = performance.now();
|
|
122
124
|
// Include EVERY request begun while cold warm-up was active, even one ending after it.
|
|
123
125
|
const measurement = timingDelta(measurementStart, timingSnapshot());
|
|
124
|
-
threadWatch?.watch(false);
|
|
125
126
|
samples.push({ fromMs: measurementStart.at - start, startMs: requestStart - start, endMs: requestEnd - start,
|
|
126
127
|
latencyMs: requestEnd - requestStart, plannedMs, ...measurement, ...blockingBudget(measurement) });
|
|
127
128
|
if (end !== undefined) break;
|
|
128
129
|
pauseStart = timingSnapshot();
|
|
129
130
|
await delay(pauseMs);
|
|
130
131
|
}
|
|
132
|
+
threadWatch?.watch(false);
|
|
131
133
|
await warming;
|
|
132
134
|
unhookCalls();
|
|
133
|
-
const
|
|
135
|
+
const waits = (await threadWatch?.stop()) ?? [];
|
|
134
136
|
threadWatch = undefined;
|
|
137
|
+
const firstFrom = start + samples[0].fromMs;
|
|
138
|
+
const firstSampleWaits = waits.filter(entry => entry.at >= firstFrom && entry.at < firstFrom + samples[0].elapsedMs);
|
|
135
139
|
for (const entry of gcObserver.takeRecords()) gcPauses.push(entry);
|
|
136
140
|
gcObserver.disconnect();
|
|
141
|
+
attachWaitsOverBudget(samples, waits, BUDGET_MS, sample => [start + sample.fromMs, start + sample.fromMs + sample.elapsedMs]);
|
|
137
142
|
for (const sample of samples) {
|
|
138
143
|
const from = start + sample.fromMs;
|
|
139
144
|
const to = from + sample.elapsedMs;
|
|
@@ -161,7 +166,7 @@ try {
|
|
|
161
166
|
console.log(JSON.stringify(result));
|
|
162
167
|
// Exclude run-queue delay and loop idle time: a response that waits on the thread pool, a worker
|
|
163
168
|
// or the kernel is latency (kept in maxLatencyMs), not main-thread blocking. Synchronous work counts.
|
|
164
|
-
assert.ok(result.maxBlockingMs <
|
|
169
|
+
assert.ok(result.maxBlockingMs < BUDGET_MS, `max health blocking ${result.maxBlockingMs.toFixed(3)}ms must be <${BUDGET_MS}ms`);
|
|
165
170
|
} finally {
|
|
166
171
|
clearTimeout(watchdog);
|
|
167
172
|
unhookCalls?.();
|
|
@@ -10,7 +10,7 @@ import { tmpdir } from 'node:os';
|
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { pathToFileURL } from 'node:url';
|
|
12
12
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
13
|
-
import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming } from './transcript-facts-timing.mjs';
|
|
13
|
+
import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming, startThreadWatch, attachWaitsOverBudget } from './transcript-facts-timing.mjs';
|
|
14
14
|
import { seedColdHistories, verifyFacts } from './transcript-facts-fixture.mjs';
|
|
15
15
|
|
|
16
16
|
const runtime = { url: process.argv[2] ? pathToFileURL(process.argv[2] + '/') : new URL('../src/', import.meta.url), ext: process.argv[3] ?? (process.argv[2] ? 'js' : 'ts') };
|
|
@@ -20,10 +20,15 @@ const timedOpen = await prepareOpenTiming(runtime);
|
|
|
20
20
|
let openTiming;
|
|
21
21
|
let store;
|
|
22
22
|
let timer;
|
|
23
|
+
let threadWatch;
|
|
24
|
+
const BUDGET_MS = 20;
|
|
23
25
|
try {
|
|
24
26
|
const fixtures = await seedColdHistories(dir, runtime);
|
|
25
27
|
// Fixture allocation/collection belongs to setup, not the measured warm path.
|
|
26
28
|
global.gc?.();
|
|
29
|
+
// Watch every tick: any one over the budget names what the main thread waited in.
|
|
30
|
+
threadWatch = await startThreadWatch();
|
|
31
|
+
threadWatch?.watch(true);
|
|
27
32
|
const periodMs = 20;
|
|
28
33
|
const ticks = [];
|
|
29
34
|
let previous = timingSnapshot();
|
|
@@ -41,6 +46,9 @@ try {
|
|
|
41
46
|
const end = performance.now();
|
|
42
47
|
while (!ticks.some(tick => tick.at > end)) await delay(periodMs);
|
|
43
48
|
clearInterval(timer);
|
|
49
|
+
threadWatch?.watch(false);
|
|
50
|
+
attachWaitsOverBudget(ticks, (await threadWatch?.stop()) ?? [], BUDGET_MS, tick => [tick.at - tick.elapsedMs, tick.at]);
|
|
51
|
+
threadWatch = undefined;
|
|
44
52
|
const overlapping = ticks.filter(tick => tick.at >= start && tick.at <= end);
|
|
45
53
|
// Keep first-open and repeated-open costs separate. Reopening must not rescan clean history.
|
|
46
54
|
const reopenTimings = Array.from({ length: 3 }, () => {
|
|
@@ -70,9 +78,10 @@ try {
|
|
|
70
78
|
assert.ok(overlapping.length > 0, 'must sample during cold warm-up');
|
|
71
79
|
assert.ok(result.durationMs > 0);
|
|
72
80
|
// Exclude loop idle time (the planned timer sleep) and run-queue delay, but retain synchronous blocking.
|
|
73
|
-
assert.ok(result.maxBlockingMs <
|
|
81
|
+
assert.ok(result.maxBlockingMs < BUDGET_MS, `max interval blocking ${result.maxBlockingMs.toFixed(3)}ms must be <${BUDGET_MS}ms`);
|
|
74
82
|
} finally {
|
|
75
83
|
clearInterval(timer);
|
|
84
|
+
await threadWatch?.stop();
|
|
76
85
|
store?.close();
|
|
77
86
|
rmSync(dir, { recursive: true, force: true });
|
|
78
87
|
}
|
package/scripts/mock-ci-tool.mjs
CHANGED
|
@@ -5,9 +5,6 @@ import { request } from 'node:http';
|
|
|
5
5
|
import { publishFile } from './mock-publish.mjs';
|
|
6
6
|
import { basename } from 'node:path';
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
8
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
9
|
-
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
10
|
-
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
11
8
|
import { productEnv } from './product-env.mjs';
|
|
12
9
|
|
|
13
10
|
export async function probeCiTool(backend, wire, pr = process.env.CEZ_MOCK_CI_PR) {
|
|
@@ -110,11 +107,13 @@ function mcpServerOf(backend, wire) {
|
|
|
110
107
|
|
|
111
108
|
async function probeMcpTool({ server, env }, name, args) {
|
|
112
109
|
if (!server) throw new Error('CI server absent');
|
|
110
|
+
// Loaded on use: the fixture runner's socket calls need no MCP client (hearsay-tools/squawk#4430).
|
|
111
|
+
const { Client } = await import('@modelcontextprotocol/sdk/client/index.js');
|
|
113
112
|
const client = new Client({ name: 'offline-harness', version: '1' });
|
|
114
113
|
try {
|
|
115
114
|
await client.connect(server.type === 'http'
|
|
116
|
-
? new StreamableHTTPClientTransport(new URL(server.url), { requestInit: { headers: Object.fromEntries(server.headers.map(header => [header.name, header.value])) } })
|
|
117
|
-
: new StdioClientTransport({ command: server.command, args: server.args, env, stderr: 'pipe' }));
|
|
115
|
+
? new (await import('@modelcontextprotocol/sdk/client/streamableHttp.js')).StreamableHTTPClientTransport(new URL(server.url), { requestInit: { headers: Object.fromEntries(server.headers.map(header => [header.name, header.value])) } })
|
|
116
|
+
: new (await import('@modelcontextprotocol/sdk/client/stdio.js')).StdioClientTransport({ command: server.command, args: server.args, env, stderr: 'pipe' }));
|
|
118
117
|
const list = await client.listTools();
|
|
119
118
|
return { names: list.tools.map(tool => tool.name), response: await client.callTool({ name, arguments: args }) };
|
|
120
119
|
} finally { await client.close(); }
|
|
@@ -165,6 +165,16 @@ export function summarizeWaits(seen) {
|
|
|
165
165
|
return counts;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/** Name the waits of every sample whose blocking reached the budget, not only the first one.
|
|
169
|
+
* `window(sample)` gives the sample's [from, to) on the performance.now() clock. */
|
|
170
|
+
export function attachWaitsOverBudget(samples, seen, budgetMs, window) {
|
|
171
|
+
for (const sample of samples) {
|
|
172
|
+
if (sample.blockingMs < budgetMs) continue;
|
|
173
|
+
const [from, to] = window(sample);
|
|
174
|
+
sample.waits = summarizeWaits(seen.filter(entry => entry.at >= from && entry.at < to));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
168
178
|
/** Instrument only the synchronous open call. Imports and hook setup are outside its budget.
|
|
169
179
|
* These diagnostic wrappers restore every method even when open throws. */
|
|
170
180
|
export async function prepareOpenTiming(runtime) {
|
|
@@ -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-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};
|
|
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-BddxDJyD.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-C-xqAWVX.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-CF2Sk1aR.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-7Rg7tdSP.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-3cUJmNQz.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-ihbrhzlZ.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};
|