harnery 0.43.0 → 0.44.0

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 (278) hide show
  1. package/README.md +3 -3
  2. package/dist/commands/agents.d.ts.map +1 -1
  3. package/dist/commands/agents.js +41 -48
  4. package/dist/commands/browse.d.ts.map +1 -1
  5. package/dist/commands/browse.js +38 -11
  6. package/dist/commands/diagnostics.d.ts.map +1 -1
  7. package/dist/commands/diagnostics.js +10 -0
  8. package/dist/commands/doctor.d.ts +12 -0
  9. package/dist/commands/doctor.d.ts.map +1 -1
  10. package/dist/commands/doctor.js +22 -7
  11. package/dist/commands/governor.js +22 -10
  12. package/dist/commands/inbox.d.ts +1 -1
  13. package/dist/commands/inbox.d.ts.map +1 -1
  14. package/dist/commands/inbox.js +55 -2
  15. package/dist/commands/rm.d.ts.map +1 -1
  16. package/dist/commands/rm.js +28 -4
  17. package/dist/commands/servers.d.ts.map +1 -1
  18. package/dist/commands/servers.js +16 -1
  19. package/dist/commands/supervisor.d.ts.map +1 -1
  20. package/dist/commands/supervisor.js +7 -2
  21. package/dist/commands/toc.d.ts +14 -0
  22. package/dist/commands/toc.d.ts.map +1 -1
  23. package/dist/commands/toc.js +7 -4
  24. package/dist/commands/workflow.js +24 -30
  25. package/dist/core/agents/live-authority-v3.d.ts +1 -0
  26. package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
  27. package/dist/core/agents/live-authority-v3.js +11 -0
  28. package/dist/core/agents/live-lifecycle-v3.d.ts +4 -2
  29. package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
  30. package/dist/core/agents/live-lifecycle-v3.js +28 -7
  31. package/dist/core/agents/mailbox.d.ts +9 -8
  32. package/dist/core/agents/mailbox.d.ts.map +1 -1
  33. package/dist/core/agents/mailbox.js +24 -17
  34. package/dist/core/agents/render/prompt-context.d.ts +2 -0
  35. package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
  36. package/dist/core/agents/render/prompt-context.js +8 -12
  37. package/dist/core/agents/render/session-context.d.ts +2 -8
  38. package/dist/core/agents/render/session-context.d.ts.map +1 -1
  39. package/dist/core/agents/render/session-context.js +7 -30
  40. package/dist/core/agents/rules/stop-hook.js +3 -3
  41. package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
  42. package/dist/core/agents/state/heartbeat-writer.js +25 -14
  43. package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -1
  44. package/dist/core/agents/state/live-coordination-writer.js +5 -0
  45. package/dist/core/agents/state/pidmap.d.ts.map +1 -1
  46. package/dist/core/agents/state/pidmap.js +5 -0
  47. package/dist/core/agents/state/proc-start.d.ts +19 -0
  48. package/dist/core/agents/state/proc-start.d.ts.map +1 -1
  49. package/dist/core/agents/state/proc-start.js +41 -0
  50. package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
  51. package/dist/core/agents/state/stale-sweep.js +180 -70
  52. package/dist/core/agents/state/unchanged-file.d.ts +44 -0
  53. package/dist/core/agents/state/unchanged-file.d.ts.map +1 -0
  54. package/dist/core/agents/state/unchanged-file.js +390 -0
  55. package/dist/core/context/index.d.ts +22 -10
  56. package/dist/core/context/index.d.ts.map +1 -1
  57. package/dist/core/context/index.js +381 -119
  58. package/dist/core/context/observation.d.ts +26 -0
  59. package/dist/core/context/observation.d.ts.map +1 -0
  60. package/dist/core/context/observation.js +11 -0
  61. package/dist/core/diagnostics/bundle.d.ts.map +1 -1
  62. package/dist/core/diagnostics/bundle.js +25 -14
  63. package/dist/core/diagnostics/path-identity.d.ts +3 -0
  64. package/dist/core/diagnostics/path-identity.d.ts.map +1 -0
  65. package/dist/core/diagnostics/path-identity.js +12 -0
  66. package/dist/core/diagnostics/sanitize.d.ts.map +1 -1
  67. package/dist/core/diagnostics/sanitize.js +4 -3
  68. package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
  69. package/dist/core/events/v3/authority-outbox.js +29 -0
  70. package/dist/core/events/v3/generation-custody.d.ts +5 -0
  71. package/dist/core/events/v3/generation-custody.d.ts.map +1 -0
  72. package/dist/core/events/v3/generation-custody.js +50 -0
  73. package/dist/core/events/v3/producers/coordination-recorder.d.ts +1 -0
  74. package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
  75. package/dist/core/events/v3/producers/coordination-recorder.js +7 -0
  76. package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
  77. package/dist/core/events/v3/producers/recorder.js +77 -64
  78. package/dist/core/governor/planning.d.ts.map +1 -1
  79. package/dist/core/governor/planning.js +14 -1
  80. package/dist/core/governor/service-read.d.ts +10 -2
  81. package/dist/core/governor/service-read.d.ts.map +1 -1
  82. package/dist/core/governor/service-read.js +105 -22
  83. package/dist/core/governor/service.d.ts +20 -2
  84. package/dist/core/governor/service.d.ts.map +1 -1
  85. package/dist/core/governor/service.js +72 -47
  86. package/dist/core/hooks/cli.js +33 -5
  87. package/dist/core/inbox/contract.d.ts +2 -1
  88. package/dist/core/inbox/contract.d.ts.map +1 -1
  89. package/dist/core/inbox/index.d.ts +2 -0
  90. package/dist/core/inbox/index.d.ts.map +1 -1
  91. package/dist/core/inbox/index.js +2 -0
  92. package/dist/core/inbox/peer-messages.d.ts +37 -0
  93. package/dist/core/inbox/peer-messages.d.ts.map +1 -0
  94. package/dist/core/inbox/peer-messages.js +72 -0
  95. package/dist/core/inbox/service.d.ts +8 -1
  96. package/dist/core/inbox/service.d.ts.map +1 -1
  97. package/dist/core/inbox/service.js +67 -21
  98. package/dist/core/inbox/targets.d.ts +22 -0
  99. package/dist/core/inbox/targets.d.ts.map +1 -0
  100. package/dist/core/inbox/targets.js +108 -0
  101. package/dist/core/inbox/watcher.js +7 -3
  102. package/dist/core/journal/index.d.ts.map +1 -1
  103. package/dist/core/journal/index.js +17 -2
  104. package/dist/core/resources/contract.d.ts +3 -0
  105. package/dist/core/resources/contract.d.ts.map +1 -1
  106. package/dist/core/resources/service-status.d.ts +14 -1
  107. package/dist/core/resources/service-status.d.ts.map +1 -1
  108. package/dist/core/resources/service-status.js +23 -13
  109. package/dist/core/resources/service.d.ts +9 -1
  110. package/dist/core/resources/service.d.ts.map +1 -1
  111. package/dist/core/resources/service.js +47 -27
  112. package/dist/core/resources/status.d.ts +2 -5
  113. package/dist/core/resources/status.d.ts.map +1 -1
  114. package/dist/core/resources/status.js +36 -7
  115. package/dist/core/servers/index.d.ts +24 -13
  116. package/dist/core/servers/index.d.ts.map +1 -1
  117. package/dist/core/servers/index.js +132 -92
  118. package/dist/core/servers/tunnels.d.ts +3 -5
  119. package/dist/core/servers/tunnels.d.ts.map +1 -1
  120. package/dist/core/servers/tunnels.js +3 -9
  121. package/dist/core/supervisor/contract.d.ts +12 -0
  122. package/dist/core/supervisor/contract.d.ts.map +1 -1
  123. package/dist/core/supervisor/explanations.d.ts.map +1 -1
  124. package/dist/core/supervisor/explanations.js +2 -1
  125. package/dist/core/supervisor/findings.d.ts.map +1 -1
  126. package/dist/core/supervisor/findings.js +54 -9
  127. package/dist/core/supervisor/service.d.ts +9 -1
  128. package/dist/core/supervisor/service.d.ts.map +1 -1
  129. package/dist/core/supervisor/service.js +59 -29
  130. package/dist/core/supervisor/services.d.ts.map +1 -1
  131. package/dist/core/supervisor/services.js +22 -1
  132. package/dist/core/supervisor/status.d.ts +17 -2
  133. package/dist/core/supervisor/status.d.ts.map +1 -1
  134. package/dist/core/supervisor/status.js +70 -12
  135. package/dist/core/supervisor/timeline.d.ts.map +1 -1
  136. package/dist/core/supervisor/timeline.js +2 -1
  137. package/dist/core/work/state.js +7 -7
  138. package/dist/core/workflow/engine.d.ts.map +1 -1
  139. package/dist/core/workflow/engine.js +105 -32
  140. package/dist/core/workflow/failure-evidence.d.ts +16 -0
  141. package/dist/core/workflow/failure-evidence.d.ts.map +1 -0
  142. package/dist/core/workflow/failure-evidence.js +114 -0
  143. package/dist/core/workflow/index.d.ts +1 -1
  144. package/dist/core/workflow/index.d.ts.map +1 -1
  145. package/dist/core/workflow/index.js +1 -1
  146. package/dist/core/workflow/live-session-v3.d.ts +6 -0
  147. package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
  148. package/dist/core/workflow/live-session-v3.js +126 -5
  149. package/dist/core/workflow/proof.d.ts +5 -5
  150. package/dist/core/workflow/proof.d.ts.map +1 -1
  151. package/dist/core/workflow/proof.js +115 -20
  152. package/dist/core/workflow/run-state.d.ts +3 -1
  153. package/dist/core/workflow/run-state.d.ts.map +1 -1
  154. package/dist/core/workflow/run-state.js +31 -27
  155. package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
  156. package/dist/core/workflow/spawn-claude.js +19 -0
  157. package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
  158. package/dist/core/workflow/spawn-codex.js +13 -0
  159. package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
  160. package/dist/core/workflow/spawn-cursor.js +19 -0
  161. package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
  162. package/dist/core/workflow/spawn-opencode.js +14 -0
  163. package/dist/core/workflow/types.d.ts +64 -17
  164. package/dist/core/workflow/types.d.ts.map +1 -1
  165. package/dist/core/workflow/workspaces/index.d.ts +0 -1
  166. package/dist/core/workflow/workspaces/index.d.ts.map +1 -1
  167. package/dist/core/workflow/workspaces/index.js +0 -1
  168. package/dist/core/workflow/workspaces/leases.d.ts +3 -1
  169. package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
  170. package/dist/core/workflow/workspaces/leases.js +30 -16
  171. package/dist/core/workflow/workspaces/local-git.d.ts +6 -2
  172. package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
  173. package/dist/core/workflow/workspaces/local-git.js +270 -6
  174. package/dist/core/workflow/workspaces/ownership.d.ts +11 -0
  175. package/dist/core/workflow/workspaces/ownership.d.ts.map +1 -0
  176. package/dist/core/workflow/workspaces/ownership.js +194 -0
  177. package/dist/core/workflow/workspaces/reclaim.d.ts +35 -0
  178. package/dist/core/workflow/workspaces/reclaim.d.ts.map +1 -1
  179. package/dist/core/workflow/workspaces/reclaim.js +14 -0
  180. package/dist/core/workflow/workspaces/recovery.d.ts.map +1 -1
  181. package/dist/core/workflow/workspaces/recovery.js +21 -13
  182. package/dist/core/workflow/workspaces/state.d.ts +1 -0
  183. package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
  184. package/dist/core/workflow/workspaces/state.js +21 -1
  185. package/dist/lib/browser/windows-chrome.d.ts +100 -12
  186. package/dist/lib/browser/windows-chrome.d.ts.map +1 -1
  187. package/dist/lib/browser/windows-chrome.js +262 -73
  188. package/dist/lib/docs-links.d.ts.map +1 -1
  189. package/dist/lib/docs-links.js +45 -2
  190. package/dist/lib/guarded-remove.d.ts +7 -0
  191. package/dist/lib/guarded-remove.d.ts.map +1 -1
  192. package/dist/lib/guarded-remove.js +106 -12
  193. package/dist/lib/identities/assume.d.ts.map +1 -1
  194. package/dist/lib/identities/assume.js +4 -0
  195. package/dist/lib/zip/index.d.ts +41 -0
  196. package/dist/lib/zip/index.d.ts.map +1 -0
  197. package/dist/lib/zip/index.js +398 -0
  198. package/package.json +7 -1
  199. package/src/commands/agents.ts +54 -63
  200. package/src/commands/browse.ts +50 -14
  201. package/src/commands/diagnostics.ts +10 -0
  202. package/src/commands/doctor.ts +26 -7
  203. package/src/commands/governor.ts +23 -10
  204. package/src/commands/inbox.ts +52 -2
  205. package/src/commands/rm.ts +43 -4
  206. package/src/commands/servers.ts +16 -4
  207. package/src/commands/supervisor.ts +7 -2
  208. package/src/commands/toc.ts +14 -6
  209. package/src/commands/workflow.ts +30 -30
  210. package/src/core/agents/live-authority-v3.ts +17 -0
  211. package/src/core/agents/live-lifecycle-v3.ts +52 -14
  212. package/src/core/agents/mailbox.ts +26 -17
  213. package/src/core/agents/render/prompt-context.ts +10 -12
  214. package/src/core/agents/render/session-context.ts +9 -32
  215. package/src/core/agents/rules/stop-hook.ts +3 -3
  216. package/src/core/agents/state/heartbeat-writer.ts +29 -12
  217. package/src/core/agents/state/live-coordination-writer.ts +29 -0
  218. package/src/core/agents/state/pidmap.ts +13 -0
  219. package/src/core/agents/state/proc-start.ts +57 -0
  220. package/src/core/agents/state/stale-sweep.ts +247 -82
  221. package/src/core/agents/state/unchanged-file.ts +456 -0
  222. package/src/core/context/index.ts +446 -136
  223. package/src/core/context/observation.ts +29 -0
  224. package/src/core/diagnostics/bundle.ts +23 -18
  225. package/src/core/diagnostics/path-identity.ts +15 -0
  226. package/src/core/diagnostics/sanitize.ts +4 -3
  227. package/src/core/events/v3/authority-outbox.ts +56 -0
  228. package/src/core/events/v3/generation-custody.ts +59 -0
  229. package/src/core/events/v3/producers/coordination-recorder.ts +15 -0
  230. package/src/core/events/v3/producers/recorder.ts +94 -68
  231. package/src/core/governor/planning.ts +20 -8
  232. package/src/core/governor/service-read.ts +128 -20
  233. package/src/core/governor/service.ts +119 -42
  234. package/src/core/hooks/cli.ts +33 -5
  235. package/src/core/inbox/contract.ts +2 -1
  236. package/src/core/inbox/index.ts +2 -0
  237. package/src/core/inbox/peer-messages.ts +94 -0
  238. package/src/core/inbox/service.ts +88 -22
  239. package/src/core/inbox/targets.ts +148 -0
  240. package/src/core/inbox/watcher.ts +8 -9
  241. package/src/core/journal/index.ts +19 -2
  242. package/src/core/resources/contract.ts +4 -0
  243. package/src/core/resources/service-status.ts +35 -12
  244. package/src/core/resources/service.ts +71 -24
  245. package/src/core/resources/status.ts +57 -8
  246. package/src/core/servers/index.ts +177 -91
  247. package/src/core/servers/tunnels.ts +3 -11
  248. package/src/core/supervisor/contract.ts +13 -0
  249. package/src/core/supervisor/explanations.ts +4 -1
  250. package/src/core/supervisor/findings.ts +68 -10
  251. package/src/core/supervisor/service.ts +88 -26
  252. package/src/core/supervisor/services.ts +26 -8
  253. package/src/core/supervisor/status.ts +89 -12
  254. package/src/core/supervisor/timeline.ts +2 -1
  255. package/src/core/work/state.ts +7 -7
  256. package/src/core/workflow/engine.ts +131 -49
  257. package/src/core/workflow/failure-evidence.ts +141 -0
  258. package/src/core/workflow/index.ts +0 -1
  259. package/src/core/workflow/live-session-v3.ts +146 -5
  260. package/src/core/workflow/proof.ts +134 -26
  261. package/src/core/workflow/run-state.ts +31 -29
  262. package/src/core/workflow/spawn-claude.ts +18 -0
  263. package/src/core/workflow/spawn-codex.ts +13 -0
  264. package/src/core/workflow/spawn-cursor.ts +18 -0
  265. package/src/core/workflow/spawn-opencode.ts +14 -0
  266. package/src/core/workflow/types.ts +51 -17
  267. package/src/core/workflow/workspaces/index.ts +0 -1
  268. package/src/core/workflow/workspaces/leases.ts +48 -17
  269. package/src/core/workflow/workspaces/local-git.ts +315 -5
  270. package/src/core/workflow/workspaces/ownership.ts +232 -0
  271. package/src/core/workflow/workspaces/reclaim.ts +58 -0
  272. package/src/core/workflow/workspaces/recovery.ts +25 -13
  273. package/src/core/workflow/workspaces/state.ts +20 -0
  274. package/src/lib/browser/windows-chrome.ts +346 -86
  275. package/src/lib/docs-links.ts +49 -2
  276. package/src/lib/guarded-remove.ts +132 -14
  277. package/src/lib/identities/assume.ts +4 -0
  278. package/src/lib/zip/index.ts +483 -0
