@hearsay-tools/squawk 0.19.0-pr4424.8672 → 0.19.0-pr4426.8671

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 (102) hide show
  1. package/dist/contract/index.js +46 -57
  2. package/dist/contract/repo-requests.d.ts +9 -1
  3. package/dist/contract/repo.d.ts +39 -2
  4. package/dist/contract/runs.d.ts +0 -50
  5. package/dist/contract/workspace-events.d.ts +0 -18
  6. package/dist/git-worktree.d.ts +9 -0
  7. package/dist/git-worktree.js +113 -3
  8. package/dist/git-worktree.js.map +1 -1
  9. package/dist/runs/retention.d.ts +6 -0
  10. package/dist/runs/retention.js +7 -3
  11. package/dist/runs/retention.js.map +1 -1
  12. package/dist/server/repo-routes.d.ts +40 -14
  13. package/dist/server/repo-routes.js +30 -15
  14. package/dist/server/repo-routes.js.map +1 -1
  15. package/dist/server/run-checkout.d.ts +1 -1
  16. package/dist/server/run-checkout.js +20 -7
  17. package/dist/server/run-checkout.js.map +1 -1
  18. package/dist/server/runs-routes.d.ts +0 -8
  19. package/dist/server/server.d.ts +120 -92
  20. package/dist/server/workspace-routes.d.ts +0 -8
  21. package/dist/server/worktree-size-cache.d.ts +11 -0
  22. package/dist/server/worktree-size-cache.js +3 -1
  23. package/dist/server/worktree-size-cache.js.map +1 -1
  24. package/package.json +4 -4
  25. package/web/dist/assets/{accounts-section-CzFhdKWy.js → accounts-section-vKkfS7YX.js} +1 -1
  26. package/web/dist/assets/activity-motion-DQoK98JL.js +2 -0
  27. package/web/dist/assets/{activity-route-Cvw0jXpy.js → activity-route-snD0tuxO.js} +1 -1
  28. package/web/dist/assets/{agent-config-section-BCzxsvys.js → agent-config-section-DoleNTpD.js} +1 -1
  29. package/web/dist/assets/{agent-defaults-section-DMRK-Qlp.js → agent-defaults-section-ysitxF4K.js} +1 -1
  30. package/web/dist/assets/{appearance-Ew3vb_-K.js → appearance-DVdKOCpj.js} +1 -1
  31. package/web/dist/assets/{archive-on-merge-field-g87CG6RL.js → archive-on-merge-field-DrgP61Ey.js} +1 -1
  32. package/web/dist/assets/attention-CcwTbcYb.js +1 -0
  33. package/web/dist/assets/automations-route-FZreqZEC.js +2 -0
  34. package/web/dist/assets/commit-list-_lCNrPe9.js +1 -0
  35. package/web/dist/assets/diff-B5kvGFig.js +3 -0
  36. package/web/dist/assets/{diff-controls-CmYvdEGt.js → diff-controls-BEdzHFBp.js} +1 -1
  37. package/web/dist/assets/{diff-view-DV6muJdZ.js → diff-view-Cn75jglS.js} +1 -1
  38. package/web/dist/assets/{file-preview-CTPfK-oR.js → file-preview-DOCPVTlT.js} +1 -1
  39. package/web/dist/assets/{folder-browser-DnSFycbU.js → folder-browser-DAam7eGA.js} +1 -1
  40. package/web/dist/assets/git-toolbar-CZVQtcyI.js +1 -0
  41. package/web/dist/assets/github-B4nythBc.js +1 -0
  42. package/web/dist/assets/{global-activity-route-Dvx2uk8w.js → global-activity-route-CRiXcL16.js} +1 -1
  43. package/web/dist/assets/image-preview-BHVPu_Ot.js +1 -0
  44. package/web/dist/assets/index-CFtjrhlQ.js +21 -0
  45. package/web/dist/assets/index-COOMjwiP.css +1 -0
  46. package/web/dist/assets/{label-o_DsEmPt.js → label-BqslTY3y.js} +1 -1
  47. package/web/dist/assets/{live-reads-Cgk2XbiP.js → live-reads-CYQJSB0x.js} +1 -1
  48. package/web/dist/assets/{markdown-CJzxFk0P.js → markdown-ZJPe40Kg.js} +1 -1
  49. package/web/dist/assets/{notifications-section-DNYO4sd4.js → notifications-section-BAxVmNvS.js} +1 -1
  50. package/web/dist/assets/{open-in-menu-Bzae69TK.js → open-in-menu-C8XOuvhZ.js} +1 -1
  51. package/web/dist/assets/{preview-pane-connected-CRooCkyb.js → preview-pane-connected-o04x4ut2.js} +2 -2
  52. package/web/dist/assets/{project-location-D6riKh0Z.js → project-location-C5wL8Cmv.js} +1 -1
  53. package/web/dist/assets/{project-router-CZ89wg-5.js → project-router-Djen61eU.js} +1 -1
  54. package/web/dist/assets/{project-scope-context-DIcqj4jJ.js → project-scope-context-DBPcPWqF.js} +2 -2
  55. package/web/dist/assets/{projects-section-4rsb8E52.js → projects-section-DjW4lZdo.js} +1 -1
  56. package/web/dist/assets/{prompt-templates-section-G3dlAOXt.js → prompt-templates-section-BZ9kPTz8.js} +1 -1
  57. package/web/dist/assets/{queries-DZhNVAD_.js → queries-B27CAXOU.js} +1 -1
  58. package/web/dist/assets/{reference-chip-DSJSqjmO.js → reference-chip-BvcSKzIw.js} +1 -1
  59. package/web/dist/assets/{remote-settings-notice-GNs7i0kP.js → remote-settings-notice-B7px6Rjz.js} +1 -1
  60. package/web/dist/assets/repo-git-OhYxFr6e.js +1 -0
  61. package/web/dist/assets/{report-reader-CLlNdsZG.js → report-reader-CFDdbV9p.js} +1 -1
  62. package/web/dist/assets/reports-C_oLuf2Z.js +1 -0
  63. package/web/dist/assets/{resources-section-DhEoaA0K.js → resources-section-DPKpkT00.js} +1 -1
  64. package/web/dist/assets/run-header-Cvjx6fLe.js +2 -0
  65. package/web/dist/assets/{select-D3snxxoD.js → select-DCgMFs3P.js} +1 -1
  66. package/web/dist/assets/{session-context-section-esqZfONg.js → session-context-section-DUDyUnD6.js} +2 -2
  67. package/web/dist/assets/{settings-agent-picker-Dso2TmRM.js → settings-agent-picker-Dj9w9Rqy.js} +1 -1
  68. package/web/dist/assets/{settings-shell-UO_0dSGl.js → settings-shell-Dj0lpmcY.js} +1 -1
  69. package/web/dist/assets/{sidebar-section-pp7e3AZa.js → sidebar-section-CFausX6G.js} +1 -1
  70. package/web/dist/assets/{skills-B99glme7.js → skills-C59hjIpW.js} +1 -1
  71. package/web/dist/assets/{tab-link-BGXFZZ_Z.js → tab-link-B7UoArdY.js} +1 -1
  72. package/web/dist/assets/task-changes-HqrNlmGK.js +1 -0
  73. package/web/dist/assets/task-commits-QHeItJLu.js +1 -0
  74. package/web/dist/assets/{task-files-Csx1Bonx.js → task-files-QFVIGaz9.js} +1 -1
  75. package/web/dist/assets/{task-github-item-D0kQ0K4S.js → task-github-item-UKsVEOul.js} +1 -1
  76. package/web/dist/assets/{task-groups-DK0I9p71.js → task-groups-BwdcbABY.js} +1 -1
  77. package/web/dist/assets/{task-thread-DsMuGSug.js → task-thread-CnGokWLH.js} +9 -9
  78. package/web/dist/assets/{tasks-table-BNFYIwtc.js → tasks-table-Y4sDrQge.js} +1 -1
  79. package/web/dist/assets/{thread-state-DMWi6eLk.js → thread-state-Cu4CGztL.js} +1 -1
  80. package/web/dist/assets/{toaster-0sM0sfWx.js → toaster-DXCOcLoK.js} +1 -1
  81. package/web/dist/assets/use-hand-to-agent-state-Cxrl8yfx.js +1 -0
  82. package/web/dist/assets/{workflows-CxJvAn6z.js → workflows-Dl7hrImQ.js} +3 -3
  83. package/web/dist/assets/{workspace-tools-DqJ8akIy.js → workspace-tools-ti_LJ2EA.js} +1 -1
  84. package/web/dist/assets/{worktrees-section-DBZZlAe0.js → worktrees-section-CpVznl7Q.js} +4 -4
  85. package/web/dist/index.html +15 -16
  86. package/web/dist/assets/activity-motion-D0Fch0mc.js +0 -2
  87. package/web/dist/assets/attention-80jX8HhC.js +0 -1
  88. package/web/dist/assets/automations-route-CRBtWEo1.js +0 -2
  89. package/web/dist/assets/commit-list-Cd14tNSj.js +0 -1
  90. package/web/dist/assets/diff-D55N_7Ul.js +0 -3
  91. package/web/dist/assets/diff-stat-U7DT4Ilj.js +0 -1
  92. package/web/dist/assets/git-toolbar-Dc_o1nrh.js +0 -1
  93. package/web/dist/assets/github-WYk7bQID.js +0 -1
  94. package/web/dist/assets/image-preview-2S3PEy8S.js +0 -1
  95. package/web/dist/assets/index-CGdnowj-.js +0 -21
  96. package/web/dist/assets/index-DAxuDJAo.css +0 -1
  97. package/web/dist/assets/repo-git-CvZTTKFl.js +0 -1
  98. package/web/dist/assets/reports-sl2SMDG1.js +0 -1
  99. package/web/dist/assets/run-header-DZoOLIBZ.js +0 -2
  100. package/web/dist/assets/task-changes-Tn9M2OPH.js +0 -1
  101. package/web/dist/assets/task-commits-BHDMp1sO.js +0 -1
  102. package/web/dist/assets/use-hand-to-agent-state-DqCW8Giu.js +0 -1
