@hearsay-tools/squawk 0.18.0-dev.6807 → 0.18.0-dev.6821

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 (155) hide show
  1. package/dist/ci-wait/controller.d.ts +4 -4
  2. package/dist/contract/delegation.d.ts +20 -0
  3. package/dist/contract/index.js +4 -1
  4. package/dist/core/agent-runner.d.ts +16 -0
  5. package/dist/core/agent-runner.js +7 -0
  6. package/dist/core/agent-runner.js.map +1 -1
  7. package/dist/core/claude-cli-runner.js +3 -2
  8. package/dist/core/claude-cli-runner.js.map +1 -1
  9. package/dist/core/codex-app-server-runner.js +3 -3
  10. package/dist/core/codex-app-server-runner.js.map +1 -1
  11. package/dist/core/codex-app-server-transport.d.ts +2 -0
  12. package/dist/core/codex-app-server-transport.js +1 -1
  13. package/dist/core/codex-app-server-transport.js.map +1 -1
  14. package/dist/core/cursor-print-process.d.ts +3 -0
  15. package/dist/core/cursor-print-process.js +1 -1
  16. package/dist/core/cursor-print-process.js.map +1 -1
  17. package/dist/core/cursor-print-runner.js +3 -2
  18. package/dist/core/cursor-print-runner.js.map +1 -1
  19. package/dist/core/omp-runner.js +3 -1
  20. package/dist/core/omp-runner.js.map +1 -1
  21. package/dist/core/opencode-server-runner.js +3 -3
  22. package/dist/core/opencode-server-runner.js.map +1 -1
  23. package/dist/core/pi-runner.js +3 -2
  24. package/dist/core/pi-runner.js.map +1 -1
  25. package/dist/core/session-process.d.ts +6 -0
  26. package/dist/core/session-process.js +53 -2
  27. package/dist/core/session-process.js.map +1 -1
  28. package/dist/delegation/family-end.js +2 -4
  29. package/dist/delegation/family-end.js.map +1 -1
  30. package/dist/delegation/owned-workspace-release.d.ts +1 -2
  31. package/dist/delegation/owned-workspace-release.js +2 -2
  32. package/dist/delegation/owned-workspace-release.js.map +1 -1
  33. package/dist/delegation/process-liveness.d.ts +8 -58
  34. package/dist/delegation/process-liveness.js +9 -86
  35. package/dist/delegation/process-liveness.js.map +1 -1
  36. package/dist/delegation/routes.d.ts +25 -21
  37. package/dist/delegation/scratch-cleanup.d.ts +1 -1
  38. package/dist/delegation/scratch-cleanup.js +7 -10
  39. package/dist/delegation/scratch-cleanup.js.map +1 -1
  40. package/dist/delegation/service.js +2 -1
  41. package/dist/delegation/service.js.map +1 -1
  42. package/dist/delegation/transport.d.ts +20 -16
  43. package/dist/delegation/worker-cleanup.d.ts +2 -9
  44. package/dist/delegation/worker-cleanup.js +44 -86
  45. package/dist/delegation/worker-cleanup.js.map +1 -1
  46. package/dist/delegation/workspace-removal.d.ts +4 -12
  47. package/dist/delegation/workspace-removal.js +18 -51
  48. package/dist/delegation/workspace-removal.js.map +1 -1
  49. package/dist/git-worktree.js +2 -6
  50. package/dist/git-worktree.js.map +1 -1
  51. package/dist/preview/dev-server.d.ts +3 -0
  52. package/dist/preview/dev-server.js +40 -1
  53. package/dist/preview/dev-server.js.map +1 -1
  54. package/dist/preview/host.d.ts +3 -1
  55. package/dist/preview/host.js +2 -1
  56. package/dist/preview/host.js.map +1 -1
  57. package/dist/runs/private-record-file.d.ts +7 -0
  58. package/dist/runs/private-record-file.js +55 -0
  59. package/dist/runs/private-record-file.js.map +1 -0
  60. package/dist/runs/store.d.ts +18 -6
  61. package/dist/runs/store.js +43 -99
  62. package/dist/runs/store.js.map +1 -1
  63. package/dist/runs/worker-execution.d.ts +1 -0
  64. package/dist/runs/worker-execution.js +4 -1
  65. package/dist/runs/worker-execution.js.map +1 -1
  66. package/dist/runs/worker-resource-holders.d.ts +10 -7
  67. package/dist/runs/worker-resource-holders.js +9 -25
  68. package/dist/runs/worker-resource-holders.js.map +1 -1
  69. package/dist/server/server.d.ts +66 -58
  70. package/dist/server/workspace-live-routes.d.ts +6 -6
  71. package/dist/worker-scope/cgroup.d.ts +41 -0
  72. package/dist/worker-scope/cgroup.js +173 -0
  73. package/dist/worker-scope/cgroup.js.map +1 -0
  74. package/dist/worker-scope/groups.d.ts +24 -0
  75. package/dist/worker-scope/groups.js +60 -0
  76. package/dist/worker-scope/groups.js.map +1 -0
  77. package/dist/worker-scope/scope.d.ts +32 -0
  78. package/dist/worker-scope/scope.js +18 -0
  79. package/dist/worker-scope/scope.js.map +1 -0
  80. package/dist/worker-scope/worker-scopes.d.ts +63 -0
  81. package/dist/worker-scope/worker-scopes.js +181 -0
  82. package/dist/worker-scope/worker-scopes.js.map +1 -0
  83. package/dist/workflows/grouped-command.d.ts +3 -0
  84. package/dist/workflows/grouped-command.js +28 -2
  85. package/dist/workflows/grouped-command.js.map +1 -1
  86. package/dist/workflows/run/compose.d.ts +0 -2
  87. package/dist/workflows/run/compose.js.map +1 -1
  88. package/dist/workflows/run/continuation-session.js +1 -0
  89. package/dist/workflows/run/continuation-session.js.map +1 -1
  90. package/dist/workflows/run/input-delivery.d.ts +13 -3
  91. package/dist/workflows/run/input-delivery.js +26 -6
  92. package/dist/workflows/run/input-delivery.js.map +1 -1
  93. package/dist/workflows/run/step-loop.d.ts +1 -1
  94. package/dist/workflows/run/step-loop.js +4 -2
  95. package/dist/workflows/run/step-loop.js.map +1 -1
  96. package/dist/workflows/run/step-session.js +1 -0
  97. package/dist/workflows/run/step-session.js.map +1 -1
  98. package/dist/workflows/run/worker-executions.d.ts +2 -1
  99. package/dist/workflows/run/worker-executions.js +8 -4
  100. package/dist/workflows/run/worker-executions.js.map +1 -1
  101. package/dist/workflows/run/worker-orphans.d.ts +16 -31
  102. package/dist/workflows/run/worker-orphans.js +71 -123
  103. package/dist/workflows/run/worker-orphans.js.map +1 -1
  104. package/dist/workflows/run.d.ts +0 -2
  105. package/dist/workflows/run.js +1 -4
  106. package/dist/workflows/run.js.map +1 -1
  107. package/dist/worktree-setup.d.ts +3 -0
  108. package/dist/worktree-setup.js +2 -1
  109. package/dist/worktree-setup.js.map +1 -1
  110. package/package.json +4 -4
  111. package/web/dist/assets/{activity-motion-ankV4z_y.js → activity-motion-AuQA350-.js} +1 -1
  112. package/web/dist/assets/{activity-route-C7Lo4d_1.js → activity-route-BNZ9bOOZ.js} +1 -1
  113. package/web/dist/assets/{agent-accounts-BAUPVmTO.js → agent-accounts-D2uZHuiM.js} +1 -1
  114. package/web/dist/assets/attention-B7icDSLh.js +1 -0
  115. package/web/dist/assets/{cez-idle-TVRD1sce.js → cez-idle-MToU9Wv_.js} +1 -1
  116. package/web/dist/assets/{commit-diff-panel-Cmqi-EvU.js → commit-diff-panel-DBW7us79.js} +1 -1
  117. package/web/dist/assets/{diff-BawymO3F.js → diff-C3Cms5Ep.js} +2 -2
  118. package/web/dist/assets/{diff-view-DHx_pu8b.js → diff-view-D5zTYOKV.js} +1 -1
  119. package/web/dist/assets/{file-preview-DV7f2pOk.js → file-preview-FhzIdXZ3.js} +1 -1
  120. package/web/dist/assets/{git-toolbar-BrVfyYBr.js → git-toolbar-MFjkjDDG.js} +1 -1
  121. package/web/dist/assets/{github-DVXWmfeu.js → github-CYmdc5Dh.js} +1 -1
  122. package/web/dist/assets/{global-activity-route-ybR1xgLf.js → global-activity-route-C41ofuHV.js} +1 -1
  123. package/web/dist/assets/{index-Dc_KmL4Z.js → index-e1OpsDKN.js} +4 -4
  124. package/web/dist/assets/{live-protocol-aMLJJ0MQ.js → live-protocol-B8boP96Z.js} +1 -1
  125. package/web/dist/assets/{preview-pane-connected-CT7tXifI.js → preview-pane-connected-Ds209_UZ.js} +1 -1
  126. package/web/dist/assets/{project-router-CbWELZZ9.js → project-router-F1inY-EB.js} +1 -1
  127. package/web/dist/assets/{project-scope-context-p1OpXpSJ.js → project-scope-context-0Z0nsheq.js} +1 -1
  128. package/web/dist/assets/{prompt-template-menu-Ct3m86h1.js → prompt-template-menu-uUjg9v98.js} +1 -1
  129. package/web/dist/assets/{queries-BAUtqJph.js → queries-7W9tOZsg.js} +1 -1
  130. package/web/dist/assets/{reference-chip-B2B-Ky7w.js → reference-chip-BqRpnpaI.js} +1 -1
  131. package/web/dist/assets/{repo-git-DRONt4_i.js → repo-git-BZcRanYE.js} +1 -1
  132. package/web/dist/assets/{report-reader-BF8rmJRD.js → report-reader-BLlV3dPF.js} +1 -1
  133. package/web/dist/assets/{reports-Bv91XlcP.js → reports-C--EXqf1.js} +1 -1
  134. package/web/dist/assets/{run-header-CvJ84kr2.js → run-header-CJg8dyfz.js} +1 -1
  135. package/web/dist/assets/{skills-Ceg2Y9LM.js → skills-CHWVejdV.js} +1 -1
  136. package/web/dist/assets/{tab-link-CT5gqdai.js → tab-link-XI9xWLwR.js} +1 -1
  137. package/web/dist/assets/{task-changes-BplRsiSs.js → task-changes-DFm_EHnj.js} +1 -1
  138. package/web/dist/assets/{task-commits-CYLy-lg-.js → task-commits-BX-GVdXG.js} +1 -1
  139. package/web/dist/assets/{task-files-COYxL8mg.js → task-files-Dsn11PYu.js} +1 -1
  140. package/web/dist/assets/{task-github-item-DAD__wEa.js → task-github-item-3N6jEijR.js} +1 -1
  141. package/web/dist/assets/{task-thread-CTEobEyX.js → task-thread-VNPhkI8i.js} +1 -1
  142. package/web/dist/assets/{thread-state-CpdUCQVd.js → thread-state-D1XLo7ab.js} +1 -1
  143. package/web/dist/assets/{use-desktop-Bok38AjX.js → use-desktop-DdcA0Atl.js} +1 -1
  144. package/web/dist/assets/{use-hand-to-agent-state-DiBEjj2Y.js → use-hand-to-agent-state-2tzEmCDo.js} +1 -1
  145. package/web/dist/assets/{useInfiniteQuery-DD7iZHIJ.js → useInfiniteQuery-BmmIZbVY.js} +1 -1
  146. package/web/dist/assets/useQuery-CBKC2lBX.js +1 -0
  147. package/web/dist/assets/{workflows-Cq6Fg1ZT.js → workflows-CqqdPBFr.js} +1 -1
  148. package/web/dist/assets/{ws-CqtLOaJ8.js → ws-BvDSfSVH.js} +1 -1
  149. package/web/dist/index.html +14 -14
  150. package/web/dist/live-worker.js +1 -1
  151. package/dist/delegation/destroy-observation.d.ts +0 -44
  152. package/dist/delegation/destroy-observation.js +0 -116
  153. package/dist/delegation/destroy-observation.js.map +0 -1
  154. package/web/dist/assets/attention-C6XIgMqB.js +0 -1
  155. package/web/dist/assets/useQuery-DVAeyc_X.js +0 -1