@@ -1,5 +1,7 @@
1
+ import { type ProcessGenerationVerdict } from "../agents/state/proc-start.js";
1
2
  import { type ResourceServiceStatus, type ResourceServiceStatusRecord } from "./contract.js";
2
3
  import { sampleResources } from "./sampler.js";
4
+ import { type ResourceProcessDependencies } from "./service-status.js";
3
5
  export declare const RESOURCE_SERVICE_DEFAULT_INTERVAL_MS = 2000;
4
6
  export interface RunResourceServiceInput {
5
7
  coordRoot: string;
@@ -21,6 +23,12 @@ export declare function spawnResourceService(coordRootRaw: string, options?: {
21
23
  intervalMs?: number;
22
24
  }): Promise<ResourceServiceStatus>;
23
25
  export declare function ensureResourceServiceRunning(coordRoot: string): Promise<EnsureResourceServiceResult>;
24
- export declare function requestResourceServiceStop(coordRootRaw: string): ResourceServiceStatus;
26
+ export interface ResourceServiceStopResult extends ResourceServiceStatus {
27
+ signal_sent: boolean;
28
+ signal_verdict: ProcessGenerationVerdict;
29
+ }
30
+ export declare function requestResourceServiceStop(coordRootRaw: string, dependencies?: ResourceProcessDependencies & {
31
+ kill?: (pid: number, signal: NodeJS.Signals | number) => unknown;
32
+ }): ResourceServiceStopResult;
25
33
  export declare function runResourceService(input: RunResourceServiceInput): Promise<ResourceServiceStatusRecord>;
26
34
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/core/resources/service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EACjC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,eAAO,MAAM,oCAAoC,OAAQ,CAAC;AAY1D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,eAAe,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,2BAA2B,GACnC;IAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,GAC/D;IAAE,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpC,OAAO,CAAC,qBAAqB,CAAC,CAwChC;AAED,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,2BAA2B,CAAC,CAoBtC;AAED,wBAAgB,0BAA0B,CAAC,YAAY,EA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CAAC,2BAA2B,CAAC,CAoBtC;AAED,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,wBAAwB,CAAC;CAC1C;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,YAAY,GAAE,2BAA2B,GAAG;IAC1C,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,MAAM,KAAK,OAAO,CAAC;CAC7D,GACL,yBAAyB,CAuB3B;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,2BAA2B,CAAC,CA4FtC"}
@@ -3,12 +3,13 @@ import { randomUUID } from "node:crypto";
3
3
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, unlinkSync, writeFileSync, } from "node:fs";
4
4
  import { hostname, platform } from "node:os";
