@hearsay-tools/squawk 0.18.0-dev.8446 → 0.18.0-dev.8452

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 (80) hide show
  1. package/dist/automations/tools.d.ts +8 -8
  2. package/dist/autosave-cleanup.js +2 -1
  3. package/dist/autosave-cleanup.js.map +1 -1
  4. package/dist/built-in-cli-commands.js +0 -4
  5. package/dist/built-in-cli-commands.js.map +1 -1
  6. package/dist/built-in-launch-parts.d.ts +0 -2
  7. package/dist/built-in-launch-parts.js +1 -8
  8. package/dist/built-in-launch-parts.js.map +1 -1
  9. package/dist/built-in-run-slots.js +1 -2
  10. package/dist/built-in-run-slots.js.map +1 -1
  11. package/dist/ci-wait/tool-catalog.d.ts +2 -1
  12. package/dist/ci-wait/tool-catalog.js +22 -16
  13. package/dist/ci-wait/tool-catalog.js.map +1 -1
  14. package/dist/core/cli-registry.d.ts +3 -0
  15. package/dist/core/cli-registry.js +3 -0
  16. package/dist/core/cli-registry.js.map +1 -1
  17. package/dist/core/process-ownership.d.ts +12 -0
  18. package/dist/core/process-ownership.js +33 -0
  19. package/dist/core/process-ownership.js.map +1 -0
  20. package/dist/delegation/process-liveness.d.ts +6 -3
  21. package/dist/delegation/process-liveness.js +0 -16
  22. package/dist/delegation/process-liveness.js.map +1 -1
  23. package/dist/delegation/scratch-cleanup.js +5 -5
  24. package/dist/delegation/scratch-cleanup.js.map +1 -1
  25. package/dist/delegation/transport.d.ts +10 -10
  26. package/dist/{jobs → features/jobs}/cli.js +1 -1
  27. package/dist/features/jobs/cli.js.map +1 -0
  28. package/dist/{jobs → features/jobs}/command.js +2 -2
  29. package/dist/features/jobs/command.js.map +1 -0
  30. package/dist/features/jobs/index.d.ts +11 -0
  31. package/dist/features/jobs/index.js +20 -0
  32. package/dist/features/jobs/index.js.map +1 -0
  33. package/dist/{jobs → features/jobs}/job.js +9 -10
  34. package/dist/features/jobs/job.js.map +1 -0
  35. package/dist/features/jobs/removal-slot.d.ts +14 -0
  36. package/dist/features/jobs/removal-slot.js +50 -0
  37. package/dist/features/jobs/removal-slot.js.map +1 -0
  38. package/dist/legacy-runs.js.map +1 -1
  39. package/dist/pack-check.d.ts +4 -1
  40. package/dist/pack-check.js +9 -1
  41. package/dist/pack-check.js.map +1 -1
  42. package/dist/plugin/index.d.ts +1 -1
  43. package/dist/runs/agent-tmpdir.d.ts +5 -4
  44. package/dist/runs/agent-tmpdir.js +7 -5
  45. package/dist/runs/agent-tmpdir.js.map +1 -1
  46. package/dist/runs/removal-slots.d.ts +15 -3
  47. package/dist/runs/removal-slots.js +12 -2
  48. package/dist/runs/removal-slots.js.map +1 -1
  49. package/dist/runs/run-exits.d.ts +352 -352
  50. package/dist/runs/worker-execution.js.map +1 -1
  51. package/dist/server/activity-routes.d.ts +23 -23
  52. package/dist/server/models-routes.d.ts +12 -12
  53. package/dist/server/providers-routes.d.ts +57 -57
  54. package/dist/server/repo-routes.d.ts +34 -34
  55. package/dist/server/reports-api.d.ts +2 -2
  56. package/dist/server/server.d.ts +68 -68
  57. package/dist/server/workspace-live-routes.d.ts +6 -6
  58. package/dist/server/workspace-routes.d.ts +84 -84
  59. package/dist/worker-scope/groups.d.ts +0 -9
  60. package/dist/worker-scope/groups.js +3 -18
  61. package/dist/worker-scope/groups.js.map +1 -1
  62. package/dist/workflows/input-acknowledgement.d.ts +24 -24
  63. package/dist/workflows/run/run-settlement.d.ts +0 -10
  64. package/dist/workflows/run/run-settlement.js +5 -38
  65. package/dist/workflows/run/run-settlement.js.map +1 -1
  66. package/dist/workflows/run/wait-engine.d.ts +72 -72
  67. package/dist/workflows/run/wait-input-descriptors.js +11 -2
  68. package/dist/workflows/run/wait-input-descriptors.js.map +1 -1
  69. package/dist/workflows/run/wait-kinds.d.ts +52 -52
  70. package/package.json +4 -4
  71. package/scripts/check-pack.mjs +5 -2
  72. package/dist/jobs/cli.js.map +0 -1
  73. package/dist/jobs/command.js.map +0 -1
  74. package/dist/jobs/job.js.map +0 -1
  75. package/dist/jobs/removal-slot.d.ts +0 -4
  76. package/dist/jobs/removal-slot.js +0 -10
  77. package/dist/jobs/removal-slot.js.map +0 -1
  78. /package/dist/{jobs → features/jobs}/cli.d.ts +0 -0
  79. /package/dist/{jobs → features/jobs}/command.d.ts +0 -0
  80. /package/dist/{jobs → features/jobs}/job.d.ts +0 -0
