@e4779/pi-fabric 0.131.0-fork.32 → 0.132.6-fork.34

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 (232) hide show
  1. package/README.md +1 -1
  2. package/dist/activity/store.d.ts.map +1 -1
  3. package/dist/actors/feedback.d.ts +5 -0
  4. package/dist/actors/feedback.d.ts.map +1 -0
  5. package/dist/actors/global-registry.d.ts.map +1 -1
  6. package/dist/actors/manager.d.ts.map +1 -1
  7. package/dist/agents/completion-inbox.d.ts +2 -1
  8. package/dist/agents/completion-inbox.d.ts.map +1 -1
  9. package/dist/agents/manager.d.ts.map +1 -1
  10. package/dist/agents/request.d.ts.map +1 -1
  11. package/dist/agents/transports/herdr-core-socket.d.ts +13 -0
  12. package/dist/agents/transports/herdr-core-socket.d.ts.map +1 -0
  13. package/dist/agents/transports/herdr-core-transport.d.ts +10 -0
  14. package/dist/agents/transports/herdr-core-transport.d.ts.map +1 -0
  15. package/dist/agents.js +5 -1
  16. package/dist/agents.js.map +1 -1
  17. package/dist/async-settlement.d.ts +1 -1
  18. package/dist/async-settlement.d.ts.map +1 -1
  19. package/dist/audit/details.d.ts +2 -0
  20. package/dist/audit/details.d.ts.map +1 -1
  21. package/dist/chunks/{chunk-HSEZPCL5.js → chunk-2OC4YJOL.js} +3 -3
  22. package/dist/chunks/{chunk-TXCNZCZP.js → chunk-2QJ4MNS6.js} +2 -2
  23. package/dist/chunks/{chunk-QOEOKW2X.js → chunk-3QH6JAE3.js} +2 -2
  24. package/dist/chunks/{chunk-3XT5WHSG.js → chunk-4Y5KEJP4.js} +3 -3
  25. package/dist/chunks/{chunk-RAA3FAYZ.js → chunk-5PSEJOJB.js} +2 -2
  26. package/dist/chunks/{chunk-XFOSUGLU.js → chunk-66UTGL7T.js} +2 -2
  27. package/dist/chunks/{chunk-WWTGWGH7.js → chunk-6ZPEPRUV.js} +27 -9
  28. package/dist/chunks/chunk-6ZPEPRUV.js.map +7 -0
  29. package/dist/chunks/{chunk-7TB7NXSL.js → chunk-7CIQQOOD.js} +11 -3
  30. package/dist/chunks/{chunk-7TB7NXSL.js.map → chunk-7CIQQOOD.js.map} +2 -2
  31. package/dist/chunks/{chunk-3PKZSIRA.js → chunk-ASOJYFKU.js} +8 -4
  32. package/dist/chunks/chunk-ASOJYFKU.js.map +7 -0
  33. package/dist/chunks/{chunk-PUBHBEYO.js → chunk-B2FIGOPI.js} +2 -2
  34. package/dist/chunks/{chunk-ZFWICFNJ.js → chunk-DGUXJSYA.js} +41 -17
  35. package/dist/chunks/chunk-DGUXJSYA.js.map +7 -0
  36. package/dist/chunks/{chunk-WGMCNCP6.js → chunk-F3D7GTBK.js} +228 -90
  37. package/dist/chunks/chunk-F3D7GTBK.js.map +7 -0
  38. package/dist/chunks/{chunk-X7QETPBC.js → chunk-F6GIK5GO.js} +8 -8
  39. package/dist/chunks/{chunk-LKYLD5SN.js → chunk-FMEOJJ6Y.js} +3 -2
  40. package/dist/chunks/chunk-FMEOJJ6Y.js.map +7 -0
  41. package/dist/chunks/{chunk-4PBW54I2.js → chunk-GGQ43B7T.js} +3 -3
  42. package/dist/chunks/{chunk-MSDL7U6Q.js → chunk-JSHIS7GO.js} +2 -2
  43. package/dist/chunks/{chunk-VNWQIGQL.js → chunk-JWERGULW.js} +421 -254
  44. package/dist/chunks/chunk-JWERGULW.js.map +7 -0
  45. package/dist/chunks/{chunk-HRDMBGMY.js → chunk-K4VRQ7WZ.js} +4 -4
  46. package/dist/chunks/{chunk-5BOTHX47.js → chunk-LP5EVMBB.js} +157 -4
  47. package/dist/chunks/chunk-LP5EVMBB.js.map +7 -0
  48. package/dist/chunks/{chunk-4KX6BIPL.js → chunk-LRSZFYUC.js} +2 -2
  49. package/dist/chunks/chunk-LRSZFYUC.js.map +7 -0
  50. package/dist/chunks/{chunk-56NMRVTV.js → chunk-MGFSQXAJ.js} +23 -23
  51. package/dist/chunks/{chunk-56NMRVTV.js.map → chunk-MGFSQXAJ.js.map} +2 -2
  52. package/dist/chunks/{chunk-RWKQ5SRW.js → chunk-MTAFECXB.js} +2 -2
  53. package/dist/chunks/{chunk-UFMYN5TA.js → chunk-MX53BRAC.js} +2 -2
  54. package/dist/chunks/{chunk-7CIES6X2.js → chunk-NGXAEGD2.js} +12 -2
  55. package/dist/chunks/chunk-NGXAEGD2.js.map +7 -0
  56. package/dist/chunks/{chunk-IOGDTIGN.js → chunk-NSV7WTCT.js} +3 -3
  57. package/dist/chunks/{chunk-IOGDTIGN.js.map → chunk-NSV7WTCT.js.map} +1 -1
  58. package/dist/chunks/{chunk-3VK6UGAN.js → chunk-O5SHIUIL.js} +6 -1
  59. package/dist/chunks/chunk-O5SHIUIL.js.map +7 -0
  60. package/dist/chunks/{chunk-4WKD3YM3.js → chunk-OILZ4PDY.js} +3 -3
  61. package/dist/chunks/{chunk-H57KPL3V.js → chunk-S2JWFXW5.js} +2 -2
  62. package/dist/chunks/{chunk-HFDJWLMS.js → chunk-SOEUGSY4.js} +2 -2
  63. package/dist/chunks/{chunk-YHFWMAQ5.js → chunk-TEMKDJJY.js} +151 -52
  64. package/dist/chunks/chunk-TEMKDJJY.js.map +7 -0
  65. package/dist/chunks/{chunk-KIFOEBYJ.js → chunk-VEXCD3RA.js} +2 -2
  66. package/dist/chunks/{chunk-GS67KDMV.js → chunk-VN7AE3EY.js} +2 -2
  67. package/dist/chunks/{chunk-MPMEK3IQ.js → chunk-WYLBWFAO.js} +2 -2
  68. package/dist/chunks/{chunk-6GWDGTHC.js → chunk-YLO62DWD.js} +4 -4
  69. package/dist/chunks/{chunk-4BYS4ZLY.js → chunk-YN4K3FNB.js} +5 -5
  70. package/dist/chunks/{chunk-OJ4HAALD.js → chunk-YO5UIWDY.js} +3 -3
  71. package/dist/chunks/{chunk-7N7IC3Z2.js → chunk-ZCXW3GR7.js} +2 -2
  72. package/dist/chunks/{chunk-36XQFTEN.js → chunk-ZY375C2U.js} +2 -2
  73. package/dist/commands/fabric-handler.js +2 -2
  74. package/dist/commands/fabric-handler.js.map +1 -1
  75. package/dist/commands/fabric.d.ts.map +1 -1
  76. package/dist/compaction/claim-events.js +8 -8
  77. package/dist/compaction/hook.js +6 -6
  78. package/dist/compaction/owner.js +7 -7
  79. package/dist/compaction/threshold.d.ts.map +1 -1
  80. package/dist/components/configuration.js +3 -3
  81. package/dist/config.d.ts +1 -1
  82. package/dist/config.d.ts.map +1 -1
  83. package/dist/core/action-registry.d.ts +1 -1
  84. package/dist/core/action-registry.d.ts.map +1 -1
  85. package/dist/core/action-registry.js +8 -8
  86. package/dist/core/attached-monitors.d.ts +39 -0
  87. package/dist/core/attached-monitors.d.ts.map +1 -0
  88. package/dist/core/call-presentation.d.ts +14 -0
  89. package/dist/core/call-presentation.d.ts.map +1 -0
  90. package/dist/core/execution-guidelines.d.ts +6 -0
  91. package/dist/core/execution-guidelines.d.ts.map +1 -0
  92. package/dist/core/guidance-delivery.d.ts +19 -0
  93. package/dist/core/guidance-delivery.d.ts.map +1 -0
  94. package/dist/core/observation-actions.d.ts +9 -0
  95. package/dist/core/observation-actions.d.ts.map +1 -0
  96. package/dist/core/prompt-guidance.d.ts +1 -0
  97. package/dist/core/prompt-guidance.d.ts.map +1 -1
  98. package/dist/core/prompt-guidance.js +50 -1
  99. package/dist/core/prompt-guidance.js.map +3 -3
  100. package/dist/core/provider-operations.js +1 -1
  101. package/dist/core/shell-inbox.d.ts +1 -1
  102. package/dist/core/shell-inbox.d.ts.map +1 -1
  103. package/dist/core/shell-jobs.d.ts +17 -1
  104. package/dist/core/shell-jobs.d.ts.map +1 -1
  105. package/dist/core/shell-monitor.d.ts +1 -0
  106. package/dist/core/shell-monitor.d.ts.map +1 -1
  107. package/dist/durable/agent.d.ts.map +1 -1
  108. package/dist/durable/worker-host.js +1 -1
  109. package/dist/durable-extension.d.ts +2 -2
  110. package/dist/durable-extension.d.ts.map +1 -1
  111. package/dist/durable-extension.js +215 -1
  112. package/dist/durable-extension.js.map +3 -3
  113. package/dist/durable-host.js +1 -1
  114. package/dist/durable.d.ts.map +1 -1
  115. package/dist/durable.js +5 -4
  116. package/dist/durable.js.map +2 -2
  117. package/dist/entropy/index.js +9 -9
  118. package/dist/extension-bootstrap.d.ts.map +1 -1
  119. package/dist/extension-bootstrap.js +12 -12
  120. package/dist/extension.d.ts.map +1 -1
  121. package/dist/fabric-exec-tool.d.ts.map +1 -1
  122. package/dist/fabric-runtime-state.d.ts.map +1 -1
  123. package/dist/fabric-runtime-state.js +410 -230
  124. package/dist/fabric-runtime-state.js.map +4 -4
  125. package/dist/feedback.d.ts +5 -0
  126. package/dist/feedback.d.ts.map +1 -0
  127. package/dist/index.js +21 -21
  128. package/dist/jev/client.js +2 -2
  129. package/dist/jev/observation.js +5 -5
  130. package/dist/jev.js +10 -10
  131. package/dist/main-agent.d.ts +2 -1
  132. package/dist/main-agent.d.ts.map +1 -1
  133. package/dist/memory/discovery.js +6 -6
  134. package/dist/memory/file-worker.js +8 -8
  135. package/dist/memory/normalize.js +5 -5
  136. package/dist/memory/search.js +6 -6
  137. package/dist/memory/worker-provider.js +9 -9
  138. package/dist/memory.js +9 -9
  139. package/dist/providers/agents-actions.d.ts.map +1 -1
  140. package/dist/providers/agents-message-router.d.ts.map +1 -1
  141. package/dist/providers/agents-provider.d.ts +2 -0
  142. package/dist/providers/agents-provider.d.ts.map +1 -1
  143. package/dist/providers/jev-provider.js +10 -10
  144. package/dist/providers/memory-provider.js +8 -8
  145. package/dist/providers/tasks-provider.d.ts +3 -1
  146. package/dist/providers/tasks-provider.d.ts.map +1 -1
  147. package/dist/residency/host.js +9 -9
  148. package/dist/residency/pi-entry.js +9 -9
  149. package/dist/runtime/core-override-guest-types.js +2 -2
  150. package/dist/runtime/cpython-runtime.js +1 -1
  151. package/dist/runtime/guest-types.d.ts +1 -1
  152. package/dist/runtime/guest-types.d.ts.map +1 -1
  153. package/dist/runtime/guest-types.js +1 -1
  154. package/dist/runtime/monty-runtime.js +2 -2
  155. package/dist/runtime/node-process-runtime.js +3 -3
  156. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  157. package/dist/runtime/quickjs-runtime.js +2 -2
  158. package/dist/runtime/typescript-kernel.js +5 -5
  159. package/dist/runtime-state-builtins.d.ts +2 -0
  160. package/dist/runtime-state-builtins.d.ts.map +1 -1
  161. package/dist/topology/participant-directory.d.ts.map +1 -1
  162. package/dist/topology/peer-presence.d.ts.map +1 -1
  163. package/dist/topology/provider-participants.d.ts +1 -0
  164. package/dist/topology/provider-participants.d.ts.map +1 -1
  165. package/dist/type-error-guidance.js +1 -1
  166. package/dist/ui/code-preview-shell.d.ts +1 -0
  167. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  168. package/dist/ui/dashboard-model.d.ts.map +1 -1
  169. package/dist/ui/dashboard.js +8 -5
  170. package/dist/ui/dashboard.js.map +2 -2
  171. package/dist/ui/fabric-render.d.ts +1 -0
  172. package/dist/ui/fabric-render.d.ts.map +1 -1
  173. package/dist/ui/settings-values.d.ts +1 -1
  174. package/dist/ui/settings-values.d.ts.map +1 -1
  175. package/dist/ui/settings.js +3 -3
  176. package/dist/ui/settings.js.map +2 -2
  177. package/dist/ui/shell-tasks.d.ts.map +1 -1
  178. package/dist/ui/shell-tasks.js +20 -4
  179. package/dist/ui/shell-tasks.js.map +2 -2
  180. package/dist/ui/widget.d.ts +8 -4
  181. package/dist/ui/widget.d.ts.map +1 -1
  182. package/dist/verified/generated/manifest.json +12 -3
  183. package/dist/verified/generated/prompt-guidance.d.ts +4 -0
  184. package/dist/verified/generated/prompt-guidance.js +17 -0
  185. package/docs/agents.md +26 -6
  186. package/docs/background-tasks.md +98 -14
  187. package/docs/configuration.md +2 -0
  188. package/docs/interface.md +3 -1
  189. package/docs/jev.md +1 -1
  190. package/docs/verified-kernels.md +23 -0
  191. package/package.json +9 -9
  192. package/proofs/index.ts +2 -0
  193. package/proofs/prompt-guidance.ts +38 -0
  194. package/scripts/verified-kernels.ts +1 -1
  195. package/skillsets/python/fabric-council/SKILL.md +25 -14
  196. package/skillsets/typescript/fabric-council/SKILL.md +24 -15
  197. package/skillsets/typescript/fabric-exec/references/agents.md +5 -5
  198. package/dist/chunks/chunk-3PKZSIRA.js.map +0 -7
  199. package/dist/chunks/chunk-3VK6UGAN.js.map +0 -7
  200. package/dist/chunks/chunk-4KX6BIPL.js.map +0 -7
  201. package/dist/chunks/chunk-5BOTHX47.js.map +0 -7
  202. package/dist/chunks/chunk-7CIES6X2.js.map +0 -7
  203. package/dist/chunks/chunk-LKYLD5SN.js.map +0 -7
  204. package/dist/chunks/chunk-VNWQIGQL.js.map +0 -7
  205. package/dist/chunks/chunk-WGMCNCP6.js.map +0 -7
  206. package/dist/chunks/chunk-WWTGWGH7.js.map +0 -7
  207. package/dist/chunks/chunk-YHFWMAQ5.js.map +0 -7
  208. package/dist/chunks/chunk-ZFWICFNJ.js.map +0 -7
  209. /package/dist/chunks/{chunk-HSEZPCL5.js.map → chunk-2OC4YJOL.js.map} +0 -0
  210. /package/dist/chunks/{chunk-TXCNZCZP.js.map → chunk-2QJ4MNS6.js.map} +0 -0
  211. /package/dist/chunks/{chunk-QOEOKW2X.js.map → chunk-3QH6JAE3.js.map} +0 -0
  212. /package/dist/chunks/{chunk-3XT5WHSG.js.map → chunk-4Y5KEJP4.js.map} +0 -0
  213. /package/dist/chunks/{chunk-RAA3FAYZ.js.map → chunk-5PSEJOJB.js.map} +0 -0
  214. /package/dist/chunks/{chunk-XFOSUGLU.js.map → chunk-66UTGL7T.js.map} +0 -0
  215. /package/dist/chunks/{chunk-PUBHBEYO.js.map → chunk-B2FIGOPI.js.map} +0 -0
  216. /package/dist/chunks/{chunk-X7QETPBC.js.map → chunk-F6GIK5GO.js.map} +0 -0
  217. /package/dist/chunks/{chunk-4PBW54I2.js.map → chunk-GGQ43B7T.js.map} +0 -0
  218. /package/dist/chunks/{chunk-MSDL7U6Q.js.map → chunk-JSHIS7GO.js.map} +0 -0
  219. /package/dist/chunks/{chunk-HRDMBGMY.js.map → chunk-K4VRQ7WZ.js.map} +0 -0
  220. /package/dist/chunks/{chunk-RWKQ5SRW.js.map → chunk-MTAFECXB.js.map} +0 -0
  221. /package/dist/chunks/{chunk-UFMYN5TA.js.map → chunk-MX53BRAC.js.map} +0 -0
  222. /package/dist/chunks/{chunk-4WKD3YM3.js.map → chunk-OILZ4PDY.js.map} +0 -0
  223. /package/dist/chunks/{chunk-H57KPL3V.js.map → chunk-S2JWFXW5.js.map} +0 -0
  224. /package/dist/chunks/{chunk-HFDJWLMS.js.map → chunk-SOEUGSY4.js.map} +0 -0
  225. /package/dist/chunks/{chunk-KIFOEBYJ.js.map → chunk-VEXCD3RA.js.map} +0 -0
  226. /package/dist/chunks/{chunk-GS67KDMV.js.map → chunk-VN7AE3EY.js.map} +0 -0
  227. /package/dist/chunks/{chunk-MPMEK3IQ.js.map → chunk-WYLBWFAO.js.map} +0 -0
  228. /package/dist/chunks/{chunk-6GWDGTHC.js.map → chunk-YLO62DWD.js.map} +0 -0
  229. /package/dist/chunks/{chunk-4BYS4ZLY.js.map → chunk-YN4K3FNB.js.map} +0 -0
  230. /package/dist/chunks/{chunk-OJ4HAALD.js.map → chunk-YO5UIWDY.js.map} +0 -0
  231. /package/dist/chunks/{chunk-7N7IC3Z2.js.map → chunk-ZCXW3GR7.js.map} +0 -0
  232. /package/dist/chunks/{chunk-36XQFTEN.js.map → chunk-ZY375C2U.js.map} +0 -0
