@hearsay-tools/squawk 0.19.0-pr4432.8694 → 0.19.0-pr4437.8732

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/activity/read-model.js +5 -2
  2. package/dist/activity/read-model.js.map +1 -1
  3. package/dist/ci-wait/controller.d.ts +7 -7
  4. package/dist/contract/activity.d.ts +14 -0
  5. package/dist/contract/index.js +89 -16
  6. package/dist/contract/repo-requests.d.ts +9 -1
  7. package/dist/contract/repo.d.ts +39 -2
  8. package/dist/contract/runs.d.ts +50 -0
  9. package/dist/contract/workspace-events.d.ts +18 -0
  10. package/dist/delegation/routes.d.ts +65 -65
  11. package/dist/git-worktree.d.ts +9 -0
  12. package/dist/git-worktree.js +118 -3
  13. package/dist/git-worktree.js.map +1 -1
  14. package/dist/runners/codex/codex-app-server-runner.js +2 -42
  15. package/dist/runners/codex/codex-app-server-runner.js.map +1 -1
  16. package/dist/runners/codex/codex-questions.d.ts +5 -0
  17. package/dist/runners/codex/codex-questions.js +55 -0
  18. package/dist/runners/codex/codex-questions.js.map +1 -0
  19. package/dist/runners/opencode/opencode-questions.js +9 -1
  20. package/dist/runners/opencode/opencode-questions.js.map +1 -1
  21. package/dist/runs/retention.d.ts +6 -0
  22. package/dist/runs/retention.js +7 -3
  23. package/dist/runs/retention.js.map +1 -1
  24. package/dist/runs/run-database.d.ts +5 -0
  25. package/dist/runs/run-database.js +5 -0
  26. package/dist/runs/run-database.js.map +1 -1
  27. package/dist/runs/run-queries.d.ts +9 -0
  28. package/dist/runs/run-queries.js +43 -6
  29. package/dist/runs/run-queries.js.map +1 -1
  30. package/dist/runs/store.js +1 -0
  31. package/dist/runs/store.js.map +1 -1
  32. package/dist/runs/transcript-facts-topic.d.ts +2 -0
  33. package/dist/runs/transcript-facts-topic.js +8 -10
  34. package/dist/runs/transcript-facts-topic.js.map +1 -1
  35. package/dist/server/activity-routes.d.ts +27 -23
  36. package/dist/server/automations-routes.d.ts +150 -150
  37. package/dist/server/project-settings-routes.d.ts +107 -107
  38. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  39. package/dist/server/repo-routes.d.ts +40 -14
  40. package/dist/server/repo-routes.js +30 -15
  41. package/dist/server/repo-routes.js.map +1 -1
  42. package/dist/server/reports-api.d.ts +2 -2
  43. package/dist/server/run-checkout.d.ts +1 -1
  44. package/dist/server/run-checkout.js +20 -7
  45. package/dist/server/run-checkout.js.map +1 -1
  46. package/dist/server/runners-routes.d.ts +10 -10
  47. package/dist/server/runs-routes.d.ts +283 -275
  48. package/dist/server/server.d.ts +148 -68
  49. package/dist/server/workspace-routes.d.ts +8 -0
  50. package/dist/server/worktree-size-cache.d.ts +11 -0
  51. package/dist/server/worktree-size-cache.js +3 -1
  52. package/dist/server/worktree-size-cache.js.map +1 -1
  53. package/package.json +4 -4
  54. package/scripts/measure-transcript-facts-lag.mjs +11 -2
  55. package/web/dist/assets/accounts-section-DVJon113.js +1 -0
  56. package/web/dist/assets/activity-motion-D_Mig_D4.js +1 -0
  57. package/web/dist/assets/activity-route-BvYIEdOs.js +1 -0
  58. package/web/dist/assets/agent-config-section-BImy20b0.js +7 -0
  59. package/web/dist/assets/agent-defaults-section-D30dOTKu.js +1 -0
  60. package/web/dist/assets/{appearance-DQLHHfI4.js → appearance-CHsrT2VO.js} +1 -1
  61. package/web/dist/assets/archive-on-merge-field-BT4e_k9f.js +1 -0
  62. package/web/dist/assets/attention-CGsbqL2t.js +1 -0
  63. package/web/dist/assets/automations-route-BEhmjeVF.js +2 -0
  64. package/web/dist/assets/{change-counts-CW7O8g5Y.js → change-counts-npLATh-3.js} +1 -1
  65. package/web/dist/assets/commit-list-02HM16KN.js +1 -0
  66. package/web/dist/assets/diff-BmDcJsHL.js +3 -0
  67. package/web/dist/assets/{diff-controls-BRa3141W.js → diff-controls-HmgYRhy7.js} +1 -1
  68. package/web/dist/assets/diff-stat-C7KB1kDX.js +1 -0
  69. package/web/dist/assets/{diff-view-CwlKCj5V.js → diff-view-CRx2ZNOd.js} +1 -1
  70. package/web/dist/assets/file-preview-B361k1Oo.js +2 -0
  71. package/web/dist/assets/folder-browser-BJ3aXo9k.js +1 -0
  72. package/web/dist/assets/git-toolbar-DsNQUL5f.js +1 -0
  73. package/web/dist/assets/github-DP2REdU5.js +1 -0
  74. package/web/dist/assets/global-activity-route-Iv0uN7Wy.js +2 -0
  75. package/web/dist/assets/image-preview-DCUeM8u3.js +1 -0
  76. package/web/dist/assets/index-CVz-Ls8s.css +1 -0
  77. package/web/dist/assets/index-mCjln54E.js +21 -0
  78. package/web/dist/assets/label-CH-a6Jyv.js +1 -0
  79. package/web/dist/assets/{markdown-9L65ixU6.js → markdown-DiMerfHU.js} +1 -1
  80. package/web/dist/assets/nav-row-styles-D5HpOmDZ.js +1 -0
  81. package/web/dist/assets/notifications-section-DGH8tp1N.js +1 -0
  82. package/web/dist/assets/open-in-menu-CML2QKil.js +1 -0
  83. package/web/dist/assets/{popover-BPgUYFyu.js → popover-CZV6tz9i.js} +1 -1
  84. package/web/dist/assets/preview-pane-connected-Cl_6DHNm.js +3 -0
  85. package/web/dist/assets/project-location-CZNz3wYW.js +1 -0
  86. package/web/dist/assets/project-router-BvBqllk2.js +1 -0
  87. package/web/dist/assets/projects-section-D3h_nr6-.js +1 -0
  88. package/web/dist/assets/prompt-templates-section-DelsVm7I.js +1 -0
  89. package/web/dist/assets/queries-CYWRnyM5.js +1 -0
  90. package/web/dist/assets/reference-chip-BdikRjql.js +1 -0
  91. package/web/dist/assets/remote-settings-notice-D2x0qeKt.js +1 -0
  92. package/web/dist/assets/repo-git-DKkOxBOJ.js +1 -0
  93. package/web/dist/assets/report-reader-D2b9baRm.js +1 -0
  94. package/web/dist/assets/report-selection-D2RvkiGX.js +1 -0
  95. package/web/dist/assets/reports-CBP54u9k.js +1 -0
  96. package/web/dist/assets/resources-section-D86nQvrk.js +1 -0
  97. package/web/dist/assets/review-panel-BcuyfiuF.js +11 -0
  98. package/web/dist/assets/run-detail-refresh-BNI7eMgG.js +1 -0
  99. package/web/dist/assets/run-header-B2AfxeyZ.js +2 -0
  100. package/web/dist/assets/{run-header-Ccnr9k0X.css → run-header-DfEfupCk.css} +1 -1
  101. package/web/dist/assets/{select-y3oRuA2s.js → select-KMLdkF0Y.js} +1 -1
  102. package/web/dist/assets/{session-context-section-CiPNMiL7.js → session-context-section-Do5bNw8y.js} +2 -2
  103. package/web/dist/assets/settings-agent-picker-Dtqb26Hz.js +1 -0
  104. package/web/dist/assets/settings-shell-AMRJAsgc.css +1 -0
  105. package/web/dist/assets/settings-shell-CWPwhUDh.js +1 -0
  106. package/web/dist/assets/sidebar-section-pLjtUKHT.js +1 -0
  107. package/web/dist/assets/skills-CaXsJiUU.js +1 -0
  108. package/web/dist/assets/{tab-link-Bu1g-ArE.js → tab-link-B0pNjKxZ.js} +1 -1
  109. package/web/dist/assets/task-changes-oogngDub.js +1 -0
  110. package/web/dist/assets/task-commits-_Aa8bkJq.js +1 -0
  111. package/web/dist/assets/task-file-scope-DY0ozMDn.js +1 -0
  112. package/web/dist/assets/task-files-DxFFK3zI.js +1 -0
  113. package/web/dist/assets/task-github-item-LSzJuoiu.js +1 -0
  114. package/web/dist/assets/task-groups-lh9gz7TP.js +1 -0
  115. package/web/dist/assets/task-thread-BlThx_dR.js +2 -0
  116. package/web/dist/assets/task-thread-PDeU-fL6.css +1 -0
  117. package/web/dist/assets/tasks-table-k18AuMR5.js +1 -0
  118. package/web/dist/assets/thread-state-DA2aAkKF.js +4 -0
  119. package/web/dist/assets/toaster-B0kvcFif.js +4 -0
  120. package/web/dist/assets/tool-display-B9NN44oU.js +1 -0
  121. package/web/dist/assets/{use-hand-to-agent-state-Ch0ok71s.css → use-hand-to-agent-state-BHaqyTxa.css} +1 -1
  122. package/web/dist/assets/use-hand-to-agent-state-dgiJEULj.js +1 -0
  123. package/web/dist/assets/use-search-params-writer-ClMScnNe.js +1 -0
  124. package/web/dist/assets/workflows-DNs9e08u.js +7 -0
  125. package/web/dist/assets/{workflows-DsE0ExV6.css → workflows-FH3RBKvk.css} +1 -1
  126. package/web/dist/assets/workspace-tools-DHek4GFd.js +1 -0
  127. package/web/dist/assets/worktrees-section-fLfqff8U.js +4 -0
  128. package/web/dist/assets/{zoomable-image-CIQl1Wpe.js → zoomable-image-6RTKhLGE.js} +1 -1
  129. package/web/dist/index.html +19 -17
  130. package/web/dist/assets/accounts-section-RDVTJfi7.js +0 -1
  131. package/web/dist/assets/activity-motion-B7km8QVK.js +0 -2
  132. package/web/dist/assets/activity-route-CjE0yxn0.js +0 -1
  133. package/web/dist/assets/agent-config-section-DQ1RaVK2.js +0 -7
  134. package/web/dist/assets/agent-defaults-section-Dzm7jIza.js +0 -1
  135. package/web/dist/assets/archive-on-merge-field-C7_Fwy2A.js +0 -1
  136. package/web/dist/assets/attention-CBCeJN5w.js +0 -1
  137. package/web/dist/assets/automations-route-BcdL5f0K.js +0 -2
  138. package/web/dist/assets/commit-list-CN1zX-0X.js +0 -1
  139. package/web/dist/assets/diff-hxqBOfZH.js +0 -3
  140. package/web/dist/assets/file-preview-VvCzp02k.js +0 -2
  141. package/web/dist/assets/folder-browser-B7IbnF0d.js +0 -1
  142. package/web/dist/assets/git-toolbar-BulcGzsv.js +0 -1
  143. package/web/dist/assets/github-By3yOcFH.js +0 -1
  144. package/web/dist/assets/global-activity-route-C4-bmfh_.js +0 -1
  145. package/web/dist/assets/hourglass-CikYdGGQ.js +0 -1
  146. package/web/dist/assets/image-preview-Pgf8bnzY.js +0 -1
  147. package/web/dist/assets/index-C69_Sk06.css +0 -1
  148. package/web/dist/assets/index-DNQcTHxV.js +0 -21
  149. package/web/dist/assets/label-Bt8n7Spq.js +0 -1
  150. package/web/dist/assets/live-reads-Crd6fVGH.js +0 -1
  151. package/web/dist/assets/nav-row-styles-DKeXbc4N.js +0 -1
  152. package/web/dist/assets/notifications-section-QWmuj2j2.js +0 -1
  153. package/web/dist/assets/open-in-menu-BPp88ouw.js +0 -1
  154. package/web/dist/assets/preview-pane-connected-DAM2Snwh.js +0 -3
  155. package/web/dist/assets/project-location-BRxXN249.js +0 -1
  156. package/web/dist/assets/project-router-CLJTc7gv.js +0 -1
  157. package/web/dist/assets/project-scope-context-Rv6S_BXt.js +0 -4
  158. package/web/dist/assets/projects-section-DxubjpZI.js +0 -1
  159. package/web/dist/assets/prompt-templates-section-CkQneT1G.js +0 -1
  160. package/web/dist/assets/queries-qCF-eOqZ.js +0 -1
  161. package/web/dist/assets/reference-chip-D0v0keVC.js +0 -1
  162. package/web/dist/assets/remote-settings-notice-COojb6XK.js +0 -1
  163. package/web/dist/assets/repo-git-Mgk4Qcmo.js +0 -1
  164. package/web/dist/assets/report-reader-zWwalJDN.js +0 -1
  165. package/web/dist/assets/reports-BCHWt3zy.js +0 -1
  166. package/web/dist/assets/resources-section-Cb2WIqNv.js +0 -1
  167. package/web/dist/assets/run-header-DeprqSP7.js +0 -2
  168. package/web/dist/assets/settings-agent-picker-CJJJncuA.js +0 -1
  169. package/web/dist/assets/settings-shell-CLToW28f.js +0 -1
  170. package/web/dist/assets/settings-shell-CqiAPuLq.css +0 -1
  171. package/web/dist/assets/sidebar-section-VOYJarPd.js +0 -1
  172. package/web/dist/assets/skills-BySF3yBA.js +0 -1
  173. package/web/dist/assets/task-changes-NUwvUglx.js +0 -1
  174. package/web/dist/assets/task-commits-CpV1Hz9L.js +0 -1
  175. package/web/dist/assets/task-files-Bu-L_NRW.js +0 -1
  176. package/web/dist/assets/task-github-item-DhiTqCjk.js +0 -1
  177. package/web/dist/assets/task-groups-4tzKGROI.js +0 -1
  178. package/web/dist/assets/task-thread-CKkTeQdi.js +0 -9
  179. package/web/dist/assets/task-thread-DzADOhZd.css +0 -1
  180. package/web/dist/assets/tasks-table-C5uoZMFs.js +0 -1
  181. package/web/dist/assets/thread-state-B_ZqjjRr.js +0 -4
  182. package/web/dist/assets/toaster-BXnLIU3z.js +0 -1
  183. package/web/dist/assets/use-hand-to-agent-state-K864D69i.js +0 -1
  184. package/web/dist/assets/workflows-DlTkuM0J.js +0 -7
  185. package/web/dist/assets/workspace-tools-BRK7f1Hk.js +0 -1
  186. package/web/dist/assets/worktrees-section-BXI0-7HH.js +0 -4