@@ -10,6 +10,7 @@ export declare const workerExecutionSchema: z.ZodObject<{
10
10
  }>;
11
11
  neverMaterialized: z.ZodOptional<z.ZodLiteral<true>>;
12
12
  abandoned: z.ZodOptional<z.ZodLiteral<true>>;
13
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
13
14
  scratchCleanup: z.ZodOptional<z.ZodObject<{
14
15
  resourceId: z.ZodString;
15
16
  path: z.ZodString;
@@ -9,8 +9,11 @@ export const workerExecutionSchema = z.object({
9
9
  generation: z.string().uuid(), phase: z.enum(['queued', 'starting', 'complete']), neverMaterialized: z.literal(true).optional(),
10
10
  // Settlement after a same-boot crash with unverified holders is not exit proof (hearsay-tools/cezarion#839).
11
11
  abandoned: z.literal(true).optional(),
12
+ // A crashed controller's generation, settled once its recorded sessions were gone: what it left
13
+ // in the worker's scope is stopped by the next Continue (ADR 0032).
14
+ interrupted: z.literal(true).optional(),
12
15
  scratchCleanup: z.object({ resourceId: z.string().uuid(), path: z.string().refine(isAbsolute) }).strict().optional(),
13
- }).strict().refine(proof => ((!proof.neverMaterialized && !proof.scratchCleanup && !proof.abandoned) || proof.phase === 'complete') &&
16
+ }).strict().refine(proof => ((!proof.neverMaterialized && !proof.scratchCleanup && !proof.abandoned && !proof.interrupted) || proof.phase === 'complete') &&
14
17
  !(proof.abandoned && proof.neverMaterialized));