@@ -34,7 +34,7 @@ import {
34
34
  import {
35
35
  compileFabricSummary,
36
36
  rawContextTokens
37
- } from "./chunk-3XT5WHSG.js";
37
+ } from "./chunk-4Y5KEJP4.js";
38
38
  import {
39
39
  launchScope,
40
40
  normalizeScope,
@@ -56,7 +56,7 @@ import {
56
56
  DEFAULT_FABRIC_CONFIG,
57
57
  MAX_AGENT_TIMEOUT_MS,
58
58
  MIN_AGENT_TIMEOUT_MS
59
- } from "./chunk-4KX6BIPL.js";
59
+ } from "./chunk-LRSZFYUC.js";
60
60
  import {
61
61
  readJsonlPage
62
62
  } from "./chunk-CGPK5WHX.js";
@@ -304,10 +304,10 @@ function appendBudgetLedger(file, entry) {
304
304
  }
305
305
 
306
306
  // src/agents/manager.ts
307
- import { randomUUID as randomUUID4 } from "node:crypto";
308
- import fs12 from "node:fs";
307
+ import { randomUUID as randomUUID6 } from "node:crypto";
308
+ import fs13 from "node:fs";
309
309
  import os3 from "node:os";
310
- import path13 from "node:path";
310
+ import path14 from "node:path";
311
311
  import { fileURLToPath } from "node:url";
312
312
 
313
313
  // src/agents/hosted-run.ts
@@ -971,6 +971,11 @@ var adoptedWorkerHandle = (pid, id, probes = {}) => ({
971
971
  }
972
972
  });
973
973
 
974
+ // src/agents/transports/herdr-core-transport.ts
975
+ import { randomUUID as randomUUID4 } from "node:crypto";
976
+ import path5 from "node:path";
977
+ import fs5 from "node:fs/promises";
978
+
974
979
  // src/agents/constants.ts
975
980
  var AGENT_STATUS_POLL_INTERVAL_MS = 250;
976
981
  var EXTERNAL_TRANSPORT_LIVENESS_POLL_INTERVAL_MS = 2e3;
@@ -979,6 +984,162 @@ var AGENT_STARTUP_RETRY_BASE_DELAY_MS = 500;
979
984
  var AGENT_RESUME_MAX_ATTEMPTS = 3;
980
985
  var AGENT_RESUME_RETRY_BASE_DELAY_MS = 1e3;
981
986
 
