harnery 0.45.0 → 0.45.2

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 (235) hide show
  1. package/dist/commander.js +0 -1
  2. package/dist/commands/files.d.ts +2 -2
  3. package/dist/commands/files.d.ts.map +1 -1
  4. package/dist/commands/files.js +4 -7
  5. package/dist/commands/servers.d.ts.map +1 -1
  6. package/dist/commands/servers.js +17 -11
  7. package/dist/commands/tunnel.d.ts +0 -15
  8. package/dist/commands/tunnel.d.ts.map +1 -1
  9. package/dist/commands/tunnel.js +153 -453
  10. package/dist/commands/workflow.d.ts.map +1 -1
  11. package/dist/commands/workflow.js +6 -45
  12. package/dist/core/agents/coord-client.d.ts.map +1 -1
  13. package/dist/core/agents/coord-client.js +0 -18
  14. package/dist/core/agents/live-authority-v3.d.ts +0 -1
  15. package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
  16. package/dist/core/agents/live-authority-v3.js +0 -11
  17. package/dist/core/agents/live-lifecycle-v3.d.ts +2 -4
  18. package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
  19. package/dist/core/agents/live-lifecycle-v3.js +7 -28
  20. package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
  21. package/dist/core/agents/state/heartbeat-writer.js +14 -25
  22. package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -1
  23. package/dist/core/agents/state/live-coordination-writer.js +0 -5
  24. package/dist/core/agents/state/pidmap.d.ts.map +1 -1
  25. package/dist/core/agents/state/pidmap.js +2 -7
  26. package/dist/core/agents/state/proc-start.d.ts +20 -31
  27. package/dist/core/agents/state/proc-start.d.ts.map +1 -1
  28. package/dist/core/agents/state/proc-start.js +37 -70
  29. package/dist/core/agents/state/service-process.d.ts +61 -0
  30. package/dist/core/agents/state/service-process.d.ts.map +1 -0
  31. package/dist/core/agents/state/service-process.js +143 -0
  32. package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
  33. package/dist/core/agents/state/stale-sweep.js +70 -180
  34. package/dist/core/artifacts/activity.d.ts +4 -1
  35. package/dist/core/artifacts/activity.d.ts.map +1 -1
  36. package/dist/core/artifacts/activity.js +8 -2
  37. package/dist/core/artifacts/delivery-card.d.ts.map +1 -1
  38. package/dist/core/artifacts/delivery-card.js +1 -2
  39. package/dist/core/artifacts/index.d.ts.map +1 -1
  40. package/dist/core/artifacts/index.js +38 -12
  41. package/dist/core/context/index.d.ts +6 -4
  42. package/dist/core/context/index.d.ts.map +1 -1
  43. package/dist/core/context/index.js +194 -256
  44. package/dist/core/context/observation.d.ts +9 -9
  45. package/dist/core/context/observation.d.ts.map +1 -1
  46. package/dist/core/context/observation.js +37 -6
  47. package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
  48. package/dist/core/events/v3/authority-outbox.js +0 -29
  49. package/dist/core/events/v3/producers/coordination-recorder.d.ts +0 -1
  50. package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
  51. package/dist/core/events/v3/producers/coordination-recorder.js +0 -7
  52. package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
  53. package/dist/core/events/v3/producers/recorder.js +64 -77
  54. package/dist/core/events/v3/runtime-build.d.ts +14 -0
  55. package/dist/core/events/v3/runtime-build.d.ts.map +1 -1
  56. package/dist/core/events/v3/runtime-build.js +44 -0
  57. package/dist/core/governor/index.d.ts +2 -1
  58. package/dist/core/governor/index.d.ts.map +1 -1
  59. package/dist/core/governor/index.js +2 -1
  60. package/dist/core/governor/service-read.d.ts +3 -10
  61. package/dist/core/governor/service-read.d.ts.map +1 -1
  62. package/dist/core/governor/service-read.js +10 -94
  63. package/dist/core/governor/service.d.ts +3 -7
  64. package/dist/core/governor/service.d.ts.map +1 -1
  65. package/dist/core/governor/service.js +17 -182
  66. package/dist/core/hooks/cli.js +78 -48
  67. package/dist/core/hooks/resolve/owner.js +2 -2
  68. package/dist/core/resources/sampler.js +2 -2
  69. package/dist/core/resources/service-status.d.ts +2 -14
  70. package/dist/core/resources/service-status.d.ts.map +1 -1
  71. package/dist/core/resources/service-status.js +3 -23
  72. package/dist/core/resources/service.d.ts +3 -7
  73. package/dist/core/resources/service.d.ts.map +1 -1
  74. package/dist/core/resources/service.js +12 -101
  75. package/dist/core/resources/status.d.ts.map +1 -1
  76. package/dist/core/resources/status.js +3 -2
  77. package/dist/core/semantic/service.d.ts.map +1 -1
  78. package/dist/core/semantic/service.js +9 -2
  79. package/dist/core/servers/index.d.ts +11 -10
  80. package/dist/core/servers/index.d.ts.map +1 -1
  81. package/dist/core/servers/index.js +82 -192
  82. package/dist/core/servers/tunnels.d.ts +3 -5
  83. package/dist/core/servers/tunnels.d.ts.map +1 -1
  84. package/dist/core/servers/tunnels.js +2 -45
  85. package/dist/core/storage/durable-history.js +56 -22
  86. package/dist/core/storage/segments.d.ts.map +1 -1
  87. package/dist/core/storage/segments.js +73 -17
  88. package/dist/core/supervisor/service.d.ts +4 -7
  89. package/dist/core/supervisor/service.d.ts.map +1 -1
  90. package/dist/core/supervisor/service.js +23 -122
  91. package/dist/core/supervisor/services.js +2 -2
  92. package/dist/core/supervisor/status.d.ts +3 -17
  93. package/dist/core/supervisor/status.d.ts.map +1 -1
  94. package/dist/core/supervisor/status.js +7 -70
  95. package/dist/core/work/state.js +7 -7
  96. package/dist/core/workflow/engine.d.ts.map +1 -1
  97. package/dist/core/workflow/engine.js +23 -66
  98. package/dist/core/workflow/index.d.ts +3 -4
  99. package/dist/core/workflow/index.d.ts.map +1 -1
  100. package/dist/core/workflow/index.js +2 -2
  101. package/dist/core/workflow/live-session-v3.d.ts +0 -6
  102. package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
  103. package/dist/core/workflow/live-session-v3.js +5 -126
  104. package/dist/core/workflow/proof.d.ts +4 -4
  105. package/dist/core/workflow/proof.d.ts.map +1 -1
  106. package/dist/core/workflow/proof.js +34 -86
  107. package/dist/core/workflow/resume-lock.d.ts +17 -0
  108. package/dist/core/workflow/resume-lock.d.ts.map +1 -0
  109. package/dist/core/workflow/resume-lock.js +158 -0
  110. package/dist/core/workflow/run-state.d.ts +0 -21
  111. package/dist/core/workflow/run-state.d.ts.map +1 -1
  112. package/dist/core/workflow/run-state.js +3 -174
  113. package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
  114. package/dist/core/workflow/spawn-claude.js +0 -19
  115. package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
  116. package/dist/core/workflow/spawn-codex.js +0 -13
  117. package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
  118. package/dist/core/workflow/spawn-cursor.js +0 -19
  119. package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
  120. package/dist/core/workflow/spawn-opencode.js +0 -14
  121. package/dist/core/workflow/types.d.ts +11 -54
  122. package/dist/core/workflow/types.d.ts.map +1 -1
  123. package/dist/core/workflow/workspaces/leases.d.ts +4 -0
  124. package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
  125. package/dist/core/workflow/workspaces/leases.js +1 -1
  126. package/dist/core/workflow/workspaces/local-git.js +91 -210
  127. package/dist/core/workflow/workspaces/ownership.d.ts +0 -7
  128. package/dist/core/workflow/workspaces/ownership.d.ts.map +1 -1
  129. package/dist/core/workflow/workspaces/ownership.js +3 -130
  130. package/dist/core/workflow/workspaces/reclaim.d.ts +4 -7
  131. package/dist/core/workflow/workspaces/reclaim.d.ts.map +1 -1
  132. package/dist/core/workflow/workspaces/reclaim.js +0 -4
  133. package/dist/core/workflow/workspaces/recovery.d.ts +1 -1
  134. package/dist/core/workflow/workspaces/recovery.d.ts.map +1 -1
  135. package/dist/core/workflow/workspaces/recovery.js +1 -1
  136. package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
  137. package/dist/core/workflow/workspaces/state.js +1 -4
  138. package/dist/lib/identities/assume.d.ts.map +1 -1
  139. package/dist/lib/identities/assume.js +0 -4
  140. package/dist/lib/tunnel/state.d.ts +6 -13
  141. package/dist/lib/tunnel/state.d.ts.map +1 -1
  142. package/dist/lib/tunnel/state.js +12 -58
  143. package/package.json +1 -6
  144. package/src/commander.ts +0 -10
  145. package/src/commands/files.ts +5 -13
  146. package/src/commands/servers.ts +23 -12
  147. package/src/commands/tunnel.ts +166 -533
  148. package/src/commands/workflow.ts +8 -58
  149. package/src/core/agents/coord-client.ts +0 -20
  150. package/src/core/agents/live-authority-v3.ts +0 -17
  151. package/src/core/agents/live-lifecycle-v3.ts +14 -52
  152. package/src/core/agents/state/heartbeat-writer.ts +12 -29
  153. package/src/core/agents/state/live-coordination-writer.ts +0 -29
  154. package/src/core/agents/state/pidmap.ts +2 -15
  155. package/src/core/agents/state/proc-start.ts +41 -69
  156. package/src/core/agents/state/service-process.ts +217 -0
  157. package/src/core/agents/state/stale-sweep.ts +82 -247
  158. package/src/core/artifacts/activity.ts +9 -2
  159. package/src/core/artifacts/delivery-card.ts +1 -7
  160. package/src/core/artifacts/index.ts +45 -12
  161. package/src/core/context/index.ts +207 -272
  162. package/src/core/context/observation.ts +40 -9
  163. package/src/core/events/v3/authority-outbox.ts +0 -56
  164. package/src/core/events/v3/producers/coordination-recorder.ts +0 -15
  165. package/src/core/events/v3/producers/recorder.ts +68 -94
  166. package/src/core/events/v3/runtime-build.ts +62 -0
  167. package/src/core/governor/index.ts +1 -2
  168. package/src/core/governor/service-read.ts +15 -114
  169. package/src/core/governor/service.ts +36 -220
  170. package/src/core/hooks/cli.ts +85 -47
  171. package/src/core/hooks/resolve/owner.ts +2 -2
  172. package/src/core/resources/sampler.ts +3 -2
  173. package/src/core/resources/service-status.ts +6 -35
  174. package/src/core/resources/service.ts +23 -133
  175. package/src/core/resources/status.ts +3 -2
  176. package/src/core/semantic/service.ts +8 -2
  177. package/src/core/servers/index.ts +86 -228
  178. package/src/core/servers/tunnels.ts +3 -55
  179. package/src/core/storage/durable-history.ts +52 -20
  180. package/src/core/storage/segments.ts +79 -17
  181. package/src/core/supervisor/service.ts +33 -155
  182. package/src/core/supervisor/services.ts +2 -2
  183. package/src/core/supervisor/status.ts +10 -85
  184. package/src/core/work/state.ts +7 -7
  185. package/src/core/workflow/engine.ts +22 -74
  186. package/src/core/workflow/index.ts +2 -13
  187. package/src/core/workflow/live-session-v3.ts +5 -146
  188. package/src/core/workflow/proof.ts +40 -104
  189. package/src/core/workflow/resume-lock.ts +179 -0
  190. package/src/core/workflow/run-state.ts +3 -207
  191. package/src/core/workflow/spawn-claude.ts +0 -18
  192. package/src/core/workflow/spawn-codex.ts +0 -13
  193. package/src/core/workflow/spawn-cursor.ts +0 -18
  194. package/src/core/workflow/spawn-opencode.ts +0 -14
  195. package/src/core/workflow/types.ts +11 -41
  196. package/src/core/workflow/workspaces/leases.ts +1 -1
  197. package/src/core/workflow/workspaces/local-git.ts +120 -239
  198. package/src/core/workflow/workspaces/ownership.ts +3 -158
  199. package/src/core/workflow/workspaces/reclaim.ts +3 -9
  200. package/src/core/workflow/workspaces/recovery.ts +1 -1
  201. package/src/core/workflow/workspaces/state.ts +1 -5
  202. package/src/lib/identities/assume.ts +0 -4
  203. package/src/lib/tunnel/state.ts +15 -70
  204. package/dist/commands/turn-rollback.d.ts +0 -5
  205. package/dist/commands/turn-rollback.d.ts.map +0 -1
  206. package/dist/commands/turn-rollback.js +0 -76
  207. package/dist/core/agents/state/process-handle.d.ts +0 -26
  208. package/dist/core/agents/state/process-handle.d.ts.map +0 -1
  209. package/dist/core/agents/state/process-handle.js +0 -121
  210. package/dist/core/agents/state/unchanged-file.d.ts +0 -44
  211. package/dist/core/agents/state/unchanged-file.d.ts.map +0 -1
  212. package/dist/core/agents/state/unchanged-file.js +0 -390
  213. package/dist/core/events/v3/generation-custody.d.ts +0 -5
  214. package/dist/core/events/v3/generation-custody.d.ts.map +0 -1
  215. package/dist/core/events/v3/generation-custody.js +0 -50
  216. package/dist/core/turn-rollback/content.d.ts +0 -53
  217. package/dist/core/turn-rollback/content.d.ts.map +0 -1
  218. package/dist/core/turn-rollback/content.js +0 -396
  219. package/dist/core/turn-rollback/index.d.ts +0 -72
  220. package/dist/core/turn-rollback/index.d.ts.map +0 -1
  221. package/dist/core/turn-rollback/index.js +0 -443
  222. package/dist/core/workflow/failure-evidence.d.ts +0 -16
  223. package/dist/core/workflow/failure-evidence.d.ts.map +0 -1
  224. package/dist/core/workflow/failure-evidence.js +0 -114
  225. package/dist/core/workflow/recovery-audit.d.ts +0 -30
  226. package/dist/core/workflow/recovery-audit.d.ts.map +0 -1
  227. package/dist/core/workflow/recovery-audit.js +0 -116
  228. package/src/commands/turn-rollback.ts +0 -111
  229. package/src/core/agents/state/process-handle.ts +0 -165
  230. package/src/core/agents/state/unchanged-file.ts +0 -456
  231. package/src/core/events/v3/generation-custody.ts +0 -59
  232. package/src/core/turn-rollback/content.ts +0 -499
  233. package/src/core/turn-rollback/index.ts +0 -580
  234. package/src/core/workflow/failure-evidence.ts +0 -141
  235. package/src/core/workflow/recovery-audit.ts +0 -181