@@ -418,7 +418,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
418
418
  runner?: string | undefined;
419
419
  model?: string | undefined;
420
420
  currentStepId?: string | undefined;
421
+ createdAt?: string | undefined;
421
422
  startedAt?: string | undefined;
423
+ finishedAt?: string | undefined;
422
424
  wait?: {
423
425
  kind: "human";
424
426
  since: string;
@@ -520,7 +522,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
520
522
  runner?: string | undefined;
521
523
  model?: string | undefined;
522
524
  currentStepId?: string | undefined;
525
+ createdAt?: string | undefined;
523
526
  startedAt?: string | undefined;
527
+ finishedAt?: string | undefined;
524
528
  wait?: {
525
529
  kind: "human";
526
530
  since: string;
@@ -775,6 +779,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
775
779
  currentStepId?: string | undefined;
776
780
  currentStepBackend?: string | undefined;
777
781
  error?: string | undefined;
782
+ statePreview?: {
783
+ kind: "ask" | "error" | "permission" | "review";
784
+ text: string;
785
+ } | undefined;
778
786
  worktreePath?: string | undefined;
779
787
  projectId: string;
780
788
  }[];
@@ -939,6 +947,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
939
947
  currentStepId?: string | undefined;
940
948
  currentStepBackend?: string | undefined;
941
949
  error?: string | undefined;
950
+ statePreview?: {
951
+ kind: "ask" | "error" | "permission" | "review";
952
+ text: string;
953
+ } | undefined;
942
954
  worktreePath?: string | undefined;
943
955
  projectId: string;
944
956
  }[];
