@hearsay-tools/squawk 0.18.0-pr3703.6809 → 0.18.0-pr3704.6811

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 (180) hide show
  1. package/dist/ci-wait/controller.d.ts +4 -4
  2. package/dist/contract/delegation.d.ts +22 -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 +79 -75
  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 +19 -15
  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 +44 -2
  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/live-routes.d.ts +6 -6
  70. package/dist/server/server.d.ts +14 -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/job.d.ts +27 -0
  78. package/dist/worker-scope/job.js +50 -0
  79. package/dist/worker-scope/job.js.map +1 -0
  80. package/dist/worker-scope/scope.d.ts +34 -0
  81. package/dist/worker-scope/scope.js +20 -0
  82. package/dist/worker-scope/scope.js.map +1 -0
  83. package/dist/worker-scope/worker-scopes.d.ts +74 -0
  84. package/dist/worker-scope/worker-scopes.js +231 -0
  85. package/dist/worker-scope/worker-scopes.js.map +1 -0
  86. package/dist/workflows/grouped-command.d.ts +3 -0
  87. package/dist/workflows/grouped-command.js +28 -2
  88. package/dist/workflows/grouped-command.js.map +1 -1
  89. package/dist/workflows/run/compose.d.ts +0 -2
  90. package/dist/workflows/run/compose.js +0 -5
  91. package/dist/workflows/run/compose.js.map +1 -1
  92. package/dist/workflows/run/continuation-session.js +1 -0
  93. package/dist/workflows/run/continuation-session.js.map +1 -1
  94. package/dist/workflows/run/input-delivery.d.ts +0 -6
  95. package/dist/workflows/run/input-delivery.js +0 -10
  96. package/dist/workflows/run/input-delivery.js.map +1 -1
  97. package/dist/workflows/run/liveness-timers.d.ts +1 -1
  98. package/dist/workflows/run/liveness-timers.js +1 -1
  99. package/dist/workflows/run/liveness-timers.js.map +1 -1
  100. package/dist/workflows/run/run-settlement.js +1 -2
  101. package/dist/workflows/run/run-settlement.js.map +1 -1
  102. package/dist/workflows/run/session-events.d.ts +0 -1
  103. package/dist/workflows/run/session-events.js +3 -6
  104. package/dist/workflows/run/session-events.js.map +1 -1
  105. package/dist/workflows/run/step-loop.d.ts +1 -1
  106. package/dist/workflows/run/step-loop.js +4 -2
  107. package/dist/workflows/run/step-loop.js.map +1 -1
  108. package/dist/workflows/run/step-session.js +1 -0
  109. package/dist/workflows/run/step-session.js.map +1 -1
  110. package/dist/workflows/run/turn-nudges.d.ts +0 -22
  111. package/dist/workflows/run/turn-nudges.js +1 -44
  112. package/dist/workflows/run/turn-nudges.js.map +1 -1
  113. package/dist/workflows/run/turn-settler.d.ts +1 -5
  114. package/dist/workflows/run/turn-settler.js +8 -15
  115. package/dist/workflows/run/turn-settler.js.map +1 -1
  116. package/dist/workflows/run/worker-executions.d.ts +2 -1
  117. package/dist/workflows/run/worker-executions.js +8 -4
  118. package/dist/workflows/run/worker-executions.js.map +1 -1
  119. package/dist/workflows/run/worker-orphans.d.ts +16 -31
  120. package/dist/workflows/run/worker-orphans.js +71 -123
  121. package/dist/workflows/run/worker-orphans.js.map +1 -1
  122. package/dist/workflows/run-states.js +0 -1
  123. package/dist/workflows/run-states.js.map +1 -1
  124. package/dist/workflows/run.d.ts +0 -2
  125. package/dist/workflows/run.js +1 -4
  126. package/dist/workflows/run.js.map +1 -1
  127. package/dist/workflows/turn-end.d.ts +0 -1
  128. package/dist/workflows/turn-end.js +0 -1
  129. package/dist/workflows/turn-end.js.map +1 -1
  130. package/dist/worktree-setup.d.ts +3 -0
  131. package/dist/worktree-setup.js +2 -1
  132. package/dist/worktree-setup.js.map +1 -1
  133. package/package.json +4 -4
  134. package/scripts/windows-worker-job.cs +176 -0
  135. package/scripts/windows-worker-job.ps1 +23 -0
  136. package/web/dist/assets/{activity-motion-ankV4z_y.js → activity-motion-awuRigEi.js} +1 -1
  137. package/web/dist/assets/{activity-route-C7Lo4d_1.js → activity-route-rhYVhpXu.js} +1 -1
  138. package/web/dist/assets/{agent-accounts-BAUPVmTO.js → agent-accounts-D3q1WLxk.js} +1 -1
  139. package/web/dist/assets/attention-CdwMIvQG.js +1 -0
  140. package/web/dist/assets/{cez-idle-TVRD1sce.js → cez-idle-BqmM5iRr.js} +1 -1
  141. package/web/dist/assets/{commit-diff-panel-Cmqi-EvU.js → commit-diff-panel-CZAQ_wMQ.js} +1 -1
  142. package/web/dist/assets/{diff-BawymO3F.js → diff-BDJ4xGSd.js} +2 -2
  143. package/web/dist/assets/{diff-view-DHx_pu8b.js → diff-view-Bn7tV6S7.js} +1 -1
  144. package/web/dist/assets/{file-preview-DV7f2pOk.js → file-preview-1f8vPVsK.js} +1 -1
  145. package/web/dist/assets/{git-toolbar-BrVfyYBr.js → git-toolbar-BbY7l1x9.js} +1 -1
  146. package/web/dist/assets/{github-DVXWmfeu.js → github-CTdrVztq.js} +1 -1
  147. package/web/dist/assets/{global-activity-route-ybR1xgLf.js → global-activity-route-xvY0P60v.js} +1 -1
  148. package/web/dist/assets/{index-Dc_KmL4Z.js → index-MgNz22Tg.js} +4 -4
  149. package/web/dist/assets/{live-protocol-aMLJJ0MQ.js → live-protocol-BmbbwF5R.js} +1 -1
  150. package/web/dist/assets/{preview-pane-connected-CT7tXifI.js → preview-pane-connected-D6TfZFTU.js} +1 -1
  151. package/web/dist/assets/{project-router-CbWELZZ9.js → project-router-BqAKGSaS.js} +1 -1
  152. package/web/dist/assets/{project-scope-context-p1OpXpSJ.js → project-scope-context-B0yKt2yI.js} +1 -1
  153. package/web/dist/assets/{prompt-template-menu-Ct3m86h1.js → prompt-template-menu-DpCrLDWG.js} +1 -1
  154. package/web/dist/assets/{queries-BAUtqJph.js → queries-DoYRza8s.js} +1 -1
  155. package/web/dist/assets/{reference-chip-B2B-Ky7w.js → reference-chip-Dd_YU2KX.js} +1 -1
  156. package/web/dist/assets/{repo-git-DRONt4_i.js → repo-git-BrkR6pTH.js} +1 -1
  157. package/web/dist/assets/{report-reader-BF8rmJRD.js → report-reader-BeZdoVhf.js} +1 -1
  158. package/web/dist/assets/{reports-Bv91XlcP.js → reports-D93WfzdD.js} +1 -1
  159. package/web/dist/assets/{run-header-CvJ84kr2.js → run-header-FB4j_Fjm.js} +1 -1
  160. package/web/dist/assets/{skills-Ceg2Y9LM.js → skills-BV3eF6mC.js} +1 -1
  161. package/web/dist/assets/{tab-link-CT5gqdai.js → tab-link-CGzPcVvS.js} +1 -1
  162. package/web/dist/assets/{task-changes-BplRsiSs.js → task-changes-f9ldtHuA.js} +1 -1
  163. package/web/dist/assets/{task-commits-CYLy-lg-.js → task-commits-CLjEhkFM.js} +1 -1
  164. package/web/dist/assets/{task-files-COYxL8mg.js → task-files-BEKlg0dR.js} +1 -1
  165. package/web/dist/assets/{task-github-item-DAD__wEa.js → task-github-item-CbdPCKot.js} +1 -1
  166. package/web/dist/assets/{task-thread-CTEobEyX.js → task-thread-BPSL3OMS.js} +1 -1
  167. package/web/dist/assets/{thread-state-CpdUCQVd.js → thread-state-ZdBez7Ij.js} +1 -1
  168. package/web/dist/assets/{use-desktop-Bok38AjX.js → use-desktop-BwkqVHep.js} +1 -1
  169. package/web/dist/assets/{use-hand-to-agent-state-DiBEjj2Y.js → use-hand-to-agent-state-BOD9cT6o.js} +1 -1
  170. package/web/dist/assets/{useInfiniteQuery-DD7iZHIJ.js → useInfiniteQuery-DYAQvmMU.js} +1 -1
  171. package/web/dist/assets/useQuery-CnVG8NoC.js +1 -0
  172. package/web/dist/assets/{workflows-Cq6Fg1ZT.js → workflows-Driy32Xn.js} +1 -1
  173. package/web/dist/assets/{ws-CqtLOaJ8.js → ws-BXpZYApG.js} +1 -1
  174. package/web/dist/index.html +14 -14
  175. package/web/dist/live-worker.js +1 -1
  176. package/dist/delegation/destroy-observation.d.ts +0 -44
  177. package/dist/delegation/destroy-observation.js +0 -116
  178. package/dist/delegation/destroy-observation.js.map +0 -1
  179. package/web/dist/assets/attention-C6XIgMqB.js +0 -1
  180. package/web/dist/assets/useQuery-DVAeyc_X.js +0 -1