@@ -19,7 +19,7 @@
19
19
  * which `gc` never stops; a record without an owner is never stopped
20
20
  * automatically.
21
21
  */
22
- import { createHash, randomUUID } from "node:crypto";
22
+ import { createHash } from "node:crypto";
23
23
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
24
24
  import { hostname } from "node:os";
25
25
  import { basename, isAbsolute, join, relative, resolve } from "node:path";
@@ -31,13 +31,13 @@ import { readCoordinationViewV3, requireAuthoritySafeCoordinationViewV3, } from
31
31
  import { liveInstanceIdV3 } from "../events/v3/live-route-observer.js";
32
32
  import { resolveOwner } from "../hooks/resolve/owner.js";
33
33
  import { writePrivateJsonAtomic } from "../storage/atomic-json.js";
34
- import { acquireNoClobberLease } from "../workflow/workspaces/leases.js";
35
34
  import { ancestry, establishedConnectionCounts, listListeningPorts, listListeningSockets, processStartedAt, readProcessInfo, scanSupport, } from "./net.js";
35
+ // Host supervisors verify and signal their own children with the same checks.
36
36
  export { processStartToken, signalIfSameGeneration, verifyProcessGeneration, } from "../agents/state/proc-start.js";
37
37
  export { acquireNoClobberLease } from "../workflow/workspaces/leases.js";