15
18
  /** Presence, not parseability, reserves scratch. Unknown evidence must never turn into an
16
19
  * orphan merely because runs.json was missing, partly salvaged, or unreadable. Undefined
@@ -1 +1 @@
1
- {"version":3,"file":"worker-execution.js","sourceRoot":"","sources":["../../src/runs/worker-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAA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AC,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,sBAAsB,CAAC,6DAA6D,KAAK,EAAE,KAAK,IAAI,SAAS,GAAG,EACxH,0DAA0D,UAAU,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,aAAa,CAAC,OAA0B;IACtD,OAAO,OAAO,CAAC,MAAM;QACnB,CAAC,CAAC,IAAI,sBAAsB,CAAC,aAAa,iBAAiB,CAAC,OAAO,CAAC,8CAA8C,EAAE,uCAAuC,CAAC;QAC5J,CAAC,CAAC,IAAI,sBAAsB,CAAC,kEAAkE,EAAE,4CAA4C,UAAU,EAAE,CAAC,CAAC;AAC/J,CAAC;AAED;0CAC0C;AAC1C,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,QAAgB;IAC/D,IAAI,KAAK,YAAY,sBAAsB;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1G,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClG,CAAC"}
@@ -1,5 +1,11 @@
1
+ /**
2
+ * Holder proof for worker persistent paths (worktree and scratch). `RunStore.workerResourceHolders`
3
+ * reads the row and checkpoints, then these helpers decide whether the generation is gone. Only the
4
+ * generation's recorded processes count: ownership is set when Squawk starts a process, never read
5
+ * from which files a process uses (ADR 0032).
6
+ */
1
7
  import type { RunRecord } from '../contract/index.js';