@@ -3984,6 +3996,17 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3984
3996
  finishedAt: string | null;
3985
3997
  reclaimable: boolean;
3986
3998
  pastKeep: boolean;
3999
+ reclaimBlocker: {
4000
+ kind: "dirty";
4001
+ uncommittedFiles: number;
4002
+ detachedHead: boolean;
4003
+ } | {
4004
+ kind: "detached-head";
4005
+ } | {
4006
+ kind: "submodules";
4007
+ } | {
4008
+ kind: "invalid";
4009
+ } | null;
3987
4010
  }[];
3988
4011
  totalBytes: number | null;
3989
4012
  keep: number;
@@ -4003,7 +4026,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4003
4026
  status: import("hono/utils/http-status").ContentfulStatusCode;
4004
4027
  input: {
4005
4028
  json: {
4006
- [x: string]: unknown;
4029
+ discardWork: true;
4030
+ runIds: string[];
4031
+ } | {
4032
+ discardWork?: false | undefined;
4007
4033
  };
4008
4034
  };
4009
4035
  };
@@ -4021,6 +4047,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4021
4047
  param: {
4022
4048
  runId: string;
4023
4049
  };
4050
+ } & {
4051
+ json: {
4052
+ discardWork?: boolean | undefined;
4053
+ };
4024
4054
  };