@@ -3062,12 +3062,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3062
3062
  output: {
3063
3063
  generation: string;
3064
3064
  results: ({
3065
- projectId: string;
3066
- runId: string;
3067
- type: "error" | "reset";
3068
- status: 400 | 404 | 409 | 413 | 503;
3069
- error: string;
3070
- } | {
3071
3065
  projectId: string;
3072
3066
  runId: string;
3073
3067
  type: "batch";
@@ -3088,6 +3082,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3088
3082
  cursor: string;
3089
3083
  afterSeq: number;
3090
3084
  hasMore: boolean;
3085
+ } | {
3086
+ projectId: string;
3087
+ runId: string;
3088
+ type: "error" | "reset";
3089
+ status: 400 | 404 | 409 | 413 | 503;
3090
+ error: string;
3091
3091
  })[];
3092
3092
  };
3093
3093
  outputFormat: "json";
@@ -8596,6 +8596,37 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8596
8596
  } & {
8597
8597
  "/runs/:id/worker-destroy": {
8598
8598
  $post: {
8599
+ output: {
8600
+ readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
8601
+ readonly error: string;
8602
+ readonly modelChoices?: {
8603
+ runner: string;
8604
+ requestedModel: string;
8605
+ availableModels: {
8606
+ id: string;
8607
+ label: string;
8608
+ description: string;
8609
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
8610
+ }[];
8611
+ otherRunners: string[];
8612
+ } | undefined;
8613
+ };
8614
+ outputFormat: "json";
8615
+ status: 400 | 401 | 403 | 409 | 503;
8616
+ input: {
8617
+ query: {
8618
+ [x: string]: string | string[];
8619
+ };
8620
+ } & {
8621
+ param: {
8622
+ id: string;
8623
+ };
8624
+ } & {
8625
+ json: {
8626
+ discardWork?: true | undefined;
8627
+ };
8628
+ };
8629
+ } | {
8599
8630
  output: {
8600
8631
  error: string;
8601
8632
  code?: "invalid_input" | undefined;
@@ -8681,37 +8712,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8681
8712
  discardWork?: true | undefined;
8682
8713
  };
8683
8714
  };
8684
- } | {
8685
- output: {
8686
- readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
8687
- readonly error: string;
8688
- readonly modelChoices?: {
8689
- runner: string;
8690
- requestedModel: string;
8691
- availableModels: {
8692
- id: string;
8693
- label: string;
8694
- description: string;
8695
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
8696
- }[];
8697
- otherRunners: string[];
8698
- } | undefined;
8699
- };
8700
- outputFormat: "json";
8701
- status: 400 | 401 | 403 | 409 | 503;
8702
- input: {
8703
- query: {
8704
- [x: string]: string | string[];
8705
- };
8706
- } & {
8707
- param: {
8708
- id: string;
8709
- };
8710
- } & {
8711
- json: {
8712
- discardWork?: true | undefined;
8713
- };
8714
- };
8715
8715
  };
8716
8716
  };