@@ -775,10 +775,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
775
775
  currentStepId?: string | undefined;
776
776
  currentStepBackend?: string | undefined;
777
777
  error?: string | undefined;
778
- statePreview?: {
779
- kind: "ask" | "error" | "permission" | "review";
780
- text: string;
781
- } | undefined;
782
778
  worktreePath?: string | undefined;
783
779
  projectId: string;
784
780
  }[];
@@ -943,10 +939,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
943
939
  currentStepId?: string | undefined;
944
940
  currentStepBackend?: string | undefined;
945
941
  error?: string | undefined;
946
- statePreview?: {
947
- kind: "ask" | "error" | "permission" | "review";
948
- text: string;
949
- } | undefined;
950
942
  worktreePath?: string | undefined;
951
943
  projectId: string;
952
944
  }[];
@@ -3992,6 +3984,17 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3992
3984
  finishedAt: string | null;
3993
3985
  reclaimable: boolean;
3994
3986
  pastKeep: boolean;
3987
+ reclaimBlocker: {
3988
+ kind: "dirty";
3989
+ uncommittedFiles: number;
3990
+ detachedHead: boolean;
3991
+ } | {
3992
+ kind: "detached-head";
3993
+ } | {
3994
+ kind: "submodules";
3995
+ } | {
3996
+ kind: "invalid";
3997
+ } | null;
3995
3998
  }[];