38
38
  export { ancestry, establishedConnectionCounts, listListeningPorts, listListeningSockets, lsofConnectionCounts, lsofListeningSockets, parseElapsed, parseLsofListen, parseProcNetTcp, processStartedAt, psProcessInfo, readProcessInfo, scanSupport, } from "./net.js";
39
- export { createTunnelReadinessVerifier, tunnelServerId, tunnelServerInput } from "./tunnels.js";
40
- export const SERVER_RECORD_SCHEMA_VERSION = 2;
39
+ export { tunnelServerId, tunnelServerInput } from "./tunnels.js";
40
+ export const SERVER_RECORD_SCHEMA_VERSION = 1;
41
41
  export const SERVER_DEFAULT_IDLE_HOURS = 2;
42
42
  export const SERVER_DEFAULT_OWNER_STALE_HOURS = 24;
43
43
  const TOUCH_INTERVAL_MS = 60_000;
@@ -86,54 +86,40 @@ export function registerServer(input, options) {
86
86
  !(Number.isInteger(input.port) && input.port > 0 && input.port < 65536))
87
87
  throw new Error(`invalid server port: ${input.port}`);
88
88
  const id = input.id ?? serverId(input.type, input.scope);
89
- return withServerMutation(coordRoot, id, () => {
90
- const path = recordPath(coordRoot, id);
91
- const now = new Date().toISOString();
92
- const startToken = input.start_token ?? processStartToken(pid);
93
- const pids = [...new Set(input.pids?.filter((p) => Number.isSafeInteger(p) && p > 0))];
94
- const pidsStartTokens = {};
95
- for (const auxiliaryPid of pids) {
96
- const token = processStartToken(auxiliaryPid);
97
- if (token)
98
- pidsStartTokens[auxiliaryPid] = token;
99
- }
100
- const owner = input.owner === undefined ? callingOwner(coordRoot) : (input.owner ?? undefined);
101
- const record = {
102
- schema_version: SERVER_RECORD_SCHEMA_VERSION,
103
- id,
104
- registration_id: randomUUID(),
105
- kind: input.kind,
106
- type: input.type,
107
- label: input.label ?? id,
108
- ...(input.url ? { url: input.url } : {}),
109
- ...(input.port ? { port: input.port } : {}),
110
- pid,
111
- ...(startToken ? { start_token: startToken } : {}),
112
- ...(pids.length ? { pids, pids_start_tokens: pidsStartTokens } : {}),
113
- host: hostname(),
114
- ...(input.scope ? { scope: resolve(input.scope) } : {}),
115
- ...(input.cwd ? { cwd: resolve(input.cwd) } : {}),
116
- ...(input.log ? { log: resolve(input.log) } : {}),
117
- ...(owner ? { owner } : {}),
118
- started_at: input.started_at ?? now,
119
- registered_at: now,
120
- last_active_at: now,
121
- };
122
- if (input.start_token !== undefined &&
123
- verifyProcessGeneration(pid, input.start_token) !== "same")
124
- throw new Error(`pid ${pid} generation could not be verified before registration`);
125
- if (existsSync(path)) {
126
- const existing = readRecord(path);
127
- if (!existing)
128
- throw new Error(`registration ${id} custody is unknown: invalid or older server record retained`);
129
- if (sameProcessCustody(existing, record) && serverState(existing) === "running")
130
- return existing;
131
- if (existing.host !== hostname() || !allProcessesAbsent(existing))
132
- throw new Error(`registration ${id} custody is held by a live or unverifiable server`);
133
- }
134
- writePrivateJsonAtomic(path, record);
135
- return record;
136
- });
89
+ const now = new Date().toISOString();
90
+ const startToken = input.start_token ?? processStartToken(pid);
91
+ const pids = [...new Set(input.pids?.filter((p) => Number.isSafeInteger(p) && p > 0))];
92
+ const pidsStartTokens = {};
93
+ for (const auxiliaryPid of pids) {
94
+ const token = processStartToken(auxiliaryPid);
95
+ if (token)
96
+ pidsStartTokens[auxiliaryPid] = token;
97
+ }
98
+ const owner = input.owner === undefined ? callingOwner(coordRoot) : (input.owner ?? undefined);
99
+ const record = {
100
+ schema_version: SERVER_RECORD_SCHEMA_VERSION,
101
+ id,
102
+ kind: input.kind,
103
+ type: input.type,
104
+ label: input.label ?? id,
105
+ ...(input.url ? { url: input.url } : {}),
106
+ ...(input.port ? { port: input.port } : {}),
107
+ pid,
108
+ ...(startToken ? { start_token: startToken } : {}),
109
+ ...(pids.length ? { pids, pids_start_tokens: pidsStartTokens } : {}),
110
+ host: hostname(),
111
+ ...(input.scope ? { scope: resolve(input.scope) } : {}),
112
+ ...(input.cwd ? { cwd: resolve(input.cwd) } : {}),
113
+ ...(input.log ? { log: resolve(input.log) } : {}),
114
+ ...(owner ? { owner } : {}),
115
+ started_at: input.started_at ?? now,
116
+ registered_at: now,
117
+ last_active_at: now,
118
+ };
119
+ if (input.start_token !== undefined && verifyProcessGeneration(pid, input.start_token) !== "same")
120
+ throw new Error(`pid ${pid} generation could not be verified before registration`);
121
+ writePrivateJsonAtomic(recordPath(coordRoot, id), record);
122
+ return record;
137
123
  }