4025
4055
  } | {
4026
4056
  output: {
@@ -4032,6 +4062,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4032
4062
  param: {
4033
4063
  runId: string;
4034
4064
  };
4065
+ } & {
4066
+ json: {
4067
+ discardWork?: boolean | undefined;
4068
+ };
4035
4069
  };
4036
4070
  } | {
4037
4071
  output: {
@@ -4044,6 +4078,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4044
4078
  param: {
4045
4079
  runId: string;
4046
4080
  };
4081
+ } & {
4082
+ json: {
4083
+ discardWork?: boolean | undefined;
4084
+ };
4047
4085
  };
4048
4086
  };
4049
4087
  };
@@ -4720,6 +4758,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4720
4758
  } & {
4721
4759
  "/repo/commit/:sha": {
4722
4760
  $get: {
4761
+ output: string;
4762
+ outputFormat: "text";
4763
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4764
+ input: {
4765
+ query: {
4766
+ structured?: string | undefined;
4767
+ };
4768
+ } & {
4769
+ param: {
4770
+ sha: string;
4771
+ };
4772
+ };
4773
+ } | {
4723
4774
  output: {
4724
4775
  error: string;
4725
4776
  code?: "invalid_input" | undefined;
@@ -4783,19 +4834,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4783
4834
  sha: string;
4784
4835
  };
4785
4836
  };
4786
- } | {
4787
- output: string;
4788
- outputFormat: "text";
4789
- status: import("hono/utils/http-status").ContentfulStatusCode;
4790
- input: {
4791
- query: {
4792
- structured?: string | undefined;
4793
- };
4794
- } & {
4795
- param: {
4796
- sha: string;
4797
- };
4798
- };
4799
4837
  };
4800
4838
  };