5
5
  import { resolve } from "node:path";
6
- import { checkPidToken, processStartToken } from "../agents/state/proc-start.js";
6
+ import { processStartToken, signalIfSameGeneration, } from "../agents/state/proc-start.js";
7
+ import { resolveBinName } from "../config.js";
7
8
  import { closeProcessLoggers, legacyLogFields, processLogger } from "../storage/logger.js";
8
9
  import { stateDirMode, stateFileMode } from "../storage/modes.js";
9
10
  import { RESOURCE_SERVICE_STATUS_SCHEMA_VERSION, } from "./contract.js";
10
11
  import { sampleResources } from "./sampler.js";
11
- import { readResourceServiceStatus } from "./service-status.js";
12
+ import { readResourceServiceStatus, resourceProcessLiveness, } from "./service-status.js";
12
13
  import { resourcePaths, writePrivateJsonAtomic } from "./storage.js";
13
14
  export const RESOURCE_SERVICE_DEFAULT_INTERVAL_MS = 2_000;
14
15
  const RESOURCE_SERVICE_MIN_INTERVAL_MS = 500;
@@ -16,13 +17,15 @@ const RESOURCE_SERVICE_MAX_INTERVAL_MS = 60_000;
16
17
  export async function spawnResourceService(coordRootRaw, options = {}) {
17
18
  const coordRoot = resolve(coordRootRaw);
18
19
  const current = readResourceServiceStatus(coordRoot);
19
- if (current.running) {
20
+ if (current.liveness === "unknown")
21
+ throw unknownResourceOwnerError();
22
+ if (current.liveness === "running") {
20
23
  throw new Error(`resource observer is already running under pid ${current.record?.pid}`);
21
24
  }
22
25
  const intervalMs = normalizeInterval(options.intervalMs);
23
26
  const paths = resourcePaths(coordRoot);
27
+ assertResourceLeaseAvailable(paths.lease);
24
28
  mkdirSync(paths.root, { recursive: true, mode: stateDirMode() });
25
- rmSync(paths.stop, { force: true });
26
29
  const harnBin = new URL("../../../bin/harn", import.meta.url).pathname;
27
30
  if (!existsSync(harnBin))
28
31
  throw new Error(`cannot find harn executable at ${harnBin}`);
@@ -77,27 +80,31 @@ export async function ensureResourceServiceRunning(coordRoot) {
77
80
  };
78
81
  }
79
82
  }