987
+ // src/agents/transports/herdr-core-socket.ts
988
+ import net from "node:net";
989
+ import { randomUUID as randomUUID3 } from "node:crypto";
990
+ var HerdrCoreRpcError = class extends Error {
991
+ constructor(code, message2, kind) {
992
+ super(`Herdr Core API: ${code}: ${message2}`);
993
+ this.code = code;
994
+ this.kind = kind;
995
+ this.name = "HerdrCoreRpcError";
996
+ }
997
+ };
998
+ var herdrCoreEndpoint = (socket, platform = process.platform) => platform === "win32" && !socket.startsWith("\\\\.\\pipe\\") ? `\\\\.\\pipe\\${socket}` : socket;
999
+ var herdrCoreSocketRequest = (socketPath, method, params, options = {}) => new Promise((resolve, reject) => {
1000
+ const id = `pi-fabric:${randomUUID3()}`;
1001
+ const socket = net.createConnection(herdrCoreEndpoint(socketPath));
1002
+ const chunks = [];
1003
+ let bytes = 0;
1004
+ let settled = false;
1005
+ const finish = (error, result) => {
1006
+ if (settled) return;
1007
+ settled = true;
1008
+ clearTimeout(timer);
1009
+ socket.destroy();
1010
+ if (error) reject(error);
1011
+ else resolve(result);
1012
+ };
1013
+ const timer = setTimeout(() => finish(new Error("Herdr Core API request timed out")), options.timeoutMs ?? 5e3);
1014
+ timer.unref?.();
1015
+ socket.on("connect", () => socket.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
1016
+ `));
1017
+ socket.on("data", (chunk) => {
1018
+ const newline = chunk.indexOf(10);
1019
+ const captured = newline < 0 ? chunk : chunk.subarray(0, newline);
1020
+ bytes += captured.length;
1021
+ if (bytes > (options.maxResponseBytes ?? 1024 * 1024)) {
1022
+ finish(new Error("Herdr Core API response exceeds byte limit"));
1023
+ return;
1024
+ }
1025
+ chunks.push(captured);
1026
+ if (newline < 0) return;
1027
+ try {
1028
+ const value = JSON.parse(Buffer.concat(chunks).toString("utf8"));
1029
+ if (!value || value.jsonrpc !== "2.0" || value.id !== id || Object.hasOwn(value, "result") === Object.hasOwn(value, "error")) {
1030
+ throw new Error("uncorrelated or invalid JSON-RPC envelope");
1031
+ }
1032
+ if (Object.hasOwn(value, "error")) {
1033
+ const error = value.error;
1034
+ if (!error || !Number.isInteger(error.code) || typeof error.message !== "string") {
1035
+ throw new Error("invalid JSON-RPC error");
1036
+ }
1037
+ finish(new HerdrCoreRpcError(
1038
+ error.code,
1039
+ error.message,
1040
+ typeof error.data?.kind === "string" ? error.data.kind : void 0
1041
+ ));
1042
+ } else finish(void 0, value.result);
1043
+ } catch (error) {
1044
+ finish(new Error(`Invalid Herdr Core API response: ${error instanceof Error ? error.message : String(error)}`));
1045
+ }
1046
+ });
1047
+ socket.on("error", (error) => finish(error));
1048
+ socket.on("end", () => finish(new Error("Herdr Core API closed without a complete response")));
1049
+ socket.on("close", () => finish(new Error("Herdr Core API socket closed")));
1050
+ });
1051
+
1052
+ // src/agents/transports/herdr-core-transport.ts
1053
+ var missing = (error) => error instanceof HerdrCoreRpcError && error.kind === "not_found";
1054
+ var terminal = (value) => {
1055
+ const result = value;
1056
+ if (!result || typeof result.address !== "string" || !/^t[0-9a-z]+$/.test(result.address) || result.state !== "live" && result.state !== "finished") {
1057
+ throw new Error("Herdr Core returned an invalid terminal");
1058
+ }
1059
+ return { address: result.address, state: result.state };
1060
+ };
1061
+ var HerdrCoreTransport = class {
1062
+ constructor(environment = process.env) {
1063
+ this.environment = environment;
1064
+ }
1065
+ kind = "herdr-core";
1066
+ async available() {
1067
+ if (!this.environment.HC_TERMINAL_ID || !this.environment.HC_TERMINAL_SOCKET) return false;
1068
+ try {
1069
+ const hello = await this.#request("hello", { generation: 1, framed: false });
1070
+ return hello?.generation === 1 && hello.framed === false && Array.isArray(hello.methods) && ["terminal.run", "terminal.get", "terminal.kill"].every((method) => hello.methods.includes(method));
1071
+ } catch {
1072
+ return false;
1073
+ }
1074
+ }
1075
+ async launch(request) {
1076
+ const caller = this.environment.HC_TERMINAL_ID;
1077
+ if (!caller) throw new Error("Herdr Core transport requires HC_TERMINAL_ID");
1078
+ const argv = await scriptSpawnArgs(request.workerPath, request.workerArguments);
1079
+ if (!path5.isAbsolute(argv[0])) {
1080
+ const names = process.platform === "win32" && !path5.extname(argv[0]) ? [argv[0], ...(this.environment.PATHEXT ?? ".EXE;.CMD;.BAT").split(";").map((ext) => argv[0] + ext)] : [argv[0]];
1081
+ let resolved;
1082
+ for (const directory of (this.environment.PATH ?? "").split(path5.delimiter).filter(Boolean)) {
1083
+ for (const name of names) {
1084
+ const candidate = path5.resolve(directory.replace(/^"|"$/g, ""), name);
1085
+ try {
1086
+ if ((await fs5.stat(candidate)).isFile()) {
1087
+ await fs5.access(candidate, process.platform === "win32" ? fs5.constants.F_OK : fs5.constants.X_OK);
1088
+ resolved = candidate;
1089
+ break;
1090
+ }
1091
+ } catch {
1092
+ }
1093
+ }
1094
+ if (resolved) break;
1095
+ }
1096
+ if (!resolved) throw new Error("Herdr Core could not resolve an absolute worker runtime");
1097
+ argv[0] = resolved;
1098
+ }
1099
+ const prefix = request.name.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").slice(0, 7) || "agent";
1100
+ const child = terminal(await this.#request("terminal.run", {
1101
+ argv,
1102
+ cwd: request.cwd,
1103
+ name: `${prefix}-${randomUUID4().replaceAll("-", "").slice(0, 24)}`,
1104
+ caller,
1105
+ parent: caller,
1106
+ no_notify: true,
1107
+ wait: false,
1108
+ keep: false,
1109
+ outlive_parent: false
1110
+ }));
1111
+ const params = { terminal: child.address, caller };
1112
+ return {
1113
+ kind: this.kind,
1114
+ sessionId: child.address,
1115
+ attachCommand: `hc attach ${child.address}`,
1116
+ livenessPollIntervalMs: EXTERNAL_TRANSPORT_LIVENESS_POLL_INTERVAL_MS,
1117
+ isAlive: async () => {
1118
+ try {
1119
+ const current = terminal(await this.#request("terminal.get", params));
1120
+ if (current.address !== child.address) throw new Error("Herdr Core terminal address changed");
1121
+ return current.state === "live";
1122
+ } catch (error) {
1123
+ if (missing(error)) return false;
1124
+ throw error;
1125
+ }
1126
+ },
1127
+ stop: async () => {
1128
+ try {
1129
+ await this.#request("terminal.kill", params);
1130
+ } catch (error) {
1131
+ if (!missing(error)) throw error;
1132
+ }
1133
+ }
1134
+ };
1135
+ }
1136
+ #request(method, params) {
1137
+ const socket = this.environment.HC_TERMINAL_SOCKET;
1138
+ if (!socket) return Promise.reject(new Error("Herdr Core transport requires HC_TERMINAL_SOCKET"));
1139
+ return herdrCoreSocketRequest(socket, method, params);
1140
+ }
1141
+ };
1142
+
982
1143
  // src/agents/transports/herdr-transport.ts
983
1144
  var HerdrTransport = class {
984
1145
  constructor(environment = process.env) {
@@ -1201,16 +1362,16 @@ var TmuxTransport = class {
1201
1362
  };
1202
1363
 
1203
1364
  // src/agents/worktree-manager.ts
1204
- import fs8 from "node:fs";
1205
- import path8 from "node:path";
1365
+ import fs9 from "node:fs";
1366
+ import path9 from "node:path";
1206
1367
 
1207
1368
  // src/agents/clone-first-worktree.ts
1208
- import fs7 from "node:fs";
1209
- import path7 from "node:path";
1369
+ import fs8 from "node:fs";
1370
+ import path8 from "node:path";
1210
1371
 
1211
1372
  // src/agents/cow-clone.ts
1212
- import fs5 from "node:fs";
1213
- import path5 from "node:path";
1373
+ import fs6 from "node:fs";
1374
+ import path6 from "node:path";
1214
1375
  var CLONE_SKIP_PREFIXES = [".git", ".pi/fabric/worktrees"];
1215
1376
  var CowUnavailableError = class extends Error {
1216
1377
  constructor(message2, options) {
@@ -1226,11 +1387,11 @@ var isCowUnavailable = (error) => {
1226
1387
  };
1227
1388
  var cloneEntry = async (from, to) => {
1228
1389
  try {
1229
- await fs5.promises.cp(from, to, {
1390
+ await fs6.promises.cp(from, to, {
1230
1391
  recursive: true,
1231
1392
  verbatimSymlinks: true,
1232
1393
  force: false,
1233
- mode: fs5.constants.COPYFILE_FICLONE_FORCE
1394
+ mode: fs6.constants.COPYFILE_FICLONE_FORCE
1234
1395
  });
1235
1396
  } catch (error) {
1236
1397
  if (isCowUnavailable(error)) {
@@ -1250,13 +1411,13 @@ var hasNestedSkip = (rel, prefixes) => {
1250
1411
  return prefixes.some((prefix) => prefix.startsWith(`${value}/`));
1251
1412
  };
1252
1413
  var cloneLevel = async (source, dest, relBase, prefixes) => {
1253
- await fs5.promises.mkdir(dest, { recursive: true });
1254
- const entries = await fs5.promises.readdir(source, { withFileTypes: true });
1414
+ await fs6.promises.mkdir(dest, { recursive: true });
1415
+ const entries = await fs6.promises.readdir(source, { withFileTypes: true });
1255
1416
  for (const entry of entries) {
1256
1417
  const rel = relBase ? `${relBase}/${entry.name}` : entry.name;
1257
1418
  if (skipped(rel, prefixes)) continue;
1258
- const from = path5.join(source, entry.name);
1259
- const to = path5.join(dest, entry.name);
1419
+ const from = path6.join(source, entry.name);
1420
+ const to = path6.join(dest, entry.name);
1260
1421
  if (entry.isDirectory() && !entry.isSymbolicLink() && hasNestedSkip(rel, prefixes)) {
1261
1422
  await cloneLevel(from, to, rel, prefixes);
1262
1423
  continue;
@@ -1266,20 +1427,20 @@ var cloneLevel = async (source, dest, relBase, prefixes) => {
1266
1427
  }
1267
1428
  };
1268
1429
  var cloneTree = async (source, dest, prefixes = CLONE_SKIP_PREFIXES) => {
1269
- await fs5.promises.mkdir(dest, { recursive: true });
1270
- const [realSource, realDest] = await Promise.all([fs5.promises.realpath(source), fs5.promises.realpath(dest)]);
1271
- const relativeDest = path5.relative(realSource, realDest);
1430
+ await fs6.promises.mkdir(dest, { recursive: true });
1431
+ const [realSource, realDest] = await Promise.all([fs6.promises.realpath(source), fs6.promises.realpath(dest)]);
1432
+ const relativeDest = path6.relative(realSource, realDest);
1272
1433
  if (!relativeDest) throw new Error("Cannot clone a tree into itself");
1273
- const inside = relativeDest !== ".." && !relativeDest.startsWith(`..${path5.sep}`) && !path5.isAbsolute(relativeDest);
1434
+ const inside = relativeDest !== ".." && !relativeDest.startsWith(`..${path6.sep}`) && !path6.isAbsolute(relativeDest);
1274
1435
  await cloneLevel(realSource, realDest, "", inside ? [...prefixes, posixRel(relativeDest)] : prefixes);
1275
1436
  };
1276
1437
 
1277
1438
  // src/agents/worktree-paths.ts
1278
- import fs6 from "node:fs";
1279
- import path6 from "node:path";
1439
+ import fs7 from "node:fs";
1440
+ import path7 from "node:path";
1280
1441
  var FABRIC_WORKTREE_SEGMENTS = [".pi", "fabric", "worktrees"];
1281
1442
  var FABRIC_WORKTREE_EXCLUDE = ".pi/fabric/worktrees/";
1282
- var fabricWorktreePath = (gitRoot, id) => path6.join(gitRoot, ...FABRIC_WORKTREE_SEGMENTS, id);
1443
+ var fabricWorktreePath = (gitRoot, id) => path7.join(gitRoot, ...FABRIC_WORKTREE_SEGMENTS, id);
1283
1444
  var isFabricWorktreePath = (worktree, id) => {
1284
1445
  const parts = worktree.split(/[\\/]/).filter(Boolean);
1285
1446
  return parts.length >= 4 && parts.at(-1) === id && parts.at(-2) === "worktrees" && parts.at(-3) === "fabric" && parts.at(-4) === ".pi";
@@ -1289,11 +1450,11 @@ var ensureWorktreeExclude = async (gitRoot) => {
1289
1450
  cwd: gitRoot,
1290
1451
  timeoutMs: 1e4
1291
1452
  });
1292
- const excludePath = path6.resolve(gitRoot, located.stdout.trim());
1293
- fs6.mkdirSync(path6.dirname(excludePath), { recursive: true });
1453
+ const excludePath = path7.resolve(gitRoot, located.stdout.trim());
1454
+ fs7.mkdirSync(path7.dirname(excludePath), { recursive: true });
1294
1455
  let current = "";
1295
1456
  try {
1296
- current = fs6.readFileSync(excludePath, "utf8");
1457
+ current = fs7.readFileSync(excludePath, "utf8");
1297
1458
  } catch (error) {
1298
1459
  const code = error instanceof Error && "code" in error ? error.code : void 0;
1299
1460
  if (code !== "ENOENT") throw error;
@@ -1301,7 +1462,7 @@ var ensureWorktreeExclude = async (gitRoot) => {
1301
1462
  const lines = current.split(/\r?\n/);
1302
1463
  if (lines.some((line) => line.trim() === FABRIC_WORKTREE_EXCLUDE)) return;
1303
1464
  const prefix = current.length === 0 || current.endsWith("\n") ? "" : "\n";
1304
- fs6.appendFileSync(excludePath, `${prefix}${FABRIC_WORKTREE_EXCLUDE}
1465
+ fs7.appendFileSync(excludePath, `${prefix}${FABRIC_WORKTREE_EXCLUDE}
1305
1466
  `);
1306
1467
  };
1307
1468
 
@@ -1312,10 +1473,10 @@ var worktreeRollbackError = (gitRoot, worktree, branch, error, cleanupError) =>
1312
1473
  };
1313
1474
  var addCloneFirstWorktree = async (options) => {
1314
1475
  const dest = options.dest;
1315
- if (isFabricWorktreePath(dest, path7.basename(dest))) {
1476
+ if (isFabricWorktreePath(dest, path8.basename(dest))) {
1316
1477
  await ensureWorktreeExclude(options.gitRoot);
1317
1478
  }
1318
- fs7.mkdirSync(path7.dirname(dest), { recursive: true });
1479
+ fs8.mkdirSync(path8.dirname(dest), { recursive: true });
1319
1480
  const args = ["worktree", "add", "--no-checkout"];
1320
1481
  if (options.quiet) args.push("-q");
1321
1482
  if (options.detach) args.push("--detach");
@@ -1349,7 +1510,7 @@ var removeWorktree = async (gitRoot, worktree, branch) => {
1349
1510
  try {
1350
1511
  await executeFile("git", ["worktree", "remove", "--force", worktree], { cwd: gitRoot, timeoutMs: 6e4 });
1351
1512
  } catch (error) {
1352
- if (fs7.existsSync(worktree)) failure = error;
1513
+ if (fs8.existsSync(worktree)) failure = error;
1353
1514
  else await executeFile("git", ["worktree", "prune"], { cwd: gitRoot, timeoutMs: 3e4 }).catch(() => void 0);
1354
1515
  }
1355
1516
  if (branch) {
@@ -1373,9 +1534,9 @@ var SETUP_TIMEOUT_MS = 10 * 6e4;
1373
1534
  var SETUP_OUTPUT_TAIL_CHARS = 2e3;
1374
1535
  var countLines = (file) => {
1375
1536
  try {
1376
- const stat = fs8.statSync(file);
1537
+ const stat = fs9.statSync(file);
1377
1538
  if (!stat.isFile() || stat.size > MAX_COUNTED_BYTES) return 0;
1378
- const content = fs8.readFileSync(file);
1539
+ const content = fs9.readFileSync(file);
1379
1540
  if (content.length === 0 || content.includes(0)) return 0;
1380
1541
  let lines = 0;
1381
1542
  for (const byte of content) if (byte === 10) lines++;
@@ -1386,8 +1547,8 @@ var countLines = (file) => {
1386
1547
  };
1387
1548
  var safeLabel = (value) => value.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 30) || "agent";
1388
1549
  var isInside2 = (root, target) => {
1389
- const relative = path8.relative(root, target);
1390
- return relative === "" || relative !== ".." && !relative.startsWith(`..${path8.sep}`) && !path8.isAbsolute(relative);
1550
+ const relative = path9.relative(root, target);
1551
+ return relative === "" || relative !== ".." && !relative.startsWith(`..${path9.sep}`) && !path9.isAbsolute(relative);
1391
1552
  };
1392
1553
  var worktreePrefixParts = (prefix) => {
1393
1554
  const parts = prefix.split(/[\\/]+/).filter(Boolean);
@@ -1405,7 +1566,7 @@ var WorktreeManager = class {
1405
1566
  ]);
1406
1567
  const output = root.stdout.trim();
1407
1568
  if (!output) throw new Error("Git did not return a worktree root");
1408
- gitRoot = fs8.realpathSync(output);
1569
+ gitRoot = fs9.realpathSync(output);
1409
1570
  sourcePrefix = prefix2.stdout.trim();
1410
1571
  } catch (error) {
1411
1572
  const failure = error;
@@ -1422,7 +1583,7 @@ var WorktreeManager = class {
1422
1583
  });
1423
1584
  let canonicalWorktreePath;
1424
1585
  try {
1425
- canonicalWorktreePath = fs8.realpathSync(worktreePath);
1586
+ canonicalWorktreePath = fs9.realpathSync(worktreePath);
1426
1587
  } catch (error) {
1427
1588
  try {
1428
1589
  await removeWorktree(gitRoot, worktreePath, branch);
@@ -1435,10 +1596,10 @@ var WorktreeManager = class {
1435
1596
  const prefix = preserveSourceSubdirectory ? worktreePrefixParts(sourcePrefix) : void 0;
1436
1597
  let effectiveCwd = canonicalWorktreePath;
1437
1598
  if (prefix && prefix.length > 0) {
1438
- const candidate = path8.resolve(canonicalWorktreePath, ...prefix);
1599
+ const candidate = path9.resolve(canonicalWorktreePath, ...prefix);
1439
1600
  try {
1440
- const canonicalCandidate = fs8.realpathSync(candidate);
1441
- if (fs8.statSync(canonicalCandidate).isDirectory() && isInside2(canonicalWorktreePath, canonicalCandidate)) {
1601
+ const canonicalCandidate = fs9.realpathSync(candidate);
1602
+ if (fs9.statSync(canonicalCandidate).isDirectory() && isInside2(canonicalWorktreePath, canonicalCandidate)) {
1442
1603
  effectiveCwd = canonicalCandidate;
1443
1604
  }
1444
1605
  } catch {
@@ -1477,7 +1638,7 @@ ${tail}` : ""}`);
1477
1638
  ...lease.baseRef ? { baseRef: lease.baseRef } : {},
1478
1639
  changedFiles: [],
1479
1640
  diffstat: { files: 0, insertions: 0, deletions: 0 },
1480
- kept: fs8.existsSync(lease.path)
1641
+ kept: fs9.existsSync(lease.path)
1481
1642
  };
1482
1643
  if (!result.kept) return result;
1483
1644
  try {
@@ -1497,7 +1658,7 @@ ${tail}` : ""}`);
1497
1658
  for (const file of untracked.stdout.split("\n")) {
1498
1659
  if (!file || files.has(file)) continue;
1499
1660
  files.add(file);
1500
- if (files.size <= MAX_CHANGED_FILES) result.diffstat.insertions += countLines(path8.join(lease.path, file));
1661
+ if (files.size <= MAX_CHANGED_FILES) result.diffstat.insertions += countLines(path9.join(lease.path, file));
1501
1662
  }
1502
1663
  result.diffstat.files = files.size;
1503
1664
  result.changedFiles = [...files].sort().slice(0, MAX_CHANGED_FILES);
@@ -1516,9 +1677,9 @@ ${tail}` : ""}`);
1516
1677
  };
1517
1678
 
1518
1679
  // src/agents/handoff.ts
1519
- import { randomUUID as randomUUID3 } from "node:crypto";
1520
- import fs9 from "node:fs";
1521
- import path9 from "node:path";
1680
+ import { randomUUID as randomUUID5 } from "node:crypto";
1681
+ import fs10 from "node:fs";
1682
+ import path10 from "node:path";
1522
1683
 
1523
1684
  // src/core/host-sdk-runtime.ts
1524
1685
  var PiCodingAgent = await loadHostSdk();
@@ -1729,8 +1890,8 @@ var materializeBranch = (seed, cwd, directory, options = {}) => {
1729
1890
  if (!seed.sourceBranch) {
1730
1891
  throw new Error("In-memory trajectory handoff is missing its source branch");
1731
1892
  }
1732
- const id = randomUUID3();
1733
- const sessionFile = path9.join(directory, `handoff-${id}.jsonl`);
1893
+ const id = randomUUID5();
1894
+ const sessionFile = path10.join(directory, `handoff-${id}.jsonl`);
1734
1895
  const header = {
1735
1896
  type: "session",
1736
1897
  version: PiCodingAgent.CURRENT_SESSION_VERSION,
@@ -1740,7 +1901,7 @@ var materializeBranch = (seed, cwd, directory, options = {}) => {
1740
1901
  ...seed.sourceSessionFile ? { parentSession: seed.sourceSessionFile } : {}
1741
1902
  };
1742
1903
  const entries = options.workerRole ? withWorkerRoot(seed.sourceBranch) : seed.sourceBranch;
1743
- fs9.writeFileSync(
1904
+ fs10.writeFileSync(
1744
1905
  sessionFile,
1745
1906
  `${[header, ...entries].map((entry) => JSON.stringify(entry)).join("\n")}
1746
1907
  `,
@@ -1749,13 +1910,13 @@ var materializeBranch = (seed, cwd, directory, options = {}) => {
1749
1910
  return PiCodingAgent.SessionManager.open(sessionFile, directory, cwd);
1750
1911
  };
1751
1912
  var insertWorkerRoot = (sessionFile) => {
1752
- if (!fs9.existsSync(sessionFile)) {
1913
+ if (!fs10.existsSync(sessionFile)) {
1753
1914
  throw new Error("Trajectory handoff session file was not written, so the worker role cannot be placed at its root");
1754
1915
  }
1755
- const [headerLine, ...entryLines] = fs9.readFileSync(sessionFile, "utf8").split("\n").filter((line) => line.length > 0);
1916
+ const [headerLine, ...entryLines] = fs10.readFileSync(sessionFile, "utf8").split("\n").filter((line) => line.length > 0);
1756
1917
  const entries = entryLines.map((line) => JSON.parse(line));
1757
1918
  const placed = withWorkerRoot(entries);
1758
- fs9.writeFileSync(
1919
+ fs10.writeFileSync(
1759
1920
  sessionFile,
1760
1921
  `${[headerLine, ...placed.map((entry) => JSON.stringify(entry))].join("\n")}
1761
1922
  `,
@@ -1798,7 +1959,7 @@ var synchronizeSourceSettings = (session, seed) => {
1798
1959
  }
1799
1960
  };
1800
1961
  var writeHandoffSession = (seed, cwd, directory, transfer, compaction, compactionBudget, options = {}) => {
1801
- fs9.mkdirSync(directory, { recursive: true, mode: 448 });
1962
+ fs10.mkdirSync(directory, { recursive: true, mode: 448 });
1802
1963
  const policy = transfer ? thinkingTransferPolicy(transfer) : "preserved";
1803
1964
  let session;
1804
1965
  const viaPiBranch = Boolean(seed.sourceSessionFile) && (!transfer || policy === "preserved");
@@ -1874,11 +2035,11 @@ var writeHandoffSession = (seed, cwd, directory, transfer, compaction, compactio
1874
2035
  const sessionFile = session.getSessionFile();
1875
2036
  if (!sessionFile) throw new Error("Trajectory handoff did not produce a Pi session file");
1876
2037
  if (options.workerRole && viaPiBranch) insertWorkerRoot(sessionFile);
1877
- fs9.chmodSync(sessionFile, 384);
2038
+ fs10.chmodSync(sessionFile, 384);
1878
2039
  return sessionFile;
1879
2040
  };
1880
2041
  var writeForkSession = (seed, cwd, directory, transfer, options = {}) => {
1881
- fs9.mkdirSync(directory, { recursive: true, mode: 448 });
2042
+ fs10.mkdirSync(directory, { recursive: true, mode: 448 });
1882
2043
  const policy = transfer ? thinkingTransferPolicy(transfer) : "preserved";
1883
2044
  const raw = structuredClone(seed.sourceBranch);
1884
2045
  const digest = policy === "stripped" && transfer ? buildThinkingDigest(raw, transfer) : void 0;
@@ -1902,13 +2063,13 @@ var writeForkSession = (seed, cwd, directory, transfer, options = {}) => {
1902
2063
  });
1903
2064
  const sessionFile = session.getSessionFile();
1904
2065
  if (!sessionFile) throw new Error("Branch seed did not produce a Pi session file");
1905
- fs9.chmodSync(sessionFile, 384);
2066
+ fs10.chmodSync(sessionFile, 384);
1906
2067
  return sessionFile;
1907
2068
  };
1908
2069
 
1909
2070
  // src/agents/child-env.ts
1910
- import fs10 from "node:fs";
1911
- import path10 from "node:path";
2071
+ import fs11 from "node:fs";
2072
+ import path11 from "node:path";
1912
2073
  var MAX_WRITABLE_ROOTS = 32;
1913
2074
  var MAX_ROOT_CHARS = 4096;
1914
2075
  var readAgentLineage = (raw = process.env.PI_FABRIC_LINEAGE) => {
@@ -1939,12 +2100,12 @@ var checkWritePolicyRequest = (request) => {
1939
2100
  };
1940
2101
  var nearestExisting = (target) => {
1941
2102
  let current = target;
1942
- while (!fs10.existsSync(current)) {
1943
- const parent = path10.dirname(current);
2103
+ while (!fs11.existsSync(current)) {
2104
+ const parent = path11.dirname(current);
1944
2105
  if (parent === current) break;
1945
2106
  current = parent;
1946
2107
  }
1947
- return path10.join(fs10.realpathSync(current), path10.relative(current, target));
2108
+ return path11.join(fs11.realpathSync(current), path11.relative(current, target));
1948
2109
  };
1949
2110
  var resolveChildWritePolicy = (request, parent, cwd) => {
1950
2111
  if (!requestsWritePolicy(request)) return parent;
@@ -1957,21 +2118,21 @@ var resolveChildWritePolicy = (request, parent, cwd) => {
1957
2118
  throw new Error('A shell-confined agent cannot launch a child with shell: "unconfined"');
1958
2119
  }
1959
2120
  if (readOnly) return { readOnly, writableRoots: [], shell };
1960
- const realCwd = fs10.realpathSync(cwd);
2121
+ const realCwd = fs11.realpathSync(cwd);
1961
2122
  const within = (target) => !parent || parent.writableRoots.some((root) => isInside(root, target));
1962
2123
  const roots = request.writableRoots ?? (parent ? parent.writableRoots : [cwd]);
1963
2124
  const resolved = /* @__PURE__ */ new Set();
1964
2125
  for (const root of roots) {
1965
- const absolute = path10.resolve(cwd, root);
1966
- if (!fs10.existsSync(absolute)) {
2126
+ const absolute = path11.resolve(cwd, root);
2127
+ if (!fs11.existsSync(absolute)) {
1967
2128
  const target = nearestExisting(absolute);
1968
2129
  if (!isInside(cwd, absolute) || !isInside(realCwd, target) || !within(target)) {
1969
2130
  throw new Error(`Writable root must exist or be creatable inside the agent cwd: ${root}`);
1970
2131
  }
1971
- fs10.mkdirSync(absolute, { recursive: true });
2132
+ fs11.mkdirSync(absolute, { recursive: true });
1972
2133
  }
1973
- const real = fs10.realpathSync(absolute);
1974
- if (!fs10.statSync(real).isDirectory()) throw new Error(`Writable root is not a directory: ${root}`);
2134
+ const real = fs11.realpathSync(absolute);
2135
+ if (!fs11.statSync(real).isDirectory()) throw new Error(`Writable root is not a directory: ${root}`);
1975
2136
  if (!within(real)) throw new Error(`Writable root is outside the caller's writable roots: ${root}`);
1976
2137
  resolved.add(real);
1977
2138
  }
@@ -2012,17 +2173,17 @@ var budgetAdmits = (spent, limit) => {
2012
2173
  };
2013
2174
 
2014
2175
  // src/storage/retention.ts
2015
- import fs11 from "node:fs";
2016
- import path11 from "node:path";
2176
+ import fs12 from "node:fs";
2177
+ import path12 from "node:path";
2017
2178
  var RUN_ROOT_OWNER_FILE = ".fabric-owner.json";
2018
2179
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "stopped", "timed_out"]);
2019
2180
  var RUN_ROOT_HEARTBEAT_TTL_MS = 45 * 60 * 1e3;
2020
- var ownerPath = (root) => path11.join(root, RUN_ROOT_OWNER_FILE);
2181
+ var ownerPath = (root) => path12.join(root, RUN_ROOT_OWNER_FILE);
2021
2182
  var readJson = (file) => {
2022
2183
  try {
2023
2184
  const stat = ownedStat(file);
2024
2185
  if (!stat?.isFile() || stat.size > 1024 * 1024) return;
2025
- return JSON.parse(fs11.readFileSync(file, "utf8"));
2186
+ return JSON.parse(fs12.readFileSync(file, "utf8"));
2026
2187
  } catch {
2027
2188
  return;
2028
2189
  }
@@ -2030,9 +2191,9 @@ var readJson = (file) => {
2030
2191
  var time = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
2031
2192
  var validOwner = (owner) => !!owner && Number.isSafeInteger(owner.pid) && owner.pid > 0 && time(owner.startedAt) && time(owner.heartbeatAt) && (owner.closedAt === void 0 || time(owner.closedAt)) && (owner.orphanedAt === void 0 || time(owner.orphanedAt)) && (owner.childrenStopped === void 0 || typeof owner.childrenStopped === "boolean");
2032
2193
  var writeOwner = (root, owner) => {
2033
- if (fs11.existsSync(root) && !ownedStat(root)?.isDirectory()) throw new Error("Unsafe Fabric run root");
2194
+ if (fs12.existsSync(root) && !ownedStat(root)?.isDirectory()) throw new Error("Unsafe Fabric run root");
2034
2195
  const file = ownerPath(root);
2035
- if (fs11.existsSync(file)) {
2196
+ if (fs12.existsSync(file)) {
2036
2197
  const existing = readJson(file);
2037
2198
  if (!validOwner(existing) || existing.pid !== owner.pid) throw new Error("Unsafe Fabric run owner marker");
2038
2199
  }
@@ -2079,21 +2240,21 @@ var DURABLE_KEY = /^(?:initial|[0-9a-f]{64})$/;
2079
2240
  var DURABLE_LEASE_FILES = /* @__PURE__ */ new Set(["lease.sqlite", "lease.sqlite-journal"]);
2080
2241
  var DURABLE_STORE_FILE = /^(?:main|(?:doc|task)-(?:0|[1-9]\d*))\.jsonl(?:\.reclaim)?$/;
2081
2242
  var FABRIC_JOURNAL_FILE = /^[0-9a-f]{32}\.jsonl$/;
2082
- var onlyOwnedFiles = (directory, allowed) => fs11.readdirSync(directory).every((name) => allowed(name) && ownedStat(path11.join(directory, name))?.isFile() === true);
2243
+ var onlyOwnedFiles = (directory, allowed) => fs12.readdirSync(directory).every((name) => allowed(name) && ownedStat(path12.join(directory, name))?.isFile() === true);
2083
2244
  var DURABLE_SESSION_FILE = "session.jsonl";
2084
2245
  var DURABLE_SESSION_TEMP = /^tmp-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.jsonl$/;
2085
2246
  var DURABLE_SESSION_SIDECAR = /^session\.jsonl\.[A-Za-z0-9][A-Za-z0-9._-]*$/;
2086
2247
  var safeDurableSessionFolder = (directory) => {
2087
2248
  const uid = process.getuid?.();
2088
2249
  const stats = /* @__PURE__ */ new Map();
2089
- for (const name of fs11.readdirSync(directory)) {
2250
+ for (const name of fs12.readdirSync(directory)) {
2090
2251
  if (DURABLE_SESSION_SIDECAR.test(name)) {
2091
- const sidecar = fs11.lstatSync(path11.join(directory, name));
2252
+ const sidecar = fs12.lstatSync(path12.join(directory, name));
2092
2253
  if (!sidecar.isFile() || uid !== void 0 && sidecar.uid !== uid || sidecar.nlink !== 1) return false;
2093
2254
  continue;
2094
2255
  }
2095
2256
  if (name !== DURABLE_SESSION_FILE && !DURABLE_SESSION_TEMP.test(name)) return false;
2096
- const stat = fs11.lstatSync(path11.join(directory, name));
2257
+ const stat = fs12.lstatSync(path12.join(directory, name));
2097
2258
  if (!stat.isFile() || uid !== void 0 && stat.uid !== uid || stat.nlink > 2) return false;
2098
2259
  stats.set(name, stat);
2099
2260
  }
@@ -2104,11 +2265,11 @@ var safeDurableSessionFolder = (directory) => {
2104
2265
  const [temporary] = temporaries;
2105
2266
  return stats.size === 2 && session !== void 0 && temporaries.length === 1 && temporary !== void 0 && session.nlink === 2 && temporary[1].nlink === 2 && session.dev === temporary[1].dev && session.ino === temporary[1].ino;
2106
2267
  };
2107
- var safeDurableTree = (directory) => fs11.readdirSync(directory).every((key) => {
2108
- const conversation = path11.join(directory, key);
2268
+ var safeDurableTree = (directory) => fs12.readdirSync(directory).every((key) => {
2269
+ const conversation = path12.join(directory, key);
2109
2270
  if (!DURABLE_KEY.test(key) || !ownedStat(conversation)?.isDirectory()) return false;
2110
- return fs11.readdirSync(conversation).every((name) => {
2111
- const file = path11.join(conversation, name);
2271
+ return fs12.readdirSync(conversation).every((name) => {
2272
+ const file = path12.join(conversation, name);
2112
2273
  if (name === "store") return ownedStat(file)?.isDirectory() === true && onlyOwnedFiles(file, (child) => DURABLE_STORE_FILE.test(child));
2113
2274
  if (name === "fabric-journal") return ownedStat(file)?.isDirectory() === true && onlyOwnedFiles(file, (child) => FABRIC_JOURNAL_FILE.test(child));
2114
2275
  return DURABLE_LEASE_FILES.has(name) && ownedStat(file)?.isFile() === true;
@@ -2116,25 +2277,25 @@ var safeDurableTree = (directory) => fs11.readdirSync(directory).every((key) =>
2116
2277
  });
2117
2278
  var ownedTree = (directory, depth) => {
2118
2279
  if (depth > 32) return false;
2119
- return fs11.readdirSync(directory).every((name) => {
2120
- const stat = ownedStat(path11.join(directory, name));
2280
+ return fs12.readdirSync(directory).every((name) => {
2281
+ const stat = ownedStat(path12.join(directory, name));
2121
2282
  if (!stat || name.startsWith("hosted.json")) return false;
2122
- return stat.isFile() || stat.isDirectory() && ownedTree(path11.join(directory, name), depth + 1);
2283
+ return stat.isFile() || stat.isDirectory() && ownedTree(path12.join(directory, name), depth + 1);
2123
2284
  });
2124
2285
  };
2125
2286
  var safeRunTree = (root, childrenStopped, owner, depth = 0, anyContents = false) => {
2126
2287
  if (depth > 32 || !ownedStat(root)?.isDirectory()) return false;
2127
- const record = readJson(path11.join(root, "status.json"));
2288
+ const record = readJson(path12.join(root, "status.json"));
2128
2289
  const pid = record?.transport === "process" && typeof record.sessionId === "string" && /^\d+$/.test(record.sessionId) ? Number(record.sessionId) : void 0;
2129
2290
  if (pid !== void 0 && childAlive(owner, pid)) return false;
2130
- const terminal = !!record?.status && TERMINAL_STATUSES.has(record.status);
2131
- if (!terminal) {
2291
+ const terminal2 = !!record?.status && TERMINAL_STATUSES.has(record.status);
2292
+ if (!terminal2) {
2132
2293
  if (!childrenStopped && pid === void 0) return false;
2133
- if (!ownedStat(path11.join(root, "task.txt"))?.isFile()) return false;
2294
+ if (!ownedStat(path12.join(root, "task.txt"))?.isFile()) return false;
2134
2295
  }
2135
2296
  try {
2136
- for (const name of fs11.readdirSync(root)) {
2137
- const file = path11.join(root, name);
2297
+ for (const name of fs12.readdirSync(root)) {
2298
+ const file = path12.join(root, name);
2138
2299
  const stat = ownedStat(file);
2139
2300
  if (!stat) return false;
2140
2301
  if (stat.isFile() && (runFiles.has(name) || name === OVERSIZED_EVENT_FILE || STATUS_TEMP_FILE.test(name))) continue;
@@ -2147,7 +2308,7 @@ var safeRunTree = (root, childrenStopped, owner, depth = 0, anyContents = false)
2147
2308
  continue;
2148
2309
  }
2149
2310
  if (stat.isDirectory() && name === "handoff-session") {
2150
- if (fs11.readdirSync(file).some((child) => !child.endsWith(".jsonl") || !ownedStat(path11.join(file, child))?.isFile())) return false;
2311
+ if (fs12.readdirSync(file).some((child) => !child.endsWith(".jsonl") || !ownedStat(path12.join(file, child))?.isFile())) return false;
2151
2312
  continue;
2152
2313
  }
2153
2314
  if (stat.isDirectory() && name === "durable-session") {
@@ -2159,7 +2320,7 @@ var safeRunTree = (root, childrenStopped, owner, depth = 0, anyContents = false)
2159
2320
  continue;
2160
2321
  }
2161
2322
  if (stat.isDirectory() && name === "nested") {
2162
- for (const child of fs11.readdirSync(file)) if (!safeRunTree(path11.join(file, child), false, owner, depth + 1, anyContents)) return false;
2323
+ for (const child of fs12.readdirSync(file)) if (!safeRunTree(path12.join(file, child), false, owner, depth + 1, anyContents)) return false;
2163
2324
  continue;
2164
2325
  }
2165
2326
  return false;
@@ -2171,7 +2332,7 @@ var safeRunTree = (root, childrenStopped, owner, depth = 0, anyContents = false)
2171
2332
  };
2172
2333
  var safeRootContents = (root, childrenStopped, owner, anyContents = false) => {
2173
2334
  try {
2174
- return fs11.readdirSync(root).every((name) => name === RUN_ROOT_OWNER_FILE || safeRunTree(path11.join(root, name), childrenStopped, owner, 0, anyContents));
2335
+ return fs12.readdirSync(root).every((name) => name === RUN_ROOT_OWNER_FILE || safeRunTree(path12.join(root, name), childrenStopped, owner, 0, anyContents));
2175
2336
  } catch {
2176
2337
  return false;
2177
2338
  }
@@ -2184,8 +2345,8 @@ var canRemoveManagedRunRoot = (root) => {
2184
2345
  var removeEmptyRunRoot = (root) => {
2185
2346
  try {
2186
2347
  if (!ownedStat(root)?.isDirectory() || !validOwner(readJson(ownerPath(root)))) return false;
2187
- if (fs11.readdirSync(root).some((name) => name !== RUN_ROOT_OWNER_FILE)) return false;
2188
- fs11.rmSync(root, { recursive: true, force: true });
2348
+ if (fs12.readdirSync(root).some((name) => name !== RUN_ROOT_OWNER_FILE)) return false;
2349
+ fs12.rmSync(root, { recursive: true, force: true });
2189
2350
  return true;
2190
2351
  } catch {
2191
2352
  return false;
@@ -2195,21 +2356,21 @@ var pruneClosedRunRoot = (root, owner, orphanMs, oneShotMs, now) => {
2195
2356
  const removed = [];
2196
2357
  let entries;
2197
2358
  try {
2198
- entries = fs11.readdirSync(root, { withFileTypes: true });
2359
+ entries = fs12.readdirSync(root, { withFileTypes: true });
2199
2360
  } catch {
2200
2361
  return removed;
2201
2362
  }
2202
2363
  for (const entry of entries) {
2203
2364
  if (!entry.isDirectory()) continue;
2204
- const directory = path11.join(root, entry.name);
2365
+ const directory = path12.join(root, entry.name);
2205
2366
  if (!safeRunTree(directory, owner.childrenStopped === true, owner)) continue;
2206
- const record = readJson(path11.join(directory, "status.json"));
2207
- const terminal = !!record?.status && TERMINAL_STATUSES.has(record.status);
2208
- const reference = terminal ? recordAgeReference(record, ownedStat(directory)?.mtimeMs ?? now) : owner.closedAt;
2209
- const retention = terminal && !record?.actorId ? oneShotMs : orphanMs;
2367
+ const record = readJson(path12.join(directory, "status.json"));
2368
+ const terminal2 = !!record?.status && TERMINAL_STATUSES.has(record.status);
2369
+ const reference = terminal2 ? recordAgeReference(record, ownedStat(directory)?.mtimeMs ?? now) : owner.closedAt;
2370
+ const retention = terminal2 && !record?.actorId ? oneShotMs : orphanMs;
2210
2371
  if (now - reference < retention) continue;
2211
2372
  try {
2212
- fs11.rmSync(directory, { recursive: true, force: true });
2373
+ fs12.rmSync(directory, { recursive: true, force: true });
2213
2374
  removed.push(directory);
2214
2375
  } catch {
2215
2376
  }
@@ -2221,14 +2382,14 @@ var sweepTempRunRoots = (options) => {
2221
2382
  const result = { removedRoots: [], removedRuns: [] };
2222
2383
  let entries;
2223
2384
  try {
2224
- entries = fs11.readdirSync(options.tempRoot, { withFileTypes: true });
2385
+ entries = fs12.readdirSync(options.tempRoot, { withFileTypes: true });
2225
2386
  } catch {
2226
2387
  return result;
2227
2388
  }
2228
2389
  for (const entry of entries) {
2229
2390
  if (!entry.isDirectory() || !/^pi-fabric-runs-[A-Za-z0-9_-]+$/.test(entry.name)) continue;
2230
- const root = path11.join(options.tempRoot, entry.name);
2231
- if (options.currentRoot && path11.resolve(root) === path11.resolve(options.currentRoot)) continue;
2391
+ const root = path12.join(options.tempRoot, entry.name);
2392
+ if (options.currentRoot && path12.resolve(root) === path12.resolve(options.currentRoot)) continue;
2232
2393
  if (!ownedStat(root)?.isDirectory()) continue;
2233
2394
  const owner = readJson(ownerPath(root));
2234
2395
  if (!validOwner(owner)) continue;
@@ -2247,7 +2408,7 @@ var sweepTempRunRoots = (options) => {
2247
2408
  }
2248
2409
  if (now - owner.orphanedAt < options.orphanedTempRunRetentionMs || !safeRootContents(root, false, owner, true)) continue;
2249
2410
  try {
2250
- fs11.rmSync(root, { recursive: true, force: true });
2411
+ fs12.rmSync(root, { recursive: true, force: true });
2251
2412
  result.removedRoots.push(root);
2252
2413
  } catch {
2253
2414
  }
@@ -2260,18 +2421,18 @@ var pruneActorRunArchives = (options) => {
2260
2421
  if (!ownedStat(options.runsDirectory)?.isDirectory()) return removed;
2261
2422
  let entries;
2262
2423
  try {
2263
- entries = fs11.readdirSync(options.runsDirectory, { withFileTypes: true });
2424
+ entries = fs12.readdirSync(options.runsDirectory, { withFileTypes: true });
2264
2425
  } catch {
2265
2426
  return removed;
2266
2427
  }
2267
2428
  for (const entry of entries) {
2268
2429
  if (!entry.isDirectory() || entry.name === options.latestRunId) continue;
2269
- const directory = path11.join(options.runsDirectory, entry.name);
2270
- const record = readJson(path11.join(directory, "status.json"));
2430
+ const directory = path12.join(options.runsDirectory, entry.name);
2431
+ const record = readJson(path12.join(directory, "status.json"));
2271
2432
  if (!record?.status || !TERMINAL_STATUSES.has(record.status) || !safeRunTree(directory, false)) continue;
2272
2433
  if (now - recordAgeReference(record, ownedStat(directory)?.mtimeMs ?? now) < options.retentionMs) continue;
2273
2434
  try {
2274
- fs11.rmSync(directory, { recursive: true, force: true });
2435
+ fs12.rmSync(directory, { recursive: true, force: true });
2275
2436
  removed.push(directory);
2276
2437
  } catch {
2277
2438
  }
@@ -2281,21 +2442,21 @@ var pruneActorRunArchives = (options) => {
2281
2442
 
2282
2443
  // src/agents/session-export.ts
2283
2444
  import os2 from "node:os";
2284
- import path12 from "node:path";
2445
+ import path13 from "node:path";
2285
2446
  var SESSION_EXPORT_ENV = "PI_FABRIC_AGENT_DIR";
2286
- var expandHome = (value) => value === "~" ? os2.homedir() : value.startsWith("~/") || value.startsWith(`~${path12.win32.sep}`) ? path12.join(os2.homedir(), value.slice(2)) : value;
2447
+ var expandHome = (value) => value === "~" ? os2.homedir() : value.startsWith("~/") || value.startsWith(`~${path13.win32.sep}`) ? path13.join(os2.homedir(), value.slice(2)) : value;
2287
2448
  var encodeSessionExportCwd = (cwd) => {
2288
- const absolute = path12.isAbsolute(cwd) || path12.win32.isAbsolute(cwd) ? cwd : path12.resolve(cwd);
2449
+ const absolute = path13.isAbsolute(cwd) || path13.win32.isAbsolute(cwd) ? cwd : path13.resolve(cwd);
2289
2450
  return `--${absolute.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
2290
2451
  };
2291
2452
  var resolveSessionExportDir = (config) => {
2292
2453
  if (!config.sessionExport) return void 0;
2293
- const raw = process.env[SESSION_EXPORT_ENV]?.trim() || config.sessionExportDir.trim() || path12.join(os2.homedir(), ".pi", "agent");
2454
+ const raw = process.env[SESSION_EXPORT_ENV]?.trim() || config.sessionExportDir.trim() || path13.join(os2.homedir(), ".pi", "agent");
2294
2455
  return expandHome(raw);
2295
2456
  };
2296
2457
  var sessionExportFileFor = (root, cwd, runId, at) => {
2297
2458
  const fileTimestamp = at.toISOString().replace(/[:.]/g, "-");
2298
- return path12.join(
2459
+ return path13.join(
2299
2460
  root,
2300
2461
  "sessions",
2301
2462
  ".fabric",
@@ -2336,11 +2497,11 @@ var resolveAgentCwd = (parentCwd, requestedCwd) => {
2336
2497
  if (typeof requested !== "string" || requested.trim().length === 0) {
2337
2498
  throw new Error(`Invalid Fabric agent cwd ${JSON.stringify(requested)}: path must not be empty`);
2338
2499
  }
2339
- const candidate = path13.isAbsolute(requested) ? requested : path13.resolve(parentCwd, requested);
2500
+ const candidate = path14.isAbsolute(requested) ? requested : path14.resolve(parentCwd, requested);
2340
2501
  try {
2341
- const canonical = fs12.realpathSync(candidate);
2342
- fs12.accessSync(canonical, fs12.constants.R_OK | fs12.constants.X_OK);
2343
- if (!fs12.statSync(canonical).isDirectory()) {
2502
+ const canonical = fs13.realpathSync(candidate);
2503
+ fs13.accessSync(canonical, fs13.constants.R_OK | fs13.constants.X_OK);
2504
+ if (!fs13.statSync(canonical).isDirectory()) {
2344
2505
  throw new Error("path is not a directory");
2345
2506
  }
2346
2507
  return canonical;
@@ -2374,7 +2535,7 @@ var queuedResult = (entry, status, error) => {
2374
2535
  };
2375
2536
  var fileSize = (filePath) => {
2376
2537
  try {
2377
- return fs12.statSync(filePath).size;
2538
+ return fs13.statSync(filePath).size;
2378
2539
  } catch {
2379
2540
  return 0;
2380
2541
  }
@@ -2425,7 +2586,7 @@ var runName = (request) => safeName(request.name ?? request.task.split("\n", 1)[
2425
2586
  var safeName = (value) => value.replace(/[\r\n\t]+/g, " ").trim().slice(0, MAX_NAME_LENGTH) || "Fabric agent";
2426
2587
  var readRecord = (filePath) => {
2427
2588
  try {
2428
- const parsed = JSON.parse(fs12.readFileSync(filePath, "utf8"));
2589
+ const parsed = JSON.parse(fs13.readFileSync(filePath, "utf8"));
2429
2590
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
2430
2591
  const record = parsed;
2431
2592
  return { ...record, runner: isFabricRunnerId(record.runner) ? record.runner : "pi" };
@@ -2477,24 +2638,24 @@ var reconcileNestedAgents = (records, owner) => records.map((record) => {
2477
2638
  });
2478
2639
  var readNestedAgents = (runDirectory, depth = 0) => {
2479
2640
  if (depth >= 8) return [];
2480
- const nestedRoot = path13.join(runDirectory, "nested");
2641
+ const nestedRoot = path14.join(runDirectory, "nested");
2481
2642
  let entries;
2482
2643
  try {
2483
- entries = fs12.readdirSync(nestedRoot);
2644
+ entries = fs13.readdirSync(nestedRoot);
2484
2645
  } catch {
2485
2646
  return [];
2486
2647
  }
2487
2648
  const agents = [];
2488
2649
  for (const entry of entries.slice(0, 200)) {
2489
- const runDirectory2 = path13.join(nestedRoot, entry);
2490
- const record = readRecord(path13.join(runDirectory2, "status.json"));
2650
+ const runDirectory2 = path14.join(nestedRoot, entry);
2651
+ const record = readRecord(path14.join(runDirectory2, "status.json"));
2491
2652
  if (!record) continue;
2492
2653
  const nestedAgents = readNestedAgents(runDirectory2, depth + 1);
2493
2654
  const { logFile: _logFile, nestedAgents: _nestedAgents, ...safeRecord } = record;
2494
2655
  agents.push(
2495
2656
  compactUiRecord({
2496
2657
  ...safeRecord,
2497
- logFile: path13.join(runDirectory2, "events.jsonl"),
2658
+ logFile: path14.join(runDirectory2, "events.jsonl"),
2498
2659
  ...nestedAgents.length > 0 ? { nestedAgents } : {}
2499
2660
  })
2500
2661
  );
@@ -2502,7 +2663,7 @@ var readNestedAgents = (runDirectory, depth = 0) => {
2502
2663
  return agents;
2503
2664
  };
2504
2665
  var summarizeRunLog = (runDirectory, lines) => {
2505
- const page = readJsonlPage(path13.join(runDirectory, "events.jsonl"), lines);
2666
+ const page = readJsonlPage(path14.join(runDirectory, "events.jsonl"), lines);
2506
2667
  const summary = [];
2507
2668
  for (const entry of page.lines) {
2508
2669
  const parsed = entry.parsed;
@@ -2555,8 +2716,8 @@ var AgentManager = class {
2555
2716
  this.config = config;
2556
2717
  this.#semaphore = new AgentAdmission(config.maxConcurrent, Infinity, config.maxDepth);
2557
2718
  this.#managedTempRoot = options.runRoot === void 0 && process.env.PI_FABRIC_RUN_ROOT === void 0;
2558
- this.#runRoot = options.runRoot ?? process.env.PI_FABRIC_RUN_ROOT ?? fs12.mkdtempSync(path13.join(os3.tmpdir(), "pi-fabric-runs-"));
2559
- this.#parentOwnedRunRoot = options.runRoot === void 0 && this.#parentLineage?.worker === true && this.#parentLineage.depth > 0 && path13.basename(this.#runRoot) === "nested" && path13.basename(path13.dirname(this.#runRoot)) === this.#parentLineage.runId;
2719
+ this.#runRoot = options.runRoot ?? process.env.PI_FABRIC_RUN_ROOT ?? fs13.mkdtempSync(path14.join(os3.tmpdir(), "pi-fabric-runs-"));
2720
+ this.#parentOwnedRunRoot = options.runRoot === void 0 && this.#parentLineage?.worker === true && this.#parentLineage.depth > 0 && path14.basename(this.#runRoot) === "nested" && path14.basename(path14.dirname(this.#runRoot)) === this.#parentLineage.runId;
2560
2721
  this.#retention = options.retention ?? DEFAULT_FABRIC_CONFIG.retention;
2561
2722
  this.#workerPath = options.workerPath ?? fileURLToPath(new URL("../worker.js", import.meta.url));
2562
2723
  this.#fabricExtensionPath = options.fabricExtensionPath ?? fileURLToPath(new URL("../index.js", import.meta.url));
@@ -2593,7 +2754,8 @@ var AgentManager = class {
2593
2754
  new TmuxTransport(),
2594
2755
  new ScreenTransport(),
2595
2756
  new LocaltermTransport(),
2596
- new HerdrTransport()
2757
+ new HerdrTransport(),
2758
+ new HerdrCoreTransport()
2597
2759
  ];
2598
2760
  this.#transports = new Map(adapters.map((adapter) => [adapter.kind, adapter]));
2599
2761
  if (this.#managedTempRoot) {
@@ -2770,7 +2932,7 @@ var AgentManager = class {
2770
2932
  if (request.residency === "durable") {
2771
2933
  return Promise.reject(new Error('queue: true is not supported with residency: "durable"'));
2772
2934
  }
2773
- const id = randomUUID4().replaceAll("-", "");
2935
+ const id = randomUUID6().replaceAll("-", "");
2774
2936
  const control = new AbortController();
2775
2937
  return new Promise((resolve, reject) => {
2776
2938
  let entry;
@@ -2953,28 +3115,28 @@ var AgentManager = class {
2953
3115
  release();
2954
3116
  throw error;
2955
3117
  }
2956
- const id = queued?.id ?? randomUUID4().replaceAll("-", "");
3118
+ const id = queued?.id ?? randomUUID6().replaceAll("-", "");
2957
3119
  const name = runName(request);
2958
- const runDirectory = path13.join(this.#runRoot, id);
3120
+ const runDirectory = path14.join(this.#runRoot, id);
2959
3121
  const durableSession = runner === "pi-durable" && this.config.durableWorkerSession === true;
2960
- const taskFile = path13.join(runDirectory, "task.txt");
2961
- const statusFile = path13.join(runDirectory, "status.json");
2962
- const lifecycleFile = path13.join(runDirectory, "lifecycle.jsonl");
2963
- const logFile = path13.join(runDirectory, "events.jsonl");
2964
- const steerFile = path13.join(runDirectory, "steer.jsonl");
2965
- const schemaFile = request.schema ? path13.join(runDirectory, "schema.json") : void 0;
2966
- const imagesFile = request.images && request.images.length > 0 ? path13.join(runDirectory, "images.json") : void 0;
3122
+ const taskFile = path14.join(runDirectory, "task.txt");
3123
+ const statusFile = path14.join(runDirectory, "status.json");
3124
+ const lifecycleFile = path14.join(runDirectory, "lifecycle.jsonl");
3125
+ const logFile = path14.join(runDirectory, "events.jsonl");
3126
+ const steerFile = path14.join(runDirectory, "steer.jsonl");
3127
+ const schemaFile = request.schema ? path14.join(runDirectory, "schema.json") : void 0;
3128
+ const imagesFile = request.images && request.images.length > 0 ? path14.join(runDirectory, "images.json") : void 0;
2967
3129
  try {
2968
- fs12.mkdirSync(runDirectory, durableSession ? { recursive: true, mode: 448 } : { recursive: true });
2969
- fs12.writeFileSync(taskFile, request.task, { encoding: "utf8", mode: 384 });
3130
+ fs13.mkdirSync(runDirectory, durableSession ? { recursive: true, mode: 448 } : { recursive: true });
3131
+ fs13.writeFileSync(taskFile, request.task, { encoding: "utf8", mode: 384 });
2970
3132
  if (imagesFile) {
2971
- fs12.writeFileSync(imagesFile, JSON.stringify(request.images), {
3133
+ fs13.writeFileSync(imagesFile, JSON.stringify(request.images), {
2972
3134
  encoding: "utf8",
2973
3135
  mode: 384
2974
3136
  });
2975
3137
  }
2976
3138
  if (schemaFile) {
2977
- fs12.writeFileSync(schemaFile, JSON.stringify(request.schema, null, 2), {
3139
+ fs13.writeFileSync(schemaFile, JSON.stringify(request.schema, null, 2), {
2978
3140
  encoding: "utf8",
2979
3141
  mode: 384
2980
3142
  });
@@ -3022,10 +3184,10 @@ var AgentManager = class {
3022
3184
  const seedOptions = durableSession ? { workerRole: true } : {};
3023
3185
  const handoffBudget = request.sessionSeed && request.handoffCompact ? await this.#resolveHandoffCompactionBudget?.(model, agentCwd) : void 0;
3024
3186
  admissionSignal.throwIfAborted();
3025
- const sessionFile = request.forkSeed ? writeForkSession(request.forkSeed, agentCwd, path13.join(runDirectory, "fork-session"), request.thinkingTransfer, seedOptions) : request.sessionSeed ? writeHandoffSession(
3187
+ const sessionFile = request.forkSeed ? writeForkSession(request.forkSeed, agentCwd, path14.join(runDirectory, "fork-session"), request.thinkingTransfer, seedOptions) : request.sessionSeed ? writeHandoffSession(
3026
3188
  request.sessionSeed,
3027
3189
  agentCwd,
3028
- path13.join(runDirectory, "handoff-session"),
3190
+ path14.join(runDirectory, "handoff-session"),
3029
3191
  request.thinkingTransfer,
3030
3192
  request.handoffCompact,
3031
3193
  handoffBudget,
@@ -3044,7 +3206,11 @@ var AgentManager = class {
3044
3206
  const inheritedSessionPins = (runner === "pi" || runner === "pi-durable") && extensions ? this.#inheritedSessionPins(request) : void 0;
3045
3207
  const inheritedFullCodeMode = capabilities2.recursiveFabric && this.#fullCodeMode && extensions;
3046
3208
  const componentGuidance = recursive ? void 0 : this.#resolveParticipantGuidance?.({ ...model ? { model } : {}, runner })?.trim();
3047
- const systemPrompt = [request.systemPrompt?.trim(), request.childSkills?.preload, componentGuidance].filter((section) => Boolean(section)).join("\n\n") || void 0;
3209
+ const mainGuidance = this.#mainAgentId ? [
3210
+ `Your owning Main peer (lineage root): ${this.#mainAgentId}.`,
3211
+ capabilities2.recursiveFabric && extensions && (recursive || inheritedFullCodeMode || requiresFabricKernel) ? `Use agents.self() for your participant identity and agents.main() for your owning Main. To report back, use agents.steer({ id: "main", message: "..." }) or agents.followUp({ id: "main", message: "..." }) in fabric_exec. The alias "main" always targets your lineage root, not another peer's Main. Use an exact discovered participant id to message another peer or worker; ownerHostId is a routing address, not a participant id.` : "Report results in your response; the host delivers them to your coordinator. This launch does not provide direct Fabric coordination tools."
3212
+ ].join("\n") : void 0;
3213
+ const systemPrompt = [request.systemPrompt?.trim(), request.childSkills?.preload, componentGuidance, mainGuidance].filter((section) => Boolean(section)).join("\n\n") || void 0;
3048
3214
  const sessionExportDir = resolveSessionExportDir(this.config);
3049
3215
  const sessionExportFile = sessionExportDir ? sessionExportFileFor(sessionExportDir, agentCwd, id, /* @__PURE__ */ new Date()) : void 0;
3050
3216
  const traceContext = this.#traceContext(request, { runId: id, runner, name });
@@ -3161,7 +3327,7 @@ var AgentManager = class {
3161
3327
  ...this.#identityId ? ["--owner-identity-id", this.#identityId] : [],
3162
3328
  ...request.runnerSessionId ? ["--runner-session-id", request.runnerSessionId] : [],
3163
3329
  "--run-root",
3164
- path13.join(runDirectory, "nested"),
3330
+ path14.join(runDirectory, "nested"),
3165
3331
  "--steer-file",
3166
3332
  steerFile,
3167
3333
  ...this.config.childQuestions === "route" && capabilities2.questions ? [
@@ -3313,7 +3479,7 @@ var AgentManager = class {
3313
3479
  const hosted = await HostedRun.prepare(
3314
3480
  adapter,
3315
3481
  { ...context, idempotencyKey: context.id },
3316
- { ...launch.files, stateFile: path13.join(context.runDirectory, HOSTED_STATE_FILE) },
3482
+ { ...launch.files, stateFile: path14.join(context.runDirectory, HOSTED_STATE_FILE) },
3317
3483
  record,
3318
3484
  this.#hostedHooks(() => managed, launch.request.holdQuestions === true)
3319
3485
  );
@@ -3400,17 +3566,17 @@ var AgentManager = class {
3400
3566
  async recoverHostedRuns() {
3401
3567
  let entries;
3402
3568
  try {
3403
- entries = fs12.readdirSync(this.#runRoot);
3569
+ entries = fs13.readdirSync(this.#runRoot);
3404
3570
  } catch {
3405
3571
  return [];
3406
3572
  }
3407
3573
  const recovered = [];
3408
3574
  for (const entry of entries) {
3409
3575
  if (this.#closing || this.#runs.has(entry) || !/^[0-9a-f]{32}$/.test(entry)) continue;
3410
- const runDirectory = path13.join(this.#runRoot, entry);
3411
- const statusFile = path13.join(runDirectory, "status.json");
3576
+ const runDirectory = path14.join(this.#runRoot, entry);
3577
+ const statusFile = path14.join(runDirectory, "status.json");
3412
3578
  const record = readRecord(statusFile);
3413
- const state = readHostedRunState(path13.join(runDirectory, HOSTED_STATE_FILE));
3579
+ const state = readHostedRunState(path14.join(runDirectory, HOSTED_STATE_FILE));
3414
3580
  if (!record?.hosted || !state || record.id !== entry || state.context.id !== entry || terminalStatuses.has(record.status)) {
3415
3581
  continue;
3416
3582
  }
@@ -3442,9 +3608,9 @@ var AgentManager = class {
3442
3608
  state,
3443
3609
  {
3444
3610
  statusFile,
3445
- lifecycleFile: path13.join(runDirectory, "lifecycle.jsonl"),
3446
- logFile: path13.join(runDirectory, "events.jsonl"),
3447
- stateFile: path13.join(runDirectory, HOSTED_STATE_FILE)
3611
+ lifecycleFile: path14.join(runDirectory, "lifecycle.jsonl"),
3612
+ logFile: path14.join(runDirectory, "events.jsonl"),
3613
+ stateFile: path14.join(runDirectory, HOSTED_STATE_FILE)
3448
3614
  },
3449
3615
  record,
3450
3616
  this.#hostedHooks(() => managed, state.holdQuestions === true)
@@ -3524,16 +3690,16 @@ var AgentManager = class {
3524
3690
  async recoverWorkerRuns() {
3525
3691
  let entries;
3526
3692
  try {
3527
- entries = fs12.readdirSync(this.#runRoot);
3693
+ entries = fs13.readdirSync(this.#runRoot);
3528
3694
  } catch {
3529
3695
  return [];
3530
3696
  }
3531
3697
  const recovered = [];
3532
3698
  for (const entry of entries) {
3533
3699
  if (this.#closing || this.#runs.has(entry) || !/^[0-9a-f]{32}$/.test(entry)) continue;
3534
- const runDirectory = path13.join(this.#runRoot, entry);
3700
+ const runDirectory = path14.join(this.#runRoot, entry);
3535
3701
  const recovery = readWorkerRecovery(runDirectory);
3536
- const statusFile = path13.join(runDirectory, "status.json");
3702
+ const statusFile = path14.join(runDirectory, "status.json");
3537
3703
  const record = readRecord(statusFile);
3538
3704
  if (!recovery || recovery.id !== entry) {
3539
3705
  if (!hasWorkerRecovery(runDirectory)) continue;
@@ -3621,7 +3787,7 @@ var AgentManager = class {
3621
3787
  indeterminate(`Fabric cannot verify whether worker process ${recovery.pid} is still running`);
3622
3788
  continue;
3623
3789
  }
3624
- if (liveness === "dead" && !fs12.existsSync(authority.launch.workerPath)) {
3790
+ if (liveness === "dead" && !fs13.existsSync(authority.launch.workerPath)) {
3625
3791
  indeterminate(`The worker entry ${recovery.launch.workerPath} no longer exists`);
3626
3792
  continue;
3627
3793
  }
@@ -3646,9 +3812,9 @@ var AgentManager = class {
3646
3812
  residency: "durable",
3647
3813
  cwd: record.cwd,
3648
3814
  statusFile,
3649
- lifecycleFile: path13.join(runDirectory, "lifecycle.jsonl"),
3815
+ lifecycleFile: path14.join(runDirectory, "lifecycle.jsonl"),
3650
3816
  // Events before this point reached the previous host's ledger.
3651
- lifecycleOffset: fileSize(path13.join(runDirectory, "lifecycle.jsonl")),
3817
+ lifecycleOffset: fileSize(path14.join(runDirectory, "lifecycle.jsonl")),
3652
3818
  lifecycleRemainder: Buffer.alloc(0),
3653
3819
  runDirectory,
3654
3820
  transport: adoptedWorkerHandle(authority.pid, entry),
@@ -3907,9 +4073,9 @@ var AgentManager = class {
3907
4073
  await this.#stopWorkerRunner(managed);
3908
4074
  await managed.transport.stop();
3909
4075
  await this.#waitForTransportExit(managed);
3910
- const terminal = readRecord(managed.statusFile);
3911
- const record = terminal && terminalStatuses.has(terminal.status) ? this.#withTransportMetadata(terminal, managed) : failedRecord(managed, "stopped", "Agent stopped");
3912
- if (!terminal || !terminalStatuses.has(terminal.status)) writeRecord(managed.statusFile, record);
4076
+ const terminal2 = readRecord(managed.statusFile);
4077
+ const record = terminal2 && terminalStatuses.has(terminal2.status) ? this.#withTransportMetadata(terminal2, managed) : failedRecord(managed, "stopped", "Agent stopped");
4078
+ if (!terminal2 || !terminalStatuses.has(terminal2.status)) writeRecord(managed.statusFile, record);
3913
4079
  await this.#captureWorktree(managed);
3914
4080
  this.#settle(managed, record);
3915
4081
  return record;
@@ -3933,15 +4099,15 @@ var AgentManager = class {
3933
4099
  this.#runs.delete(id);
3934
4100
  this.#pruneRetainedUiRecords();
3935
4101
  this.#invalidateUiList();
3936
- return { cleaned: cleaned || !fs12.existsSync(managed.runDirectory) };
4102
+ return { cleaned: cleaned || !fs13.existsSync(managed.runDirectory) };
3937
4103
  }
3938
4104
  readLog(id, opts = {}) {
3939
4105
  const managed = this.#requireRun(id);
3940
4106
  const runDirectory = managed.runDirectory;
3941
- const logFile = path13.join(runDirectory, "events.jsonl");
4107
+ const logFile = path14.join(runDirectory, "events.jsonl");
3942
4108
  const lines = Math.max(1, Math.min(opts.lines ?? 200, 5e3));
3943
4109
  const page = readJsonlPage(logFile, lines, opts.before);
3944
- const statusRecord = readRecord(path13.join(runDirectory, "status.json"));
4110
+ const statusRecord = readRecord(path14.join(runDirectory, "status.json"));
3945
4111
  return {
3946
4112
  id,
3947
4113
  runDirectory,
@@ -4016,10 +4182,10 @@ var AgentManager = class {
4016
4182
  `Fabric agent ${id} already finished (${record.status}); steering has no target`
4017
4183
  );
4018
4184
  }
4019
- const steerFile = path13.join(managed.runDirectory, "steer.jsonl");
4020
- const messageId = randomUUID4();
4185
+ const steerFile = path14.join(managed.runDirectory, "steer.jsonl");
4186
+ const messageId = randomUUID6();
4021
4187
  const line = JSON.stringify({ ...entry, id: messageId, ts: Date.now() }) + "\n";
4022
- fs12.appendFileSync(steerFile, line, { encoding: "utf8", mode: 384 });
4188
+ fs13.appendFileSync(steerFile, line, { encoding: "utf8", mode: 384 });
4023
4189
  return { queued: true, messageId };
4024
4190
  }
4025
4191
  close() {
@@ -4072,7 +4238,7 @@ var AgentManager = class {
4072
4238
  removeEmptyRunRoot(this.#runRoot);
4073
4239
  }
4074
4240
  if (storageSafe && this.#budgetOwned && this.#budget) {
4075
- await removeTree(path13.dirname(this.#budget.file)).catch(() => void 0);
4241
+ await removeTree(path14.dirname(this.#budget.file)).catch(() => void 0);
4076
4242
  }
4077
4243
  }
4078
4244
  if (this.#budgetOwned) clearOwnedBudgetEnv();
@@ -4114,7 +4280,7 @@ var AgentManager = class {
4114
4280
  });
4115
4281
  for (const managed of expired) {
4116
4282
  await removeTree(managed.runDirectory).catch(() => void 0);
4117
- if (!fs12.existsSync(managed.runDirectory)) this.#runs.delete(managed.id);
4283
+ if (!fs13.existsSync(managed.runDirectory)) this.#runs.delete(managed.id);
4118
4284
  }
4119
4285
  if (expired.length > 0) {
4120
4286
  this.#pruneRetainedUiRecords();
@@ -4218,7 +4384,7 @@ var AgentManager = class {
4218
4384
  );
4219
4385
  }
4220
4386
  if (resume) {
4221
- fs12.writeFileSync(path13.join(managed.runDirectory, "task.txt"), resume.task, {
4387
+ fs13.writeFileSync(path14.join(managed.runDirectory, "task.txt"), resume.task, {
4222
4388
  encoding: "utf8",
4223
4389
  mode: 384
4224
4390
  });
@@ -4241,10 +4407,10 @@ var AgentManager = class {
4241
4407
  }
4242
4408
  this.#drainLifecycle(managed);
4243
4409
  if (managed.settled || this.#closing || managed.stopRequested) return false;
4244
- fs12.rmSync(managed.statusFile, { force: true });
4410
+ fs13.rmSync(managed.statusFile, { force: true });
4245
4411
  managed.lifecycleOffset = 0;
4246
4412
  managed.lifecycleRemainder = Buffer.alloc(0);
4247
- fs12.rmSync(managed.lifecycleFile, { force: true });
4413
+ fs13.rmSync(managed.lifecycleFile, { force: true });
4248
4414
  managed.transport = await this.#launchTransport(managed.adapter, managed.launch);
4249
4415
  this.#unregisteredTransports.delete(managed.transport);
4250
4416
  if (managed.workerRecovery) this.#persistWorkerRecovery(managed);
@@ -4423,7 +4589,7 @@ var AgentManager = class {
4423
4589
  managed.questions?.abort(new Error("Agent run settled"));
4424
4590
  managed.hosted?.close();
4425
4591
  try {
4426
- fs12.rmSync(path13.join(managed.runDirectory, "images.json"), { force: true });
4592
+ fs13.rmSync(path14.join(managed.runDirectory, "images.json"), { force: true });
4427
4593
  } catch {
4428
4594
  }
4429
4595
  this.#emitLifecycle(managed, `run.${result.status}`, result.finishedAt ?? Date.now(), {
@@ -4458,7 +4624,7 @@ var AgentManager = class {
4458
4624
  #drainLifecycle(managed) {
4459
4625
  let content;
4460
4626
  try {
4461
- content = fs12.readFileSync(managed.lifecycleFile);
4627
+ content = fs13.readFileSync(managed.lifecycleFile);
4462
4628
  } catch {
4463
4629
  return;
4464
4630
  }
@@ -4511,9 +4677,9 @@ var AgentManager = class {
4511
4677
  const requestId = question.requestId;
4512
4678
  const steer = (command) => {
4513
4679
  try {
4514
- fs12.appendFileSync(
4515
- path13.join(managed.runDirectory, "steer.jsonl"),
4516
- `${JSON.stringify({ ...command, id: randomUUID4(), ts: Date.now() })}
4680
+ fs13.appendFileSync(
4681
+ path14.join(managed.runDirectory, "steer.jsonl"),
4682
+ `${JSON.stringify({ ...command, id: randomUUID6(), ts: Date.now() })}
4517
4683
  `,
4518
4684
  { encoding: "utf8", mode: 384 }
4519
4685
  );
@@ -4660,7 +4826,7 @@ var AgentManager = class {
4660
4826
  }
4661
4827
  return adapter;
4662
4828
  }
4663
- for (const kind of ["herdr", "localterm", "tmux", "screen", "process"]) {
4829
+ for (const kind of ["herdr-core", "herdr", "localterm", "tmux", "screen", "process"]) {
4664
4830
  const adapter = this.#transports.get(kind);
4665
4831
  if (adapter && await adapter.available()) return adapter;
4666
4832
  }
@@ -4728,7 +4894,7 @@ var AgentManager = class {
4728
4894
  // directories. Terminal-owner reconciliation prevents cached active ghosts.
4729
4895
  #nestedAgents(managed, force = false) {
4730
4896
  const now = Date.now();
4731
- const needsInitialDiscovery = managed.nestedSnapshot === void 0 && fs12.existsSync(path13.join(managed.runDirectory, "nested"));
4897
+ const needsInitialDiscovery = managed.nestedSnapshot === void 0 && fs13.existsSync(path14.join(managed.runDirectory, "nested"));
4732
4898
  if (!force && !needsInitialDiscovery && managed.nestedSnapshotAt !== void 0 && now - managed.nestedSnapshotAt < NESTED_SNAPSHOT_POLL_MS) {
4733
4899
  return managed.nestedSnapshot ? structuredClone(managed.nestedSnapshot) : [];
4734
4900
  }
@@ -4756,7 +4922,7 @@ var AgentManager = class {
4756
4922
  runner: managed.runner,
4757
4923
  ...managed.kernel ? { kernel: managed.kernel } : {},
4758
4924
  ...managed.residency === "durable" ? { residency: "durable" } : {},
4759
- logFile: path13.join(managed.runDirectory, "events.jsonl"),
4925
+ logFile: path14.join(managed.runDirectory, "events.jsonl"),
4760
4926
  ...nestedAgents.length > 0 ? { nestedAgents } : {},
4761
4927
  ...budget ? { budget } : {},
4762
4928
  ...model ? { model } : {},
@@ -4812,15 +4978,15 @@ var actorDeliveryNotice = (delivery, triggerTurn) => {
4812
4978
  };
4813
4979
 
4814
4980
  // src/actors/directory.ts
4815
- import fs19 from "node:fs";
4981
+ import fs20 from "node:fs";
4816
4982
 
4817
4983
  // src/actors/manager.ts
4818
- import { randomUUID as randomUUID7 } from "node:crypto";
4819
- import fs18 from "node:fs";
4984
+ import { randomUUID as randomUUID9 } from "node:crypto";
4985
+ import fs19 from "node:fs";
4820
4986
 
4821
4987
  // src/actors/mesh-monitor.ts
4822
- import fs13 from "node:fs";
4823
- import path14 from "node:path";
4988
+ import fs14 from "node:fs";
4989
+ import path15 from "node:path";
4824
4990
  var MESH_WATCH_RECONCILE_MS = 2e3;
4825
4991
  var ActorMeshMonitor = class {
4826
4992
  constructor(mesh, config, callbacks) {
@@ -4847,8 +5013,8 @@ var ActorMeshMonitor = class {
4847
5013
  return;
4848
5014
  }
4849
5015
  try {
4850
- const watcher = fs13.watch(this.mesh.root, { persistent: false }, (_event, filename) => {
4851
- const name = filename == null ? void 0 : path14.basename(filename.toString());
5016
+ const watcher = fs14.watch(this.mesh.root, { persistent: false }, (_event, filename) => {
5017
+ const name = filename == null ? void 0 : path15.basename(filename.toString());
4852
5018
  if (name !== void 0 && name !== "events.jsonl" && name !== "schedules.json") return;
4853
5019
  this.schedule();
4854
5020
  });
@@ -4940,7 +5106,7 @@ var ActorMeshMonitor = class {
4940
5106
  #readCursor() {
4941
5107
  if (!this.callbacks.cursorPath) return void 0;
4942
5108
  try {
4943
- const value = JSON.parse(fs13.readFileSync(this.callbacks.cursorPath, "utf8"));
5109
+ const value = JSON.parse(fs14.readFileSync(this.callbacks.cursorPath, "utf8"));
4944
5110
  return value.format === 1 && typeof value.cursor === "number" && value.cursor >= 0 ? value.cursor : void 0;
4945
5111
  } catch {
4946
5112
  return void 0;
@@ -4957,11 +5123,11 @@ var ActorMeshMonitor = class {
4957
5123
 
4958
5124
  // src/actors/manager.ts
4959
5125
  import os4 from "node:os";
4960
- import path18 from "node:path";
5126
+ import path19 from "node:path";
4961
5127
 
4962
5128
  // src/actors/log-store.ts
4963
- import fs14 from "node:fs";
4964
- import path15 from "node:path";
5129
+ import fs15 from "node:fs";
5130
+ import path16 from "node:path";
4965
5131
  var ACTOR_MESSAGE_HISTORY_LIMIT = 100;
4966
5132
  var ACTOR_MESSAGE_ENVELOPE_BYTES = 4096;
4967
5133
  var ACTOR_TRUNCATION_SUFFIX = "\n[actor message truncated]";
@@ -5019,17 +5185,17 @@ var ActorLogStore = class {
5019
5185
  this.retention = retention;
5020
5186
  }
5021
5187
  async retainRun(actor, runId, runDirectory) {
5022
- if (!runDirectory || !fs14.existsSync(runDirectory)) return;
5023
- const dest = path15.join(path15.dirname(actor.sessionFile), "runs", runId);
5024
- fs14.mkdirSync(dest, { recursive: true, mode: 448 });
5188
+ if (!runDirectory || !fs15.existsSync(runDirectory)) return;
5189
+ const dest = path16.join(path16.dirname(actor.sessionFile), "runs", runId);
5190
+ fs15.mkdirSync(dest, { recursive: true, mode: 448 });
5025
5191
  for (const file of ["events.jsonl", "status.json", "task.txt"]) {
5026
- const src = path15.join(runDirectory, file);
5027
- if (fs14.existsSync(src)) fs14.copyFileSync(src, path15.join(dest, file));
5192
+ const src = path16.join(runDirectory, file);
5193
+ if (fs15.existsSync(src)) fs15.copyFileSync(src, path16.join(dest, file));
5028
5194
  }
5029
- const nested = path15.join(runDirectory, "nested");
5030
- if (fs14.existsSync(nested)) {
5195
+ const nested = path16.join(runDirectory, "nested");
5196
+ if (fs15.existsSync(nested)) {
5031
5197
  try {
5032
- fs14.cpSync(nested, path15.join(dest, "nested"), { recursive: true });
5198
+ fs15.cpSync(nested, path16.join(dest, "nested"), { recursive: true });
5033
5199
  } catch {
5034
5200
  }
5035
5201
  }
@@ -5037,16 +5203,16 @@ var ActorLogStore = class {
5037
5203
  }
5038
5204
  pruneRuns(actor, now = Date.now()) {
5039
5205
  pruneActorRunArchives({
5040
- runsDirectory: path15.join(path15.dirname(actor.sessionFile), "runs"),
5206
+ runsDirectory: path16.join(path16.dirname(actor.sessionFile), "runs"),
5041
5207
  ...actor.lastRunId ? { latestRunId: actor.lastRunId } : {},
5042
5208
  retentionMs: this.retention.actorRunArchiveMs,
5043
5209
  now
5044
5210
  });
5045
5211
  }
5046
5212
  retainedRunIds(actor) {
5047
- const runsDir = path15.join(path15.dirname(actor.sessionFile), "runs");
5213
+ const runsDir = path16.join(path16.dirname(actor.sessionFile), "runs");
5048
5214
  try {
5049
- return fs14.readdirSync(runsDir).sort();
5215
+ return fs15.readdirSync(runsDir).sort();
5050
5216
  } catch {
5051
5217
  return [];
5052
5218
  }
@@ -5195,12 +5361,12 @@ var evaluateActorValidWhile = async (source, facts) => {
5195
5361
  };
5196
5362
 
5197
5363
  // src/actors/binding-store.ts
5198
- import { createHash, randomUUID as randomUUID5 } from "node:crypto";
5199
- import fs16 from "node:fs";
5200
- import path16 from "node:path";
5364
+ import { createHash, randomUUID as randomUUID7 } from "node:crypto";
5365
+ import fs17 from "node:fs";
5366
+ import path17 from "node:path";
5201
5367
 
5202
5368
  // src/actors/store-read.ts
5203
- import fs15 from "node:fs";
5369
+ import fs16 from "node:fs";
5204
5370
  var ActorStoreReadError = class extends Error {
5205
5371
  filePath;
5206
5372
  constructor(filePath, detail, options) {
@@ -5212,7 +5378,7 @@ var ActorStoreReadError = class extends Error {
5212
5378
  var readStoreJson = (filePath) => {
5213
5379
  let text;
5214
5380
  try {
5215
- text = fs15.readFileSync(filePath, "utf8");
5381
+ text = fs16.readFileSync(filePath, "utf8");
5216
5382
  } catch (error) {
5217
5383
  if (error?.code === "ENOENT") return void 0;
5218
5384
  throw new ActorStoreReadError(
@@ -5241,7 +5407,7 @@ var delay2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5241
5407
  var ActorBindingStore = class {
5242
5408
  constructor(sessionId, root) {
5243
5409
  this.sessionId = sessionId;
5244
- this.filePath = root ? path16.join(root, "bindings", bindingFileName(sessionId)) : void 0;
5410
+ this.filePath = root ? path17.join(root, "bindings", bindingFileName(sessionId)) : void 0;
5245
5411
  this.#sync(true);
5246
5412
  }
5247
5413
  #bindings = /* @__PURE__ */ new Map();
@@ -5374,7 +5540,7 @@ var ActorBindingStore = class {
5374
5540
  #currentFingerprint() {
5375
5541
  if (!this.filePath) return void 0;
5376
5542
  try {
5377
- const stat = fs16.statSync(this.filePath);
5543
+ const stat = fs17.statSync(this.filePath);
5378
5544
  return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeMs}`;
5379
5545
  } catch {
5380
5546
  return void 0;
@@ -5384,7 +5550,7 @@ var ActorBindingStore = class {
5384
5550
  if (!this.filePath) return operation();
5385
5551
  const lockPath = `${this.filePath}.lock`;
5386
5552
  const deadline = Date.now() + BINDING_LOCK_TIMEOUT_MS;
5387
- const token = randomUUID5();
5553
+ const token = randomUUID7();
5388
5554
  const processAlive2 = (pid) => {
5389
5555
  if (!Number.isSafeInteger(pid) || pid <= 0) return false;
5390
5556
  try {
@@ -5394,7 +5560,7 @@ var ActorBindingStore = class {
5394
5560
  return false;
5395
5561
  }
5396
5562
  };
5397
- fs16.mkdirSync(path16.dirname(this.filePath), { recursive: true, mode: 448 });
5563
+ fs17.mkdirSync(path17.dirname(this.filePath), { recursive: true, mode: 448 });
5398
5564
  while (!tryAcquireShortLock(lockPath, formatShortLockOwner(token))) {
5399
5565
  if (reapStaleShortLock(lockPath, { staleMs: BINDING_STALE_LOCK_MS, legacyAlive: processAlive2 })) continue;
5400
5566
  if (Date.now() >= deadline) {
@@ -5411,9 +5577,9 @@ var ActorBindingStore = class {
5411
5577
  };
5412
5578
 
5413
5579
  // src/actors/registry-store.ts
5414
- import { randomUUID as randomUUID6 } from "node:crypto";
5415
- import fs17 from "node:fs";
5416
- import path17 from "node:path";
5580
+ import { randomUUID as randomUUID8 } from "node:crypto";
5581
+ import fs18 from "node:fs";
5582
+ import path18 from "node:path";
5417
5583
  import { setTimeout as delay3 } from "node:timers/promises";
5418
5584
  var ACTOR_REGISTRY_LOCK_TIMEOUT_MS = 5e3;
5419
5585
  var ACTOR_REGISTRY_STALE_LOCK_MS = 3e4;
@@ -5424,7 +5590,7 @@ var ActorRegistryStore = class {
5424
5590
  #actorRoot;
5425
5591
  constructor(actorRoot) {
5426
5592
  this.#actorRoot = actorRoot;
5427
- this.#registryPath = path17.join(actorRoot, "actors.json");
5593
+ this.#registryPath = path18.join(actorRoot, "actors.json");
5428
5594
  }
5429
5595
  /**
5430
5596
  * Every entry in actors.json, including entries without a valid identity, so
@@ -5448,7 +5614,7 @@ var ActorRegistryStore = class {
5448
5614
  async withLock(operation, signal) {
5449
5615
  const lockPath = `${this.#registryPath}.lock`;
5450
5616
  const deadline = Date.now() + ACTOR_REGISTRY_LOCK_TIMEOUT_MS;
5451
- const token = randomUUID6();
5617
+ const token = randomUUID8();
5452
5618
  const processAlive2 = (pid) => {
5453
5619
  if (!Number.isSafeInteger(pid) || pid <= 0) return false;
5454
5620
  try {
@@ -5458,7 +5624,7 @@ var ActorRegistryStore = class {
5458
5624
  return false;
5459
5625
  }
5460
5626
  };
5461
- fs17.mkdirSync(this.#actorRoot, { recursive: true, mode: 448 });
5627
+ fs18.mkdirSync(this.#actorRoot, { recursive: true, mode: 448 });
5462
5628
  signal?.throwIfAborted();
5463
5629
  while (!tryAcquireShortLock(lockPath, formatShortLockOwner(token))) {
5464
5630
  if (reapStaleShortLock(lockPath, { staleMs: ACTOR_REGISTRY_STALE_LOCK_MS, legacyAlive: processAlive2 })) continue;
@@ -5477,14 +5643,14 @@ var ActorRegistryStore = class {
5477
5643
  }
5478
5644
  fingerprint() {
5479
5645
  try {
5480
- const stat = fs17.statSync(this.#registryPath);
5646
+ const stat = fs18.statSync(this.#registryPath);
5481
5647
  return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeMs}`;
5482
5648
  } catch {
5483
5649
  return void 0;
5484
5650
  }
5485
5651
  }
5486
5652
  read() {
5487
- return JSON.parse(fs17.readFileSync(this.#registryPath, "utf8"));
5653
+ return JSON.parse(fs18.readFileSync(this.#registryPath, "utf8"));
5488
5654
  }
5489
5655
  /** Call within withLock for read-modify-write operations. */
5490
5656
  write(actors) {
@@ -5522,7 +5688,7 @@ var normalizeCapabilityRequirements = (requirements = []) => {
5522
5688
  };
5523
5689
  var readRunRecord = (filePath) => {
5524
5690
  try {
5525
- const parsed = JSON.parse(fs18.readFileSync(filePath, "utf8"));
5691
+ const parsed = JSON.parse(fs19.readFileSync(filePath, "utf8"));
5526
5692
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
5527
5693
  return parsed;
5528
5694
  } catch {
@@ -5572,7 +5738,7 @@ var ActorManager = class {
5572
5738
  this.meshConfig = meshConfig;
5573
5739
  this.agents = agents;
5574
5740
  this.onDeliver = onDeliver;
5575
- this.#actorRoot = options.actorRoot ?? fs18.mkdtempSync(path18.join(os4.tmpdir(), "pi-fabric-actors-"));
5741
+ this.#actorRoot = options.actorRoot ?? fs19.mkdtempSync(path19.join(os4.tmpdir(), "pi-fabric-actors-"));
5576
5742
  this.#actorScope = options.actorScope ?? meshConfig.actorScope;
5577
5743
  this.#persistent = options.persistent ?? false;
5578
5744
  this.#mainAgent = options.mainAgent;
@@ -5744,8 +5910,8 @@ var ActorManager = class {
5744
5910
  throw new Error("This Fabric host cannot commit actor capability requirements");
5745
5911
  }
5746
5912
  const principalScope = launchScope(void 0, request.principalScope);
5747
- const id = randomUUID7().replaceAll("-", "");
5748
- const actorDirectory = path18.join(this.#actorRoot, id);
5913
+ const id = randomUUID9().replaceAll("-", "");
5914
+ const actorDirectory = path19.join(this.#actorRoot, id);
5749
5915
  const actor = {
5750
5916
  id,
5751
5917
  name,
@@ -5772,14 +5938,14 @@ var ActorManager = class {
5772
5938
  ...request.validWhile ? { validWhile: structuredClone(request.validWhile) } : {},
5773
5939
  ...principalScope ? { principalScope } : {},
5774
5940
  latestActivationSequence: 0,
5775
- sessionFile: path18.join(actorDirectory, "session.jsonl"),
5941
+ sessionFile: path19.join(actorDirectory, "session.jsonl"),
5776
5942
  queue: [],
5777
5943
  draining: false,
5778
5944
  messages: [],
5779
5945
  createdAt: Date.now(),
5780
5946
  updatedAt: Date.now()
5781
5947
  };
5782
- fs18.mkdirSync(actorDirectory, { recursive: true, mode: 448 });
5948
+ fs19.mkdirSync(actorDirectory, { recursive: true, mode: 448 });
5783
5949
  this.#actors.set(id, actor);
5784
5950
  this.#locallyCreated.add(id);
5785
5951
  this.#ownership.set(id, true);
@@ -6109,17 +6275,17 @@ var ActorManager = class {
6109
6275
  const type = opts.type ?? "session";
6110
6276
  const lines = Math.max(1, Math.min(opts.lines ?? 200, 5e3));
6111
6277
  const sessionFile = actor.sessionFile;
6112
- const logDir = path18.join(path18.dirname(sessionFile), "runs");
6278
+ const logDir = path19.join(path19.dirname(sessionFile), "runs");
6113
6279
  const sessionPage = type === "run" ? { lines: [], hasMore: false } : readJsonlPage(sessionFile, lines, opts.before);
6114
6280
  const session = sessionPage.lines;
6115
6281
  let run;
6116
6282
  if (type !== "session") {
6117
6283
  const targetRunId = opts.runId ?? actor.lastRunId;
6118
6284
  if (targetRunId) {
6119
- const runPath = path18.join(logDir, targetRunId);
6120
- if (fs18.existsSync(runPath)) {
6121
- const statusRecord = readRunRecord(path18.join(runPath, "status.json"));
6122
- const eventsFile = path18.join(runPath, "events.jsonl");
6285
+ const runPath = path19.join(logDir, targetRunId);
6286
+ if (fs19.existsSync(runPath)) {
6287
+ const statusRecord = readRunRecord(path19.join(runPath, "status.json"));
6288
+ const eventsFile = path19.join(runPath, "events.jsonl");
6123
6289
  const page = readJsonlPage(eventsFile, lines, opts.before);
6124
6290
  run = {
6125
6291
  runId: targetRunId,
@@ -6322,7 +6488,7 @@ var ActorManager = class {
6322
6488
  await this.#bindings.delete(actor.id);
6323
6489
  this.#actors.delete(actor.id);
6324
6490
  this.#emitChange();
6325
- fs18.rmSync(path18.dirname(actor.sessionFile), { recursive: true, force: true });
6491
+ fs19.rmSync(path19.dirname(actor.sessionFile), { recursive: true, force: true });
6326
6492
  await this.#saveActors(/* @__PURE__ */ new Set([actor.id]));
6327
6493
  await this.mesh.delete({ key: this.#presenceKey(actor.id) }).catch(() => ({ deleted: false }));
6328
6494
  if (retainedRunId) await this.agents.cleanup(retainedRunId).catch(() => ({ cleaned: false }));
@@ -6363,7 +6529,7 @@ var ActorManager = class {
6363
6529
  await Promise.allSettled(
6364
6530
  [...this.#actors.values()].map((actor) => actor.drain ?? Promise.resolve())
6365
6531
  );
6366
- fs18.rmSync(this.#actorRoot, { recursive: true, force: true });
6532
+ fs19.rmSync(this.#actorRoot, { recursive: true, force: true });
6367
6533
  }
6368
6534
  #enqueue(actor, source, payload, options = {}) {
6369
6535
  const canManage = options.ownershipChecked ? this.#canManageCached(actor.id) : this.#canManage(actor.id);
@@ -6406,7 +6572,7 @@ var ActorManager = class {
6406
6572
  `Fabric actor queue limit reached for ${actor.name} (${this.meshConfig.actorQueueLimit})`
6407
6573
  );
6408
6574
  }
6409
- const itemId = randomUUID7();
6575
+ const itemId = randomUUID9();
6410
6576
  const item = {
6411
6577
  id: itemId,
6412
6578
  source,
@@ -6526,7 +6692,7 @@ var ActorManager = class {
6526
6692
  if (actor.responseMode === "directive") {
6527
6693
  const reason = result.error || `Actor run ${result.status}`;
6528
6694
  const silent = {
6529
- id: randomUUID7(),
6695
+ id: randomUUID9(),
6530
6696
  actorId: actor.id,
6531
6697
  actorName: actor.name,
6532
6698
  direction: "out",
@@ -6592,7 +6758,7 @@ var ActorManager = class {
6592
6758
  }
6593
6759
  actor.lastError = message2;
6594
6760
  const failed = {
6595
- id: randomUUID7(),
6761
+ id: randomUUID9(),
6596
6762
  actorId: actor.id,
6597
6763
  actorName: actor.name,
6598
6764
  direction: "out",
@@ -6684,7 +6850,7 @@ var ActorManager = class {
6684
6850
  if (actor.responseMode === "directive") {
6685
6851
  const directive = asDirective(result);
6686
6852
  return {
6687
- id: randomUUID7(),
6853
+ id: randomUUID9(),
6688
6854
  actorId: actor.id,
6689
6855
  actorName: actor.name,
6690
6856
  direction: "out",
@@ -6698,7 +6864,7 @@ var ActorManager = class {
6698
6864
  };
6699
6865
  }
6700
6866
  return {
6701
- id: randomUUID7(),
6867
+ id: randomUUID9(),
6702
6868
  actorId: actor.id,
6703
6869
  actorName: actor.name,
6704
6870
  direction: "out",
@@ -6753,7 +6919,7 @@ var ActorManager = class {
6753
6919
  }
6754
6920
  #recordStale(actor, item, reason = "validWhile returned false", runId, usage) {
6755
6921
  const message2 = {
6756
- id: randomUUID7(),
6922
+ id: randomUUID9(),
6757
6923
  actorId: actor.id,
6758
6924
  actorName: actor.name,
6759
6925
  direction: "out",
@@ -7027,7 +7193,7 @@ var ActorManager = class {
7027
7193
  ...typeof record.model === "string" ? { model: record.model } : {},
7028
7194
  ...isFabricThinking(record.thinking) ? { thinking: record.thinking } : {},
7029
7195
  ...Array.isArray(record.tools) ? { tools: record.tools.filter((tool) => typeof tool === "string") } : {},
7030
- ...record.transport === "auto" || record.transport === "process" || record.transport === "tmux" || record.transport === "screen" || record.transport === "localterm" || record.transport === "herdr" ? { transport: record.transport } : {},
7196
+ ...record.transport === "auto" || record.transport === "process" || record.transport === "tmux" || record.transport === "screen" || record.transport === "localterm" || record.transport === "herdr" || record.transport === "herdr-core" ? { transport: record.transport } : {},
7031
7197
  ...typeof record.timeoutMs === "number" ? { timeoutMs: record.timeoutMs } : {},
7032
7198
  ...typeof record.extensions === "boolean" ? { extensions: record.extensions } : {},
7033
7199
  requirements,
@@ -7035,7 +7201,7 @@ var ActorManager = class {
7035
7201
  ...record.validWhile?.version === 1 && typeof record.validWhile.source === "string" ? { validWhile: record.validWhile } : {},
7036
7202
  ...principalScope ? { principalScope } : {},
7037
7203
  latestActivationSequence: 0,
7038
- sessionFile: path18.join(this.#actorRoot, record.id, "session.jsonl"),
7204
+ sessionFile: path19.join(this.#actorRoot, record.id, "session.jsonl"),
7039
7205
  queue: [],
7040
7206
  draining: false,
7041
7207
  messages: [],
@@ -7140,7 +7306,7 @@ var ActorManager = class {
7140
7306
  ...actor.lastRunId ? { lastRunId: actor.lastRunId } : {},
7141
7307
  ...actor.lastError ? { lastError: actor.lastError } : {},
7142
7308
  sessionFile: actor.sessionFile,
7143
- logDir: path18.join(path18.dirname(actor.sessionFile), "runs")
7309
+ logDir: path19.join(path19.dirname(actor.sessionFile), "runs")
7144
7310
  };
7145
7311
  }
7146
7312
  validateDirectMessage(message2, data) {
@@ -7347,10 +7513,10 @@ var ActorDirectory = class extends ActorManager {
7347
7513
  delete options.actorRoot;
7348
7514
  delete options.meshCursorPath;
7349
7515
  const cursorPaths = meshCursorPath ? { project: `${meshCursorPath}.project`, session: `${meshCursorPath}.session` } : void 0;
7350
- if (meshCursorPath && fs19.existsSync(meshCursorPath)) {
7516
+ if (meshCursorPath && fs20.existsSync(meshCursorPath)) {
7351
7517
  for (const cursorPath of Object.values(cursorPaths)) {
7352
7518
  try {
7353
- if (!fs19.existsSync(cursorPath)) fs19.copyFileSync(meshCursorPath, cursorPath);
7519
+ if (!fs20.existsSync(cursorPath)) fs20.copyFileSync(meshCursorPath, cursorPath);
7354
7520
  } catch {
7355
7521
  }
7356
7522
  }
@@ -7522,7 +7688,7 @@ var ActorDirectory = class extends ActorManager {
7522
7688
  };
7523
7689
 
7524
7690
  // src/lifecycle/broker.ts
7525
- import { randomUUID as randomUUID8 } from "node:crypto";
7691
+ import { randomUUID as randomUUID10 } from "node:crypto";
7526
7692
  var subscriptionKey = (id) => FABRIC_LIFECYCLE_SUBSCRIPTION_PREFIX + id;
7527
7693
  var LifecycleBroker = class {
7528
7694
  constructor(mesh, identity, participants, options, deliver) {
@@ -7601,7 +7767,7 @@ var LifecycleBroker = class {
7601
7767
  const now = Date.now();
7602
7768
  const subscription = {
7603
7769
  format: 1,
7604
- id: randomUUID8().replaceAll("-", ""),
7770
+ id: randomUUID10().replaceAll("-", ""),
7605
7771
  from,
7606
7772
  events,
7607
7773
  to,
@@ -7771,7 +7937,7 @@ var LifecycleBroker = class {
7771
7937
  };
7772
7938
 
7773
7939
  // src/topology/control-plane.ts
7774
- import { createHash as createHash2, randomUUID as randomUUID9 } from "node:crypto";
7940
+ import { createHash as createHash2, randomUUID as randomUUID11 } from "node:crypto";
7775
7941
  var CONTROL_TOPIC = "fabric.control.command";
7776
7942
  var ACK_TOPIC = "fabric.control.ack";
7777
7943
  var CONTROL_SEEN_PREFIX = "topology/control-seen/";
@@ -7819,7 +7985,7 @@ var FabricControlPlane = class {
7819
7985
  #activeHandlers = /* @__PURE__ */ new Set();
7820
7986
  #pollMs;
7821
7987
  #ackTimeoutMs;
7822
- #incarnation = randomUUID9();
7988
+ #incarnation = randomUUID11();
7823
7989
  #offset;
7824
7990
  #lastSequence;
7825
7991
  #timer;
@@ -7881,7 +8047,7 @@ var FabricControlPlane = class {
7881
8047
  this.#pollMs * 4,
7882
8048
  Math.min(MAX_CONTROL_TIMEOUT_MS, Math.floor(options.timeoutMs ?? this.#ackTimeoutMs))
7883
8049
  );
7884
- const commandId = randomUUID9();
8050
+ const commandId = randomUUID11();
7885
8051
  const requestedAt = Date.now();
7886
8052
  let pendingRequest;
7887
8053
  const acceptance = new Promise((resolve, reject) => {
@@ -7975,7 +8141,7 @@ var FabricControlPlane = class {
7975
8141
  to: pending.ownerHostId,
7976
8142
  data: {
7977
8143
  version: 1,
7978
- commandId: randomUUID9(),
8144
+ commandId: randomUUID11(),
7979
8145
  targetId: pending.targetId,
7980
8146
  operation: "cancel",
7981
8147
  cancelCommandId: commandId,
@@ -8275,7 +8441,8 @@ var transports = /* @__PURE__ */ new Set([
8275
8441
  "tmux",
8276
8442
  "screen",
8277
8443
  "localterm",
8278
- "herdr"
8444
+ "herdr",
8445
+ "herdr-core"
8279
8446
  ]);
8280
8447
  var capabilities = /* @__PURE__ */ new Set([
8281
8448
  "steer",
@@ -9015,4 +9182,4 @@ export {
9015
9182
  agentParticipantRecords,
9016
9183
  actorParticipantRecord
9017
9184
  };
9018
- //# sourceMappingURL=chunk-VNWQIGQL.js.map
9185
+ //# sourceMappingURL=chunk-JWERGULW.js.map