4801
4839
  } & {
@@ -8326,6 +8364,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8326
8364
  currentStepId?: string | undefined;
8327
8365
  currentStepBackend?: string | undefined;
8328
8366
  error?: string | undefined;
8367
+ statePreview?: {
8368
+ kind: "ask" | "error" | "permission" | "review";
8369
+ text: string;
8370
+ } | undefined;
8329
8371
  worktreePath?: string | undefined;
8330
8372
  }[];
8331
8373
  outputFormat: "json";
@@ -8504,6 +8546,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8504
8546
  currentStepId?: string | undefined;
8505
8547
  currentStepBackend?: string | undefined;
8506
8548
  error?: string | undefined;
8549
+ statePreview?: {
8550
+ kind: "ask" | "error" | "permission" | "review";
8551
+ text: string;
8552
+ } | undefined;
8507
8553
  worktreePath?: string | undefined;
8508
8554
  }[];
8509
8555
  nextCursor: string | null;
@@ -19290,20 +19336,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19290
19336
  } & {
19291
19337
  "/runs/:id/handoff": {
19292
19338
  $get: {
19293
- output: {
19294
- error: string;
19295
- };
19296
- outputFormat: "json";
19297
- status: 404;
19339
+ output: string;
19340
+ outputFormat: "text";
19341
+ status: 200;
19298
19342
  input: {
19299
19343
  param: {
19300
19344
  id: string;
19301
19345
  };
19302
19346
  };
19303
19347
  } | {
19304
- output: string;
19305
- outputFormat: "text";
19306
- status: 200;
19348
+ output: {
19349
+ error: string;
19350
+ };
19351
+ outputFormat: "json";
19352
+ status: 404;
19307
19353
  input: {
19308
19354
  param: {
19309
19355
  id: string;
@@ -19341,20 +19387,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19341
19387
  } & {
19342
19388
  "/runs/:id/diff": {
19343
19389
  $get: {
19344
- output: {
19345
- error: string;
19346
- };
19347
- outputFormat: "json";
19348
- status: 404 | 409;
19390
+ output: string;
19391
+ outputFormat: "text";
19392
+ status: import("hono/utils/http-status").ContentfulStatusCode;
19349
19393
  input: {
19350
19394
  param: {
19351
19395
  id: string;
19352
19396
  };
19353
19397
  };
19354
19398
  } | {
19355
- output: string;
19356
- outputFormat: "text";
19357
- status: import("hono/utils/http-status").ContentfulStatusCode;
19399
+ output: {
19400
+ error: string;
19401
+ };
19402
+ outputFormat: "json";
19403
+ status: 404 | 409;
19358
19404
  input: {
19359
19405
  param: {
19360
19406
  id: string;
@@ -19447,9 +19493,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19447
19493
  status: 404 | 409;
19448
19494
  input: {
19449
19495
  param: {
19450
- sha: string;
19451
- } & {
19452
19496
  id: string;
19497
+ } & {
19498
+ sha: string;
19453
19499
  };
19454
19500
  };
19455
19501
  } | {
@@ -19478,9 +19524,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19478
19524
  status: import("hono/utils/http-status").ContentfulStatusCode;
19479
19525
  input: {
19480
19526
  param: {
19481
- sha: string;
19482
- } & {
19483
19527
  id: string;
19528
+ } & {
19529
+ sha: string;
19484
19530
  };
19485
19531
  };
19486
19532
  };
@@ -20753,6 +20799,17 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20753
20799
  finishedAt: string | null;
20754
20800
  reclaimable: boolean;
20755
20801
  pastKeep: boolean;
20802
+ reclaimBlocker: {
20803
+ kind: "dirty";
20804
+ uncommittedFiles: number;
20805
+ detachedHead: boolean;
20806
+ } | {
20807
+ kind: "detached-head";
20808
+ } | {
20809
+ kind: "submodules";
20810
+ } | {
20811
+ kind: "invalid";
20812
+ } | null;
20756
20813
  }[];
20757
20814
  totalBytes: number | null;
20758
20815
  keep: number;
@@ -20772,7 +20829,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20772
20829
  status: import("hono/utils/http-status").ContentfulStatusCode;
20773
20830
  input: {
20774
20831
  json: {
20775
- [x: string]: unknown;
20832
+ discardWork: true;
20833
+ runIds: string[];
20834
+ } | {
20835
+ discardWork?: false | undefined;
20776
20836
  };
20777
20837
  };
20778
20838
  };
@@ -20790,6 +20850,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20790
20850
  param: {
20791
20851
  runId: string;
20792
20852
  };
20853
+ } & {
20854
+ json: {
20855
+ discardWork?: boolean | undefined;
20856
+ };
20793
20857
  };
20794
20858
  } | {
20795
20859
  output: {
@@ -20801,6 +20865,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20801
20865
  param: {
20802
20866
  runId: string;
20803
20867
  };
20868
+ } & {
20869
+ json: {
20870
+ discardWork?: boolean | undefined;
20871
+ };
20804
20872
  };
20805
20873
  } | {
20806
20874
  output: {
@@ -20813,6 +20881,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20813
20881
  param: {
20814
20882
  runId: string;
20815
20883
  };
20884
+ } & {
20885
+ json: {
20886
+ discardWork?: boolean | undefined;
20887
+ };
20816
20888
  };
20817
20889
  };
20818
20890
  };
@@ -21489,6 +21561,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21489
21561
  } & {
21490
21562
  "/repo/commit/:sha": {
21491
21563
  $get: {
21564
+ output: string;
21565
+ outputFormat: "text";
21566
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21567
+ input: {
21568
+ query: {
21569
+ structured?: string | undefined;
21570
+ };
21571
+ } & {
21572
+ param: {
21573
+ sha: string;
21574
+ };
21575
+ };
21576
+ } | {
21492
21577
  output: {
21493
21578
  error: string;
21494
21579
  code?: "invalid_input" | undefined;
@@ -21552,19 +21637,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21552
21637
  sha: string;
21553
21638
  };
21554
21639
  };
21555
- } | {
21556
- output: string;
21557
- outputFormat: "text";
21558
- status: import("hono/utils/http-status").ContentfulStatusCode;
21559
- input: {
21560
- query: {
21561
- structured?: string | undefined;
21562
- };
21563
- } & {
21564
- param: {
21565
- sha: string;
21566
- };
21567
- };
21568
21640
  };
21569
21641
  };
21570
21642
  } & {
@@ -25095,6 +25167,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25095
25167
  currentStepId?: string | undefined;
25096
25168
  currentStepBackend?: string | undefined;
25097
25169
  error?: string | undefined;
25170
+ statePreview?: {
25171
+ kind: "ask" | "error" | "permission" | "review";
25172
+ text: string;
25173
+ } | undefined;
25098
25174
  worktreePath?: string | undefined;
25099
25175
  }[];
25100
25176
  outputFormat: "json";
@@ -25273,6 +25349,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25273
25349
  currentStepId?: string | undefined;
25274
25350
  currentStepBackend?: string | undefined;
25275
25351
  error?: string | undefined;
25352
+ statePreview?: {
25353
+ kind: "ask" | "error" | "permission" | "review";
25354
+ text: string;
25355
+ } | undefined;
25276
25356
  worktreePath?: string | undefined;
25277
25357
  }[];