2
- import { type GenerationProbe, type WorkerProcessRecord } from '../delegation/process-liveness.ts';
8
+ import { type WorkerProcessRecord } from '../delegation/process-liveness.ts';
3
9
  import type { WorkerExecution } from './worker-execution.ts';
4
10
  type WorkerOwnedRun = RunRecord & {
5
11
  delegation: Extract<RunRecord['delegation'], {
@@ -8,10 +14,7 @@ type WorkerOwnedRun = RunRecord & {
8
14
  };
9
15
  /** The row owns this generation's workspace and the checkpoint is complete, or queued when admitting. */
10
16
  export declare function workerResourceAuthorized(run: RunRecord | undefined, proof: WorkerExecution | undefined, id: string, generation: string, resourceId: string, admittingQueued?: boolean): run is WorkerOwnedRun;
11
- /** Only ENOENT at every path proves absence; existsSync would also hide access errors. */
12
- export declare function workerResourcePathsGone(paths: readonly string[]): boolean;
13
- /** Recorded survivors still block reuse when every persistent path is already gone. */
14
- export declare function workerResourceAbsentHolders(record: WorkerProcessRecord | 'absent'): 'safe' | number[];
15
- /** Live PIDs that refuse reuse, or `safe` when the generation is gone. */
16
- export declare function workerResourceLiveHolders(probe: GenerationProbe): 'safe' | number[];
17
+ /** The live recorded processes of a generation: another live controller, else live session
18
+ * processes. `safe` when none is live, or the generation predates process records. */
19
+ export declare function recordedHolders(record: WorkerProcessRecord | 'absent'): 'safe' | number[];
17
20
  export {};
@@ -1,8 +1,3 @@
1
- /**
2
- * Holder proof for worker persistent paths (worktree and scratch). `RunStore.workerResourceHolders`
3
- * reads the row and checkpoints, then these helpers decide whether the generation is gone.
4
- */
5
- import { lstatSync } from 'node:fs';
6
1
  import { isCurrentProcess, recordedProcessLive } from '../delegation/process-liveness.js';
7
2
  /** The row owns this generation's workspace and the checkpoint is complete, or queued when admitting. */
8
3
  export function workerResourceAuthorized(run, proof, id, generation, resourceId, admittingQueued) {
@@ -10,25 +5,14 @@ export function workerResourceAuthorized(run, proof, id, generation, resourceId,
10
5
  run.delegation.workspace.resourceId !== resourceId || proof?.generation !== generation ||
11
6
  (proof.phase !== 'complete' && !(admittingQueued && proof.phase === 'queued')));
12
7
  }
13
- /** Only ENOENT at every path proves absence; existsSync would also hide access errors. */
14
- export function workerResourcePathsGone(paths) {
15
- return paths.every((path) => {
16
- try {
17
- lstatSync(path);
18
- return false;
19
- }
20
- catch (error) {
21
- return error.code === 'ENOENT';
22
- }
23
- });
24
- }
25
- /** Recorded survivors still block reuse when every persistent path is already gone. */
26
- export function workerResourceAbsentHolders(record) {
27
- return record === 'absent' ||
28
- ((!recordedProcessLive(record.controller) || isCurrentProcess(record.controller)) && !record.processes.some(recordedProcessLive)) ? 'safe' : [];
29
- }
30
- /** Live PIDs that refuse reuse, or `safe` when the generation is gone. */
31
- export function workerResourceLiveHolders(probe) {
32
- return probe.liveness === 'gone' ? 'safe' : probe.controller !== undefined ? [probe.controller] : probe.pids;
8
+ /** The live recorded processes of a generation: another live controller, else live session
9
+ * processes. `safe` when none is live, or the generation predates process records. */
10
+ export function recordedHolders(record) {
11
+ if (record === 'absent')
12
+ return 'safe';
13
+ if (!isCurrentProcess(record.controller) && recordedProcessLive(record.controller))
14
+ return [record.controller.pid];
15
+ const pids = record.processes.filter(recordedProcessLive).map(entry => entry.pid);
16
+ return pids.length ? pids : 'safe';
33
17
  }
34
18
  //# sourceMappingURL=worker-resource-holders.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-resource-holders.js","sourceRoot":"","sources":["../../src/runs/worker-resource-holders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAkD,MAAM,mCAAmC,CAAC;AAK1I,yGAAyG;AACzG,MAAM,UAAU,wBAAwB,CACtC,GAA0B,EAC1B,KAAkC,EAClC,EAAU,EACV,UAAkB,EAClB,UAAkB,EAClB,eAAyB;IAEzB,OAAO,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,KAAK,EAAE;QACvF,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,IA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E,mBAAmB,EAA4B,MAAM,mCAAmC,CAAC;AAKpH,yGAAyG;AACzG,MAAM,UAAU,wBAAwB,CACtC,GAA0B,EAC1B,KAAkC,EAClC,EAAU,EACV,UAAkB,EAClB,UAAkB,EAClB,eAAyB;IAEzB,OAAO,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,KAAK,EAAE;QACvF,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,IAAI,KAAK,EAAE,UAAU,KAAK,UAAU;QACtF,CAAC,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,CAAC,eAAe,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC;AAED;sFACsF;AACtF,MAAM,UAAU,eAAe,CAAC,MAAsC;IACpE,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IACvC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC;QAAE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACnH,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClF,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACrC,CAAC"}
@@ -4794,19 +4794,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4794
4794
  } & {
4795
4795
  "/repo/commit/:sha": {
4796
4796
  $get: {
4797
- output: string;
4798
- outputFormat: "text";
4799
- status: import("hono/utils/http-status").ContentfulStatusCode;
4800
- input: {
4801
- query: {
4802
- structured?: string | undefined;
4803
- };
4804
- } & {
4805
- param: {
4806
- sha: string;
4807
- };
4808
- };
4809
- } | {
4810
4797
  output: {
4811
4798
  error: string;
4812
4799
  code?: "invalid_input" | undefined;
@@ -4870,6 +4857,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4870
4857
  sha: string;
4871
4858
  };
4872
4859
  };
4860
+ } | {
4861
+ output: string;
4862
+ outputFormat: "text";
4863
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4864
+ input: {
4865
+ query: {
4866
+ structured?: string | undefined;
4867
+ };
4868
+ } & {
4869
+ param: {
4870
+ sha: string;
4871
+ };
4872
+ };
4873
4873
  };
4874
4874
  };
4875
4875
  } & {
@@ -8546,6 +8546,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
8546
8546
  summary?: string | undefined;
8547
8547
  revision?: number | undefined;
8548
8548
  } | undefined;
8549
+ scope?: {
8550
+ backend: "cgroup" | "groups";
8551
+ guarantee: "contained" | "scoped";
8552
+ } | undefined;
8549
8553
  }[];
