@hearsay-tools/squawk 0.19.0-pr4426.8671 → 0.19.0-pr4427.8675

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 (86) hide show
  1. package/dist/contract/index.js +2 -32
  2. package/dist/contract/repo-requests.d.ts +1 -9
  3. package/dist/contract/repo.d.ts +2 -39
  4. package/dist/delegation/transport.d.ts +65 -65
  5. package/dist/git-worktree.d.ts +0 -9
  6. package/dist/git-worktree.js +3 -113
  7. package/dist/git-worktree.js.map +1 -1
  8. package/dist/runs/retention.d.ts +0 -6
  9. package/dist/runs/retention.js +3 -7
  10. package/dist/runs/retention.js.map +1 -1
  11. package/dist/server/projects-routes.d.ts +45 -45
  12. package/dist/server/repo-routes.d.ts +14 -40
  13. package/dist/server/repo-routes.js +15 -30
  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 +7 -20
  17. package/dist/server/run-checkout.js.map +1 -1
  18. package/dist/server/server.d.ts +60 -112
  19. package/dist/server/worktree-size-cache.d.ts +0 -11
  20. package/dist/server/worktree-size-cache.js +1 -3
  21. package/dist/server/worktree-size-cache.js.map +1 -1
  22. package/package.json +4 -4
  23. package/web/dist/assets/{accounts-section-vKkfS7YX.js → accounts-section-RDVTJfi7.js} +1 -1
  24. package/web/dist/assets/{activity-motion-DQoK98JL.js → activity-motion-B7km8QVK.js} +1 -1
  25. package/web/dist/assets/{activity-route-snD0tuxO.js → activity-route-CjE0yxn0.js} +1 -1
  26. package/web/dist/assets/{agent-config-section-DoleNTpD.js → agent-config-section-DQ1RaVK2.js} +1 -1
  27. package/web/dist/assets/{agent-defaults-section-ysitxF4K.js → agent-defaults-section-Dzm7jIza.js} +1 -1
  28. package/web/dist/assets/{appearance-DVdKOCpj.js → appearance-DQLHHfI4.js} +1 -1
  29. package/web/dist/assets/{archive-on-merge-field-DrgP61Ey.js → archive-on-merge-field-C7_Fwy2A.js} +1 -1
  30. package/web/dist/assets/attention-CBCeJN5w.js +1 -0
  31. package/web/dist/assets/{automations-route-FZreqZEC.js → automations-route-BcdL5f0K.js} +1 -1
  32. package/web/dist/assets/{commit-list-_lCNrPe9.js → commit-list-CN1zX-0X.js} +1 -1
  33. package/web/dist/assets/{diff-controls-BEdzHFBp.js → diff-controls-BRa3141W.js} +1 -1
  34. package/web/dist/assets/{diff-B5kvGFig.js → diff-hxqBOfZH.js} +2 -2
  35. package/web/dist/assets/{diff-view-Cn75jglS.js → diff-view-CwlKCj5V.js} +1 -1
  36. package/web/dist/assets/{file-preview-DOCPVTlT.js → file-preview-VvCzp02k.js} +1 -1
  37. package/web/dist/assets/{folder-browser-DAam7eGA.js → folder-browser-B7IbnF0d.js} +1 -1
  38. package/web/dist/assets/{git-toolbar-CZVQtcyI.js → git-toolbar-BulcGzsv.js} +1 -1
  39. package/web/dist/assets/{github-B4nythBc.js → github-By3yOcFH.js} +1 -1
  40. package/web/dist/assets/{global-activity-route-CRiXcL16.js → global-activity-route-C4-bmfh_.js} +1 -1
  41. package/web/dist/assets/{image-preview-BHVPu_Ot.js → image-preview-Pgf8bnzY.js} +1 -1
  42. package/web/dist/assets/index-C69_Sk06.css +1 -0
  43. package/web/dist/assets/{index-CFtjrhlQ.js → index-DNQcTHxV.js} +5 -5
  44. package/web/dist/assets/{label-BqslTY3y.js → label-Bt8n7Spq.js} +1 -1
  45. package/web/dist/assets/{live-reads-CYQJSB0x.js → live-reads-Crd6fVGH.js} +1 -1
  46. package/web/dist/assets/{markdown-ZJPe40Kg.js → markdown-9L65ixU6.js} +1 -1
  47. package/web/dist/assets/{notifications-section-BAxVmNvS.js → notifications-section-QWmuj2j2.js} +1 -1
  48. package/web/dist/assets/{open-in-menu-C8XOuvhZ.js → open-in-menu-BPp88ouw.js} +1 -1
  49. package/web/dist/assets/{preview-pane-connected-o04x4ut2.js → preview-pane-connected-DAM2Snwh.js} +1 -1
  50. package/web/dist/assets/{project-location-C5wL8Cmv.js → project-location-BRxXN249.js} +1 -1
  51. package/web/dist/assets/{project-router-Djen61eU.js → project-router-CLJTc7gv.js} +1 -1
  52. package/web/dist/assets/{project-scope-context-DBPcPWqF.js → project-scope-context-Rv6S_BXt.js} +1 -1
  53. package/web/dist/assets/{projects-section-DjW4lZdo.js → projects-section-DxubjpZI.js} +1 -1
  54. package/web/dist/assets/{prompt-templates-section-BZ9kPTz8.js → prompt-templates-section-CkQneT1G.js} +1 -1
  55. package/web/dist/assets/{queries-B27CAXOU.js → queries-qCF-eOqZ.js} +1 -1
  56. package/web/dist/assets/{reference-chip-BvcSKzIw.js → reference-chip-D0v0keVC.js} +1 -1
  57. package/web/dist/assets/{remote-settings-notice-B7px6Rjz.js → remote-settings-notice-COojb6XK.js} +1 -1
  58. package/web/dist/assets/repo-git-Mgk4Qcmo.js +1 -0
  59. package/web/dist/assets/{report-reader-CFDdbV9p.js → report-reader-zWwalJDN.js} +1 -1
  60. package/web/dist/assets/{reports-C_oLuf2Z.js → reports-BCHWt3zy.js} +1 -1
  61. package/web/dist/assets/{resources-section-DPKpkT00.js → resources-section-Cb2WIqNv.js} +1 -1
  62. package/web/dist/assets/{run-header-Cvjx6fLe.js → run-header-DeprqSP7.js} +1 -1
  63. package/web/dist/assets/{select-DCgMFs3P.js → select-y3oRuA2s.js} +1 -1
  64. package/web/dist/assets/{session-context-section-DUDyUnD6.js → session-context-section-CiPNMiL7.js} +1 -1
  65. package/web/dist/assets/{settings-agent-picker-Dj9w9Rqy.js → settings-agent-picker-CJJJncuA.js} +1 -1
  66. package/web/dist/assets/{settings-shell-Dj0lpmcY.js → settings-shell-CLToW28f.js} +1 -1
  67. package/web/dist/assets/{sidebar-section-CFausX6G.js → sidebar-section-VOYJarPd.js} +1 -1
  68. package/web/dist/assets/{skills-C59hjIpW.js → skills-BySF3yBA.js} +1 -1
  69. package/web/dist/assets/{tab-link-B7UoArdY.js → tab-link-Bu1g-ArE.js} +1 -1
  70. package/web/dist/assets/{task-changes-HqrNlmGK.js → task-changes-NUwvUglx.js} +1 -1
  71. package/web/dist/assets/{task-commits-QHeItJLu.js → task-commits-CpV1Hz9L.js} +1 -1
  72. package/web/dist/assets/{task-files-QFVIGaz9.js → task-files-Bu-L_NRW.js} +1 -1
  73. package/web/dist/assets/{task-github-item-UKsVEOul.js → task-github-item-DhiTqCjk.js} +1 -1
  74. package/web/dist/assets/{task-groups-BwdcbABY.js → task-groups-4tzKGROI.js} +1 -1
  75. package/web/dist/assets/{task-thread-CnGokWLH.js → task-thread-CKkTeQdi.js} +1 -1
  76. package/web/dist/assets/{tasks-table-Y4sDrQge.js → tasks-table-C5uoZMFs.js} +1 -1
  77. package/web/dist/assets/{thread-state-Cu4CGztL.js → thread-state-B_ZqjjRr.js} +1 -1
  78. package/web/dist/assets/{toaster-DXCOcLoK.js → toaster-BXnLIU3z.js} +1 -1
  79. package/web/dist/assets/{use-hand-to-agent-state-Cxrl8yfx.js → use-hand-to-agent-state-K864D69i.js} +1 -1
  80. package/web/dist/assets/{workflows-Dl7hrImQ.js → workflows-DlTkuM0J.js} +1 -1
  81. package/web/dist/assets/{workspace-tools-ti_LJ2EA.js → workspace-tools-BRK7f1Hk.js} +1 -1
  82. package/web/dist/assets/{worktrees-section-CpVznl7Q.js → worktrees-section-BXI0-7HH.js} +1 -1
  83. package/web/dist/index.html +14 -14
  84. package/web/dist/assets/attention-CcwTbcYb.js +0 -1
  85. package/web/dist/assets/index-COOMjwiP.css +0 -1
  86. package/web/dist/assets/repo-git-OhYxFr6e.js +0 -1