25278
25358
  nextCursor: string | null;
@@ -36059,20 +36139,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36059
36139
  } & {
36060
36140
  "/runs/:id/handoff": {
36061
36141
  $get: {
36062
- output: {
36063
- error: string;
36064
- };
36065
- outputFormat: "json";
36066
- status: 404;
36142
+ output: string;
36143
+ outputFormat: "text";
36144
+ status: 200;
36067
36145
  input: {
36068
36146
  param: {
36069
36147
  id: string;
36070
36148
  };
36071
36149
  };
36072
36150
  } | {
36073
- output: string;
36074
- outputFormat: "text";
36075
- status: 200;
36151
+ output: {
36152
+ error: string;
36153
+ };
36154
+ outputFormat: "json";
36155
+ status: 404;
36076
36156
  input: {
36077
36157
  param: {
36078
36158
  id: string;
@@ -36110,20 +36190,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36110
36190
  } & {
36111
36191
  "/runs/:id/diff": {
36112
36192
  $get: {
36113
- output: {
36114
- error: string;
36115
- };
36116
- outputFormat: "json";
36117
- status: 404 | 409;
36193
+ output: string;
36194
+ outputFormat: "text";
36195
+ status: import("hono/utils/http-status").ContentfulStatusCode;
36118
36196
  input: {
36119
36197
  param: {
36120
36198
  id: string;
36121
36199
  };
36122
36200
  };
36123
36201
  } | {
36124
- output: string;
36125
- outputFormat: "text";
36126
- status: import("hono/utils/http-status").ContentfulStatusCode;
36202
+ output: {
36203
+ error: string;
36204
+ };
36205
+ outputFormat: "json";
36206
+ status: 404 | 409;
36127
36207
  input: {
36128
36208
  param: {
36129
36209
  id: string;
@@ -36216,9 +36296,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36216
36296
  status: 404 | 409;
36217
36297
  input: {
36218
36298
  param: {
36219
- sha: string;
36220
- } & {
36221
36299
  id: string;
36300
+ } & {
36301
+ sha: string;
36222
36302
  };
36223
36303
  };
36224
36304
  } | {
@@ -36247,9 +36327,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36247
36327
  status: import("hono/utils/http-status").ContentfulStatusCode;
36248
36328
  input: {
36249
36329
  param: {
36250
- sha: string;
36251
- } & {
36252
36330
  id: string;
36331
+ } & {
36332
+ sha: string;
36253
36333
  };
36254
36334
  };
36255
36335
  };
@@ -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
  }[];
@@ -1,3 +1,14 @@
1
1
  export declare const cachedWorktreeSizeBytes: (path: string) => Promise<number | null>;
2
+ export declare const queuedWorktreeReclaimBlocker: (repoRoot: string, path: string) => Promise<{
3
+ kind: "dirty";
4
+ uncommittedFiles: number;
5
+ detachedHead: boolean;
6
+ } | {
7
+ kind: "detached-head";
8
+ } | {
9
+ kind: "submodules";
10
+ } | {
11
+ kind: "invalid";
12
+ } | null>;
2
13
  export declare const forgetWorktreeSize: (path: string) => void;
3
14
  export declare const clearWorktreeSizeCacheForTests: () => void;
@@ -1,8 +1,10 @@
1
- import { worktreeSizeBytes } from '../git-worktree.js';
1
+ import { inspectWorktreeReclaimBlocker, worktreeSizeBytes } from '../git-worktree.js';
2
2
  import { boundedReadCache, readQueue } from './bounded-read-cache.js';
3
3
  const sizes = boundedReadCache(30_000, 512);
4
4
  const queue = readQueue(6);
5
+ const blockerQueue = readQueue(6);
5
6
  export const cachedWorktreeSizeBytes = (path) => sizes.read(path, () => queue(() => worktreeSizeBytes(path)));
7
+ export const queuedWorktreeReclaimBlocker = (repoRoot, path) => blockerQueue(() => inspectWorktreeReclaimBlocker(repoRoot, path));
6
8
  export const forgetWorktreeSize = (path) => sizes.forget(path);
7
9
  export const clearWorktreeSizeCacheForTests = () => sizes.clear();
8
10
  //# sourceMappingURL=worktree-size-cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worktree-size-cache.js","sourceRoot":"","sources":["../../src/server/worktree-size-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,KAAK,GAAG,gBAAgB,CAAgB,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3D,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"worktree-size-cache.js","sourceRoot":"","sources":["../../src/server/worktree-size-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,KAAK,GAAG,gBAAgB,CAAgB,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3D,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,EAAE,CAC7E,YAAY,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-pr4432.8694",
3
+ "version": "0.19.0-pr4437.8732",
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-pr4432.8694",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4432.8694",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4437.8732",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4437.8732",
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": "c199acd9b1a8b9060025e2301f532fb81956178a"
90
+ "gitHead": "766ff7c90edb21963c3857dfae361747838efc21"
91
91
  }
@@ -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 < 20, `max interval blocking ${result.maxBlockingMs.toFixed(3)}ms must be <20ms`);
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
  }
@@ -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,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-CYWRnyM5.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-B0kvcFif.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-BJ3aXo9k.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 se,s as ce,t as j}from"./dialog-B531GGAo.js";import{t as M}from"./status-dot-BRzVlF2X.js";import{n as N}from"./agents-settings-path-7X6_cvUg.js";import{t as P}from"./centered-state-V15AR_qo.js";import{A as F,Cn as I,Gt as L,Ht as R,Jt as z,Kt as B,M as V,Ut as H,Vt as U,Wt as W,bn as G,qt as le,wn as K}from"./index-mCjln54E.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as ue,t as de}from"./settings-agent-picker-Dtqb26Hz.js";import{n as fe,r as pe,t as me}from"./remote-settings-notice-D2x0qeKt.js";var he=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(),ge=`~/.claude-second`;function _e({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)(j,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(ce,{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??ge,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 ve(e){return D(await C.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ye(e,t){return D(await C.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var be={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function xe(e){let t=b().data?.capabilities?.settingsAdmin===!0,n=w(),r=[`runner-install`,e],i=T({queryKey:r,queryFn:()=>ve(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=>ye(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 Se({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 Ce({runner:e}){let t=xe(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?` · ${be[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(Se,{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 we={connected:K(`connected`),disconnected:K(`disconnected`),"not-installed":K(`not-installed`),unknown:K(`unknown`)};function Te(){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)(P,{icon:(0,X.jsx)(he,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Oe,{data:e.data,runners:t.data})}function Ee(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function De(){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 Oe({data:e,runners:t}){let n=b(),[r,i]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=a();return De(),pe(),(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)(fe,{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:me}),` 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)(je,{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)(Me,{runners:t}),r===null?null:(0,X.jsx)(_e,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(U,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,X.jsxs)(W,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(le,{children:[(0,X.jsxs)(z,{children:[`Remove “`,o?.label,`”?`]}),(0,X.jsxs)(L,{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)(B,{children:[(0,X.jsx)(H,{children:`Cancel`}),(0,X.jsx)(R,{"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 ke({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:I(t.version)?`CLI simulated`:`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)(Z,{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]})}function Z({version:e}){return I(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:G.label}):(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 Ae({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 Q({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)(Ae,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function je({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=`${N(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)(ke,{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:N(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)(Q,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(Ce,{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 Me({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=ue([],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)(de,{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:[V(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)(Ne,{runner:t.id,runners:e,catalog:u[t.id]})]})]},t.id))]})]})}function Ne({runner:e,runners:t,catalog:n}){let r=F(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Pe({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 Fe(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?we[c.status]:void 0,u=Fe(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)(M,{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)(M,{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)(Pe,{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-xs 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:Ee(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)(Ie,{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)(Q,{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 Ie({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{Te as GlobalAgentsSection};