@hearsay-tools/squawk 0.18.0-dev.7436 → 0.18.0-dev.7444

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 (84) hide show
  1. package/dist/ci-wait/tools.d.ts +4 -4
  2. package/dist/contract/delegation.d.ts +26 -0
  3. package/dist/contract/index.js +13 -1
  4. package/dist/contract/runs.d.ts +3 -0
  5. package/dist/delegation/cli.js +10 -7
  6. package/dist/delegation/cli.js.map +1 -1
  7. package/dist/delegation/owned-workspace-release.d.ts +2 -3
  8. package/dist/delegation/owned-workspace-release.js +2 -2
  9. package/dist/delegation/owned-workspace-release.js.map +1 -1
  10. package/dist/delegation/routes.d.ts +19 -3
  11. package/dist/delegation/routes.js +3 -3
  12. package/dist/delegation/routes.js.map +1 -1
  13. package/dist/delegation/service.d.ts +16 -3
  14. package/dist/delegation/service.js +4 -4
  15. package/dist/delegation/service.js.map +1 -1
  16. package/dist/delegation/transport.d.ts +34 -18
  17. package/dist/delegation/worker-cleanup.d.ts +6 -2
  18. package/dist/delegation/worker-cleanup.js +27 -7
  19. package/dist/delegation/worker-cleanup.js.map +1 -1
  20. package/dist/delegation/workspace-kinds.d.ts +8 -2
  21. package/dist/delegation/workspace-kinds.js +7 -2
  22. package/dist/delegation/workspace-kinds.js.map +1 -1
  23. package/dist/delegation/workspace-record.js +3 -2
  24. package/dist/delegation/workspace-record.js.map +1 -1
  25. package/dist/delegation/workspace-removal.d.ts +9 -4
  26. package/dist/delegation/workspace-removal.js +55 -38
  27. package/dist/delegation/workspace-removal.js.map +1 -1
  28. package/dist/delegation/workspace-work.d.ts +35 -0
  29. package/dist/delegation/workspace-work.js +75 -0
  30. package/dist/delegation/workspace-work.js.map +1 -0
  31. package/dist/runs/delegation-state.d.ts +1 -0
  32. package/dist/runs/run-exits.d.ts +6 -0
  33. package/dist/runs/store.d.ts +2 -0
  34. package/dist/server/server.d.ts +60 -8
  35. package/dist/server/server.js +3 -3
  36. package/dist/server/server.js.map +1 -1
  37. package/dist/workflows/continuation-admission.d.ts +1 -0
  38. package/dist/workflows/run/wait-engine.d.ts +1 -0
  39. package/package.json +4 -4
  40. package/web/dist/assets/{activity-motion-CQKAazEg.js → activity-motion-dNVCOgIS.js} +1 -1
  41. package/web/dist/assets/{activity-route-C6oKznjI.js → activity-route-DMnwyl9c.js} +1 -1
  42. package/web/dist/assets/{agent-accounts-T6Q6vL9r.js → agent-accounts-DpQGh6AY.js} +1 -1
  43. package/web/dist/assets/attention-KNpeHgY7.js +1 -0
  44. package/web/dist/assets/{commit-diff-panel-DUeb6EUF.js → commit-diff-panel-0YMWMSS5.js} +1 -1
  45. package/web/dist/assets/{diff-DVALb2F0.js → diff-uoV05LOo.js} +2 -2
  46. package/web/dist/assets/{diff-view-DxV_tLUt.js → diff-view-DsgNtCun.js} +1 -1
  47. package/web/dist/assets/{file-preview-BFS1UwXr.js → file-preview-lbIox3_r.js} +1 -1
  48. package/web/dist/assets/{git-toolbar-C89FoROy.js → git-toolbar-BKPdSdFU.js} +1 -1
  49. package/web/dist/assets/{github-B4Meld9S.js → github-CKFgh3_h.js} +1 -1
  50. package/web/dist/assets/{global-activity-route-CuU0bmKz.js → global-activity-route-Dn7DpFx9.js} +1 -1
  51. package/web/dist/assets/index-Du3iOaSl.js +14 -0
  52. package/web/dist/assets/{markdown-DuVt8jbQ.js → markdown-4X0eZfcY.js} +1 -1
  53. package/web/dist/assets/{picker-pill-CwbEYCjL.js → picker-pill-CbOFEu2Q.js} +1 -1
  54. package/web/dist/assets/{preview-pane-connected-CSwZ6Xl5.js → preview-pane-connected-Bglr5RzA.js} +1 -1
  55. package/web/dist/assets/{project-router-B73juPC3.js → project-router-mfT7Zjrz.js} +1 -1
  56. package/web/dist/assets/project-scope-context-CN_qUdKE.js +4 -0
  57. package/web/dist/assets/{prompt-template-menu-nShN9uXQ.js → prompt-template-menu-DRZbBFIy.js} +1 -1
  58. package/web/dist/assets/queries-DCMqb5cz.js +1 -0
  59. package/web/dist/assets/{reference-chip-yXXzlbts.js → reference-chip-DpSg7B3L.js} +1 -1
  60. package/web/dist/assets/{repo-git-CDOCx8X4.js → repo-git-PioGdOOQ.js} +1 -1
  61. package/web/dist/assets/{report-reader-CgYcjz5W.js → report-reader-CoWKOnD5.js} +1 -1
  62. package/web/dist/assets/{reports-nt1YPqOJ.js → reports-CDR_xSv6.js} +1 -1
  63. package/web/dist/assets/run-header--v3zgN-D.js +2 -0
  64. package/web/dist/assets/{skills-D45ND2YB.js → skills-CMCb5oGu.js} +1 -1
  65. package/web/dist/assets/{tab-link-BwGcrAfg.js → tab-link-DRCtSLMC.js} +1 -1
  66. package/web/dist/assets/{task-changes-NPbEK_pM.js → task-changes-gdJm6bLV.js} +1 -1
  67. package/web/dist/assets/{task-commits-D_YFcFld.js → task-commits-Ddrh4yVp.js} +1 -1
  68. package/web/dist/assets/{task-files-eHbJ4ftX.js → task-files-B3GsdzeL.js} +1 -1
  69. package/web/dist/assets/{task-github-item-D0splQvy.js → task-github-item-DT3qM81J.js} +1 -1
  70. package/web/dist/assets/{task-thread-B_pBPheb.js → task-thread-Co28WXQc.js} +1 -1
  71. package/web/dist/assets/{thread-state-DFXgDkC_.js → thread-state-Rg1AjAMm.js} +1 -1
  72. package/web/dist/assets/{use-desktop-D3W91YLi.js → use-desktop-BylUB37R.js} +1 -1
  73. package/web/dist/assets/{use-hand-to-agent-state-CVgHwx89.js → use-hand-to-agent-state-BuuvdaEy.js} +1 -1
  74. package/web/dist/assets/{useInfiniteQuery-B6Kx_mBY.js → useInfiniteQuery-kvMYflQO.js} +1 -1
  75. package/web/dist/assets/useQuery-CBcJwUYN.js +1 -0
  76. package/web/dist/assets/{workflows-fidBxppB.js → workflows-BROu_Zz4.js} +2 -2
  77. package/web/dist/assets/{ws-Bb6iWQU5.js → ws-X7SxM79d.js} +1 -1
  78. package/web/dist/index.html +13 -13
  79. package/web/dist/assets/attention-KYhxOgNq.js +0 -1
  80. package/web/dist/assets/index-Cwfi9cG9.js +0 -14
  81. package/web/dist/assets/project-scope-context-B2P3zXB1.js +0 -4
  82. package/web/dist/assets/queries-B6a1W2sa.js +0 -1
  83. package/web/dist/assets/run-header-DaqWXi5W.js +0 -2
  84. package/web/dist/assets/useQuery-D8aTqerT.js +0 -1