8717
8717
  } & {
@@ -25237,6 +25237,37 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25237
25237
  } & {
25238
25238
  "/runs/:id/worker-destroy": {
25239
25239
  $post: {
25240
+ output: {
25241
+ readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
25242
+ readonly error: string;
25243
+ readonly modelChoices?: {
25244
+ runner: string;
25245
+ requestedModel: string;
25246
+ availableModels: {
25247
+ id: string;
25248
+ label: string;
25249
+ description: string;
25250
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
25251
+ }[];
25252
+ otherRunners: string[];
25253
+ } | undefined;
25254
+ };
25255
+ outputFormat: "json";
25256
+ status: 400 | 401 | 403 | 409 | 503;
25257
+ input: {
25258
+ query: {
25259
+ [x: string]: string | string[];
25260
+ };
25261
+ } & {
25262
+ param: {
25263
+ id: string;
25264
+ };
25265
+ } & {
25266
+ json: {
25267
+ discardWork?: true | undefined;
25268
+ };
25269
+ };
25270
+ } | {
25240
25271
  output: {
25241
25272
  error: string;
25242
25273
  code?: "invalid_input" | undefined;
@@ -25322,37 +25353,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
25322
25353
  discardWork?: true | undefined;
25323
25354
  };
25324
25355
  };
25325
- } | {
25326
- output: {
25327
- readonly code: "capacity_limit" | "denied_scope" | "incompatible_state" | "incomplete_cleanup" | "invalid_baseline" | "invalid_input" | "unauthenticated" | "unavailable_diff" | "unavailable_transport";
25328
- readonly error: string;
25329
- readonly modelChoices?: {
25330
- runner: string;
25331
- requestedModel: string;
25332
- availableModels: {
25333
- id: string;
25334
- label: string;
25335
- description: string;
25336
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
25337
- }[];
25338
- otherRunners: string[];
25339
- } | undefined;
25340
- };
25341
- outputFormat: "json";
25342
- status: 400 | 401 | 403 | 409 | 503;
25343
- input: {
25344
- query: {
25345
- [x: string]: string | string[];
25346
- };
25347
- } & {
25348
- param: {
25349
- id: string;
25350
- };
25351
- } & {
25352
- json: {
25353
- discardWork?: true | undefined;
25354
- };
25355
- };
25356
25356
  };
25357
25357
  };