138
124
  /** Best-effort registration that never throws (for server start paths). */
139
125
  export function tryRegisterServer(input, options) {
@@ -156,106 +142,43 @@ function callingOwner(coordRoot) {
156
142
  return undefined;
157
143
  }
158
144
  }
159
- /** Remove only the exact registration receipt observed by the caller. */
160
- export function unregisterServer(record, options) {
145
+ /**
146
+ * Remove a server's record. With `pid`, only a record still naming that pid
147
+ * is removed, so a replacement that re-registered the same id survives.
148
+ */
149
+ export function unregisterServer(id, options) {
161
150
  const coordRoot = rootOf(options);
162
- if (!coordRoot || !record || !isValidServerId(record.id))
151
+ if (!coordRoot || !isValidServerId(id))
163
152
  return false;
164
- return withServerMutation(coordRoot, record.id, () => removeServerReceipt(coordRoot, record));
165
- }
166
- export function withServerRegistrationCustody(record, options, effect) {
167
- const coordRoot = rootOf(options);
168
- if (!coordRoot)
169
- throw new Error("registration custody root is unavailable");
170
- const lease = serverMutationLease(coordRoot, record.id);
171
- try {
172
- const current = readServer(record.id, { coordRoot });
173
- if (!current ||
174
- current.registration_id !== record.registration_id ||
175
- !sameProcessCustody(current, record))
176
- throw new Error(`registration ${record.id} custody changed`);
177
- const result = effect();
178
- if (result !== null &&
179
- (typeof result === "object" || typeof result === "function") &&
180
- typeof result.then === "function")
181
- return Promise.resolve(result).finally(() => lease.release());
182
- lease.release();
183
- return result;
184
- }
185
- catch (error) {
186
- lease.release();
187
- throw error;
153
+ const path = recordPath(coordRoot, id);
154
+ if (options?.pid !== undefined) {
155
+ const record = readRecord(path);
156
+ if (record && record.pid !== options.pid)
157
+ return false;
188
158
  }
189
- }
190
- function removeServerReceipt(coordRoot, record) {
191
- const path = recordPath(coordRoot, record.id);
192
- const current = readRecord(path);
193
- if (!current ||
194
- current.registration_id !== record.registration_id ||
195
- !sameProcessCustody(current, record))
159
+ if (!existsSync(path))
196
160
  return false;
197
- rmSync(path);
161
+ rmSync(path, { force: true });
198
162
  return true;
199
163
  }
200
- function serverMutationLease(coordRoot, id) {
201
- recordPath(coordRoot, id);
202
- const scope = `server-registration-${id}`;
203
- return acquireNoClobberLease({
204
- path: join(serversDir(coordRoot), ".custody", id),
205
- scope,
206
- authoritySha256: createHash("sha256").update(scope).digest("hex"),
207
- staleAfterMs: 1,
208
- });
209
- }
210
- function withServerMutation(coordRoot, id, operation) {
211
- const lease = serverMutationLease(coordRoot, id);
212
- try {
213
- return operation();
214
- }
215
- finally {
216
- lease.release();
217
- }
218
- }
219
- function sameProcessCustody(a, b) {
220
- const helpers = (record) => [...new Set(record.pids ?? [])]
221
- .sort((x, y) => x - y)
222
- .map((pid) => [pid, record.pids_start_tokens?.[pid] ?? null]);
223
- return (a.schema_version === SERVER_RECORD_SCHEMA_VERSION &&
224
- b.schema_version === SERVER_RECORD_SCHEMA_VERSION &&
225
- a.id === b.id &&
226
- a.pid === b.pid &&
227
- a.start_token === b.start_token &&
228
- a.host === b.host &&
229
- a.kind === b.kind &&
230
- a.type === b.type &&
231
- a.scope === b.scope &&
232
- a.owner?.instance_id === b.owner?.instance_id &&
233
- JSON.stringify(helpers(a)) === JSON.stringify(helpers(b)));
234
- }
235
164
  export function readServer(id, options) {
236
165
  const coordRoot = rootOf(options);
237
166
  if (!coordRoot || !isValidServerId(id))
238
167
  return null;
239
- const path = recordPath(coordRoot, id);
240
- const record = readRecord(path);
241
- if (!record && existsSync(path))
242
- throw new Error(`server record ${id} is invalid or uses an older schema; retained without custody`);
243
- return record;
168
+ return readRecord(recordPath(coordRoot, id));
244
169
  }
245
170
  /** Mark a server as used now. */
246
171
  export function touchServer(id, options) {
247
172
  const coordRoot = rootOf(options);
248
173
  if (!coordRoot || !isValidServerId(id))
249
174
  return;
250
- withServerMutation(coordRoot, id, () => {
251
- const path = recordPath(coordRoot, id);
252
- const record = readRecord(path);
253
- if (!record)
254
- return;
255
- writePrivateJsonAtomic(path, {
256
- ...record,
257
- last_active_at: (options?.now ?? new Date()).toISOString(),
258
- });
175
+ const path = recordPath(coordRoot, id);
176
+ const record = readRecord(path);
177
+ if (!record)
178
+ return;
179
+ writePrivateJsonAtomic(path, {
180
+ ...record,
181
+ last_active_at: (options?.now ?? new Date()).toISOString(),
259
182
  });
260
183
  }
261
184
  /**
@@ -284,8 +207,6 @@ function readRecord(path) {
284
207
  const value = JSON.parse(readFileSync(path, "utf8"));
285
208
  if (value?.schema_version !== SERVER_RECORD_SCHEMA_VERSION ||
286
209
  typeof value.id !== "string" ||
287
- typeof value.registration_id !== "string" ||
288
- !/^[0-9a-f-]{36}$/.test(value.registration_id) ||
289
210
  !Number.isSafeInteger(value.pid) ||
290
211
  (value.kind !== "service" && value.kind !== "session"))
291
212
  return null;
@@ -304,12 +225,8 @@ export function readServerRecords(options) {
304
225
  return [];
305
226
  return readdirSync(dir)
306
227
  .filter((name) => name.endsWith(".json"))
307
- .map((name) => {
308
- const record = readRecord(join(dir, name));
309
- if (!record)
310
- throw new Error(`server record ${name} is invalid or uses an older schema; retained without custody`);
311
- return record;
312
- })
228
+ .map((name) => readRecord(join(dir, name)))
229
+ .filter((record) => record !== null)
313
230
  .sort((a, b) => a.kind.localeCompare(b.kind) || a.type.localeCompare(b.type) || a.id.localeCompare(b.id));
314
231
  }
315
232
  export function pidAlive(pid) {
@@ -380,7 +297,7 @@ export function listServers(options) {
380
297
  records.forEach((record, i) => {
381
298
  const state = states[i];
382
299
  if (state === "dead" && allProcessesAbsent(record) && options?.prune !== false) {
383
- unregisterServer(record, { coordRoot });
300
+ unregisterServer(record.id, { coordRoot, pid: record.pid });
384
301
  pruned.push(record.id);
385
302
  return;
386
303
  }
@@ -513,49 +430,11 @@ export function planServerGc(views, policy) {
513
430
  }
514
431
  /**
515
432
  * Stop a verified server with SIGTERM, then SIGKILL after the grace period.
516
- * Every signal targets one retained process handle, including auxiliary processes.
517
- * Each target requires a fresh generation check. Unknown or different generations retain the record.
433
+ * Each signal, including the process group and auxiliary processes, requires
434
+ * a fresh generation check. Unknown or different generations retain the record.
518
435
  */
519
436
  export async function stopServer(record, options) {
520
437
  const coordRoot = rootOf(options);
521
- if (!coordRoot)
522
- return {
523
- id: record.id,
524
- stopped: false,
525
- method: "refused",
526
- generation: "unknown",
527
- detail: "registration custody root is unavailable",
528
- };
529
- let lease;
530
- try {
531
- lease = serverMutationLease(coordRoot, record.id);
532
- }
533
- catch {
534
- return {
535
- id: record.id,
536
- stopped: false,
537
- method: "refused",
538
- generation: "unknown",
539
- detail: "registration custody is unavailable",
540
- };
541
- }
542
- try {
543
- const current = readServer(record.id, { coordRoot });
544
- if (!current || current.registration_id !== record.registration_id)
545
- return {
546
- id: record.id,
547
- stopped: false,
548
- method: "refused",
549
- generation: "unknown",
550
- detail: "registration custody changed; retained current server",
551
- };
552
- return await stopServerWithCustody(record, coordRoot, options);
553
- }
554
- finally {
555
- lease.release();
556
- }
557
- }
558
- async function stopServerWithCustody(record, coordRoot, options) {
559
438
  const graceMs = options?.graceMs ?? 5_000;
560
439
  const dependencies = options?.signalDependencies ?? {};
561
440
  const targets = [
@@ -573,7 +452,7 @@ async function stopServerWithCustody(record, coordRoot, options) {
573
452
  });
574
453
  const finish = (result) => {
575
454
  if (result.stopped || result.method === "not-running")
576
- removeServerReceipt(coordRoot, record);
455
+ unregisterServer(record.id, { coordRoot, pid: record.pid });
577
456
  return result;
578
457
  };
579
458
  if (record.host !== hostname())
@@ -595,9 +474,6 @@ async function stopServerWithCustody(record, coordRoot, options) {
595
474
  }
596
475
  if (targets.every((target) => processPresence(target.pid, dependencies.probePid) === "absent"))
597
476
  return finish({ id: record.id, stopped: false, method: "not-running" });
598
- const current = readServer(record.id, { coordRoot });
599
- if (!current || !sameProcessCustody(current, record))
600
- return refuse(record.pid, "unknown");
601
477
  for (const name of ["SIGTERM", "SIGKILL"]) {
602
478
  for (const target of targets) {
603
479
  const presence = processPresence(target.pid, dependencies.probePid);
@@ -605,9 +481,11 @@ async function stopServerWithCustody(record, coordRoot, options) {
605
481
  continue;
606
482
  if (presence === "unknown")
607
483
  return refuse(target.pid, "unknown");
608
- const result = signalIfSameGeneration(target.pid, target.token, name, dependencies);
609
- if (!result.sent || result.verdict !== "same")
610
- return refuse(target.pid, result.verdict === "same" ? "unknown" : result.verdict);
484
+ const result = target.pid === record.pid
485
+ ? signalServerLeader(target.pid, target.token, name, dependencies)
486
+ : signalIfSameGeneration(target.pid, target.token, name, dependencies);
487
+ if (result.verdict !== "same")
488
+ return refuse(target.pid, result.verdict);
611
489
  }
612
490
  const observed = await waitForExit(targets, name === "SIGTERM" ? graceMs : 2_000, dependencies);
613
491
  if (observed.refused)
@@ -623,6 +501,18 @@ async function stopServerWithCustody(record, coordRoot, options) {
623
501
  detail: "process survived SIGKILL",
624
502
  };
625
503
  }
504
+ function signalServerLeader(pid, token, name, dependencies) {
505
+ // The leader's generation authorizes its group. A failed group signal must
506
+ // not reuse that observation for the direct-PID fallback.
507
+ const kill = dependencies.kill ?? process.kill;
508
+ const group = signalIfSameGeneration(pid, token, name, {
509
+ readToken: dependencies.readToken,
510
+ kill: (leader, signal) => kill(-leader, signal),
511
+ });
512
+ return group.sent || group.verdict !== "same"
513
+ ? group
514
+ : signalIfSameGeneration(pid, token, name, dependencies);
515
+ }
626
516
  async function waitForExit(targets, waitMs, dependencies) {
627
517
  const deadline = Date.now() + waitMs;
628
518
  while (true) {
@@ -2,12 +2,10 @@
2
2
  * Tunnels as registry services.
3
3
  *
4
4
  * `tunnel up` and `tunnel reload` register the new gate; `tunnel down` removes
5
- * its record. Missing original witnesses remain unknown and cannot authorize actions.
5
+ * its record. Older tunnels need an explicit adoption of an observed listener.
6
6
  */
7
- import { type TunnelReadinessVerifier, type TunnelState } from "../../lib/tunnel/state.js";
8
- import { type RegisterServerInput, type ServerOptions } from "./index.js";
9
- /** Verify only witnesses saved by the original tunnel registration. */
10
- export declare function createTunnelReadinessVerifier(options: ServerOptions): TunnelReadinessVerifier;
7
+ import { type TunnelState } from "../../lib/tunnel/state.js";
8
+ import type { RegisterServerInput } from "./index.js";
11
9
  export declare function tunnelServerId(name: string): string;
12
10
  /** Register the new gate; saved helper PIDs have no generation witnesses. */
13
11
  export declare function tunnelServerInput(state: TunnelState, coordRoot: string): RegisterServerInput;
@@ -1 +1 @@
1
- {"version":3,"file":"tunnels.d.ts","sourceRoot":"","sources":["../../../src/core/servers/tunnels.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,aAAa,EAGnB,MAAM,YAAY,CAAC;AAEpB,uEAAuE;AACvE,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,aAAa,GAAG,uBAAuB,CAiC7F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB,CAmB5F"}
1
+ {"version":3,"file":"tunnels.d.ts","sourceRoot":"","sources":["../../../src/core/servers/tunnels.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB,CAc5F"}
@@ -2,57 +2,15 @@
2
2
  * Tunnels as registry services.
3
3
  *
4
4
  * `tunnel up` and `tunnel reload` register the new gate; `tunnel down` removes
5
- * its record. Missing original witnesses remain unknown and cannot authorize actions.
5
+ * its record. Older tunnels need an explicit adoption of an observed listener.
6
6
  */
7
- import { hostname } from "node:os";
8
7
  import { resolve } from "node:path";
9
- import { gateLogFile, } from "../../lib/tunnel/state.js";
10
- import { readServer, verifyProcessGeneration, withServerRegistrationCustody, } from "./index.js";
11
- /** Verify only witnesses saved by the original tunnel registration. */
12
- export function createTunnelReadinessVerifier(options) {
13
- return {
14
- observeProcess(pid, originalToken) {
15
- try {
16
- process.kill(pid, 0);
17
- }
18
- catch (error) {
19
- const code = error.code;
20
- if (code === "ESRCH")
21
- return "absent";
22
- return "unknown";
23
- }
24
- return verifyProcessGeneration(pid, originalToken);
25
- },
26
- withRegistration(state, inspect) {
27
- try {
28
- const original = readServer(tunnelServerId(state.name), options);
29
- if (!original ||
30
- original.host !== hostname() ||
31
- original.kind !== "service" ||
32
- original.type !== "tunnel" ||
33
- original.registration_id !== state.registration_id ||
34
- original.pid !== state.gate_pid ||
35
- original.start_token !== state.gate_start_token ||
36
- original.port !== state.gate_port ||
37
- original.url !== state.url)
38
- return "unknown";
39
- return withServerRegistrationCustody(original, options, inspect);
40
- }
41
- catch {
42
- return "unknown";
43
- }
44
- },
45
- };
46
- }
8
+ import { gateLogFile } from "../../lib/tunnel/state.js";
47
9
  export function tunnelServerId(name) {
48
10
  return `tunnel-${name.toLowerCase().replace(/[^a-z0-9._-]+/g, "-")}`;
49
11
  }
50
12
  /** Register the new gate; saved helper PIDs have no generation witnesses. */
51
13
  export function tunnelServerInput(state, coordRoot) {
52
- if (Object.hasOwn(state, "provider_pid") || Object.hasOwn(state, "provider_start_token"))
53
- throw new Error("obsolete tunnel provider authority is unknown; state retained");
54
- if (!state.gate_start_token)
55
- throw new Error("tunnel gate generation witness is unavailable; state retained");
56
14
  return {
57
15
  id: tunnelServerId(state.name),
58
16
  kind: "service",
@@ -61,7 +19,6 @@ export function tunnelServerInput(state, coordRoot) {
61
19
  url: state.url,
62
20
  port: state.gate_port,
63
21
  pid: state.gate_pid,
64
- start_token: state.gate_start_token,
65
22
  log: resolve(coordRoot, ".cache", "tunnel", gateLogFile(state.name)),
66
23
  cwd: coordRoot,
67
24
  started_at: state.started_at,
@@ -394,31 +394,55 @@ function acquireLease(lease) {
394
394
  pid: process.pid,
395
395
  acquired_at: new Date().toISOString(),
396
396
  };
397
- let claimed;
398
- try {
399
- mkdirSync(lease, { mode: stateDirMode() });
400
- assertDirectoryWithinParent(lease, parent);
401
- claimed = captureDirectoryIdentity(lease);
402
- writeOwner(join(lease, "owner.json"), owner);
403
- syncDirectory(claimed);
397
+ if (claimLease(lease, parent, owner))
404
398
  return owner;
399
+ if (recoverStaleLease(lease, DURABLE_HISTORY_LEASE_STALE_MS))
400
+ continue;
401
+ throw new Error(`durable history lease busy: ${lease}`);
402
+ }
403
+ throw new Error(`durable history lease busy: ${lease}`);
404
+ }
405
+ /**
406
+ * Publish a complete lease in one rename. The owner record is written and synced
407
+ * in a private claim directory first, so a writer stopped at any point leaves
408
+ * either no lease or one with an owner. A held lease always has an owner record,
409
+ * here and in the earlier create-then-write protocol, so a rename that replaces
410
+ * an empty lease directory never takes a held lease. A lease with any entry makes
411
+ * the rename fail and the caller reports it busy.
412
+ */
413
+ function claimLease(lease, parent, owner) {
414
+ const claim = `${lease}.claim-${process.pid}-${owner.owner_id}`;
415
+ try {
416
+ mkdirSync(claim, { mode: stateDirMode() });
417
+ assertDirectoryWithinParent(claim, parent);
418
+ const claimed = captureDirectoryIdentity(claim);
419
+ writeOwner(join(claim, "owner.json"), owner);
420
+ syncDirectory(claimed);
421
+ renameSync(claim, lease);
422
+ }
423
+ catch {
424
+ return false;
425
+ }
426
+ finally {
427
+ try {
428
+ rmSync(claim, { recursive: true, force: true });
405
429
  }
406
430
  catch {
407
- if (claimed) {
408
- try {
409
- assertDirectoryIdentity(claimed);
410
- rmSync(lease, { recursive: true, force: false });
411
- }
412
- catch {
413
- // Never remove a lease after its directory identity changes.
414
- }
415
- }
416
- if (recoverStaleLease(lease, DURABLE_HISTORY_LEASE_STALE_MS))
417
- continue;
418
- throw new Error(`durable history lease busy: ${lease}`);
431
+ // A leftover claim directory never blocks a lease.
419
432
  }
420
433
  }
421
- throw new Error(`durable history lease busy: ${lease}`);
434
+ try {
435
+ assertDirectoryWithinParent(lease, parent);
436
+ const current = JSON.parse(completeJsonl(join(lease, "owner.json")));
437
+ if (current.owner_id !== owner.owner_id)
438
+ return false;
439
+ syncDirectory(parent);
440
+ return true;
441
+ }
442
+ catch {
443
+ releaseOwnedLease(lease, owner);
444
+ return false;
445
+ }
422
446
  }
423
447
  function writeOwner(path, owner) {
424
448
  const parent = captureDirectoryIdentity(dirname(path));
@@ -468,7 +492,7 @@ function recoverStaleLease(lease, staleMs) {
468
492
  assertDirectoryIdentity(leaseIdentity);
469
493
  if (completeJsonl(ownerPath) !== raw)
470
494
  return false;
471
- rmSync(lease, { recursive: true, force: false });
495
+ retireLease(lease, randomUUID());
472
496
  return true;
473
497
  }
474
498
  catch {
@@ -480,12 +504,22 @@ function releaseOwnedLease(lease, owner) {
480
504
  const current = JSON.parse(completeJsonl(join(lease, "owner.json")));
481
505
  if (current.owner_id !== owner.owner_id)
482
506
  return;
483
- rmSync(lease, { recursive: true, force: false });
507
+ retireLease(lease, owner.owner_id);
484
508
  }
485
509
  catch {
486
510
  // A missing or replaced lease does not belong to this operation.
487
511
  }
488
512
  }
513
+ /**
514
+ * Move a lease aside before deleting it. Its path goes from held to absent in
515
+ * one rename and is never an empty directory that a concurrent claim could
516
+ * replace while a recursive removal is still running.
517
+ */
518
+ function retireLease(lease, tag) {
519
+ const retired = `${lease}.retired-${process.pid}-${tag}`;
520
+ renameSync(lease, retired);
521
+ rmSync(retired, { recursive: true, force: true });
522
+ }
489
523
  function processIsAlive(pid) {
490
524
  try {
491
525
  process.kill(pid, 0);
@@ -1 +1 @@
1
- {"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../../src/core/storage/segments.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;A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