8550
8554
  titles?: {
8551
8555
  id: string;
@@ -18242,20 +18246,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18242
18246
  } & {
18243
18247
  "/runs/:id/handoff": {
18244
18248
  $get: {
18245
- output: string;
18246
- outputFormat: "text";
18247
- status: 200;
18249
+ output: {
18250
+ error: string;
18251
+ };
18252
+ outputFormat: "json";
18253
+ status: 404;
18248
18254
  input: {
18249
18255
  param: {
18250
18256
  id: string;
18251
18257
  };
18252
18258
  };
18253
18259
  } | {
18254
- output: {
18255
- error: string;
18256
- };
18257
- outputFormat: "json";
18258
- status: 404;
18260
+ output: string;
18261
+ outputFormat: "text";
18262
+ status: 200;
18259
18263
  input: {
18260
18264
  param: {
18261
18265
  id: string;
@@ -18293,20 +18297,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18293
18297
  } & {
18294
18298
  "/runs/:id/diff": {
18295
18299
  $get: {
18296
- output: string;
18297
- outputFormat: "text";
18298
- status: import("hono/utils/http-status").ContentfulStatusCode;
18300
+ output: {
18301
+ error: string;
18302
+ };
18303
+ outputFormat: "json";
18304
+ status: 404 | 409;
18299
18305
  input: {
18300
18306
  param: {
18301
18307
  id: string;
18302
18308
  };
18303
18309
  };
18304
18310
  } | {
18305
- output: {
18306
- error: string;
18307
- };
18308
- outputFormat: "json";
18309
- status: 404 | 409;
18311
+ output: string;
18312
+ outputFormat: "text";
18313
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18310
18314
  input: {
18311
18315
  param: {
18312
18316
  id: string;
@@ -20599,19 +20603,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20599
20603
  } & {
20600
20604
  "/repo/commit/:sha": {
20601
20605
  $get: {
20602
- output: string;
20603
- outputFormat: "text";
20604
- status: import("hono/utils/http-status").ContentfulStatusCode;
20605
- input: {
20606
- query: {
20607
- structured?: string | undefined;
20608
- };
20609
- } & {
20610
- param: {
20611
- sha: string;
20612
- };
20613
- };
20614
- } | {
20615
20606
  output: {
20616
20607
  error: string;
20617
20608
  code?: "invalid_input" | undefined;
@@ -20675,6 +20666,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
20675
20666
  sha: string;
20676
20667
  };
20677
20668
  };
20669
+ } | {
20670
+ output: string;
20671
+ outputFormat: "text";
20672
+ status: import("hono/utils/http-status").ContentfulStatusCode;
20673
+ input: {
20674
+ query: {
20675
+ structured?: string | undefined;
20676
+ };
20677
+ } & {
20678
+ param: {
20679
+ sha: string;
20680
+ };
20681
+ };
20678
20682
  };
20679
20683
  };
20680
20684
  } & {
@@ -24351,6 +24355,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
24351
24355
  summary?: string | undefined;
24352
24356
  revision?: number | undefined;
24353
24357
  } | undefined;
24358
+ scope?: {
24359
+ backend: "cgroup" | "groups";
24360
+ guarantee: "contained" | "scoped";
24361
+ } | undefined;
24354
24362
  }[];
24355
24363
  titles?: {
24356
24364
  id: string;
@@ -34047,20 +34055,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34047
34055
  } & {
34048
34056
  "/runs/:id/handoff": {
34049
34057
  $get: {
34050
- output: string;
34051
- outputFormat: "text";
34052
- status: 200;
34058
+ output: {
34059
+ error: string;
34060
+ };
34061
+ outputFormat: "json";
34062
+ status: 404;
34053
34063
  input: {
34054
34064
  param: {
34055
34065
  id: string;
34056
34066
  };
34057
34067
  };
34058
34068
  } | {
34059
- output: {
34060
- error: string;
34061
- };
34062
- outputFormat: "json";
34063
- status: 404;
34069
+ output: string;
34070
+ outputFormat: "text";
34071
+ status: 200;
34064
34072
  input: {
34065
34073
  param: {
34066
34074
  id: string;
@@ -34098,20 +34106,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
34098
34106
  } & {
34099
34107
  "/runs/:id/diff": {
34100
34108
  $get: {
34101
- output: string;
34102
- outputFormat: "text";
34103
- status: import("hono/utils/http-status").ContentfulStatusCode;
34109
+ output: {
34110
+ error: string;
34111
+ };
34112
+ outputFormat: "json";
34113
+ status: 404 | 409;
34104
34114
  input: {
34105
34115
  param: {
34106
34116
  id: string;
34107
34117
  };
34108
34118
  };
34109
34119
  } | {
34110
- output: {
34111
- error: string;
34112
- };
34113
- outputFormat: "json";
34114
- status: 404 | 409;
34120
+ output: string;
34121
+ outputFormat: "text";
34122
+ status: import("hono/utils/http-status").ContentfulStatusCode;
34115
34123
  input: {
34116
34124
  param: {
34117
34125
  id: string;
@@ -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";
@@ -20,12 +26,6 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
20
26
  cursor: string;
21
27
  afterSeq: number;
22
28
  hasMore: boolean;
23
- } | {
24
- projectId: string;
25
- runId: string;
26
- type: "error" | "reset";
27
- status: 400 | 404 | 409 | 413 | 503;
28
- error: string;
29
29
  })[];
30
30
  };
31
31
  outputFormat: "json";
@@ -0,0 +1,41 @@
1
+ /** What cgroup operations read and write; tests replace it. */
2
+ export type CgroupFs = {
3
+ readFile: (path: string) => string;
4
+ writeFile: (path: string, data: string) => void;
5
+ mkdir: (path: string) => void;
6
+ rmdir: (path: string) => void;
7
+ /** False only when nothing is there; any other lookup failure throws: it proves no absence. */
8
+ isDir: (path: string) => boolean;
9
+ /** The child cgroups directly under `path`. */
10
+ children: (path: string) => string[];
11
+ };
12
+ export declare const realCgroupFs: CgroupFs;
13
+ /** The cgroup v2 directory this process is in, from `/proc/self/cgroup`. Undefined on cgroup v1,
14
+ * a hybrid host without a unified entry, or a path that leaves the hierarchy. */
15
+ export declare function ownCgroup(fs?: CgroupFs): string | undefined;
16
+ /** The argv that runs `file args` inside the cgroup at `path`. */
17
+ export declare function cgroupCommand(path: string, file: string, args: readonly string[]): [string, string[]];
18
+ /** Whether this host lets the controller create, enter, kill and remove a child cgroup. A writable
19
+ * mount alone is no proof, so the probe does each step for real; any failure answers why. */
20
+ export declare function probeCgroups(fs?: CgroupFs, place?: (procs: string) => boolean): {
21
+ base: string;
22
+ } | {
23
+ reason: string;
24
+ };
25
+ /** Where the worker's cgroup lives under `base`. */
26
+ export declare function workerCgroupPath(base: string, workerId: string): string;
27
+ /** The worker's cgroup under `base`, created when absent. A path that exists as anything but a
28
+ * real directory throws: it is not ours. */
29
+ export declare function ensureCgroup(base: string, workerId: string, fs?: CgroupFs): string;
30
+ /** Whether `path` still holds a process; an absent group holds none. */
31
+ export declare function cgroupPopulated(path: string, fs?: CgroupFs): boolean;
32
+ /** SIGKILL every process in `path` and its descendants now. An absent group is already empty. */
33
+ export declare function killCgroup(path: string, fs?: CgroupFs): void;
34
+ /** Kill, wait until empty, remove; repeated until the group is gone or `deadline` passes. One
35
+ * `cgroup.kill` on the worker's cgroup ends every process in it and in its descendants, and its
36
+ * `populated 0` covers them all; a child cgroup the worker made (threaded ones refuse their own
37
+ * `cgroup.kill`) is then removed depth-first, since the kernel removes only a cgroup without
38
+ * children. A process that placed itself after the kill makes a removal fail with EBUSY, so the
39
+ * round repeats; once the group is removed no process can enter it. True when the group is gone;
40
+ * a lookup that fails for any reason but absence answers false, never success. */
41
+ export declare function removeCgroup(path: string, deadline: number, fs?: CgroupFs): Promise<boolean>;
@@ -0,0 +1,173 @@
1
+ /** The Linux `cgroup` backend: one private cgroup v2 child per worker, under the controller's own
2
+ * cgroup. A process places itself before its command runs, so every descendant inherits the
3
+ * group, detached ones too, and `cgroup.kill` ends them all (ADR 0032). */
4
+ import { spawnSync } from 'node:child_process';
5
+ import { randomUUID } from 'node:crypto';
6
+ import { lstatSync, mkdirSync, readdirSync, readFileSync, rmdirSync, writeFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ const CGROUP_ROOT = '/sys/fs/cgroup';
9
+ const SHELL = '/bin/sh';
10
+ /** `$0` is the target `cgroup.procs`; `0` names the writer, the shell itself, which then becomes
11
+ * the command through `exec` (same pid). A failed move ends the shell before the command runs. */
12
+ const PLACE = 'echo 0 > "$0" && exec "$@"';
13
+ const POLL_MS = 10;
14
+ export const realCgroupFs = {
15
+ readFile: path => readFileSync(path, 'utf8'),
16
+ writeFile: (path, data) => writeFileSync(path, data),
17
+ mkdir: path => mkdirSync(path, { mode: 0o700 }),
18
+ rmdir: path => rmdirSync(path),
19
+ isDir: path => {
20
+ try {
21
+ const s = lstatSync(path);
22
+ return s.isDirectory() && !s.isSymbolicLink();
23
+ }
24
+ catch (error) {
25
+ if (code(error) === 'ENOENT')
26
+ return false;
27
+ throw error;
28
+ }
29
+ },
30
+ children: path => readdirSync(path, { withFileTypes: true }).filter(entry => entry.isDirectory()).map(entry => join(path, entry.name)),
31
+ };
32
+ /** The cgroup v2 directory this process is in, from `/proc/self/cgroup`. Undefined on cgroup v1,
33
+ * a hybrid host without a unified entry, or a path that leaves the hierarchy. */
34
+ export function ownCgroup(fs = realCgroupFs) {
35
+ let text;
36
+ try {
37
+ text = fs.readFile('/proc/self/cgroup');
38
+ }
39
+ catch {
40
+ return undefined;
41
+ }
42
+ const line = text.split('\n').find(entry => entry.startsWith('0::/'));
43
+ if (!line)
44
+ return undefined;
45
+ const path = line.slice(3).trim();
46
+ if (path.split('/').includes('..'))
47
+ return undefined;
48
+ return path === '/' ? CGROUP_ROOT : join(CGROUP_ROOT, path);
49
+ }
50
+ /** The argv that runs `file args` inside the cgroup at `path`. */
51
+ export function cgroupCommand(path, file, args) {
52
+ return [SHELL, ['-c', PLACE, join(path, 'cgroup.procs'), file, ...args]];
53
+ }
54
+ /** Whether this host lets the controller create, enter, kill and remove a child cgroup. A writable
55
+ * mount alone is no proof, so the probe does each step for real; any failure answers why. */
56
+ export function probeCgroups(fs = realCgroupFs, place = placeProbe) {
57
+ const base = ownCgroup(fs);
58
+ if (!base)
59
+ return { reason: 'no cgroup v2 entry in /proc/self/cgroup' };
60
+ const probe = join(base, `squawk-probe-${randomUUID()}`);
61
+ try {
62
+ fs.mkdir(probe);
63
+ }
64
+ catch (error) {
65
+ return { reason: `cannot create a child cgroup (${code(error)})` };
66
+ }
67
+ let failure;
68
+ try {
69
+ if (!place(join(probe, 'cgroup.procs')))
70
+ failure = 'cannot move a process into a child cgroup';
71
+ else
72
+ fs.writeFile(join(probe, 'cgroup.kill'), '1');
73
+ }
74
+ catch (error) {
75
+ failure = `cannot kill a child cgroup (${code(error)})`;
76
+ }
77
+ // Removal is part of the proof: a host that cannot remove a worker's cgroup cannot destroy it.
78
+ try {
79
+ fs.rmdir(probe);
80
+ }
81
+ catch (error) {
82
+ failure ??= `cannot remove a child cgroup (${code(error)})`;
83
+ }
84
+ return failure ? { reason: failure } : { base };
85
+ }
86
+ /** A shell moves itself into the probe group and exits; exit 0 means the move worked. */
87
+ function placeProbe(procs) {
88
+ const result = spawnSync(SHELL, ['-c', 'echo 0 > "$0"', procs], { stdio: 'ignore', timeout: 5_000 });
89
+ return result.status === 0;
90
+ }
91
+ const code = (error) => error.code ?? String(error);
92
+ /** Where the worker's cgroup lives under `base`. */
93
+ export function workerCgroupPath(base, workerId) {
94
+ return join(base, `squawk-worker-${workerId}`);
95
+ }
96
+ /** The worker's cgroup under `base`, created when absent. A path that exists as anything but a
97
+ * real directory throws: it is not ours. */
98
+ export function ensureCgroup(base, workerId, fs = realCgroupFs) {
99
+ const path = workerCgroupPath(base, workerId);
100
+ if (fs.isDir(path))
101
+ return path;
102
+ fs.mkdir(path);
103
+ return path;
104
+ }
105
+ /** Whether `path` still holds a process; an absent group holds none. */
106
+ export function cgroupPopulated(path, fs = realCgroupFs) {
107
+ let events;
108
+ try {
109
+ events = fs.readFile(join(path, 'cgroup.events'));
110
+ }
111
+ catch (error) {
112
+ if (code(error) === 'ENOENT')
113
+ return false;
114
+ throw error;
115
+ }
116
+ return /(?:^|\n)populated 1(?:\n|$)/.test(events);
117
+ }
118
+ /** SIGKILL every process in `path` and its descendants now. An absent group is already empty. */
119
+ export function killCgroup(path, fs = realCgroupFs) {
120
+ try {
121
+ fs.writeFile(join(path, 'cgroup.kill'), '1');
122
+ }
123
+ catch (error) {
124
+ if (code(error) !== 'ENOENT')
125
+ throw error;
126
+ }
127
+ }
128
+ /** Kill, wait until empty, remove; repeated until the group is gone or `deadline` passes. One
129
+ * `cgroup.kill` on the worker's cgroup ends every process in it and in its descendants, and its
130
+ * `populated 0` covers them all; a child cgroup the worker made (threaded ones refuse their own
131
+ * `cgroup.kill`) is then removed depth-first, since the kernel removes only a cgroup without
132
+ * children. A process that placed itself after the kill makes a removal fail with EBUSY, so the
133
+ * round repeats; once the group is removed no process can enter it. True when the group is gone;
134
+ * a lookup that fails for any reason but absence answers false, never success. */
135
+ export async function removeCgroup(path, deadline, fs = realCgroupFs) {
136
+ try {
137
+ for (;;) {
138
+ if (!fs.isDir(path))
139
+ return true;
140
+ killCgroup(path, fs);
141
+ while (cgroupPopulated(path, fs) && Date.now() < deadline)
142
+ await sleep(POLL_MS);
143
+ const removed = removeTree(path, fs);
144
+ if (removed === true)
145
+ return true;
146
+ if (removed === 'fatal' || Date.now() >= deadline)
147
+ return false;
148
+ await sleep(POLL_MS);
149
+ }
150
+ }
151
+ catch {
152
+ return false;
153
+ }
154
+ }
155
+ /** Removes `path` and its child cgroups, deepest first. `busy` when a cgroup still holds a process. */
156
+ function removeTree(path, fs) {
157
+ for (const child of fs.children(path)) {
158
+ const removed = removeTree(child, fs);
159
+ if (removed !== true)
160
+ return removed;
161
+ }
162
+ try {
163
+ fs.rmdir(path);
164
+ return true;
165
+ }
166
+ catch (error) {
167
+ if (code(error) === 'ENOENT')
168
+ return true;
169
+ return code(error) === 'EBUSY' ? 'busy' : 'fatal';
170
+ }
171
+ }
172
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
173
+ //# sourceMappingURL=cgroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cgroup.js","sourceRoot":"","sources":["../../src/worker-scope/cgroup.ts"],"names":[],"mappings":"AAAA;;2EAE2E;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB;kGACkG;AAClG,MAAM,KAAK,GAAG,4BAA4B,CAAC;AAC3C,MAAM,OAAO,GAAG,EAAE,CAAC;AAanB,MAAM,CAAC,MAAM,YAAY,GAAa;IACpC,QAAQ,EAAE,IAAI,CAAC,EAAE,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AAO,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type RecordedProcess } from '../core/process-stat.ts';
2
+ /** A group leader at spawn: its pid is its group id. */
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
+ /** SIGKILL every recorded group that is still ours, and every recorded process outside a group
14
+ * that is still the recorded incarnation. */
15
+ export declare function killGroups(entries: readonly RecordedProcess[]): void;
16
+ /** After a SIGKILL to the whole group, the recorded entries that still have a running process: a
17
+ * leader that is still the recorded incarnation, or, for a group of ours whose leader is gone, a
18
+ * running member (a zombie whose other threads run counts: they still hold its sockets). A SIGKILL takes effect asynchronously, so a member can still hold a
19
+ * port for a moment; a group of zombies still answers `kill(-pgid, 0)` until its reaper reaps it,
20
+ * which an init that does not reap never does, so zombies are never waited for. */
21
+ export declare function groupsStillStopping(entries: readonly RecordedProcess[]): RecordedProcess[];
22
+ /** The recorded groups that are still ours and have a member, and the recorded processes outside
23
+ * a group that are still the recorded incarnation. */
24
+ export declare function liveGroups(entries: readonly RecordedProcess[]): RecordedProcess[];