3996
3999
  totalBytes: number | null;
3997
4000
  keep: number;
@@ -4011,7 +4014,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4011
4014
  status: import("hono/utils/http-status").ContentfulStatusCode;
4012
4015
  input: {
4013
4016
  json: {
4014
- [x: string]: unknown;
4017
+ discardWork: true;
4018
+ runIds: string[];
4019
+ } | {
4020
+ discardWork?: false | undefined;
4015
4021
  };
4016
4022
  };
4017
4023
  };
@@ -4029,6 +4035,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4029
4035
  param: {
4030
4036
  runId: string;
4031
4037
  };
4038
+ } & {
4039
+ json: {
4040
+ discardWork?: boolean | undefined;
4041
+ };
4032
4042
  };
4033
4043
  } | {
4034
4044
  output: {
@@ -4040,6 +4050,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4040
4050
  param: {
4041
4051
  runId: string;
4042
4052
  };
4053
+ } & {
4054
+ json: {
4055
+ discardWork?: boolean | undefined;
4056
+ };
4043
4057
  };
4044
4058
  } | {
4045
4059
  output: {
@@ -4052,6 +4066,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4052
4066
  param: {
4053
4067
  runId: string;
4054
4068
  };
4069
+ } & {
4070
+ json: {
4071
+ discardWork?: boolean | undefined;
4072
+ };
4055
4073
  };
4056
4074
  };