25358
25358
  } & {
@@ -7,6 +7,12 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
7
7
  output: {
8
8
  generation: string;
9
9
  results: ({
10
+ projectId: string;
11
+ runId: string;
12
+ type: "error" | "reset";
13
+ status: 400 | 404 | 409 | 413 | 503;
14
+ error: string;
15
+ } | {
10
16
  projectId: string;
11
17
  runId: string;
12
18
  type: "batch";
@@ -27,12 +33,6 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
27
33
  cursor: string;
28
34
  afterSeq: number;
29
35
  hasMore: boolean;
30
- } | {
31
- projectId: string;
32
- runId: string;
33
- type: "error" | "reset";
34
- status: 400 | 404 | 409 | 413 | 503;
35
- error: string;
36
36
  })[];
37
37
  };
38
38
  outputFormat: "json";
@@ -51,34 +51,10 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
51
51
  "/workspace/config": {
52
52
  $put: {
53
53
  output: {
54
- browseRoot: string;
55
- projectsDir: string;
56
- archiveOnMerge: boolean | null;
57
- effectiveArchiveOnMerge: boolean;
58
- archiveOnMergeSource: "default" | "environment" | "global";
59
- composerDefaults: {
60
- autonomous: boolean | null;
61
- worktree: boolean | null;
62
- inheritedAutonomous: "source-dependent" | boolean;
63
- inheritedWorktree: boolean;
64
- };
65
- resources: {
66
- maxParallel: number;
67
- maxMonitoringSessions: number;
68
- monitoringWakeIntervalMinutes: number | null;
69
- autoResumeOnUsageLimit: boolean;
70
- memoryLimitMb: number | null;
71
- worktreeRetentionDefault: number;
72
- };
73
- agentDefaults: {
74
- runner?: string | undefined;
75
- models?: {
76
- [x: string]: string | undefined;
77
- } | undefined;
78
- };
54
+ error: string;
79
55
  };
80
56
  outputFormat: "json";
81
- status: import("hono/utils/http-status").ContentfulStatusCode;
57
+ status: 400;
82
58
  input: {
83
59
  json: {
84
60
  browseRoot?: string | undefined;
@@ -107,7 +83,7 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
107
83
  error: string;
108
84
  };
109
85
  outputFormat: "json";
110
- status: 400;
86
+ status: 500;
111
87
  input: {
112
88
  json: {
113
89
  browseRoot?: string | undefined;
@@ -133,10 +109,34 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
133
109
  };
134
110
  } | {
135
111
  output: {
136
- error: string;
112
+ browseRoot: string;
113
+ projectsDir: string;
114
+ archiveOnMerge: boolean | null;
115
+ effectiveArchiveOnMerge: boolean;
116
+ archiveOnMergeSource: "default" | "environment" | "global";
117
+ composerDefaults: {
118
+ autonomous: boolean | null;
119
+ worktree: boolean | null;
120
+ inheritedAutonomous: "source-dependent" | boolean;
121
+ inheritedWorktree: boolean;
122
+ };
123
+ resources: {
124
+ maxParallel: number;
125
+ maxMonitoringSessions: number;
126
+ monitoringWakeIntervalMinutes: number | null;
127
+ autoResumeOnUsageLimit: boolean;
128
+ memoryLimitMb: number | null;
129
+ worktreeRetentionDefault: number;
130
+ };
131
+ agentDefaults: {
132
+ runner?: string | undefined;
133
+ models?: {
134
+ [x: string]: string | undefined;
135
+ } | undefined;
136
+ };
137
137
  };
138
138
  outputFormat: "json";
139
- status: 500;
139
+ status: import("hono/utils/http-status").ContentfulStatusCode;
140
140
  input: {
141
141
  json: {
142
142
  browseRoot?: string | undefined;
@@ -208,41 +208,10 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
208
208
  "/workspace/ui-state": {
209
209
  $put: {
210
210
  output: {
211
- [x: string]: import("hono/utils/types").JSONValue;
212
- sidebar?: {
213
- [x: string]: import("hono/utils/types").JSONValue;
214
- collapsed?: {
215
- [x: string]: boolean;
216
- } | undefined;
217
- projectOrder?: string[] | undefined;
218
- } | undefined;
219
- dismissedProviderAuthFailures?: {
220
- [x: string]: string | undefined;
221
- } | undefined;
222
- appearance?: {
223
- accent?: "cezarion" | "lime" | "violet" | undefined;
224
- density?: "comfortable" | "compact" | "ultra" | undefined;
225
- width?: "narrow" | "wide" | undefined;
226
- } | undefined;
227
- notifications?: {
228
- [x: string]: import("hono/utils/types").JSONValue;
229
- enabled?: boolean | undefined;
230
- } | undefined;
231
- taskTable?: {
232
- [x: string]: import("hono/utils/types").JSONValue;
233
- expandedColumns?: {
234
- [x: string]: boolean;
235
- } | undefined;
236
- } | undefined;
237
- lastLocation?: {
238
- projectId: string;
239
- pathname: string;
240
- search?: string | undefined;
241
- hash?: string | undefined;
242
- } | undefined;
211
+ error: string;
243
212
  };
244
213
  outputFormat: "json";
245
- status: import("hono/utils/http-status").ContentfulStatusCode;
214
+ status: 500;
246
215
  input: {
247
216
  json: {
248
217
  [x: string]: unknown;
@@ -275,10 +244,41 @@ export declare function createWorkspaceConfigRoutes(deps: WorkspaceConfigRouteDe
275
244
  };
276
245
  } | {
277
246
  output: {
278
- error: string;
247
+ [x: string]: import("hono/utils/types").JSONValue;
248
+ sidebar?: {
249
+ [x: string]: import("hono/utils/types").JSONValue;
250
+ collapsed?: {
251
+ [x: string]: boolean;
252
+ } | undefined;
253
+ projectOrder?: string[] | undefined;
254
+ } | undefined;
255
+ dismissedProviderAuthFailures?: {
256
+ [x: string]: string | undefined;
257
+ } | undefined;
258
+ appearance?: {
259
+ accent?: "cezarion" | "lime" | "violet" | undefined;
260
+ density?: "comfortable" | "compact" | "ultra" | undefined;
261
+ width?: "narrow" | "wide" | undefined;
262
+ } | undefined;
263
+ notifications?: {
264
+ [x: string]: import("hono/utils/types").JSONValue;
265
+ enabled?: boolean | undefined;
266
+ } | undefined;
267
+ taskTable?: {
268
+ [x: string]: import("hono/utils/types").JSONValue;
269
+ expandedColumns?: {
270
+ [x: string]: boolean;
271
+ } | undefined;
272
+ } | undefined;
273
+ lastLocation?: {
274
+ projectId: string;
275
+ pathname: string;
276
+ search?: string | undefined;
277
+ hash?: string | undefined;
278
+ } | undefined;
279
279
  };
280
280
  outputFormat: "json";
281
- status: 500;
281
+ status: import("hono/utils/http-status").ContentfulStatusCode;
282
282
  input: {
283
283
  json: {
284
284
  [x: string]: unknown;
@@ -329,10 +329,17 @@ export declare function createFsBrowseRoutes(workspaceBrowseRoot: () => Promise<
329
329
  };
330
330
  } | {
331
331
  output: {
332
- error: string;
332
+ path: string;
333
+ parent: string | null;
334
+ dirs: {
335
+ name: string;
336
+ path: string;
337
+ isRepo: boolean;
338
+ }[];
339
+ truncated: boolean;
333
340
  };
334
341
  outputFormat: "json";
335
- status: 400 | 403 | 404;
342
+ status: import("hono/utils/http-status").ContentfulStatusCode;
336
343
  input: {
337
344
  query: {
338
345
  path?: string | undefined;
@@ -341,17 +348,10 @@ export declare function createFsBrowseRoutes(workspaceBrowseRoot: () => Promise<
341
348
  };
342
349
  } | {
343
350
  output: {
344
- path: string;
345
- parent: string | null;
346
- dirs: {
347
- name: string;
348
- path: string;
349
- isRepo: boolean;
350
- }[];
351
- truncated: boolean;
351
+ error: string;
352
352
  };
353
353
  outputFormat: "json";
354
- status: import("hono/utils/http-status").ContentfulStatusCode;
354
+ status: 400 | 403 | 404;
355
355
  input: {
356
356
  query: {
357
357
  path?: string | undefined;
@@ -370,15 +370,6 @@ export interface WorkspaceEventsRouteDeps {
370
370
  export declare function createWorkspaceEventsRoutes(deps: WorkspaceEventsRouteDeps): import("hono/hono-base").HonoBase<ProjectApiEnv, {
371
371
  "/workspace/events": {
372
372
  $get: {
373
- output: {};
374
- outputFormat: string;
375
- status: import("hono/utils/http-status").StatusCode;
376
- input: {
377
- query: {
378
- runs?: "summary" | undefined;
379
- };
380
- };
381
- } | {
382
373
  output: {
383
374
  error: string;
384
375
  code?: "invalid_input" | undefined;
@@ -390,6 +381,15 @@ export declare function createWorkspaceEventsRoutes(deps: WorkspaceEventsRouteDe
390
381
  runs?: "summary" | undefined;
391
382
  };
392
383
  };
384
+ } | {
385
+ output: {};
386
+ outputFormat: string;
387
+ status: import("hono/utils/http-status").StatusCode;
388
+ input: {
389
+ query: {
390
+ runs?: "summary" | undefined;
391
+ };
392
+ };
393
393
  };
394
394
  };
395
395
  }, "/", "/workspace/events">;
@@ -1,15 +1,6 @@
1
1
  import { type RecordedProcess } from '../core/process-stat.ts';
2
2
  /** A group leader at spawn: its pid is its group id. */
3
3
  export declare function groupEntry(pid: number): RecordedProcess;
4
- /** Whether the recorded group is the one Squawk started. A live leader must be the recorded
5
- * incarnation. A group whose leader is gone keeps its number while it has members, and the kernel
6
- * does not reuse a pid while a group of that number exists; a reused number needs the group to
7
- * empty first. So a leaderless group counts only where the record proves this boot: on Linux the
8
- * start token carries the boot id, and a token from another boot (or none) is refused. The
9
- * remaining case, the pid space wrapping within one boot while the worker lives, is ADR 0032's
10
- * stated residual. Elsewhere (macOS: no boot id, a small pid space) a leaderless group is never
11
- * signalled. */
12
- export declare function groupOwned(entry: RecordedProcess): boolean;
13
4
  /** SIGKILL every recorded group that is still ours, and every recorded process outside a group
14
5
  * that is still the recorded incarnation. */
15
6
  export declare function killGroups(entries: readonly RecordedProcess[]): void;
@@ -1,28 +1,13 @@
1
1
  /** The `groups` backend: the worker's recorded POSIX process groups. A process that leaves its group
2
2
  * (`setsid`, Node `detached`) is outside it; ADR 0032 states that limit. */
3
- import { processGroupAlive, processGroupRunning, signalProcessGroup } from '../core/session-process.js';
4
- import { linuxBootId, pidExists, processStartToken } from '../core/process-stat.js';
3
+ import { processGroupRunning, signalProcessGroup } from '../core/session-process.js';
4
+ import { pidExists, processStartToken } from '../core/process-stat.js';
5
+ import { groupOwned } from '../core/process-ownership.js';
5
6
  /** A group leader at spawn: its pid is its group id. */
6
7
  export function groupEntry(pid) {
7
8
  const startToken = processStartToken(pid);
8
9
  return { pid, pgid: pid, ...(startToken === undefined ? {} : { startToken }) };
9
10
  }
10
- /** Whether the recorded group is the one Squawk started. A live leader must be the recorded
11
- * incarnation. A group whose leader is gone keeps its number while it has members, and the kernel
12
- * does not reuse a pid while a group of that number exists; a reused number needs the group to
13
- * empty first. So a leaderless group counts only where the record proves this boot: on Linux the
14
- * start token carries the boot id, and a token from another boot (or none) is refused. The
15
- * remaining case, the pid space wrapping within one boot while the worker lives, is ADR 0032's
16
- * stated residual. Elsewhere (macOS: no boot id, a small pid space) a leaderless group is never
17
- * signalled. */
18
- export function groupOwned(entry) {
19
- if (entry.pgid === undefined || entry.pgid !== entry.pid || entry.startToken === undefined || !processGroupAlive(entry.pgid))
20
- return false;
21
- if (pidExists(entry.pid))
22
- return processStartToken(entry.pid) === entry.startToken;
23
- const boot = process.platform === 'linux' ? linuxBootId() : undefined;
24
- return boot !== undefined && entry.startToken.startsWith(`${boot}:`);
25
- }
26
11
  /** SIGKILL every recorded group that is still ours, and every recorded process outside a group
27
12
  * that is still the recorded incarnation. */
28
13
  export function killGroups(entries) {
@@ -1 +1 @@
1
- {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/worker-scope/groups.ts"],"names":[],"mappings":"AAAA;4EAC4E;AAC5E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAwB,MAAM,yBAAyB,CAAC;AAE1G,wDAAwD;AACxD,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AACjF,CAAC;AAED;;;;;;;gBAOgB;AAChB,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3I,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,UAAU,CAAC;IACnF,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC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AAE,CAAC;YAC7F,IAAI,CAAC;gBAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;mFAImF;AACnF,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IACrE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC5B,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QAC7H,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;AACL,CAAC;AAED;sDACsD;AACtD,MAAM,UAAU,UAAU,CAAC,OAAmC;IAC5D,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QACzE,CAAC,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;AACnH,CAAC"}
@@ -74,6 +74,30 @@ export declare function analyseAcknowledgedInput(runId: string, state: ActiveRun
74
74
  deadline: string;
75
75
  seconds: number;
76
76
  note?: string | undefined;
77
+ } | {
78
+ id: string;
79
+ source: "agent" | "cezar";
80
+ via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
81
+ registeredAt: string;
82
+ phase: "cancelled" | "delivered" | "open" | "resolved";
83
+ resolvedAt?: string | undefined;
84
+ deliveredAt?: string | undefined;
85
+ cancelledAt?: string | undefined;
86
+ turnId: string;
87
+ kind: "process";
88
+ deadline: string;
89
+ timeoutSeconds: number;
90
+ pid: number;
91
+ startToken?: string | undefined;
92
+ exitFile?: string | undefined;
93
+ note?: string | undefined;
94
+ result?: {
95
+ outcome: "deadline" | "error" | "exit_file" | "exited";
96
+ observedAt: string;
97
+ exitCode?: number | undefined;
98
+ exitFileNote?: "not-an-exit-code" | undefined;
99
+ diagnostic?: string | undefined;
100
+ } | undefined;
77
101
  } | {
78
102
  id: string;
79
103
  source: "agent" | "cezar";
@@ -135,30 +159,6 @@ export declare function analyseAcknowledgedInput(runId: string, state: ActiveRun
135
159
  reason: "outcome" | "timeout";
136
160
  } | undefined;
137
161
  wakeInputId?: string | undefined;
138
- } | {
139
- id: string;
140
- source: "agent" | "cezar";
141
- via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
142
- registeredAt: string;
143
- phase: "cancelled" | "delivered" | "open" | "resolved";
144
- resolvedAt?: string | undefined;
145
- deliveredAt?: string | undefined;
146
- cancelledAt?: string | undefined;
147
- turnId: string;
148
- kind: "process";
149
- deadline: string;
150
- timeoutSeconds: number;
151
- pid: number;
152
- startToken?: string | undefined;
153
- exitFile?: string | undefined;
154
- note?: string | undefined;
155
- result?: {
156
- outcome: "deadline" | "error" | "exit_file" | "exited";
157
- observedAt: string;
158
- exitCode?: number | undefined;
159
- exitFileNote?: "not-an-exit-code" | undefined;
160
- diagnostic?: string | undefined;
161
- } | undefined;
162
162
  } | {
163
163
  id: string;
164
164
  source: "agent" | "cezar";
@@ -178,15 +178,6 @@ export declare class RunSettlement {
178
178
  private reconcileSettledFamilies;
179
179
  afterDropActive(runId: string): void;
180
180
  }
181
- /**
182
- * A job started with the default directory keeps the task's scratch past the end it was running at
183
- * (hearsay-tools/squawk#3138). Every later reap of that same end keeps it too, even after the job
184
- * exits: a read mark or another run event is not an end. The task's next end (a Continue clears
185
- * `finishedAt`, and the end sets a new one), its archive or the startup sweep removes it once no
186
- * job in it runs. Archive is a removal point, so an archived run's mark holds nothing: every archive
187
- * path commits the run, and that event reaps.
188
- */
189
- export declare function jobHoldsScratch(dataDir: string, runId: string, run: Pick<RunRecord, 'finishedAt' | 'archived'>): boolean;
190
181
  export declare function sessionCloseKeepsWaiting(input: {
191
182
  readonly cancelled: boolean;
192
183
  readonly incomplete: boolean;
@@ -199,6 +190,5 @@ export declare function terminalScratchDisposition(runId: string, run: RunRecord
199
190
  claimed(): boolean;
200
191
  autosaveBlocker(): string | undefined;
201
192
  privateWorkers(): string[] | undefined;
202
- jobHolds(): boolean;
203
193
  }): 'keep' | 'schedule' | 'remove';
204
194
  export {};
@@ -1,12 +1,10 @@
1
1
  import { assertRunSlotsSealed, deletionRefusal } from '../../runs/removal-slots.js';
2
2
  import { transitionTurnBoundary } from './turn-boundary.js';
3
3
  import { workerEvidenceRunIds } from '../../runs/worker-execution.js';
4
- import { agentTmpDirLocations, removeAgentTmpDir } from '../../runs/agent-tmpdir.js';
5
- import { jobRunsIn } from '../../jobs/job.js';
4
+ import { removeAgentTmpDir } from '../../runs/agent-tmpdir.js';
6
5
  import { resolveWorktreeRetention } from '../../config.js';
7
6
  import { reclaimWorktrees } from '../../runs/retention.js';
8
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
9
- import { join } from 'node:path';
7
+ import { existsSync } from 'node:fs';
10
8
  import { atTaskHead, atContinue, narrowReviewConfig } from './launch-read-resolver.js';
11
9
  import { worktreeDiff } from '../../git-worktree.js';
12
10
  import { reviewGateEnabled } from '../../runs/review-gate.js';
@@ -53,7 +51,6 @@ export class RunSettlement {
53
51
  active: () => this.host.active.has(runId), starting: () => this.line.hasStarting(runId), queued: () => this.line.hasQueued(runId),
54
52
  claimed: () => this.host.hasClaim(runId), autosaveBlocker: () => this.host.autosaveCleanupBlocker(runId),
55
53
  privateWorkers: () => workerEvidenceRunIds(this.context.dataDir),
56
- jobHolds: () => !!run && jobHoldsScratch(this.context.dataDir, runId, run),
57
54
  });
58
55
  if (disposition === 'keep')
59
56
  return;
@@ -62,7 +59,8 @@ export class RunSettlement {
62
59
  return;
63
60
  }
64
61
  // The removal slots get the last word (`runs/removal-slots.ts`): a refusal keeps the scratch.
65
- if (deletionRefusal(runId, 'scratch', this.context.dataDir))
62
+ // The run's end lets a gate keep it past this end, as a job's does (hearsay-tools/squawk#3138).
63
+ if (deletionRefusal(runId, 'scratch', this.context.dataDir, { finishedAt: run?.finishedAt, archived: run?.archived }))
66
64
  return;
67
65
  removeAgentTmpDir(this.context.dataDir, runId);
68
66
  }
@@ -551,37 +549,6 @@ export class RunSettlement {
551
549
  }
552
550
  }
553
551
  }
554
- /** Names the task end whose reap kept the scratch for a running job. */
555
- const JOB_KEPT_FILE = '.hsq-job-kept';
556
- /**
557
- * A job started with the default directory keeps the task's scratch past the end it was running at
558
- * (hearsay-tools/squawk#3138). Every later reap of that same end keeps it too, even after the job
559
- * exits: a read mark or another run event is not an end. The task's next end (a Continue clears
560
- * `finishedAt`, and the end sets a new one), its archive or the startup sweep removes it once no
561
- * job in it runs. Archive is a removal point, so an archived run's mark holds nothing: every archive
562
- * path commits the run, and that event reaps.
563
- */
564
- export function jobHoldsScratch(dataDir, runId, run) {
565
- const locations = agentTmpDirLocations(dataDir, runId), mark = run.finishedAt ?? '';
566
- const kept = !run.archived && locations.some((dir) => { try {
567
- return readFileSync(join(dir, JOB_KEPT_FILE), 'utf8') === mark;
568
- }
569
- catch {
570
- return false;
571
- } });
572
- if (kept)
573
- return true;
574
- if (!jobRunsIn(locations))
575
- return false;
576
- // Without the mark the scratch still stays while the job runs; it goes at the first reap after.
577
- for (const dir of locations) {
578
- try {
579
- writeFileSync(join(dir, JOB_KEPT_FILE), mark);
580
- }
581
- catch { /* not this location */ }
582
- }
583
- return true;
584
- }
585
552
  export function sessionCloseKeepsWaiting(input, workflowAsk) {
586
553
  return !input.cancelled && !input.incomplete && (input.idleClosed || workflowAsk());
587
554
  }
@@ -593,6 +560,6 @@ export function terminalScratchDisposition(runId, run, reads) {
593
560
  const privateWorkers = reads.privateWorkers();
594
561
  if (run.delegation?.role === 'worker' || run.delegation?.role === 'invalid' || !privateWorkers || privateWorkers.includes(runId))
595
562
  return 'schedule';
596
- return reads.jobHolds() ? 'keep' : 'remove';
563
+ return 'remove';
597
564
  }
598
565
  //# sourceMappingURL=run-settlement.js.map