@@ -0,0 +1,75 @@
1
+ import { entryExists } from './entry-exists.js';
2
+ import { branchLog, workspaceGit } from './workspace-git.js';
3
+ /** For the branch tip and each reflog entry that is not the baseline, a branch or remote-tracking
4
+ * ref that contains it, other than this branch and never an alias; undefined when one has none,
5
+ * or when one ref is seen at two tips. A tip's ref also keeps every commit under it. */
6
+ export async function keepingRefs(git, workspace, branch) {
7
+ const tip = branch.sha;
8
+ const refs = new Map();
9
+ for (const sha of new Set([tip, ...reflogTips(branch)])) {
10
+ if (sha === workspace.baselineSha)
11
+ continue;
12
+ if (sha !== tip && refs.size > 0 && (await git(['merge-base', '--is-ancestor', sha, tip])).ok)
13
+ continue;
14
+ const listed = await git(['for-each-ref', '--contains', sha, '--format=%(refname)%00%(objectname)%00%(symref)', 'refs/heads', 'refs/remotes']);
15
+ const witness = listed.ok ? listed.stdout.split('\n').map(line => line.split('\0'))
16
+ .find(([ref, at, symref]) => ref && at && !symref && ref !== `refs/heads/${workspace.branch}`) : undefined;
17
+ if (!witness || (refs.has(witness[0]) && refs.get(witness[0]) !== witness[1]))
18
+ return undefined;
19
+ refs.set(witness[0], witness[1]);
20
+ }
21
+ return [...refs].map(([ref, sha]) => ({ ref, sha }));
22
+ }
23
+ function reflogTips(branch) {
24
+ return branch.log.content.toString('utf8').split('\n').filter(Boolean).map(entry => entry.split(' ')[1] ?? '').filter(Boolean);
25
+ }
26
+ /** Commits the branch tip or its reflog holds that no other branch or remote-tracking ref
27
+ * reaches: 0 when `keepingRefs` finds a keeper for each, otherwise at least 1. */
28
+ export async function unlandedCommits(git, workspace, branch) {
29
+ if (await keepingRefs(git, workspace, branch))
30
+ return 0;
31
+ const tips = [...new Set([branch.sha, ...reflogTips(branch)])].filter(sha => sha !== workspace.baselineSha);
32
+ const counted = await git(['rev-list', '--count', ...tips, `^${workspace.baselineSha}`, '--not', `--exclude=${workspace.branch}`, '--branches', '--remotes']);
33
+ const commits = counted.ok ? Number(counted.stdout.trim()) : NaN;
34
+ // Unreachable reflog entries or an alias can leave nothing countable; the work is still unproven.
35
+ return Number.isInteger(commits) && commits > 0 ? commits : 1;
36
+ }
37
+ /** Files with uncommitted changes in a worker directory: staged, modified, deleted or untracked;
38
+ * ignored files do not count. Throws when Git cannot read the directory. */
39
+ export async function uncommittedFiles(path) {
40
+ const status = await workspaceGit(path, ['--no-optional-locks', 'status', '--porcelain=v1', '-z', '--untracked-files=all']);
41
+ if (!status.ok)
42
+ throw new Error('Owned workspace Git status failed');
43
+ const fields = status.stdout.split('\0');
44
+ let files = 0;
45
+ for (let index = 0; index < fields.length; index++) {
46
+ const entry = fields[index];
47
+ if (entry.length < 4)
48
+ continue;
49
+ files++;
50
+ // A rename or copy carries its source path as the next field.
51
+ if (/[RC]/.test(entry.slice(0, 2)))
52
+ index++;
53
+ }
54
+ return files;
55
+ }
56
+ /** The work a destroy would delete now, or undefined when there is none. Reads only; the checked
57
+ * removal repeats it under the worktree mutation lock. Throws when Git cannot answer. */
58
+ export async function workspaceWork(repoRoot, workspace) {
59
+ const files = await entryExists(workspace.path) ? await uncommittedFiles(workspace.path) : 0;
60
+ const tip = await workspaceGit(repoRoot, ['rev-parse', '--verify', '--quiet', `refs/heads/${workspace.branch}^{commit}`]);
61
+ const sha = tip.ok ? tip.stdout.trim() : '';
62
+ const commits = sha ? await unlandedCommits(args => workspaceGit(repoRoot, args), workspace, { sha, log: await branchLog(repoRoot, workspace) }) : 0;
63
+ return files || commits ? { uncommittedFiles: files, commits } : undefined;
64
+ }
65
+ const count = (n, one, many) => `${n} ${n === 1 ? one : many}`;
66
+ /** The refusal that names the work and both ways forward. */
67
+ export function describeWork(workerId, work) {
68
+ const parts = [
69
+ ...(work.uncommittedFiles ? [count(work.uncommittedFiles, 'uncommitted file', 'uncommitted files')] : []),
70
+ ...(work.commits ? [`${count(work.commits, 'commit', 'commits')} no other branch reaches`] : []),
71
+ ];
72
+ return `Worker ${workerId.slice(0, 8)} holds work destroy would delete: ${parts.join(' and ')}. ` +
73
+ 'Land or commit what you need and rerun destroy, or rerun destroy with --discard-work to delete it';
74
+ }
75
+ //# sourceMappingURL=workspace-work.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-work.js","sourceRoot":"","sources":["../../src/delegation/workspace-work.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQ7D;;wFAEwF;AACxF,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAY,EAAE,SAA+B,EAAE,MAAmB;IAClG,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,IAAI,GAAG,KAAK,SAAS,CAAC,WAAW;YAAE,SAAS;QAC5C,IAAI,GAAG,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,YAAY,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;YAAE,SAAS;QACxG,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,cAAc,EAAE,YAAY,EAAE,GAAG,EAAE,iDAAiD,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;QAC/I,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,C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AE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,GAAW,EAAE,IAAY,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAEvF,6DAA6D;AAC7D,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,IAAuB;IACpE,MAAM,KAAK,GAAG;QACZ,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACjG,CAAC;IACF,OAAO,UAAU,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,qCAAqC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI;QAC/F,mGAAmG,CAAC;AACxG,CAAC"}
@@ -410,6 +410,7 @@ export declare const storedDelegationStateSchema: import("zod").ZodCatch<import(
410
410
  worktree: "worktree";
411
411
  }>>;