4057
4075
  };
@@ -4728,19 +4746,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4728
4746
  } & {
4729
4747
  "/repo/commit/:sha": {
4730
4748
  $get: {
4731
- output: string;
4732
- outputFormat: "text";
4733
- status: import("hono/utils/http-status").ContentfulStatusCode;
4734
- input: {
4735
- query: {
4736
- structured?: string | undefined;
4737
- };
4738
- } & {
4739
- param: {
4740
- sha: string;
4741
- };
4742
- };
4743
- } | {
4744
4749
  output: {
4745
4750
  error: string;
4746
4751
  code?: "invalid_input" | undefined;
@@ -4804,6 +4809,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4804
4809
  sha: string;
4805
4810
  };
4806
4811
  };
4812
+ } | {
4813
+ output: string;
4814
+ outputFormat: "text";
4815
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4816
+ input: {
4817
+ query: {
4818
+ structured?: string | undefined;
4819
+ };
4820
+ } & {
4821
+ param: {
4822
+ sha: string;
4823
+ };
4824
+ };
4807
4825
  };
4808
4826
  };
4809
4827
  } & {
@@ -8334,10 +8352,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8334
8352
  currentStepId?: string | undefined;
8335
8353
  currentStepBackend?: string | undefined;
8336
8354
  error?: string | undefined;
8337
- statePreview?: {
8338
- kind: "ask" | "error" | "permission" | "review";
8339
- text: string;
8340
- } | undefined;
8341
8355
  worktreePath?: string | undefined;
8342
8356
  }[];
8343
8357
  outputFormat: "json";
@@ -8516,10 +8530,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8516
8530
  currentStepId?: string | undefined;
8517
8531
  currentStepBackend?: string | undefined;
8518
8532
  error?: string | undefined;
8519
- statePreview?: {
8520
- kind: "ask" | "error" | "permission" | "review";
8521
- text: string;
8522
- } | undefined;
8523
8533
  worktreePath?: string | undefined;
8524
8534
  }[];
8525
8535
  nextCursor: string | null;