80
- export function requestResourceServiceStop(coordRootRaw) {
83
+ export function requestResourceServiceStop(coordRootRaw, dependencies = {}) {
81
84
  const coordRoot = resolve(coordRootRaw);
82
85
  const paths = resourcePaths(coordRoot);
83
- const status = readResourceServiceStatus(coordRoot);
86
+ const status = readResourceServiceStatus(coordRoot, Date.now(), dependencies);
84
87
  mkdirSync(paths.root, { recursive: true, mode: stateDirMode() });
85
88
  writePrivateJsonAtomic(paths.stop, {
86
89
  requested_at: new Date().toISOString(),
87
90
  requested_by_pid: process.pid,
88
91
  });
89
- if (status.running && status.record?.host === hostname()) {
90
- try {
91
- process.kill(status.record.pid, "SIGTERM");
92
- }
93
- catch {
94
- // The durable stop file handles a racing exit.
95
- }
96
- }
97
- return readResourceServiceStatus(coordRoot);
92
+ const signal = status.liveness === "running" && status.record?.host === hostname()
93
+ ? signalIfSameGeneration(status.record.pid, status.record.start_token, "SIGTERM", dependencies)
94
+ : { sent: false, verdict: status.generation };
95
+ return {
96
+ ...readResourceServiceStatus(coordRoot, Date.now(), dependencies),
97
+ signal_sent: signal.sent,
98
+ signal_verdict: signal.verdict,
99
+ };
98
100
  }
99
101
  export async function runResourceService(input) {
100
102
  const coordRoot = resolve(input.coordRoot);
103
+ const current = readResourceServiceStatus(coordRoot);
104
+ if (current.liveness === "unknown")
105
+ throw unknownResourceOwnerError();
106
+ if (current.liveness === "running")
107
+ throw new Error(`resource observer is already running under pid ${current.record?.pid}`);
101
108
  const paths = resourcePaths(coordRoot);
102
109
  const intervalMs = normalizeInterval(input.intervalMs);
103
110
  const now = input.now ?? (() => new Date());
@@ -212,7 +219,10 @@ function acquireLease(coordRoot, now) {
212
219
  if (error.code !== "EEXIST")
213
220
  throw error;
214
221
  const existing = readLease(paths.lease);
215
- if (existing && leaseIsLive(existing)) {
222
+ const liveness = existing ? leaseIsLive(existing) : "unknown";
223
+ if (liveness === "unknown")
224
+ throw unknownResourceOwnerError();
225
+ if (existing && liveness === "running") {
216
226
  throw new Error(`resource observer lease is held by pid ${existing.pid}`);
217
227
  }
218
228
  try {
@@ -239,7 +249,13 @@ function releaseLease(path, nonce) {
239
249
  function readLease(path) {
240
250
  try {
241
251
  const value = JSON.parse(readFileSync(path, "utf8"));
242
- return value && Number.isInteger(value.pid) && typeof value.nonce === "string"
252
+ return value &&
253
+ Number.isSafeInteger(value.pid) &&
254
+ value.pid > 0 &&
255
+ typeof value.host === "string" &&
256
+ value.host.length > 0 &&
257
+ typeof value.nonce === "string" &&
258
+ value.nonce.length > 0
243
259
  ? value
244
260
  : undefined;
245
261
  }
@@ -248,16 +264,20 @@ function readLease(path) {
248
264
  }
249
265
  }
250
266
  function leaseIsLive(lease) {
251
- if (lease.host !== hostname())
252
- return true;
253
- try {
254
- process.kill(lease.pid, 0);
255
- }
256
- catch (error) {
257
- if (error.code !== "EPERM")
258
- return false;
259
- }
260
- return checkPidToken(lease.pid, lease.start_token) !== "mismatch";
267
+ return resourceProcessLiveness(lease).liveness;
268
+ }
269
+ function assertResourceLeaseAvailable(path) {
270
+ if (!existsSync(path))
271
+ return;
272
+ const lease = readLease(path);
273
+ const liveness = lease ? leaseIsLive(lease) : "unknown";
274
+ if (liveness === "unknown")
275
+ throw unknownResourceOwnerError();
276
+ if (liveness === "running")
277
+ throw new Error(`resource observer lease is held by pid ${lease?.pid}`);
278
+ }
279
+ function unknownResourceOwnerError() {
280
+ return new Error(`resource observer process identity is unknown; run ${resolveBinName()} supervisor stop to write the durable stop request before starting again`);
261
281
  }
262
282
  function log(coordRoot, event, fields, error) {
263
283
  try {
@@ -1,5 +1,5 @@
1
1
  import { type PressureAssessment, type PressureHysteresisState } from "../diagnostics/contract.js";
2
- import { type SupervisorCapability, type SupervisorPressureRecord } from "../supervisor/contract.js";
2
+ import { type SupervisorCapability, type SupervisorPressureRecord, type SupervisorStatus } from "../supervisor/contract.js";
3
3
  import { type ResourceDiskSample, type ResourceHostSample, type ResourceIoSample, type ResourceMachineSample, type ResourceOomSample, type ResourcePressureSample, type ResourceProcessSample, type ResourceSnapshot } from "./contract.js";
4
4
  export declare const RESOURCE_STATUS_STALE_MS = 15000;
5
5
  export declare const RESOURCE_STATUS_MAX_BYTES: number;
@@ -15,10 +15,7 @@ export interface ResourceStatus {
15
15
  platform: NodeJS.Platform | null;
16
16
  namespace: ResourceSnapshot["namespace"];
17
17
  support: ResourceSnapshot["support"] | null;
18
- writer: {
19
- running: boolean;
20
- stale: boolean;
21
- };
18
+ writer: Pick<SupervisorStatus, "running" | "stale" | "generation" | "liveness" | "running_build" | "installed_build" | "restart_needed" | "build_status">;
22
19
  /**
23
20
  * The one published pressure assessment, read from the observer's record so
24
21
  * this surface, the prompt notice, the dashboard, and a diagnostic bundle all
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/core/resources/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBA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B,GAAG,IAAI,CAAC;IAC9B,EAAE,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,KAAK,CACf,IAAI,CACF,qBAAqB,EACrB,KAAK,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CACzE,CACF,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3D,cAAc,CA8HhB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAsBpE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CA6EhF;AAaD,eAAO,MAAM,yBAAyB,QAAa,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,gBAAgB,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACjD,UAAU,EAAE,oBAAoB,CAAC;IACjC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,KAAK,SAAa,EAClB,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAChC,iBAAiB,CAkFnB"}
@@ -2,7 +2,7 @@ import { closeSync, fstatSync, openSync, readSync, statSync } from "node:fs";
2
2
  import { unknownPressureAssessment } from "../diagnostics/advice.js";
3
3
  import { PRESSURE_ASSESSMENT_SCHEMA_VERSION, PRESSURE_POLICY, } from "../diagnostics/contract.js";
4
4
  import { SUPERVISOR_PRESSURE_SCHEMA_VERSION, } from "../supervisor/contract.js";
5
- import { readSupervisorStatus } from "../supervisor/status.js";
5
+ import { installedSupervisorBuild, readSupervisorStatus } from "../supervisor/status.js";
6
6
  import { supervisorPaths } from "../supervisor/storage.js";
7
7
  import { RESOURCE_SNAPSHOT_SCHEMA_VERSION, } from "./contract.js";
8
8
  import { resourcePaths } from "./storage.js";
@@ -156,11 +156,13 @@ export function formatResourceSummary(status) {
156
156
  ? "unknown"
157
157
  : `${formatBytes(m.memory_available_bytes)} available`;
158
158
  const diskText = disk ? `${formatBytes(disk.available_bytes)} available` : "unknown";
159
- return `${lead} ${status.namespace}/${status.platform}: CPU ${cpu}, RAM ${ram}, disk ${diskText}; ${Math.round((status.sample_age_ms ?? 0) / 1_000)}s old${status.support?.state === "partial" ? "; partial" : ""}${!status.writer.running ? "; writer stopped" : ""}.`;
159
+ return `${lead} ${status.namespace}/${status.platform}: CPU ${cpu}, RAM ${ram}, disk ${diskText}; ${Math.round((status.sample_age_ms ?? 0) / 1_000)}s old${status.support?.state === "partial" ? "; partial" : ""}${!status.writer.running ? `; writer ${status.writer.liveness === "unknown" ? "unknown" : status.writer.stale ? "stale" : "stopped"}` : ""}.`;
160
160
  }
161
161
  export function formatResourceStatus(status, bin) {
162
162
  const a = status.assessment;
163
163
  const lines = [formatResourceSummary(status)];
164
+ const writer = status.writer;
165
+ lines.push(`Writer: ${writer.liveness}; generation ${writer.generation}; running build ${writer.running_build ? `${writer.running_build.version} (${writer.running_build.revision})` : "unknown"}; installed build ${writer.installed_build.version} (${writer.installed_build.revision}); ${writer.build_status}.`);
164
166
  lines.push(`Assessment: ${a.state} at ${a.scope} scope; limiting resource ${a.limiting_resource}; trend ${a.trend}; evidence ${a.evidence_state}; recommended action ${a.recommended_action}.`);
165
167
  lines.push(`Evidence age: ${a.sample_age_ms === null ? "unknown" : `${Math.round(a.sample_age_ms / 1_000)}s`}; assessment source ${status.assessment_capability.state}${status.assessment_capability.reason_code ? ` (${status.assessment_capability.reason_code})` : ""}.`);
166
168
  for (const item of a.reasons)
@@ -176,7 +178,9 @@ export function formatResourceStatus(status, bin) {
176
178
  }
177
179
  if (a.unattributed_memory_percent !== null)
178
180
  lines.push(`Unattributed memory: ${Math.round(a.unattributed_memory_percent)}% of machine memory has no validated owner.`);
179
- if (status.state !== "fresh" || !status.writer.running)
181
+ if (status.writer.liveness === "unknown")
182
+ lines.push(`Inspect the writer with ${bin} supervisor status. Run ${bin} supervisor stop to write its durable stop request before starting again.`);
183
+ else if (status.state !== "fresh" || !status.writer.running)
180
184
  lines.push(`Start or inspect the writer with ${bin} supervisor start --keep-alive and ${bin} supervisor status.`);
181
185
  if (status.host)
182
186
  lines.push(`Windows host: ${status.host.state}${status.host.machine ? `; CPU ${status.host.machine.cpu_percent === null ? "warming up" : `${Math.round(status.host.machine.cpu_percent)}%`}, RAM ${status.host.machine.memory_available_bytes === null ? "unknown" : `${formatBytes(status.host.machine.memory_available_bytes)} available`}` : `; ${status.host.reason ?? "unavailable"}`}`);
@@ -238,7 +242,11 @@ export function readPublishedPressure(coordRoot, nowMs = Date.now(), writer) {
238
242
  });
239
243
  // A record can only be trusted while its writer is alive. Every surface makes
240
244
  // the same check here so none of them reports a state the others do not.
241
- if (!(writer ?? readWriterState(coordRoot, nowMs)).running) {
245
+ const observer = writer ?? readWriterState(coordRoot, nowMs);
246
+ if (observer.liveness === "unknown") {
247
+ return gap("error", "pressure_observer_unknown", "Local resource pressure cannot be determined because the resource observer's process identity is unknown.");
248
+ }
249
+ if (!observer.running) {
242
250
  return gap("expired", "pressure_observer_not_running", "Local resource pressure cannot be determined because the resource observer is not running.");
243
251
  }
244
252
  const path = supervisorPaths(coordRoot).pressure;
@@ -275,20 +283,41 @@ function readWriterState(coordRoot, nowMs) {
275
283
  // Keep malformed service metadata from making the read expensive. The shared
276
284
  // status reader retains ownership of PID/start-token liveness checks.
277
285
  if (statSync(supervisorPaths(coordRoot).service).size > 65_536) {
278
- return { running: false, stale: false };
286
+ return unknownWriterState();
279
287
  }
280
288
  const writer = readSupervisorStatus(coordRoot, nowMs);
281
289
  const futureHeartbeat = writer.record && Date.parse(writer.record.heartbeat_at) > nowMs + FUTURE_TOLERANCE_MS;
282
290
  return {
283
291
  running: writer.running && !futureHeartbeat,
284
292
  stale: writer.stale || !!futureHeartbeat,
293
+ generation: writer.generation,
294
+ liveness: writer.liveness,
295
+ running_build: writer.running_build,
296
+ installed_build: writer.installed_build,
297
+ restart_needed: writer.restart_needed,
298
+ build_status: writer.build_status,
285
299
  };
286
300
  }
287
- catch {
301
+ catch (error) {
288
302
  // A missing writer must not break normal coordination.
289
- return { running: false, stale: false };
303
+ return {
304
+ ...unknownWriterState(),
305
+ liveness: error.code === "ENOENT" ? "stopped" : "unknown",
306
+ };
290
307
  }
291
308
  }
309
+ function unknownWriterState() {
310
+ return {
311
+ running: false,
312
+ stale: false,
313
+ generation: "unknown",
314
+ liveness: "unknown",
315
+ running_build: null,
316
+ installed_build: installedSupervisorBuild(),
317
+ restart_needed: true,
318
+ build_status: "running build unknown; restart needed",
319
+ };
320
+ }
292
321
  function validPressureRecord(v) {
293
322
  if (!object(v) ||
294
323
  v.schema_version !== SUPERVISOR_PRESSURE_SCHEMA_VERSION ||
@@ -14,11 +14,12 @@
14
14
  * for `gc` once its starting agent has ended or been unobserved for a long
15
15
  * time AND nobody has used the server for the idle window.
16
16
  *
17
- * Fail-closed rules: a record whose pid was recycled is treated as dead, never
18
- * signalled; an unreadable coordination view makes every owner `unknown`,
17
+ * Fail-closed rules: a record whose pid was recycled is never signalled;
18
+ * an unreadable start token or coordination view is `unknown`,
19
19
  * which `gc` never stops; a record without an owner is never stopped
20
20
  * automatically.
21
21
  */
22
+ import { type ProcessGenerationSignalDependencies, type ProcessGenerationVerdict } from "../agents/state/proc-start.js";
22
23
  import { type ScanSupport } from "./net.js";
23
24
  export { ancestry, establishedConnectionCounts, listListeningPorts, listListeningSockets, lsofConnectionCounts, lsofListeningSockets, parseElapsed, parseLsofListen, parseProcNetTcp, processStartedAt, psProcessInfo, readProcessInfo, scanSupport, } from "./net.js";
24
25
  export { tunnelServerId, tunnelServerInput } from "./tunnels.js";
@@ -40,13 +41,13 @@ export interface ServerRecord {
40
41
  start_token?: string;
41
42
  /** Further processes that belong to this server (helpers, children). */
42
43
  pids?: number[];
44
+ /** Generation witnesses captured when the further processes registered. */
45
+ pids_start_tokens?: Record<string, string>;
43
46
  host: string;
44
47
  /** What the server serves, usually a directory. */
45
48
  scope?: string;
46
49
  cwd?: string;
47
50
  log?: string;
48
- /** Graceful stop command; signals are the fallback. */
49
- stop_argv?: string[];
50
51
  owner?: {
51
52
  instance_id: string;
52
53
  name?: string;
@@ -63,11 +64,12 @@ export interface RegisterServerInput {
63
64
  url?: string;
64
65
  port?: number;
65
66
  pid?: number;
67
+ /** Preserve an observed witness when adopting, rather than probing a new generation. */
68
+ start_token?: string;
66
69
  pids?: number[];
67
70
  scope?: string;
68
71
  cwd?: string;
69
72
  log?: string;
70
- stop_argv?: string[];
71
73
  started_at?: string;
72
74
  /** `null` records no owner; omitted resolves the calling agent session. */
73
75
  owner?: {
@@ -78,7 +80,7 @@ export interface RegisterServerInput {
78
80
  export interface ServerOptions {
79
81
  coordRoot?: string | null;
80
82
  }
81
- export type ServerState = "running" | "dead" | "other-host";
83
+ export type ServerState = "running" | "dead" | "other-host" | "unknown";
82
84
  export type OwnerState = "live" | "abandoned" | "ended" | "unknown" | "none";
83
85
  export interface ServerView {
84
86
  record: ServerRecord;
@@ -90,6 +92,8 @@ export interface ServerView {
90
92
  }
91
93
  export interface UnregisteredListener {
92
94
  pid: number;
95
+ /** Captured during the scan, before a stop can be authorized. */
96
+ start_token?: string;
93
97
  port: number;
94
98
  address: string;
95
99
  command: string;
@@ -134,7 +138,7 @@ export declare function touchServer(id: string, options?: ServerOptions & {
134
138
  export declare function createServerToucher(id: string, options?: ServerOptions): () => void;
135
139
  export declare function readServerRecords(options?: ServerOptions): ServerRecord[];
136
140
  export declare function pidAlive(pid: number): boolean;
137
- export declare function serverState(record: ServerRecord): ServerState;
141
+ export declare function serverState(record: ServerRecord, readToken?: (pid: number) => string | null, probePid?: (pid: number) => boolean): ServerState;
138
142
  export interface ListServersOptions extends ServerOptions {
139
143
  /** Look for listening processes inside the project that never registered. */
140
144
  scan?: boolean;
@@ -147,8 +151,6 @@ export interface ListServersOptions extends ServerOptions {
147
151
  }
148
152
  /** Read every record, observe it, and optionally find unregistered listeners. */
149
153
  export declare function listServers(options?: ListServersOptions): ServersReport;
150
- /** Register running tunnels that have no current record. Returns adopted ids. */
151
- export declare function adoptRunningTunnels(coordRoot: string): string[];
152
154
  /**
153
155
  * Listening processes that run inside the project (working directory or
154
156
  * command line within the coordination root) but are not covered by any
@@ -175,16 +177,21 @@ export declare function planServerGc(views: ServerView[], policy?: GcPolicy): Gc
175
177
  export interface StopResult {
176
178
  id: string;
177
179
  stopped: boolean;
178
- method: "not-running" | "stop-command" | "signal" | "refused";
180
+ method: "not-running" | "signal" | "refused";
181
+ generation?: ProcessGenerationVerdict;
179
182
  detail?: string;
180
183
  }
184
+ export interface ServerProcessDependencies extends ProcessGenerationSignalDependencies {
185
+ probePid?: (pid: number) => boolean;
186
+ }
181
187
  /**
182
- * Stop one server: its graceful stop command first when recorded, then
183
- * SIGTERM to its process group, then SIGKILL after the grace period. A pid
184
- * whose start token no longer matches is never signalled.
188
+ * Stop a verified server with SIGTERM, then SIGKILL after the grace period.
189
+ * Each signal, including the process group and auxiliary processes, requires
190
+ * a fresh generation check. Unknown or different generations retain the record.
185
191
  */
186
192
  export declare function stopServer(record: ServerRecord, options?: ServerOptions & {
187
193
  graceMs?: number;
194
+ signalDependencies?: ServerProcessDependencies;
188
195
  }): Promise<StopResult>;
189
196
  /**
190
197
  * The first free port in the configured range for `type`
@@ -200,6 +207,10 @@ export interface AdoptOptions extends ServerOptions {
200
207
  scope?: string;
201
208
  /** `self` (default) records the adopting agent as owner; `none` records no owner. */
202
209
  owner?: "self" | "none";
210
+ dependencies?: {
211
+ listServers?: typeof listServers;
212
+ readToken?: (pid: number) => string | null;
213
+ };
203
214
  }
204
215
  /**
205
216
  * Register a running server that never registered itself. Only a pid the scan
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/servers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAmBH,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,QAAQ,EACR,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjE,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAGnD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,OAAO,4BAA4B,CAAC;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG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