412
412
  error: import("zod").ZodOptional<import("zod").ZodString>;
413
+ discardWork: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
413
414
  }, import("zod/v4/core").$strict>>;
414
415
  context: import("zod").ZodOptional<import("zod").ZodObject<{
415
416
  text: import("zod").ZodOptional<import("zod").ZodString>;
@@ -389,6 +389,7 @@ export declare const RUN_EXITS: {
389
389
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
390
390
  remaining: ("branch" | "process" | "worktree")[];
391
391
  error?: string | undefined;
392
+ discardWork?: true | undefined;
392
393
  } | undefined;
393
394
  context?: {
394
395
  text?: string | undefined;
@@ -1128,6 +1129,7 @@ export declare const RUN_EXITS: {
1128
1129
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
1129
1130
  remaining: ("branch" | "process" | "worktree")[];
1130
1131
  error?: string | undefined;
1132
+ discardWork?: true | undefined;
1131
1133
  } | undefined;
1132
1134
  context?: {
1133
1135
  text?: string | undefined;
@@ -1908,6 +1910,7 @@ export declare const RUN_EXITS: {
1908
1910
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
1909
1911
  remaining: ("branch" | "process" | "worktree")[];
1910
1912
  error?: string | undefined;
1913
+ discardWork?: true | undefined;
1911
1914
  } | undefined;
1912
1915
  context?: {
1913
1916
  text?: string | undefined;
@@ -2997,6 +3000,7 @@ export declare const RUN_EXITS: {
2997
3000
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
2998
3001
  remaining: ("branch" | "process" | "worktree")[];
2999
3002
  error?: string | undefined;
3003
+ discardWork?: true | undefined;
3000
3004
  } | undefined;
3001
3005
  context?: {
3002
3006
  text?: string | undefined;
@@ -4100,6 +4104,7 @@ export declare const RUN_EXITS: {
4100
4104
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
4101
4105
  remaining: ("branch" | "process" | "worktree")[];
4102
4106
  error?: string | undefined;
4107
+ discardWork?: true | undefined;
4103
4108
  } | undefined;
4104
4109
  context?: {
4105
4110
  text?: string | undefined;
@@ -5197,6 +5202,7 @@ export declare const RUN_EXITS: {
5197
5202
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
5198
5203
  remaining: ("branch" | "process" | "worktree")[];
5199
5204
  error?: string | undefined;
5205
+ discardWork?: true | undefined;
5200
5206
  } | undefined;
5201
5207
  context?: {
5202
5208
  text?: string | undefined;
@@ -1847,6 +1847,7 @@ export declare const runRecordSchema: z.ZodObject<{
1847
1847
  worktree: "worktree";
1848
1848
  }>>;
1849
1849
  error: z.ZodOptional<z.ZodString>;
1850
+ discardWork: z.ZodOptional<z.ZodLiteral<true>>;
1850
1851
  }, z.core.$strict>>;
1851
1852
  context: z.ZodOptional<z.ZodObject<{
1852
1853
  text: z.ZodOptional<z.ZodString>;
@@ -2995,6 +2996,7 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
2995
2996
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
2996
2997
  remaining: ("branch" | "process" | "worktree")[];
2997
2998
  error?: string | undefined;
2999
+ discardWork?: true | undefined;
2998
3000
  } | undefined;
2999
3001
  context?: {
3000
3002
  text?: string | undefined;
@@ -6854,6 +6854,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
6854
6854
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
6855
6855
  remaining: ("branch" | "process" | "worktree")[];
6856
6856
  error?: string | undefined;
6857
+ discardWork?: true | undefined;
6857
6858
  } | undefined;
6858
6859
  context?: {
6859
6860
  text?: string | undefined;
@@ -8119,6 +8120,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8119
8120
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
8120
8121
  remaining: ("branch" | "process" | "worktree")[];
8121
8122
  error?: string | undefined;
8123
+ discardWork?: true | undefined;
8122
8124
  retry?: {
8123
8125
  attempts: number;
8124
8126
  nextAt: string;
@@ -8192,7 +8194,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8192
8194
  id: string;
8193
8195
  };
8194
8196
  } & {
8195
- json: Record<string, never>;
8197
+ json: {
8198
+ discardWork?: true | undefined;
8199
+ };
8196
8200
  };
8197
8201
  } | {
8198
8202
  output: {
@@ -8210,12 +8214,18 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8210
8214
  id: string;
8211
8215
  };
8212
8216
  } & {
8213
- json: Record<string, never>;
8217
+ json: {
8218
+ discardWork?: true | undefined;
8219
+ };
8214
8220
  };
8215
8221
  } | {
8216
8222
  output: {
8217
8223
  workerId: string;
8218
8224
  state: "complete" | "incomplete";
8225
+ work?: {
8226
+ uncommittedFiles: number;
8227
+ commits: number;
8228
+ } | undefined;
8219
8229
  deleted?: ({
8220
8230
  kind: "worktree";
8221
8231
  path: string;
@@ -8237,12 +8247,18 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8237
8247
  id: string;
8238
8248
  };
8239
8249
  } & {
8240
- json: Record<string, never>;
8250
+ json: {
8251
+ discardWork?: true | undefined;
8252
+ };
8241
8253
  };
8242
8254
  } | {
8243
8255
  output: {
8244
8256
  workerId: string;
8245
8257
  state: "complete" | "incomplete";
8258
+ work?: {
8259
+ uncommittedFiles: number;
8260
+ commits: number;
8261
+ } | undefined;
8246
8262
  deleted?: ({
8247
8263
  kind: "worktree";
8248
8264
  path: string;
@@ -8264,7 +8280,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8264
8280
  id: string;
8265
8281
  };
8266
8282
  } & {
8267
- json: Record<string, never>;
8283
+ json: {
8284
+ discardWork?: true | undefined;
8285
+ };
8268
8286
  };
8269
8287
  };
8270
8288
  };
@@ -9246,6 +9264,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
9246
9264
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
9247
9265
  remaining: ("branch" | "process" | "worktree")[];
9248
9266
  error?: string | undefined;
9267
+ discardWork?: true | undefined;
9249
9268
  } | undefined;
9250
9269
  context?: {
9251
9270
  text?: string | undefined;
@@ -10383,6 +10402,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
10383
10402
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
10384
10403
  remaining: ("branch" | "process" | "worktree")[];
10385
10404
  error?: string | undefined;
10405
+ discardWork?: true | undefined;
10386
10406
  } | undefined;
10387
10407
  context?: {
10388
10408
  text?: string | undefined;
@@ -11521,6 +11541,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
11521
11541
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
11522
11542
  remaining: ("branch" | "process" | "worktree")[];
11523
11543
  error?: string | undefined;
11544
+ discardWork?: true | undefined;
11524
11545
  } | undefined;
11525
11546
  context?: {
11526
11547
  text?: string | undefined;
@@ -12686,6 +12707,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12686
12707
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
12687
12708
  remaining: ("branch" | "process" | "worktree")[];
12688
12709
  error?: string | undefined;
12710
+ discardWork?: true | undefined;
12689
12711
  } | undefined;
12690
12712
  context?: {
12691
12713
  text?: string | undefined;
@@ -13799,6 +13821,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
13799
13821
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
13800
13822
  remaining: ("branch" | "process" | "worktree")[];
13801
13823
  error?: string | undefined;
13824
+ discardWork?: true | undefined;
13802
13825
  } | undefined;
13803
13826
  context?: {
13804
13827
  text?: string | undefined;
@@ -14912,6 +14935,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
14912
14935
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
14913
14936
  remaining: ("branch" | "process" | "worktree")[];
14914
14937
  error?: string | undefined;
14938
+ discardWork?: true | undefined;
14915
14939
  } | undefined;
14916
14940
  context?: {
14917
14941
  text?: string | undefined;
@@ -15431,6 +15455,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15431
15455
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
15432
15456
  remaining: ("branch" | "process" | "worktree")[];
15433
15457
  error?: string | undefined;
15458
+ discardWork?: true | undefined;
15434
15459
  } | undefined;
15435
15460
  context?: {
15436
15461
  text?: string | undefined;
@@ -17341,6 +17366,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
17341
17366
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
17342
17367
  remaining: ("branch" | "process" | "worktree")[];
17343
17368
  error?: string | undefined;
17369
+ discardWork?: true | undefined;
17344
17370
  } | undefined;
17345
17371
  context?: {
17346
17372
  text?: string | undefined;
@@ -22748,6 +22774,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
22748
22774
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
22749
22775
  remaining: ("branch" | "process" | "worktree")[];
22750
22776
  error?: string | undefined;
22777
+ discardWork?: true | undefined;
22751
22778
  } | undefined;
22752
22779
  context?: {
22753
22780
  text?: string | undefined;
@@ -24013,6 +24040,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24013
24040
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
24014
24041
  remaining: ("branch" | "process" | "worktree")[];
24015
24042
  error?: string | undefined;
24043
+ discardWork?: true | undefined;
24016
24044
  retry?: {
24017
24045
  attempts: number;
24018
24046
  nextAt: string;
@@ -24086,7 +24114,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24086
24114
  id: string;
24087
24115
  };
24088
24116
  } & {
24089
- json: Record<string, never>;
24117
+ json: {
24118
+ discardWork?: true | undefined;
24119
+ };
24090
24120
  };
24091
24121
  } | {
24092
24122
  output: {
@@ -24104,12 +24134,18 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24104
24134
  id: string;
24105
24135
  };
24106
24136
  } & {
24107
- json: Record<string, never>;
24137
+ json: {
24138
+ discardWork?: true | undefined;
24139
+ };
24108
24140
  };
24109
24141
  } | {
24110
24142
  output: {
24111
24143
  workerId: string;
24112
24144
  state: "complete" | "incomplete";
24145
+ work?: {
24146
+ uncommittedFiles: number;
24147
+ commits: number;
24148
+ } | undefined;
24113
24149
  deleted?: ({
24114
24150
  kind: "worktree";
24115
24151
  path: string;
@@ -24131,12 +24167,18 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24131
24167
  id: string;
24132
24168
  };
24133
24169
  } & {
24134
- json: Record<string, never>;
24170
+ json: {
24171
+ discardWork?: true | undefined;
24172
+ };
24135
24173
  };
24136
24174
  } | {
24137
24175
  output: {
24138
24176
  workerId: string;
24139
24177
  state: "complete" | "incomplete";
24178
+ work?: {
24179
+ uncommittedFiles: number;
24180
+ commits: number;
24181
+ } | undefined;
24140
24182
  deleted?: ({
24141
24183
  kind: "worktree";
24142
24184
  path: string;
@@ -24158,7 +24200,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24158
24200
  id: string;
24159
24201
  };
24160
24202
  } & {
24161
- json: Record<string, never>;
24203
+ json: {
24204
+ discardWork?: true | undefined;
24205
+ };
24162
24206
  };
24163
24207
  };
24164
24208
  };
@@ -25140,6 +25184,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25140
25184
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
25141
25185
  remaining: ("branch" | "process" | "worktree")[];
25142
25186
  error?: string | undefined;
25187
+ discardWork?: true | undefined;
25143
25188
  } | undefined;
25144
25189
  context?: {
25145
25190
  text?: string | undefined;
@@ -26277,6 +26322,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
26277
26322
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
26278
26323
  remaining: ("branch" | "process" | "worktree")[];
26279
26324
  error?: string | undefined;
26325
+ discardWork?: true | undefined;
26280
26326
  } | undefined;
26281
26327
  context?: {
26282
26328
  text?: string | undefined;
@@ -27415,6 +27461,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
27415
27461
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
27416
27462
  remaining: ("branch" | "process" | "worktree")[];
27417
27463
  error?: string | undefined;
27464
+ discardWork?: true | undefined;
27418
27465
  } | undefined;
27419
27466
  context?: {
27420
27467
  text?: string | undefined;
@@ -28580,6 +28627,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
28580
28627
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
28581
28628
  remaining: ("branch" | "process" | "worktree")[];
28582
28629
  error?: string | undefined;
28630
+ discardWork?: true | undefined;
28583
28631
  } | undefined;
28584
28632
  context?: {
28585
28633
  text?: string | undefined;
@@ -29693,6 +29741,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
29693
29741
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
29694
29742
  remaining: ("branch" | "process" | "worktree")[];
29695
29743
  error?: string | undefined;
29744
+ discardWork?: true | undefined;
29696
29745
  } | undefined;
29697
29746
  context?: {
29698
29747
  text?: string | undefined;
@@ -30806,6 +30855,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
30806
30855
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
30807
30856
  remaining: ("branch" | "process" | "worktree")[];
30808
30857
  error?: string | undefined;
30858
+ discardWork?: true | undefined;
30809
30859
  } | undefined;
30810
30860
  context?: {
30811
30861
  text?: string | undefined;
@@ -31325,6 +31375,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
31325
31375
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
31326
31376
  remaining: ("branch" | "process" | "worktree")[];
31327
31377
  error?: string | undefined;
31378
+ discardWork?: true | undefined;
31328
31379
  } | undefined;
31329
31380
  context?: {
31330
31381
  text?: string | undefined;
@@ -33235,6 +33286,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
33235
33286
  phase: "cleaning" | "complete" | "incomplete" | "requested" | "terminating";
33236
33287
  remaining: ("branch" | "process" | "worktree")[];
33237
33288
  error?: string | undefined;
33289
+ discardWork?: true | undefined;
33238
33290
  } | undefined;
33239
33291
  context?: {
33240
33292
  text?: string | undefined;
@@ -51,7 +51,7 @@ import { DelegationService } from '../delegation/service.js';
51
51
  import { runRelationships } from './run-relationships.js';
52
52
  import { delegationFailure } from '../delegation/routes.js';
53
53
  import { githubItemParamsSchema } from '../contract/index.js';
54
- import { workerEmptyRequestSchema, runRelationshipsSchema } from '../contract/index.js';
54
+ import { workerDestroyRequestSchema, workerEmptyRequestSchema, runRelationshipsSchema } from '../contract/index.js';
55
55
  import { existsSync, readFileSync, statSync } from 'node:fs';
56
56
  import { randomUUID } from 'node:crypto';
57
57
  import { createAutomationService, onceCreateAnswer } from '../automations/service.js';
@@ -2444,11 +2444,11 @@ export function createApp(deps) {
2444
2444
  return c.json({ error: 'not found' }, 404);
2445
2445
  return c.json(runRelationshipsSchema.parse(runRelationships(store, run)));
2446
2446
  })
2447
- .post('/runs/:id/worker-destroy', queryZodValidator(workerEmptyRequestSchema, { code: 'invalid_input', message: 'Invalid cleanup query' }), paramZodValidator(runIdParamSchema, { code: 'invalid_input', message: 'Invalid worker ID' }), jsonZodValidator(workerEmptyRequestSchema, { absent: {}, malformed: null, code: 'invalid_input', message: 'Invalid cleanup input' }), async (c) => {
2447
+ .post('/runs/:id/worker-destroy', queryZodValidator(workerEmptyRequestSchema, { code: 'invalid_input', message: 'Invalid cleanup query' }), paramZodValidator(runIdParamSchema, { code: 'invalid_input', message: 'Invalid worker ID' }), jsonZodValidator(workerDestroyRequestSchema, { absent: {}, malformed: null, code: 'invalid_input', message: 'Invalid cleanup input' }), async (c) => {
2448
2448
  const project = c.get('project');
2449
2449
  delegationService.registerProject(project);
2450
2450
  try {
2451
- const result = await delegationService.destroyForHuman(project.id, c.req.valid('param').id);
2451
+ const result = await delegationService.destroyForHuman(project.id, c.req.valid('param').id, c.req.valid('json'));
2452
2452
  return result.state === 'incomplete' ? c.json(result, 409) : c.json(result, 200);
2453
2453
  }
2454
2454
  catch (error) {