@@ -19306,20 +19316,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19306
19316
  } & {
19307
19317
  "/runs/:id/handoff": {
19308
19318
  $get: {
19309
- output: string;
19310
- outputFormat: "text";
19311
- status: 200;
19319
+ output: {
19320
+ error: string;
19321
+ };
19322
+ outputFormat: "json";
19323
+ status: 404;
19312
19324
  input: {
19313
19325
  param: {
19314
19326
  id: string;
19315
19327
  };
19316
19328
  };
19317
19329
  } | {
19318
- output: {
19319
- error: string;
19320
- };
19321
- outputFormat: "json";
19322
- status: 404;
19330
+ output: string;
19331
+ outputFormat: "text";
19332
+ status: 200;
19323
19333
  input: {
19324
19334
  param: {
19325
19335
  id: string;
@@ -19357,20 +19367,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19357
19367
  } & {
19358
19368
  "/runs/:id/diff": {
19359
19369
  $get: {
19360
- output: string;
19361
- outputFormat: "text";
19362
- status: import("hono/utils/http-status").ContentfulStatusCode;
19370
+ output: {
19371
+ error: string;
19372
+ };
19373
+ outputFormat: "json";
19374
+ status: 404 | 409;
19363
19375
  input: {
19364
19376
  param: {
19365
19377
  id: string;
19366
19378
  };
19367
19379
  };
19368
19380
  } | {
19369
- output: {
19370
- error: string;
19371
- };
19372
- outputFormat: "json";
19373
- status: 404 | 409;
19381
+ output: string;
19382
+ outputFormat: "text";
19383
+ status: import("hono/utils/http-status").ContentfulStatusCode;
19374
19384
  input: {
19375
19385
  param: {
19376
19386
  id: string;
@@ -19463,9 +19473,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19463
19473
  status: 404 | 409;
19464
19474
  input: {
19465
19475
  param: {
19466
- sha: string;
19467
- } & {
19468
19476
  id: string;
19477
+ } & {
19478
+ sha: string;
19469
19479
  };
19470
19480
  };
19471
19481
  } | {
@@ -19494,9 +19504,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19494
19504
  status: import("hono/utils/http-status").ContentfulStatusCode;
19495
19505
  input: {
19496
19506
  param: {
19497
- sha: string;
19498
- } & {
19499
19507
  id: string;
19508
+ } & {
19509
+ sha: string;
19500
19510
  };
19501
19511
  };
19502
19512
  };
@@ -20769,6 +20779,17 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20769
20779
  finishedAt: string | null;
20770
20780
  reclaimable: boolean;
20771
20781
  pastKeep: boolean;
20782
+ reclaimBlocker: {
20783
+ kind: "dirty";
20784
+ uncommittedFiles: number;
20785
+ detachedHead: boolean;
20786
+ } | {
20787
+ kind: "detached-head";
20788
+ } | {
20789
+ kind: "submodules";
20790
+ } | {
20791
+ kind: "invalid";
20792
+ } | null;
20772
20793
  }[];
20773
20794
  totalBytes: number | null;
20774
20795
  keep: number;
@@ -20788,7 +20809,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20788
20809
  status: import("hono/utils/http-status").ContentfulStatusCode;
20789
20810
  input: {
20790
20811
  json: {
20791
- [x: string]: unknown;
20812
+ discardWork: true;
20813
+ runIds: string[];
20814
+ } | {
20815
+ discardWork?: false | undefined;
20792
20816
  };
20793
20817
  };
20794
20818
  };
@@ -20806,6 +20830,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20806
20830
  param: {
20807
20831
  runId: string;
20808
20832
  };
20833
+ } & {
20834
+ json: {
20835
+ discardWork?: boolean | undefined;
20836
+ };
20809
20837
  };
20810
20838
  } | {
20811
20839
  output: {
@@ -20817,6 +20845,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20817
20845
  param: {
20818
20846
  runId: string;
20819
20847
  };
20848
+ } & {
20849
+ json: {
20850
+ discardWork?: boolean | undefined;
20851
+ };
20820
20852
  };
20821
20853
  } | {
20822
20854
  output: {
@@ -20829,6 +20861,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20829
20861
  param: {
20830
20862
  runId: string;
20831
20863
  };
20864
+ } & {
20865
+ json: {
20866
+ discardWork?: boolean | undefined;
20867
+ };
20832
20868
  };
20833
20869
  };
20834
20870
  };
@@ -21505,19 +21541,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21505
21541
  } & {
21506
21542
  "/repo/commit/:sha": {
21507
21543
  $get: {
21508
- output: string;
21509
- outputFormat: "text";
21510
- status: import("hono/utils/http-status").ContentfulStatusCode;
21511
- input: {
21512
- query: {
21513
- structured?: string | undefined;
21514
- };
21515
- } & {
21516
- param: {
21517
- sha: string;
21518
- };
21519
- };
21520
- } | {
21521
21544
  output: {
21522
21545
  error: string;
21523
21546
  code?: "invalid_input" | undefined;
@@ -21581,6 +21604,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21581
21604
  sha: string;
21582
21605
  };
21583
21606
  };
21607
+ } | {
21608
+ output: string;
21609
+ outputFormat: "text";
21610
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21611
+ input: {
21612
+ query: {
21613
+ structured?: string | undefined;
21614
+ };
21615
+ } & {
21616
+ param: {
21617
+ sha: string;
21618
+ };
21619
+ };
21584
21620
  };
21585
21621
  };
21586
21622
  } & {
@@ -25111,10 +25147,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25111
25147
  currentStepId?: string | undefined;
25112
25148
  currentStepBackend?: string | undefined;
25113
25149
  error?: string | undefined;
25114
- statePreview?: {
25115
- kind: "ask" | "error" | "permission" | "review";
25116
- text: string;
25117
- } | undefined;
25118
25150
  worktreePath?: string | undefined;
25119
25151
  }[];
25120
25152
  outputFormat: "json";
@@ -25293,10 +25325,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25293
25325
  currentStepId?: string | undefined;
25294
25326
  currentStepBackend?: string | undefined;
25295
25327
  error?: string | undefined;
25296
- statePreview?: {
25297
- kind: "ask" | "error" | "permission" | "review";
25298
- text: string;
25299
- } | undefined;
25300
25328
  worktreePath?: string | undefined;
25301
25329
  }[];