@@ -3067,22 +3067,6 @@ var worktreeEntrySchema = z24.discriminatedUnion("type", [
3067
3067
  content: z24.string().optional()
3068
3068
  })
3069
3069
  ]);
3070
- var worktreeReclaimBlockerSchema = z24.discriminatedUnion("kind", [
3071
- z24.object({
3072
- kind: z24.literal("dirty"),
3073
- uncommittedFiles: z24.number().int().min(1),
3074
- detachedHead: z24.boolean()
3075
- }),
3076
- z24.object({
3077
- kind: z24.literal("detached-head")
3078
- }),
3079
- z24.object({
3080
- kind: z24.literal("submodules")
3081
- }),
3082
- z24.object({
3083
- kind: z24.literal("invalid")
3084
- })
3085
- ]);
3086
3070
  var worktreeInfoSchema = z24.object({
3087
3071
  runId: z24.string(),
3088
3072
  title: z24.string(),
@@ -3091,8 +3075,7 @@ var worktreeInfoSchema = z24.object({
3091
3075
  sizeBytes: z24.number().nullable(),
3092
3076
  finishedAt: z24.string().nullable(),
3093
3077
  reclaimable: z24.boolean(),
3094
- pastKeep: z24.boolean(),
3095
- reclaimBlocker: worktreeReclaimBlockerSchema.nullable()
3078
+ pastKeep: z24.boolean()
3096
3079
  });
3097
3080
  var worktreesResponseSchema = z24.object({
3098
3081
  worktrees: z24.array(worktreeInfoSchema),
@@ -6162,18 +6145,7 @@ import { z as z52 } from "zod";
6162
6145
  var gitCommitSchema = z52.object({
6163
6146
  message: z52.string().trim().min(1, "must not be empty").max(5e3)
6164
6147
  });
6165
- var reclaimWorktreeBodySchema = z52.object({
6166
- discardWork: z52.boolean().optional()
6167
- });
6168
- var reclaimBodySchema = z52.union([
6169
- z52.object({
6170
- discardWork: z52.literal(true),
6171
- runIds: z52.array(z52.string().min(1)).min(1)
6172
- }),
6173
- z52.object({
6174
- discardWork: z52.literal(false).optional()
6175
- })
6176
- ]);
6148
+ var reclaimBodySchema = z52.object({}).passthrough();
6177
6149
  var repoBranchSchema = z52.object({
6178
6150
  name: z52.string().trim().min(1).max(200),
6179
6151
  from: z52.string().trim().min(1).max(200).optional()
@@ -6863,7 +6835,6 @@ export {
6863
6835
  queuedMessageSchema,
6864
6836
  reclaimBodySchema,
6865
6837
  reclaimRunParamsSchema,
6866
- reclaimWorktreeBodySchema,
6867
6838
  reclaimWorktreeResponseSchema,
6868
6839
  reclaimWorktreesResponseSchema,
6869
6840
  refNumberFromUrl,
@@ -7130,7 +7101,6 @@ export {
7130
7101
  worktreeEntrySchema,
7131
7102
  worktreeFilesQuerySchema,
7132
7103
  worktreeInfoSchema,
7133
- worktreeReclaimBlockerSchema,
7134
7104
  worktreeSetupConfigSchema,
7135
7105
  worktreesResponseSchema,
7136
7106
  writableAutomationTask,
@@ -2,15 +2,7 @@ import { z } from 'zod';
2
2
  export declare const gitCommitSchema: z.ZodObject<{
3
3
  message: z.ZodString;
4
4
  }, z.core.$strip>;
5
- export declare const reclaimWorktreeBodySchema: z.ZodObject<{
6
- discardWork: z.ZodOptional<z.ZodBoolean>;
7
- }, z.core.$strip>;
8
- export declare const reclaimBodySchema: z.ZodUnion<readonly [z.ZodObject<{
9
- discardWork: z.ZodLiteral<true>;
10
- runIds: z.ZodArray<z.ZodString>;
11
- }, z.core.$strip>, z.ZodObject<{
12
- discardWork: z.ZodOptional<z.ZodLiteral<false>>;
13
- }, z.core.$strip>]>;
5
+ export declare const reclaimBodySchema: z.ZodObject<{}, z.core.$loose>;
14
6
  export declare const repoBranchSchema: z.ZodObject<{
15
7
  name: z.ZodString;
16
8
  from: z.ZodOptional<z.ZodString>;
@@ -453,25 +453,10 @@ export declare const worktreeEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
453
453
  content: z.ZodOptional<z.ZodString>;
454
454
  }, z.core.$strip>], "type">;
455
455
  export type WorktreeEntry = z.infer<typeof worktreeEntrySchema>;
456
- /** Why a finished worktree cannot be reclaimed cleanly without discarding work. */
457
- export declare const worktreeReclaimBlockerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
458
- kind: z.ZodLiteral<"dirty">;
459
- uncommittedFiles: z.ZodNumber;
460
- detachedHead: z.ZodBoolean;
461
- }, z.core.$strip>, z.ZodObject<{
462
- kind: z.ZodLiteral<"detached-head">;
463
- }, z.core.$strip>, z.ZodObject<{
464
- kind: z.ZodLiteral<"submodules">;
465
- }, z.core.$strip>, z.ZodObject<{
466
- kind: z.ZodLiteral<"invalid">;
467
- }, z.core.$strip>], "kind">;
468
- export type WorktreeReclaimBlocker = z.infer<typeof worktreeReclaimBlockerSchema>;
469
456
  /** One materialized task worktree in the management panel (#483). `sizeBytes` is null when `du`
470
457
  * is unavailable (Windows / missing). `reclaimable` = finished, has a directory, not yet
471
- * reclaimed (retention's rule). `pastKeep` = reclaimable AND outside the newest `keep`.
472
- * `reclaimBlocker` is non-null when a clean reclaim would refuse the checkout (uncommitted files,
473
- * detached HEAD with no keeping ref, or an unregistered/broken directory); explicit discard can
474
- * still reclaim its directory while keeping the branch. */
458
+ * reclaimed (retention's rule). `pastKeep` = reclaimable AND outside the newest `keep`, i.e.
459
+ * exactly the rows a "Reclaim now" would take; a reclaimable row that is not past it is kept. */
475
460
  export declare const worktreeInfoSchema: z.ZodObject<{
476
461
  runId: z.ZodString;
477
462
  title: z.ZodString;
@@ -489,17 +474,6 @@ export declare const worktreeInfoSchema: z.ZodObject<{
489
474
  finishedAt: z.ZodNullable<z.ZodString>;
490
475
  reclaimable: z.ZodBoolean;
491
476
  pastKeep: z.ZodBoolean;
492
- reclaimBlocker: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
493
- kind: z.ZodLiteral<"dirty">;
494
- uncommittedFiles: z.ZodNumber;
495
- detachedHead: z.ZodBoolean;
496
- }, z.core.$strip>, z.ZodObject<{
497
- kind: z.ZodLiteral<"detached-head">;
498
- }, z.core.$strip>, z.ZodObject<{
499
- kind: z.ZodLiteral<"submodules">;
500
- }, z.core.$strip>, z.ZodObject<{
501
- kind: z.ZodLiteral<"invalid">;
502
- }, z.core.$strip>], "kind">>;
503
477
  }, z.core.$strip>;
504
478
  export type WorktreeInfo = z.infer<typeof worktreeInfoSchema>;
505
479
  /** `GET /api/v1/worktrees` (#483): the worktrees on disk, their total size (null when any
@@ -522,17 +496,6 @@ export declare const worktreesResponseSchema: z.ZodObject<{
522
496
  finishedAt: z.ZodNullable<z.ZodString>;
523
497
  reclaimable: z.ZodBoolean;
524
498
  pastKeep: z.ZodBoolean;
525
- reclaimBlocker: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
526
- kind: z.ZodLiteral<"dirty">;
527
- uncommittedFiles: z.ZodNumber;
528
- detachedHead: z.ZodBoolean;
529
- }, z.core.$strip>, z.ZodObject<{
530
- kind: z.ZodLiteral<"detached-head">;
531
- }, z.core.$strip>, z.ZodObject<{
532
- kind: z.ZodLiteral<"submodules">;
533
- }, z.core.$strip>, z.ZodObject<{
534
- kind: z.ZodLiteral<"invalid">;
535
- }, z.core.$strip>], "kind">>;
536
499
  }, z.core.$strip>>;
537
500
  totalBytes: z.ZodNullable<z.ZodNumber>;
538
501
  keep: z.ZodNumber;
@@ -2,18 +2,6 @@ import type { DelegationRoutes } from './routes.ts';
2
2
  export declare function createDelegationApp(routes: DelegationRoutes): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<{
3
3
  "/list": {
4
4
  $get: {
5
- output: {
6
- error: string;
7
- code?: "invalid_input" | undefined;
8
- };
9
- outputFormat: "json";
10
- status: 400;
11
- input: {
12
- query: {
13
- offset?: string | undefined;
14
- };
15
- };
16
- } | {
17
5
  output: {
18
6
  workers: {
19
7
  workerId: string;
@@ -66,6 +54,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
66
54
  offset?: string | undefined;
67
55
  };
68
56
  };
57
+ } | {
58
+ output: {
59
+ error: string;
60
+ code?: "invalid_input" | undefined;
61
+ };
62
+ outputFormat: "json";
63
+ status: 400;
64
+ input: {
65
+ query: {
66
+ offset?: string | undefined;
67
+ };
68
+ };
69
69
  };
70
70
  };
71
71
  } & {
@@ -652,18 +652,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
652
652
  } & {
653
653
  "/:workerId": {
654
654
  $get: {
655
- output: {
656
- error: string;
657
- code?: "invalid_input" | undefined;
658
- };
659
- outputFormat: "json";
660
- status: 400;
661
- input: {
662
- param: {
663
- workerId: string;
664
- };
665
- };
666
- } | {
667
655
  output: {
668
656
  workerId: string;
669
657
  settled: boolean;
@@ -788,11 +776,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
788
776
  workerId: string;
789
777
  };
790
778
  };
791
- };
792
- };
793
- } & {
794
- "/:workerId/collect": {
795
- $post: {
779
+ } | {
796
780
  output: {
797
781
  error: string;
798
782
  code?: "invalid_input" | undefined;
@@ -803,10 +787,12 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
803
787
  param: {
804
788
  workerId: string;
805
789
  };
806
- } & {
807
- json: Record<string, never>;
808
790
  };
809
- } | {
791
+ };
792
+ };
793
+ } & {
794
+ "/:workerId/collect": {
795
+ $post: {
810
796
  output: {
811
797
  workerId: string;
812
798
  parentRunId: string;
@@ -929,11 +915,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
929
915
  } & {
930
916
  json: Record<string, never>;
931
917
  };
932
- };
933
- };
934
- } & {
935
- "/:workerId/steer": {
936
- $post: {
918
+ } | {
937
919
  output: {
938
920
  error: string;
939
921
  code?: "invalid_input" | undefined;
@@ -945,11 +927,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
945
927
  workerId: string;
946
928
  };
947
929
  } & {
948
- json: {
949
- text: string;
950
- };
930
+ json: Record<string, never>;
951
931
  };
952
- } | {
932
+ };
933
+ };
934
+ } & {
935
+ "/:workerId/steer": {
936
+ $post: {
953
937
  output: {
954
938
  workerId: string;
955
939
  state: "delivered" | "queued";
@@ -965,11 +949,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
965
949
  text: string;
966
950
  };
967
951
  };
968
- };
969
- };
970
- } & {
971
- "/:workerId/stop": {
972
- $post: {
952
+ } | {
973
953
  output: {
974
954
  error: string;
975
955
  code?: "invalid_input" | undefined;
@@ -981,9 +961,15 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
981
961
  workerId: string;
982
962
  };
983
963
  } & {
984
- json: Record<string, never>;
964
+ json: {
965
+ text: string;
966
+ };
985
967
  };
986
- } | {
968
+ };
969
+ };
970
+ } & {
971
+ "/:workerId/stop": {
972
+ $post: {
987
973
  output: {
988
974
  workerId: string;
989
975
  state: "stopping" | "terminated";
@@ -997,11 +983,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
997
983
  } & {
998
984
  json: Record<string, never>;
999
985
  };
1000
- };
1001
- };
1002
- } & {
1003
- "/:workerId/destroy": {
1004
- $post: {
986
+ } | {
1005
987
  output: {
1006
988
  error: string;
1007
989
  code?: "invalid_input" | undefined;
@@ -1013,11 +995,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1013
995
  workerId: string;
1014
996
  };
1015
997
  } & {
1016
- json: {
1017
- discardWork?: true | undefined;
1018
- };
998
+ json: Record<string, never>;
1019
999
  };
1020
- } | {
1000
+ };
1001
+ };
1002
+ } & {
1003
+ "/:workerId/destroy": {
1004
+ $post: {
1021
1005
  output: {
1022
1006
  workerId: string;
1023
1007
  state: "complete" | "incomplete";
@@ -1046,6 +1030,22 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1046
1030
  discardWork?: true | undefined;
1047
1031
  };
1048
1032
  };
1033
+ } | {
1034
+ output: {
1035
+ error: string;
1036
+ code?: "invalid_input" | undefined;
1037
+ };
1038
+ outputFormat: "json";
1039
+ status: 400;
1040
+ input: {
1041
+ param: {
1042
+ workerId: string;
1043
+ };
1044
+ } & {
1045
+ json: {
1046
+ discardWork?: true | undefined;
1047
+ };
1048
+ };
1049
1049
  } | {
1050
1050
  output: {
1051
1051
  workerId: string;
@@ -1081,11 +1081,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1081
1081
  "/:workerId/diff": {
1082
1082
  $get: {
1083
1083
  output: {
1084
- error: string;
1085
- code?: "invalid_input" | undefined;
1084
+ workerId: string;
1085
+ baselineSha: string;
1086
+ diff: string;
1087
+ truncated: boolean;
1086
1088
  };
1087
1089
  outputFormat: "json";
1088
- status: 400;
1090
+ status: 200;
1089
1091
  input: {
1090
1092
  param: {
1091
1093
  workerId: string;
@@ -1093,13 +1095,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1093
1095
  };
1094
1096
  } | {
1095
1097
  output: {
1096
- workerId: string;
1097
- baselineSha: string;
1098
- diff: string;
1099
- truncated: boolean;
1098
+ error: string;
1099
+ code?: "invalid_input" | undefined;
1100
1100
  };
1101
1101
  outputFormat: "json";
1102
- status: 200;
1102
+ status: 400;
1103
1103
  input: {
1104
1104
  param: {
1105
1105
  workerId: string;
@@ -1,4 +1,3 @@
1
- import type { WorktreeReclaimBlocker } from './contract/index.js';
2
1
  import { type LiveIndexCheck, type DiffRefusal } from './git-private-index.ts';
3
2
  import { type WorktreeGitResult } from './git-worktree-lock.ts';
4
3
  /** One worktree per task (spec 006). Only createWorktree throws; its caller reports failure. */
@@ -56,14 +55,6 @@ export type RemoveWorktreeOptions = {
56
55
  assertCurrent?: () => void;
57
56
  };
58
57
  export declare function removeWorktree(repoRoot: string, worktreePath: string, branch?: string, opts?: RemoveWorktreeOptions): Promise<void>;
59
- /**
60
- * Inspect whether a finished worktree directory would be refused by a clean reclaim
61
- * (`removeCleanWorktree`): uncommitted files, a detached HEAD with no branch/remote ref holding
62
- * its commit, initialized submodules, or an unregistered/broken directory (missing `.git`).
63
- * Returns `null` when clean and ref-backed (or when the directory no longer exists).
64
- * Best-effort: never throws.
65
- */
66
- export declare function inspectWorktreeReclaimBlocker(repoRoot: string, worktreePath: string): Promise<WorktreeReclaimBlocker | null>;
67
58
  /**
68
59
  * Whole-branch committed, uncommitted and untracked diff against the merge-base. Preserve this
69
60
  * anchor for the protected text endpoint and conservative settlement checks.
@@ -3,7 +3,7 @@ import { projectPaths, isFallbackProjectPath } from './project-paths.js';
3
3
  import { git } from './git-command.js';
4
4
  import { ownedWorkspaceSchema } from './contract/index.js';
5
5
  import { existsSync, realpathSync } from 'node:fs';
6
- import { chmod, lstat, mkdir, readdir, readFile, rm, rmdir } from 'node:fs/promises';
6
+ import { lstat, mkdir, readdir, readFile, rm, rmdir } from 'node:fs/promises';
7
7
  import { basename, dirname, join, resolve } from 'node:path';
8
8
  import { resolveTaskDiffBase } from './git-diff-base.js';
9
9
  import { withPrivateIndex } from './git-private-index.js';
@@ -406,117 +406,7 @@ async function runBeforeWorktreeRemove(opts) {
406
406
  await opts?.beforeRemove?.().catch(() => undefined);
407
407
  opts?.assertCurrent?.();
408
408
  }
409
- /** Count entries in `git status --porcelain=v1 -z` output, skipping rename/copy source paths. */
410
- function countPorcelainEntries(stdout) {
411
- const fields = stdout.split('\0');
412
- let files = 0;
413
- for (let i = 0; i < fields.length; i++) {
414
- const entry = fields[i];
415
- if (entry.length < 4)
416
- continue;
417
- files++;
418
- if (/[RC]/.test(entry.slice(0, 2)))
419
- i++;
420
- }
421
- return files;
422
- }
423
- /** True only when `worktreePath` is its own Git worktree root (not walking up to `repoRoot`). */
424
- async function isWorktreeRoot(worktreePath, runGitFn) {
425
- const top = await runGitFn(worktreePath, ['rev-parse', '--show-toplevel']);
426
- return top.ok && canonicalPath(top.stdout.trim()) === canonicalPath(worktreePath);
427
- }
428
- /** True when Git's unforced `worktree remove` would refuse this worktree for submodules:
429
- * either the worktree's admin `modules` directory exists (even after `git submodule deinit`,
430
- * matching Git's `validate_no_submodules`) or a tracked gitlink (`160000`) directory is non-empty. */
431
- async function hasWorktreeSubmodules(worktreePath) {
432
- const modules = await git(worktreePath, ['rev-parse', '--path-format=absolute', '--git-path', 'modules']);
433
- if (modules.ok && modules.stdout.trim()) {
434
- const info = await lstat(modules.stdout.trim()).catch(() => undefined);
435
- if (info?.isDirectory())
436
- return true;
437
- }
438
- const listed = await git(worktreePath, ['--no-optional-locks', 'ls-files', '-s', '-z']);
439
- if (!listed.ok)
440
- return false;
441
- for (const entry of listed.stdout.split('\0')) {
442
- if (!entry.startsWith('160000 '))
443
- continue;
444
- const tab = entry.indexOf('\t');
445
- if (tab < 0)
446
- continue;
447
- const contents = await readdir(join(worktreePath, entry.slice(tab + 1))).catch(() => []);
448
- if (contents.length > 0)
449
- return true;
450
- }
451
- return false;
452
- }
453
- /**
454
- * Inspect whether a finished worktree directory would be refused by a clean reclaim
455
- * (`removeCleanWorktree`): uncommitted files, a detached HEAD with no branch/remote ref holding
456
- * its commit, initialized submodules, or an unregistered/broken directory (missing `.git`).
457
- * Returns `null` when clean and ref-backed (or when the directory no longer exists).
458
- * Best-effort: never throws.
459
- */
460
- export async function inspectWorktreeReclaimBlocker(repoRoot, worktreePath) {
461
- if (!existsSync(worktreePath))
462
- return null;
463
- if (!(await isWorktreeRoot(worktreePath, git)))
464
- return { kind: 'invalid' };
465
- const head = await git(worktreePath, ['rev-parse', '--verify', '--quiet', 'HEAD^{commit}']);
466
- const sha = head.stdout.trim();
467
- if (!head.ok || !sha)
468
- return { kind: 'invalid' };
469
- const status = await git(worktreePath, ['--no-optional-locks', 'status', '--porcelain=v1', '-z', '--untracked-files=normal']);
470
- if (!status.ok)
471
- return { kind: 'invalid' };
472
- const uncommittedFiles = countPorcelainEntries(status.stdout);
473
- const sym = await git(worktreePath, ['symbolic-ref', '-q', 'HEAD']);
474
- let detachedHead = false;
475
- if (!sym.ok || !sym.stdout.trim().startsWith('refs/heads/')) {
476
- const kept = await git(repoRoot, ['for-each-ref', '--contains', sha, '--count=1', '--format=%(refname)', 'refs/heads', 'refs/remotes']);
477
- if (!kept.ok)
478
- return { kind: 'invalid' };
479
- detachedHead = kept.stdout.trim() === '';
480
- }
481
- if (uncommittedFiles > 0)
482
- return { kind: 'dirty', uncommittedFiles, detachedHead };
483
- if (detachedHead)
484
- return { kind: 'detached-head' };
485
- if (await hasWorktreeSubmodules(worktreePath))
486
- return { kind: 'submodules' };
487
- return null;
488
- }
489
- /** Make directories writable so POSIX unlink can remove entries inside read-only fixtures.
490
- * Never chmod regular files: hard-linked files (such as pnpm node_modules) share their inode
491
- * mode with paths outside this worktree. */
492
- async function makeTreeWritable(dir) {
493
- await chmod(dir, 0o700).catch(() => undefined);
494
- const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
495
- for (const entry of entries) {
496
- if (entry.isSymbolicLink())
497
- continue;
498
- if (entry.isDirectory())
499
- await makeTreeWritable(join(dir, entry.name));
500
- }
501
- }
502
- async function removeTreeAllowingReadOnly(worktreePath) {
503
- try {
504
- await rm(worktreePath, { recursive: true, force: true });
505
- }
506
- catch (err) {
507
- const code = err?.code;
508
- if (code !== 'EACCES' && code !== 'EPERM')
509
- return;
510
- const info = await lstat(worktreePath).catch(() => undefined);
511
- if (!info || info.isSymbolicLink() || !info.isDirectory())
512
- return;
513
- await makeTreeWritable(worktreePath);
514
- await rm(worktreePath, { recursive: true, force: true }).catch(() => undefined);
515
- }
516
- }
517
409
  async function removeCleanWorktree(repoRoot, worktreePath, protection, git, beforeRemove) {
518
- if (!(await isWorktreeRoot(worktreePath, git)))
519
- return;
520
410
  const head = await git(worktreePath, ['rev-parse', '--verify', '--quiet', 'HEAD^{commit}']);
521
411
  const sha = head.stdout.trim();
522
412
  if (!head.ok || !sha)
@@ -540,14 +430,14 @@ async function removeCleanWorktree(repoRoot, worktreePath, protection, git, befo
540
430
  }
541
431
  async function forceRemoveWorktree(repoRoot, worktreePath, branch, reclaimOwnedDirectory, protection, git, beforeRemove) {
542
432
  await beforeRemove();
543
- await git(repoRoot, ['worktree', 'remove', '--force', '--force', worktreePath]);
433
+ await git(repoRoot, ['worktree', 'remove', '--force', worktreePath]);
544
434
  // Owned-path reclaim must not `rm` a receipt path that is no longer a git
545
435
  // worktree — the directory may have been replaced with unrelated files.
546
436
  // For owned resources Git already removed the exact checkout. Never recursively delete a
547
437
  // path recreated after that operation (possibly by another execution/controller).
548
438
  if (reclaimOwnedDirectory && protection.paths.has(worktreePath))
549
439
  return;
550
- await removeTreeAllowingReadOnly(worktreePath);
440
+ await rm(worktreePath, { recursive: true, force: true }).catch(() => undefined);
551
441
  if (protection.paths.size === 0)
552
442
  await git(repoRoot, ['worktree', 'prune']);
553
443
  if (branch)