@@ -15,7 +15,6 @@ import { isLiveRecord } from '../runs/run-row.js';
15
15
  import { ownedWorkspaceReceipts } from './workspace-record.js';
16
16
  import { releaseThenRemoveWorktree } from '../git-worktree-release.js';
17
17
  import { releaseThenRemoveOwnedWorkspace } from './owned-workspace-release.js';
18
- import { inspectGeneration } from './process-liveness.js';
19
18
  const SETTLED = new Set(['done', 'failed', 'cancelled', 'review']);
20
19
  /** A settled worker whose family has ended, with no member live, no destroy recorded and its
21
20
  * directory gone. */
@@ -56,15 +55,14 @@ function inProject(repoRoot, workspace) {
56
55
  }
57
56
  }
58
57
  /** An orphan receipt's directory goes as an archived worker's does: only when it is clean, and only
59
- * while still no run owns it and no process works in it. True once the directory is gone. */
58
+ * while still no run owns it. A process that works in it is not the worker's (ADR 0032). True once
59
+ * the directory is gone. */
60
60
  async function reclaimOrphanDirectory(repoRoot, store, workspace) {
61
61
  if (!existsSync(workspace.path))
62
62
  return true;
63
63
  const assertOrphan = () => {
64
64
  if (store.getRun(workspace.ownerRunId))
65
65
  throw new Error('The receipt has a run');
66
- if (inspectGeneration({ paths: [workspace.path] }).liveness !== 'gone')
67
- throw new Error('A process may hold the directory');
68
66
  };
69
67
  try {
70
68
  assertOrphan();
@@ -1 +1 @@
1
- {"version":3,"file":"family-end.js","sourceRoot":"","sources":["../../src/delegation/family-end.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK1D,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExF;sBACsB;AACtB,MAAM,UAAU,iBAAiB,CAAC,GAAc,EAAE,KAAuD;IACvG,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO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,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,UAAU,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC1E,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU;wBAC3E,OAAO,EAAE,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,8 +1,7 @@
1
1
  import type { WorkerDestroyResult, WorkerWorkspace } from '../contract/index.js';
2
- import { type RemovalReport } from './workspace-removal.ts';
3
2
  import type { PreviewHostLike } from '../preview/registration.ts';
4
3
  /** A destroyed owned worker's checkout: the same rule as `releaseThenRemoveWorktree` (`git-worktree-release.ts`),
5
4
  * through the delegation cleanup's own fenced removal. */
6
5
  export declare function releaseThenRemoveOwnedWorkspace(deps: {
7
6
  previewHost?: Pick<PreviewHostLike, 'release'> | undefined;
8
- }, repoRoot: string, workspace: WorkerWorkspace, assertCurrent?: () => void, assertUnheld?: () => void, report?: RemovalReport): Promise<WorkerDestroyResult>;
7
+ }, repoRoot: string, workspace: WorkerWorkspace, assertCurrent?: () => void, assertUnheld?: () => void): Promise<WorkerDestroyResult>;
@@ -1,9 +1,9 @@
1
1
  import { removeOwnedWorkspace } from './workspace-removal.js';
2
2
  /** A destroyed owned worker's checkout: the same rule as `releaseThenRemoveWorktree` (`git-worktree-release.ts`),
3
3
  * through the delegation cleanup's own fenced removal. */
4
- export async function releaseThenRemoveOwnedWorkspace(deps, repoRoot, workspace, assertCurrent, assertUnheld, report) {
4
+ export async function releaseThenRemoveOwnedWorkspace(deps, repoRoot, workspace, assertCurrent, assertUnheld) {
5
5
  return removeOwnedWorkspace(repoRoot, workspace, assertCurrent, async () => {
6
6
  await deps.previewHost?.release(workspace.ownerRunId).catch(() => undefined);
7
- }, assertUnheld, report);
7
+ }, assertUnheld);
8
8
  }
9
9
  //# sourceMappingURL=owned-workspace-release.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"owned-workspace-release.js","sourceRoot":"","sources":["../../src/delegation/owned-workspace-release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,wBAAwB,CAAC;AAGlF;0DAC0D;AAC1D,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,IAAoE,EACpE,QAAgB,EAChB,SAA0B,EAC1B,aAA0B,EAC1B,YAAyB,EACzB,MAAsB;IAEtB,OAAO,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/E,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"file":"owned-workspace-release.js","sourceRoot":"","sources":["../../src/delegation/owned-workspace-release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D;0DAC0D;AAC1D,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,IAAoE,EACpE,QAAgB,EAChB,SAA0B,EAC1B,aAA0B,EAC1B,YAAyB;IAEzB,OAAO,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/E,CAAC,EAAE,YAAY,CAAC,CAAC;AACnB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { type RecordedProcess } from '../core/process-stat.ts';
2
2
  /**
3
- * Synchronous process evidence for worker recovery and resource cleanup. Unreadable cwd is no
4
- * evidence; other uncertainty stays alive or unknown, never proven gone.
3
+ * Synchronous process evidence: recorded-process liveness for worker recovery, and the cwd scan
4
+ * that autosave cleanup still uses. Worker ownership never comes from the scan (ADR 0032).
5
+ * Unreadable cwd is no evidence; other uncertainty stays alive or unknown, never proven gone.
5
6
  */
6
7
  export { parseProcStat, processStartToken, recordedProcessLive, type RecordedProcess } from '../core/process-stat.ts';
7
8
  export type WorkerProcessRecord = {
@@ -9,37 +10,23 @@ export type WorkerProcessRecord = {
9
10
  controller: RecordedProcess;
10
11
  processes: RecordedProcess[];
11
12
  };
12
- export type GenerationLiveness = 'gone' | 'alive' | 'unknown';
13
13
  /** A different recorded Linux boot proves every original process group ended. */
14
14
  export declare function processPredatesCurrentBoot(entry: RecordedProcess): boolean;
15
- /** Whether a recorded session leader's group may be signalled (hearsay-tools/cezarion#890). A live
16
- * leader must be the exact recorded incarnation; a different one means the group emptied and its
17
- * number was reused. A dead leader proves nothing: its number may since have been reused, and a
18
- * double-fork daemon leaves exactly a live group with a dead leader. Such a group is signalled
19
- * only when it holds the worker's paths: `holderGroups` are the groups of those holders. */
20
- export declare function recordedGroupSignalable(entry: RecordedProcess, holderGroups?: readonly number[]): boolean;
21
15
  export declare function isCurrentProcess(entry: RecordedProcess): boolean;
22
16
  /** The `/proc` reads the Linux scan makes; injectable for platform/error boundary coverage. */
23
17
  export type ProcReader = {
24
18
  readdir: () => string[];
25
19
  readlink: (pid: string) => string;
26
20
  };
27
- /** The darwin scan: `lsof` for working directories, of every process or of one. */
21
+ /** The darwin scan: `lsof` for every process's working directory. */
28
22
  export type DarwinReader = {
29
23
  lsof: () => {
30
24
  ok: boolean;
31
25
  stdout: string;
32
26
  };
33
- lsofPid?: (pid: number) => {
34
- ok: boolean;
35
- stdout: string;
36
- };
37
27
  };
38
28
  /** Each other process's readable working directory, by pid, or `unknown` when none can be listed. */
39
29
  export type CwdSnapshot = ReadonlyMap<number, string> | 'unknown';
40
- /** A snapshot taken on first use. Shared only inside one synchronous reprobe tick, never across
41
- * a yield; destroy, admission and history deletion scan fresh (hearsay-tools/cezarion#879). */
42
- export type CwdSource = () => CwdSnapshot;
43
30
  /** Every other process's readable working directory, in one scan pass; `unknown` when the
44
31
  * processes cannot be listed at all. An unreadable cwd is no evidence (hearsay-tools/cezarion#889):
45
32
  * a process that vanished, another user's, or a non-dumpable one of ours (login `sshd`,
@@ -47,47 +34,10 @@ export type CwdSource = () => CwdSnapshot;
47
34
  * read. win32 has no cwd scan and answers none: Windows refuses to delete a directory a process
48
35
  * holds, so the checked removal is the proof there, beside the recorded processes. */
49
36
  export declare function scanProcessCwds(platform?: NodeJS.Platform, proc?: ProcReader, darwin?: DarwinReader): CwdSnapshot;
50
- /** One lazy `scan`, memoized for the life of the returned source. */
51
- export declare function sharedCwdScan(scan?: () => CwdSnapshot): CwdSource;
52
- /** PIDs (never this process) whose readable working directory is one of `dirs` or beneath it,
53
- * from `cwds` when the caller shares a snapshot, else from a fresh scan. Squawk's own short-lived
54
- * git children in a worktree make this read "alive" briefly: conservative, and a retry self-heals. */
55
- export declare function processesWithCwdUnder(dirs: string | readonly string[], platform?: NodeJS.Platform, proc?: ProcReader, darwin?: DarwinReader, cwds?: CwdSnapshot): number[] | 'unknown';
56
- /** Whether one process's working directory is still one of `dirs` or beneath it, without a scan:
57
- * one `readlink` on Linux, one `lsof` of that process on darwin. `false` when it moved away or
58
- * cannot be read (no evidence, hearsay-tools/cezarion#889); `undefined` on win32, whose scan names
59
- * no holder in the first place. */
60
- export declare function processCwdUnder(pid: number, dirs: readonly string[], platform?: NodeJS.Platform, proc?: ProcReader, darwin?: DarwinReader): boolean | undefined;
37
+ /** PIDs (never this process) whose readable working directory is one of `dirs` or beneath it.
38
+ * Squawk's own short-lived git children in a worktree make this read "alive" briefly:
39
+ * conservative, and a retry self-heals. */
40
+ export declare function processesWithCwdUnder(dirs: string | readonly string[], platform?: NodeJS.Platform, proc?: ProcReader, darwin?: DarwinReader): number[] | 'unknown';
61
41
  /** Holder pids with their executable names, `123 (sleep), 456`, so a refusal tells a test server from
62
42
  * an agent's leftover (hearsay-tools/squawk#914). At most 8 are named. */
63
43
  export declare function describeProcesses(pids: readonly number[]): string;
64
- export type GenerationProbe = {
65
- liveness: GenerationLiveness;
66
- controller?: number;
67
- pids: number[];
68
- };
69
- /** Fresh resource proof for destroy, reuse, admission, scratch cleanup and history deletion.
70
- * Controller boot says nothing about who holds persistent paths, so it always scans. A process
71
- * blocks only when its readable cwd is under `paths`, when it is a live recorded process of the
72
- * generation, or when it is a live foreign controller (hearsay-tools/cezarion#889). `paths` are
73
- * the worktree and every scratch location; a missing record (legacy) relies on the scan alone.
74
- * A live foreign controller short-circuits the scan; otherwise `pids` names every holder.
75
- * `cwds` is a reprobe tick's shared snapshot (hearsay-tools/cezarion#879); without it, it scans. */
76
- export declare function inspectGeneration({ record, paths, cwds }: {
77
- record?: WorkerProcessRecord;
78
- paths: readonly string[];
79
- cwds?: CwdSource | undefined;
80
- }): GenerationProbe;
81
- export declare function probeGeneration(input: {
82
- record?: WorkerProcessRecord;
83
- paths: readonly string[];
84
- }): GenerationLiveness;
85
- /** Execution-only proof: a known reboot ended all old descendants, provided neither the
86
- * controller nor any recorded process is still live. Never use this to authorize reuse/deletion;
87
- * execution settlement itself deletes nothing. Legacy or unknown boot evidence keeps the descendant scan. */
88
- export declare function inspectExecutionGeneration(input: {
89
- record?: WorkerProcessRecord;
90
- paths: readonly string[];
91
- pathsComplete?: boolean;
92
- cwds?: CwdSource | undefined;
93
- }): GenerationProbe;
@@ -1,10 +1,11 @@
1
1
  import { spawnSync } from 'node:child_process';
2
2
  import { readdirSync, readFileSync, readlinkSync, realpathSync } from 'node:fs';
3
3
  import { basename, resolve, sep } from 'node:path';
4
- import { linuxBootId, processStartToken, pidExists, sameIncarnation, recordedProcessLive } from '../core/process-stat.js';
4
+ import { linuxBootId, processStartToken, sameIncarnation } from '../core/process-stat.js';
5
5
  /**
6
- * Synchronous process evidence for worker recovery and resource cleanup. Unreadable cwd is no
7
- * evidence; other uncertainty stays alive or unknown, never proven gone.
6
+ * Synchronous process evidence: recorded-process liveness for worker recovery, and the cwd scan
7
+ * that autosave cleanup still uses. Worker ownership never comes from the scan (ADR 0032).
8
+ * Unreadable cwd is no evidence; other uncertainty stays alive or unknown, never proven gone.
8
9
  */
9
10
  export { parseProcStat, processStartToken, recordedProcessLive } from '../core/process-stat.js';
10
11
  const LINUX_BOOT_ID = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
@@ -17,18 +18,6 @@ function controllerPredatesBoot(token, boot) {
17
18
  export function processPredatesCurrentBoot(entry) {
18
19
  return process.platform === 'linux' && controllerPredatesBoot(entry.startToken, linuxBootId());
19
20
  }
20
- /** Whether a recorded session leader's group may be signalled (hearsay-tools/cezarion#890). A live
21
- * leader must be the exact recorded incarnation; a different one means the group emptied and its
22
- * number was reused. A dead leader proves nothing: its number may since have been reused, and a
23
- * double-fork daemon leaves exactly a live group with a dead leader. Such a group is signalled
24
- * only when it holds the worker's paths: `holderGroups` are the groups of those holders. */
25
- export function recordedGroupSignalable(entry, holderGroups = []) {
26
- if (entry.pgid === undefined || entry.pgid !== entry.pid)
27
- return false;
28
- if (pidExists(entry.pid))
29
- return entry.startToken !== undefined && processStartToken(entry.pid) === entry.startToken;
30
- return holderGroups.includes(entry.pgid);
31
- }
32
21
  export function isCurrentProcess(entry) {
33
22
  if (entry.pid !== process.pid)
34
23
  return false;
@@ -42,7 +31,6 @@ const lsofCwd = (args, timeout) => {
42
31
  };
43
32
  const realDarwin = {
44
33
  lsof: () => lsofCwd(['-a'], 5_000),
45
- lsofPid: pid => lsofCwd(['-a', '-p', String(pid)], 2_000),
46
34
  };
47
35
  const realProc = {
48
36
  readdir: () => readdirSync('/proc'),
@@ -90,16 +78,11 @@ export function scanProcessCwds(platform = process.platform, proc = realProc, da
90
78
  }
91
79
  return found;
92
80
  }
93
- /** One lazy `scan`, memoized for the life of the returned source. */
94
- export function sharedCwdScan(scan = scanProcessCwds) {
95
- let snapshot;
96
- return () => snapshot ??= scan();
97
- }
98
- /** PIDs (never this process) whose readable working directory is one of `dirs` or beneath it,
99
- * from `cwds` when the caller shares a snapshot, else from a fresh scan. Squawk's own short-lived
100
- * git children in a worktree make this read "alive" briefly: conservative, and a retry self-heals. */
101
- export function processesWithCwdUnder(dirs, platform = process.platform, proc = realProc, darwin = realDarwin, cwds) {
102
- const snapshot = cwds ?? scanProcessCwds(platform, proc, darwin);
81
+ /** PIDs (never this process) whose readable working directory is one of `dirs` or beneath it.
82
+ * Squawk's own short-lived git children in a worktree make this read "alive" briefly:
83
+ * conservative, and a retry self-heals. */
84
+ export function processesWithCwdUnder(dirs, platform = process.platform, proc = realProc, darwin = realDarwin) {
85
+ const snapshot = scanProcessCwds(platform, proc, darwin);
103
86
  if (snapshot === 'unknown')
104
87
  return 'unknown';
105
88
  const targets = (typeof dirs === 'string' ? [dirs] : dirs).map(dir => { try {
@@ -111,31 +94,6 @@ export function processesWithCwdUnder(dirs, platform = process.platform, proc =
111
94
  const under = (cwd) => { const path = cwd.replace(/ \(deleted\)$/, ''); return targets.some(target => path === target || path.startsWith(target + sep)); };
112
95
  return [...snapshot].filter(([, cwd]) => under(cwd)).map(([pid]) => pid);
113
96
  }
114
- /** Whether one process's working directory is still one of `dirs` or beneath it, without a scan:
115
- * one `readlink` on Linux, one `lsof` of that process on darwin. `false` when it moved away or
116
- * cannot be read (no evidence, hearsay-tools/cezarion#889); `undefined` on win32, whose scan names
117
- * no holder in the first place. */
118
- export function processCwdUnder(pid, dirs, platform = process.platform, proc = realProc, darwin = realDarwin) {
119
- let cwd;
120
- if (platform === 'linux') {
121
- try {
122
- cwd = proc.readlink(String(pid));
123
- }
124
- catch {
125
- return false;
126
- }
127
- }
128
- else if (platform === 'darwin') {
129
- const lsof = darwin.lsofPid?.(pid);
130
- cwd = lsof?.ok ? lsof.stdout.split('\n').find(line => line.startsWith('n'))?.slice(1) : undefined;
131
- if (cwd === undefined)
132
- return false;
133
- }
134
- else
135
- return undefined;
136
- const found = processesWithCwdUnder(dirs, platform, proc, undefined, new Map([[pid, cwd]]));
137
- return found !== 'unknown' && found.length > 0;
138
- }
139
97
  /** One process's executable name, never its arguments: destroy errors are persisted and returned by
140
98
  * the API, and any argument may carry a secret. Undefined when it cannot be read. For a refusal a
141
99
  * human reads, never for a decision. */
@@ -167,39 +125,4 @@ export function describeProcesses(pids) {
167
125
  const named = pids.slice(0, 8).map(pid => { const name = processName(pid); return name ? `${pid} (${name})` : String(pid); });
168
126
  return named.join(', ') + (pids.length > 8 ? ', …' : '');
169
127
  }
170
- /** Fresh resource proof for destroy, reuse, admission, scratch cleanup and history deletion.
171
- * Controller boot says nothing about who holds persistent paths, so it always scans. A process
172
- * blocks only when its readable cwd is under `paths`, when it is a live recorded process of the
173
- * generation, or when it is a live foreign controller (hearsay-tools/cezarion#889). `paths` are
174
- * the worktree and every scratch location; a missing record (legacy) relies on the scan alone.
175
- * A live foreign controller short-circuits the scan; otherwise `pids` names every holder.
176
- * `cwds` is a reprobe tick's shared snapshot (hearsay-tools/cezarion#879); without it, it scans. */
177
- export function inspectGeneration({ record, paths, cwds }) {
178
- if (record && !isCurrentProcess(record.controller) && recordedProcessLive(record.controller))
179
- return { liveness: 'alive', controller: record.controller.pid, pids: [] };
180
- const recorded = record?.processes.filter(recordedProcessLive).map(entry => entry.pid) ?? [];
181
- const scan = processesWithCwdUnder(paths, undefined, undefined, undefined, cwds?.());
182
- const pids = [...new Set([...recorded, ...(scan === 'unknown' ? [] : scan)])];
183
- return { liveness: pids.length ? 'alive' : scan === 'unknown' ? 'unknown' : 'gone', pids };
184
- }
185
- export function probeGeneration(input) {
186
- return inspectGeneration(input).liveness;
187
- }
188
- /** Execution-only proof: a known reboot ended all old descendants, provided neither the
189
- * controller nor any recorded process is still live. Never use this to authorize reuse/deletion;
190
- * execution settlement itself deletes nothing. Legacy or unknown boot evidence keeps the descendant scan. */
191
- export function inspectExecutionGeneration(input) {
192
- const record = input.record;
193
- if (record && recordedProcessLive(record.controller))
194
- return { liveness: 'alive', controller: record.controller.pid, pids: [] };
195
- const pids = record?.processes.filter(recordedProcessLive).map(entry => entry.pid) ?? [];
196
- if (pids.length)
197
- return { liveness: 'alive', pids };
198
- if (process.platform === 'linux' && controllerPredatesBoot(record?.controller.startToken, linuxBootId()))
199
- return { liveness: 'gone', pids: [] };
200
- const probe = inspectGeneration(input);
201
- // Unknown scratch locations can hide a legacy descendant even when every known path is
202
- // clear. Keep live PID diagnostics, but never turn a partial scan into proof of termination.
203
- return probe.liveness === 'gone' && input.pathsComplete === false ? { liveness: 'unknown', pids: [] } : probe;
204
- }
205
128
  //# sourceMappingURL=process-liveness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-liveness.js","sourceRoot":"","sources":["../../src/delegation/process-liveness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAwB,MAAM,yBAAyB,CAAC;AAEhJ;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAwB,MAAM,yBAAyB,CAAC;AAItH,MAAM,aAAa,GAAG,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AAC,CAAC;AAC3D,CAAC"}
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
27
27
  export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
28
28
  "/list": {
29
29
  $get: {
30
- output: {
31
- error: string;
32
- code?: "invalid_input" | undefined;
33
- };
34
- outputFormat: "json";
35
- status: 400;
36
- input: {
37
- query: {
38
- offset?: string | undefined;
39
- };
40
- };
41
- } | {
42
30
  output: {
43
31
  workers: {
44
32
  workerId: string;
@@ -76,12 +64,33 @@ export declare function createDelegationRoutes(service: DelegationService, crede
76
64
  offset?: string | undefined;
77
65
  };
78
66
  };
67
+ } | {
68
+ output: {
69
+ error: string;
70
+ code?: "invalid_input" | undefined;
71
+ };
72
+ outputFormat: "json";
73
+ status: 400;
74
+ input: {
75
+ query: {
76
+ offset?: string | undefined;
77
+ };
78
+ };
79
79
  };
80
80
  };
81
81
  } & {
82
82
  "/discover": {
83
83
  $post: {
84
84
  output: {
85
+ scope: "host-default-account";
86
+ runners: {
87
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
88
+ enabled?: boolean | undefined;
89
+ hint?: string | undefined;
90
+ authFailureId?: string | undefined;
91
+ runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
92
+ }[];
93
+ } | {
85
94
  tasks: {
86
95
  id: string;
87
96
  title: string;
@@ -93,15 +102,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
93
102
  reason?: string | undefined;
94
103
  }[];
95
104
  nextOffset?: number | undefined;
96
- } | {
97
- scope: "host-default-account";
98
- runners: {
99
- status: "connected" | "disconnected" | "not-installed" | "unknown";
100
- enabled?: boolean | undefined;
101
- hint?: string | undefined;
102
- authFailureId?: string | undefined;
103
- runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
104
- }[];
105
105
  } | {
106
106
  runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
107
107
  models: {
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
221
221
  status: 200;
222
222
  input: {
223
223
  json: {
224
- requestIds: string[];
225
- mode?: "all" | "any" | "one" | undefined;
226
- timeoutSeconds?: number | undefined;
227
- } | {
228
224
  workerIds: string[];
229
225
  timeoutSeconds?: number | undefined;
230
226
  mode?: "all" | "any" | "one" | undefined;
227
+ } | {
228
+ requestIds: string[];
229
+ mode?: "all" | "any" | "one" | undefined;
230
+ timeoutSeconds?: number | undefined;
231
231
  } | {
232
232
  peerIds: string[];
233
233
  timeoutSeconds?: number | undefined;
@@ -613,18 +613,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
613
613
  } & {
614
614
  "/:workerId": {
615
615
  $get: {
616
- output: {
617
- error: string;
618
- code?: "invalid_input" | undefined;
619
- };
620
- outputFormat: "json";
621
- status: 400;
622
- input: {
623
- param: {
624
- workerId: string;
625
- };
626
- };
627
- } | {
628
616
  output: {
629
617
  workerId: string;
630
618
  parentRunId: string;
@@ -720,6 +708,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
720
708
  summary?: string | undefined;
721
709
  revision?: number | undefined;
722
710
  } | undefined;
711
+ scope?: {
712
+ backend: "cgroup" | "groups" | "job";
713
+ guarantee: "contained" | "scoped";
714
+ } | undefined;
723
715
  };
724
716
  outputFormat: "json";
725
717
  status: 200;
@@ -728,11 +720,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
728
720
  workerId: string;
729
721
  };
730
722
  };
731
- };
732
- };
733
- } & {
734
- "/:workerId/collect": {
735
- $post: {
723
+ } | {
736
724
  output: {
737
725
  error: string;
738
726
  code?: "invalid_input" | undefined;
@@ -743,10 +731,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
743
731
  param: {
744
732
  workerId: string;
745
733
  };
746
- } & {
747
- json: Record<string, never>;
748
734
  };
749
- } | {
735
+ };
736
+ };
737
+ } & {
738
+ "/:workerId/collect": {
739
+ $post: {
750
740
  output: {
751
741
  workerId: string;
752
742
  parentRunId: string;
@@ -848,11 +838,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
848
838
  } & {
849
839
  json: Record<string, never>;
850
840
  };
851
- };
852
- };
853
- } & {
854
- "/:workerId/steer": {
855
- $post: {
841
+ } | {
856
842
  output: {
857
843
  error: string;
858
844
  code?: "invalid_input" | undefined;
@@ -864,11 +850,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
864
850
  workerId: string;
865
851
  };
866
852
  } & {
867
- json: {
868
- text: string;
869
- };
853
+ json: Record<string, never>;
870
854
  };
871
- } | {
855
+ };
856
+ };
857
+ } & {
858
+ "/:workerId/steer": {
859
+ $post: {
872
860
  output: {
873
861
  workerId: string;
874
862
  state: "delivered" | "queued";
@@ -884,11 +872,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
884
872
  text: string;
885
873
  };
886
874
  };
887
- };
888
- };
889
- } & {
890
- "/:workerId/stop": {
891
- $post: {
875
+ } | {
892
876
  output: {
893
877
  error: string;
894
878
  code?: "invalid_input" | undefined;
@@ -900,9 +884,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
900
884
  workerId: string;
901
885
  };
902
886
  } & {
903
- json: Record<string, never>;
887
+ json: {
888
+ text: string;
889
+ };
904
890
  };
905
- } | {
891
+ };
892
+ };
893
+ } & {
894
+ "/:workerId/stop": {
895
+ $post: {
906
896
  output: {
907
897
  workerId: string;
908
898
  state: "stopping" | "terminated";
@@ -916,11 +906,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
916
906
  } & {
917
907
  json: Record<string, never>;
918
908
  };
919
- };
920
- };
921
- } & {
922
- "/:workerId/destroy": {
923
- $post: {
909
+ } | {
924
910
  output: {
925
911
  error: string;
926
912
  code?: "invalid_input" | undefined;
@@ -934,7 +920,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
934
920
  } & {
935
921
  json: Record<string, never>;
936
922
  };
937
- } | {
923
+ };
924
+ };
925
+ } & {
926
+ "/:workerId/destroy": {
927
+ $post: {
938
928
  output: {
939
929
  workerId: string;
940
930
  state: "complete" | "incomplete";
@@ -957,6 +947,20 @@ export declare function createDelegationRoutes(service: DelegationService, crede
957
947
  } & {
958
948
  json: Record<string, never>;
959
949
  };
950
+ } | {
951
+ output: {
952
+ error: string;
953
+ code?: "invalid_input" | undefined;
954
+ };
955
+ outputFormat: "json";
956
+ status: 400;
957
+ input: {
958
+ param: {
959
+ workerId: string;
960
+ };
961
+ } & {
962
+ json: Record<string, never>;
963
+ };
960
964
  } | {
961
965
  output: {
962
966
  workerId: string;
@@ -986,11 +990,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
986
990
  "/:workerId/diff": {
987
991
  $get: {
988
992
  output: {
989
- error: string;
990
- code?: "invalid_input" | undefined;
993
+ workerId: string;
994
+ baselineSha: string;
995
+ diff: string;
996
+ truncated: boolean;
991
997
  };
992
998
  outputFormat: "json";
993
- status: 400;
999
+ status: 200;
994
1000
  input: {
995
1001
  param: {
996
1002
  workerId: string;
@@ -998,13 +1004,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
998
1004
  };
999
1005
  } | {
1000
1006
  output: {
1001
- workerId: string;
1002
- baselineSha: string;
1003
- diff: string;
1004
- truncated: boolean;
1007
+ error: string;
1008
+ code?: "invalid_input" | undefined;
1005
1009
  };
1006
1010
  outputFormat: "json";
1007
- status: 200;
1011
+ status: 400;
1008
1012
  input: {
1009
1013
  param: {
1010
1014
  workerId: string;
@@ -1,7 +1,7 @@
1
1
  import type { RunStore } from '../runs/store.ts';
2
2
  /**
3
3
  * Keep terminal cleanup intent in the generation checkpoint as well as the index. Retain and
4
- * retry unknown evidence. One timer and shared process snapshot serve pending cleanup.
4
+ * retry unknown evidence. One timer serves pending cleanup.
5
5
  */
6
6
  export declare class WorkerScratchCleanup {
7
7
  private store;