25302
25330
  nextCursor: string | null;
@@ -36083,20 +36111,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36083
36111
  } & {
36084
36112
  "/runs/:id/handoff": {
36085
36113
  $get: {
36086
- output: string;
36087
- outputFormat: "text";
36088
- status: 200;
36114
+ output: {
36115
+ error: string;
36116
+ };
36117
+ outputFormat: "json";
36118
+ status: 404;
36089
36119
  input: {
36090
36120
  param: {
36091
36121
  id: string;
36092
36122
  };
36093
36123
  };
36094
36124
  } | {
36095
- output: {
36096
- error: string;
36097
- };
36098
- outputFormat: "json";
36099
- status: 404;
36125
+ output: string;
36126
+ outputFormat: "text";
36127
+ status: 200;
36100
36128
  input: {
36101
36129
  param: {
36102
36130
  id: string;
@@ -36134,20 +36162,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36134
36162
  } & {
36135
36163
  "/runs/:id/diff": {
36136
36164
  $get: {
36137
- output: string;
36138
- outputFormat: "text";
36139
- status: import("hono/utils/http-status").ContentfulStatusCode;
36165
+ output: {
36166
+ error: string;
36167
+ };
36168
+ outputFormat: "json";
36169
+ status: 404 | 409;
36140
36170
  input: {
36141
36171
  param: {
36142
36172
  id: string;
36143
36173
  };
36144
36174
  };
36145
36175
  } | {
36146
- output: {
36147
- error: string;
36148
- };
36149
- outputFormat: "json";
36150
- status: 404 | 409;
36176
+ output: string;
36177
+ outputFormat: "text";
36178
+ status: import("hono/utils/http-status").ContentfulStatusCode;
36151
36179
  input: {
36152
36180
  param: {
36153
36181
  id: string;
@@ -36240,9 +36268,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36240
36268
  status: 404 | 409;
36241
36269
  input: {
36242
36270
  param: {
36243
- sha: string;
36244
- } & {
36245
36271
  id: string;
36272
+ } & {
36273
+ sha: string;
36246
36274
  };
36247
36275
  };
36248
36276
  } | {
@@ -36271,9 +36299,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36271
36299
  status: import("hono/utils/http-status").ContentfulStatusCode;
36272
36300
  input: {
36273
36301
  param: {
36274
- sha: string;
36275
- } & {
36276
36302
  id: string;
36303
+ } & {
36304
+ sha: string;
36277
36305
  };
36278
36306
  };
36279
36307
  };
@@ -531,10 +531,6 @@ 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;
538
534
  worktreePath?: string | undefined;
539
535
  projectId: string;
540
536
  }[];
@@ -699,10 +695,6 @@ export declare function createRunsIndexRoutes(deps: RunsIndexRouteDeps): import(
699
695
  currentStepId?: string | undefined;
700
696
  currentStepBackend?: string | undefined;
701
697
  error?: string | undefined;
702
- statePreview?: {
703
- kind: "ask" | "error" | "permission" | "review";
704
- text: string;
705
- } | undefined;
706
698
  worktreePath?: string | undefined;
707
699
  projectId: string;
708
700
  }[];
@@ -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-pr4424.8672",
3
+ "version": "0.19.0-pr4426.8671",
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-pr4424.8672",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4424.8672",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4426.8671",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4426.8671",
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": "720923de270bd02300f0364ecfa3360b0917ce4c"
90
+ "gitHead": "749b3113eb2b67b46138dfa1ecb53b97bab58fed"
91
91
  }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,m as i,o as a,s as o,u as s}from"./live-reads-Cgk2XbiP.js";import{Ln as c,Nn as l,Nr as u,Pn as d,an as f,pi as p,ti as m}from"./project-scope-context-DIcqj4jJ.js";import{n as h}from"./toaster-0sM0sfWx.js";import{Ct as g,Et as _,Ft as v,Mt as y,Qt as b,St as x,Vt as S,ft as ee,lt as te,pt as C,qt as w,ut as T,vt as E}from"./queries-DZhNVAD_.js";import{f as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as re}from"./design-icons-CzEoMH9c.js";import{t as ie}from"./createLucideIcon-BHp8sXmF.js";import{t as ae}from"./folder-browser-DnSFycbU.js";import{t as D}from"./button-B7MKxYjT.js";import{t as oe}from"./badge-DQ3U69Ht.js";import{a as O,i as k,o as A,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{Gt as L,Ht as R,Jt as z,Kt as B,N as V,Ut as H,Wt as U,Yt as W,j as G,qt as K}from"./index-CGdnowj-.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-Dso2TmRM.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-GNs7i0kP.js";var fe=ie(`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:a}){let s=i().data,[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(a??n[0]??`claude`),[m,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=C(),S=_.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)(A,{children:[(0,X.jsx)(M,{children:`Add agent account`}),(0,X.jsx)(k,{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:f,onChange:e=>p(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:o(s,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:m,placeholder:`Work`,onChange:e=>g(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:_,placeholder:r(s,f)?.accountFolderExample??pe,onChange:e=>{v(e.target.value),d(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)(D,{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)(ae,{path:c,selected:u,onSelect:e=>{d(e),v(e.path),x.reset()},onEnter:e=>{l(e),d(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)(O,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(D,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(D,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:f,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),d(null),b(!1),h(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function he(e){return c(await d.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return c(await d.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=E().data?.capabilities?.settingsAdmin===!0,n=p(),r=[`runner-install`,e],i=m({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=b({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)(D,{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)(D,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(D,{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=T(),t=i();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}=ne();(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=E(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),s=_();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:o},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)(R,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,X.jsxs)(L,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(z,{children:[(0,X.jsxs)(W,{children:[`Remove “`,a?.label,`”?`]}),(0,X.jsxs)(B,{children:[`This only forgets the account. Nothing in `,a?.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)(K,{children:[(0,X.jsx)(U,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),h(`Removed ${e.label}`)},onError:e=>h(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)(D,{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),r=p(),i=v(),o=x(),c=w(s(e)),l=b({mutationFn:e=>f(e),onSuccess:e=>r.setQueryData(S.config,e),onError:e=>h(e.message,{tone:`danger`})});if(i.data===void 0)return null;let u=se([],e),d=i.data.agentDefaults.runner??`claude`,m=a(t??d,s(e))??t??d,g=i.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:u,runner:d,accountFor:()=>null,providerStatus:o,disabled:l.isPending,onPick:e=>{e!==d&&l.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:m,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===m).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(re,{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:g[t.id]??``,disabled:l.isPending,onChange:e=>l.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,c[t.id]?.data,[g[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:c[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:i}){let a=ee();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&r(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,i&&n&&n.status!==`connected`&&r(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(D,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>h(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>h(e instanceof l&&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 ${o(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=u(e),o=g(),s=te(a,e.status===void 0),c=e.status??s.data?.status,l=c?xe[c.status]:void 0,d=Ne(e,t,c,n),f=d?(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":d.slot,className:`text-foreground`,children:d.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…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(D,{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=>h(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(oe,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ce(e.configDir)}):null,v=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Pe,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[m,f]}),_,v,y]});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:[p,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[p,b]})]})}function Pe({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=y();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)(D,{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=>h(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(D,{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{l as r,m as i,o as a,s as o,u as s}from"./live-reads-CYQJSB0x.js";import{Ln as c,Nn as l,Nr as u,Pn as d,an as f,pi as p,ti as m}from"./project-scope-context-DBPcPWqF.js";import{n as h}from"./toaster-DXCOcLoK.js";import{Ct as g,Et as _,Ft as v,Mt as y,Qt as b,St as x,Vt as S,ft as ee,lt as te,pt as C,qt as w,ut as T,vt as E}from"./queries-B27CAXOU.js";import{f as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as re}from"./design-icons-CzEoMH9c.js";import{t as ie}from"./createLucideIcon-BHp8sXmF.js";import{t as ae}from"./folder-browser-DAam7eGA.js";import{t as D}from"./button-B7MKxYjT.js";import{t as oe}from"./badge-DQ3U69Ht.js";import{a as O,i as k,o as A,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{Gt as L,Ht as R,Jt as z,Kt as B,N as V,Ut as H,Wt as U,Yt as W,j as G,qt as K}from"./index-CFtjrhlQ.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-Dj9w9Rqy.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-B7px6Rjz.js";var fe=ie(`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:a}){let s=i().data,[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(a??n[0]??`claude`),[m,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=C(),S=_.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)(A,{children:[(0,X.jsx)(M,{children:`Add agent account`}),(0,X.jsx)(k,{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:f,onChange:e=>p(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:o(s,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:m,placeholder:`Work`,onChange:e=>g(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:_,placeholder:r(s,f)?.accountFolderExample??pe,onChange:e=>{v(e.target.value),d(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)(D,{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)(ae,{path:c,selected:u,onSelect:e=>{d(e),v(e.path),x.reset()},onEnter:e=>{l(e),d(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)(O,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(D,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(D,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:f,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),d(null),b(!1),h(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function he(e){return c(await d.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return c(await d.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=E().data?.capabilities?.settingsAdmin===!0,n=p(),r=[`runner-install`,e],i=m({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=b({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)(D,{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)(D,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(D,{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=T(),t=i();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}=ne();(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=E(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),s=_();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:o},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)(R,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,X.jsxs)(L,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(z,{children:[(0,X.jsxs)(W,{children:[`Remove “`,a?.label,`”?`]}),(0,X.jsxs)(B,{children:[`This only forgets the account. Nothing in `,a?.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)(K,{children:[(0,X.jsx)(U,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),h(`Removed ${e.label}`)},onError:e=>h(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)(D,{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),r=p(),i=v(),o=x(),c=w(s(e)),l=b({mutationFn:e=>f(e),onSuccess:e=>r.setQueryData(S.config,e),onError:e=>h(e.message,{tone:`danger`})});if(i.data===void 0)return null;let u=se([],e),d=i.data.agentDefaults.runner??`claude`,m=a(t??d,s(e))??t??d,g=i.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:u,runner:d,accountFor:()=>null,providerStatus:o,disabled:l.isPending,onPick:e=>{e!==d&&l.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:m,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===m).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(re,{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:g[t.id]??``,disabled:l.isPending,onChange:e=>l.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,c[t.id]?.data,[g[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:c[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:i}){let a=ee();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&r(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,i&&n&&n.status!==`connected`&&r(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(D,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>h(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>h(e instanceof l&&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 ${o(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=u(e),o=g(),s=te(a,e.status===void 0),c=e.status??s.data?.status,l=c?xe[c.status]:void 0,d=Ne(e,t,c,n),f=d?(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":d.slot,className:`text-foreground`,children:d.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…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(D,{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=>h(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(oe,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ce(e.configDir)}):null,v=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Pe,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[m,f]}),_,v,y]});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:[p,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[p,b]})]})}function Pe({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=y();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)(D,{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=>h(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(D,{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};