failproofai 1.0.4-beta.2 → 1.0.4-beta.6

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 (176) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  6. package/.next/standalone/.next/server/app/_global-error/page.js +2 -2
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  11. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
  12. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page.js +2 -2
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
  22. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/audit/run/route.js +1 -1
  25. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +5 -5
  33. package/.next/standalone/.next/server/app/audit/page.js +3 -3
  34. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/index.html +1 -1
  37. package/.next/standalone/.next/server/app/index.rsc +14 -14
  38. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
  39. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  40. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  41. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  42. package/.next/standalone/.next/server/app/page.js +2 -2
  43. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  45. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  46. package/.next/standalone/.next/server/app/policies/page.js +4 -4
  47. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  50. package/.next/standalone/.next/server/app/project/[name]/page.js +3 -3
  51. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  54. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  55. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +4 -4
  56. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  59. package/.next/standalone/.next/server/app/projects/page.js +3 -3
  60. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
  63. package/.next/standalone/.next/server/app/settings/page.js +2 -2
  64. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/chunks/{[externals]__1lh7m5d._.js → [externals]__0v1hz15._.js} +1 -1
  67. package/.next/standalone/.next/server/chunks/{[externals]__1rqkg_y._.js → [externals]__1nb206a._.js} +1 -1
  68. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rv7m0k._.js +1 -1
  70. package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1legmza._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1p-qi2t._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/{_08w6xzm._.js → _0otft92._.js} +2 -2
  74. package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
  75. package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +4 -4
  77. package/.next/standalone/.next/server/chunks/_1vslkoe._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0p-5p8u._.js → [root-of-the-server]__0-4ja6q._.js} +3 -3
  80. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1p2otjt._.js → [root-of-the-server]__00cr3xu._.js} +3 -3
  81. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__013jr2b._.js → [root-of-the-server]__04px77e._.js} +3 -3
  82. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__190won8._.js → [root-of-the-server]__0dxf928._.js} +1 -1
  83. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0s740oi._.js → [root-of-the-server]__0egr5s1._.js} +3 -3
  84. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__01wy8d-._.js → [root-of-the-server]__0i0l1di._.js} +3 -3
  85. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0n_lxhg._.js → [root-of-the-server]__0kokc8z._.js} +1 -1
  86. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1ctpynv._.js → [root-of-the-server]__0n2txhk._.js} +1 -1
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
  88. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02npjtd._.js → [root-of-the-server]__0r3c1_0._.js} +3 -3
  89. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ftmoxc._.js → [root-of-the-server]__17xnxlx._.js} +3 -3
  90. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0da85px._.js → [root-of-the-server]__1ckpmkk._.js} +3 -3
  91. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00-s7h8._.js → [root-of-the-server]__1fvfw59._.js} +1 -1
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ui5ur8._.js +3 -0
  93. package/.next/standalone/.next/server/chunks/ssr/_02b3i98._.js +23 -0
  94. package/.next/standalone/.next/server/chunks/ssr/{_0oq1dh6._.js → _04ng_6x._.js} +2 -2
  95. package/.next/standalone/.next/server/chunks/ssr/{_1u8-lu2._.js → _07t3jol._.js} +2 -2
  96. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/{_0h_douw._.js → _0s-77v5._.js} +1 -1
  98. package/.next/standalone/.next/server/chunks/ssr/_1_ozgif._.js +1 -1
  99. package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/_1es2j7i._.js +4 -1
  101. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
  102. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
  107. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  108. package/.next/standalone/.next/server/pages/404.html +1 -1
  109. package/.next/standalone/.next/server/pages/500.html +1 -1
  110. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/server-reference-manifest.json +22 -22
  112. package/.next/standalone/.next/static/chunks/{1pb1oztsbwcss.js → 07c6l1lq5_69b.js} +1 -1
  113. package/.next/standalone/.next/static/chunks/{0o-hh5_turzlz.css → 0jpd8dv2vk930.css} +1 -1
  114. package/.next/standalone/.next/static/chunks/{32spub4wqjem-.js → 12bsgz8czvcnn.js} +1 -1
  115. package/.next/standalone/.next/static/chunks/{3m4upvybtrexd.js → 1gn08w2pgqh09.js} +1 -1
  116. package/.next/standalone/.next/static/chunks/{010bv1w6j171t.js → 1xgq22tri86an.js} +1 -1
  117. package/.next/standalone/.next/static/chunks/{2aquitk72k2op.js → 20xkiqzvfkuvm.js} +1 -1
  118. package/.next/standalone/.next/static/chunks/{2bi_1y0a_smt7.js → 2a84ug32tzik2.js} +1 -1
  119. package/.next/standalone/.next/static/chunks/{2ej3b8gk5ittu.js → 32m2ryfankf_2.js} +1 -1
  120. package/.next/standalone/.next/static/chunks/3ioub_lpen-sq.js +1 -0
  121. package/.next/standalone/.next/static/chunks/{0wz8yftk18ts2.js → 3jxd133cw2vm3.js} +1 -1
  122. package/.next/standalone/.next/static/chunks/44ncu88eq6z71.js +1 -0
  123. package/.next/standalone/app/actions/get-leaks.ts +5 -1
  124. package/.next/standalone/app/actions/update-scheduled-audit.ts +4 -56
  125. package/.next/standalone/app/api/auth/status/route.ts +3 -2
  126. package/.next/standalone/app/audit/_components/audit-dashboard.tsx +29 -2
  127. package/.next/standalone/app/audit/_components/leak-section.tsx +15 -2
  128. package/.next/standalone/app/audit/audit-styles.css +18 -0
  129. package/.next/standalone/app/settings/page.tsx +1 -1
  130. package/.next/standalone/app/settings/settings-client.tsx +13 -39
  131. package/.next/standalone/lib/auth/api-server-client.ts +6 -6
  132. package/.next/standalone/lib/codex-sessions.ts +20 -4
  133. package/.next/standalone/lib/copilot-sessions.ts +32 -1
  134. package/.next/standalone/lib/cursor-sessions.ts +62 -5
  135. package/.next/standalone/lib/sqlite-reader.ts +78 -1
  136. package/.next/standalone/package.json +10 -10
  137. package/.next/standalone/server.js +1 -1
  138. package/bin/failproofai.mjs +1 -1
  139. package/dist/cli.mjs +1191 -1130
  140. package/dist/worker.mjs +198 -359
  141. package/lib/auth/api-server-client.ts +6 -6
  142. package/lib/codex-sessions.ts +20 -4
  143. package/lib/copilot-sessions.ts +32 -1
  144. package/lib/cursor-sessions.ts +62 -5
  145. package/lib/sqlite-reader.ts +78 -1
  146. package/package.json +10 -10
  147. package/pi-extension/index.ts +11 -4
  148. package/src/audit/cache.ts +6 -0
  149. package/src/audit/cli-adapters/claude.ts +13 -0
  150. package/src/audit/cli-login.ts +4 -1
  151. package/src/audit/cli.ts +67 -51
  152. package/src/audit/harm-report.ts +12 -6
  153. package/src/audit/index.ts +151 -8
  154. package/src/audit/leak-fingerprint.ts +2 -4
  155. package/src/audit/leak-record.ts +13 -9
  156. package/src/audit/leak-scan.ts +20 -44
  157. package/src/audit/leak-store.ts +5 -2
  158. package/src/audit/machine-store.ts +8 -9
  159. package/src/audit/macos-notifier.ts +2 -2
  160. package/src/audit/redact-example.ts +62 -5
  161. package/src/audit/report-harm.ts +31 -46
  162. package/src/audit/schedule-cli.ts +17 -33
  163. package/src/audit/types.ts +11 -0
  164. package/src/hooks/configure-wizard.ts +28 -0
  165. package/src/hooks/fp-config.ts +29 -54
  166. package/src/hooks/handler.ts +1 -59
  167. package/src/hooks/integrations.ts +4 -1
  168. package/src/hooks/notice.ts +23 -154
  169. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rgu2r3._.js +0 -3
  170. package/.next/standalone/.next/server/chunks/ssr/_0-oij9d._.js +0 -23
  171. package/.next/standalone/.next/static/chunks/04r6ch8uf_n8m.js +0 -1
  172. package/.next/standalone/.next/static/chunks/0zebh1n9jkfbt.js +0 -1
  173. package/src/audit/leak-notice.ts +0 -161
  174. /package/.next/standalone/.next/static/{aKNv4Kmv98Xpwns0Xa-C- → aeM365dNTtUZOZvNkX8ba}/_buildManifest.js +0 -0
  175. /package/.next/standalone/.next/static/{aKNv4Kmv98Xpwns0Xa-C- → aeM365dNTtUZOZvNkX8ba}/_clientMiddlewareManifest.js +0 -0
  176. /package/.next/standalone/.next/static/{aKNv4Kmv98Xpwns0Xa-C- → aeM365dNTtUZOZvNkX8ba}/_ssgManifest.js +0 -0
package/dist/worker.mjs CHANGED
@@ -378,7 +378,7 @@ function failproofaiHome(home) {
378
378
  return resolve(home, ".failproofai");
379
379
  return process.env.FAILPROOFAI_HOME || resolve(homedir(), ".failproofai");
380
380
  }
381
- var LAYOUT_VERSION = 4, at = (...parts) => resolve(failproofaiHome(), ...parts), atHome = (home, ...parts) => home ? resolve(failproofaiHome(home), ...parts) : at(...parts), versionFile = (home) => atHome(home, "VERSION"), configFile = (home) => atHome(home, "config.json"), policiesDir = (home) => atHome(home, "policies"), customPoliciesDir, globalPolicyConfigFile = (home) => atHome(home, "policies-config.json"), cloudPoliciesDir = (home) => resolve(policiesDir(home), "cloud-policies"), packsDir = (home) => resolve(policiesDir(home), "packs"), packsInstalledFile = (home) => resolve(packsDir(home), "installed.json"), auditDir = (home) => atHome(home, "audit"), auditLeaksFile = (home) => resolve(auditDir(home), "leaks.json"), auditLeakIdentityFile = (home) => resolve(auditDir(home), "leak-identity.json"), hookActivityDir = (home) => atHome(home, "hook-activity"), stateDir = (home) => atHome(home, "state"), shimsDir = (home) => resolve(stateDir(home), "shims"), sessionPauseDir = () => resolve(stateDir(), "sessions"), telemetryIdFile = (home) => resolve(stateDir(home), "telemetry-id"), codexSessionPathsFile = (home) => resolve(stateDir(home), "codex-session-paths.json"), logsDir = (home) => atHome(home, "logs"), legacy;
381
+ var LAYOUT_VERSION = 4, at = (...parts) => resolve(failproofaiHome(), ...parts), atHome = (home, ...parts) => home ? resolve(failproofaiHome(home), ...parts) : at(...parts), versionFile = (home) => atHome(home, "VERSION"), configFile = (home) => atHome(home, "config.json"), policiesDir = (home) => atHome(home, "policies"), customPoliciesDir, globalPolicyConfigFile = (home) => atHome(home, "policies-config.json"), cloudPoliciesDir = (home) => resolve(policiesDir(home), "cloud-policies"), packsDir = (home) => resolve(policiesDir(home), "packs"), packsInstalledFile = (home) => resolve(packsDir(home), "installed.json"), hookActivityDir = (home) => atHome(home, "hook-activity"), stateDir = (home) => atHome(home, "state"), shimsDir = (home) => resolve(stateDir(home), "shims"), sessionPauseDir = () => resolve(stateDir(), "sessions"), telemetryIdFile = (home) => resolve(stateDir(home), "telemetry-id"), codexSessionPathsFile = (home) => resolve(stateDir(home), "codex-session-paths.json"), logsDir = (home) => atHome(home, "logs"), legacy;
382
382
  var init_fp_home = __esm(() => {
383
383
  customPoliciesDir = policiesDir;
384
384
  legacy = {
@@ -3507,7 +3507,7 @@ function parsePackPolicyName(canonicalName) {
3507
3507
  }
3508
3508
 
3509
3509
  // package.json
3510
- var version = "1.0.4-beta.2";
3510
+ var version = "1.0.4-beta.6";
3511
3511
  var init_package = () => {};
3512
3512
 
3513
3513
  // src/posthog-key.ts
@@ -5211,234 +5211,6 @@ var init_delivery_health = __esm(() => {
5211
5211
  CREDENTIAL_STATUSES = new Set([401, 403]);
5212
5212
  });
5213
5213
 
5214
- // src/hooks/notice.ts
5215
- function shapeNotice(cli, notice, existingStdout = "") {
5216
- const empty = { stdout: existingStdout, stderr: "" };
5217
- if (!notice.trim() || !cli)
5218
- return empty;
5219
- const channel = NOTICE_CHANNEL[cli] ?? "none";
5220
- const text = notice.length > MAX_NOTICE_CHARS ? notice.slice(0, MAX_NOTICE_CHARS - 1) + "…" : notice;
5221
- switch (channel) {
5222
- case "systemMessage": {
5223
- if (existingStdout.trim().startsWith("{")) {
5224
- try {
5225
- const parsed = JSON.parse(existingStdout);
5226
- parsed.systemMessage = text;
5227
- return { stdout: JSON.stringify(parsed), stderr: "" };
5228
- } catch {
5229
- return empty;
5230
- }
5231
- }
5232
- if (existingStdout.trim())
5233
- return empty;
5234
- return { stdout: JSON.stringify({ systemMessage: text }), stderr: "" };
5235
- }
5236
- case "stderr":
5237
- return { stdout: existingStdout, stderr: text + `
5238
- ` };
5239
- case "stdout":
5240
- if (existingStdout.trim())
5241
- return empty;
5242
- return { stdout: text + `
5243
- `, stderr: "" };
5244
- default:
5245
- return empty;
5246
- }
5247
- }
5248
- function canDeliverNotice(cli) {
5249
- return !!cli && (NOTICE_CHANNEL[cli] ?? "none") !== "none";
5250
- }
5251
- function leakNoticeText(newFindings) {
5252
- const n = newFindings === 1 ? "a credential" : `${newFindings} credentials`;
5253
- return `failproofai found ${n} in this project's agent transcripts.
5254
- ` + "Run `failproofai audit` to see the details, " + "or `failproofai audit --schedule` to get these by email.";
5255
- }
5256
- var NOTICE_CHANNEL, MAX_NOTICE_CHARS = 900;
5257
- var init_notice = __esm(() => {
5258
- NOTICE_CHANNEL = {
5259
- claude: "systemMessage",
5260
- codex: "systemMessage",
5261
- copilot: "stderr",
5262
- factory: "stdout"
5263
- };
5264
- });
5265
-
5266
- // lib/atomic-write.ts
5267
- import {
5268
- chmodSync as chmodSync2,
5269
- existsSync as existsSync8,
5270
- mkdirSync as mkdirSync5,
5271
- renameSync as renameSync3,
5272
- rmSync as rmSync2,
5273
- statSync as statSync6,
5274
- writeFileSync as writeFileSync4
5275
- } from "node:fs";
5276
- import { dirname as dirname3 } from "node:path";
5277
- import { randomBytes } from "node:crypto";
5278
- function writeJsonAtomically(filePath, value, opts = {}) {
5279
- const mode = opts.mode ?? 384;
5280
- const dirMode = opts.dirMode ?? 448;
5281
- const dir = dirname3(filePath);
5282
- if (!existsSync8(dir))
5283
- mkdirSync5(dir, { recursive: true, mode: dirMode });
5284
- const tmp = `${filePath}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
5285
- try {
5286
- writeFileSync4(tmp, JSON.stringify(value, null, 2), { mode });
5287
- try {
5288
- if ((statSync6(tmp).mode & 63) !== 0)
5289
- chmodSync2(tmp, mode);
5290
- } catch {}
5291
- renameSync3(tmp, filePath);
5292
- try {
5293
- if ((statSync6(filePath).mode & 63) !== 0)
5294
- chmodSync2(filePath, mode);
5295
- } catch {}
5296
- } catch (err) {
5297
- try {
5298
- rmSync2(tmp, { force: true });
5299
- } catch {}
5300
- throw err;
5301
- }
5302
- }
5303
- var init_atomic_write = () => {};
5304
-
5305
- // src/audit/leak-record.ts
5306
- function emptyRecord(salt, nowIso) {
5307
- return {
5308
- schemaVersion: LEAK_RECORD_SCHEMA_VERSION,
5309
- salt,
5310
- updatedAt: nowIso,
5311
- findings: []
5312
- };
5313
- }
5314
- var LEAK_RECORD_SCHEMA_VERSION = 1;
5315
-
5316
- // src/audit/leak-fingerprint.ts
5317
- function isFindingId(id) {
5318
- return /^[0-9a-f]{16}$/.test(id);
5319
- }
5320
- var init_leak_fingerprint = () => {};
5321
-
5322
- // src/audit/leak-store.ts
5323
- import { randomBytes as randomBytes2 } from "node:crypto";
5324
- import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync6 } from "node:fs";
5325
- import { dirname as dirname4 } from "node:path";
5326
- function readJson(path) {
5327
- try {
5328
- if (!existsSync9(path))
5329
- return null;
5330
- return JSON.parse(readFileSync6(path, "utf8"));
5331
- } catch {
5332
- return null;
5333
- }
5334
- }
5335
- function readLeakIdentity(home) {
5336
- const existing = readJson(auditLeakIdentityFile(home));
5337
- if (existing && typeof existing.salt === "string" && existing.salt.length >= 32) {
5338
- return { salt: existing.salt, dismissed: existing.dismissed ?? [] };
5339
- }
5340
- const minted = { salt: randomBytes2(32).toString("hex"), dismissed: [] };
5341
- writeLeakIdentity(minted, home);
5342
- return minted;
5343
- }
5344
- function writeLeakIdentity(identity, home) {
5345
- const path = auditLeakIdentityFile(home);
5346
- try {
5347
- mkdirSync6(dirname4(path), { recursive: true });
5348
- writeJsonAtomically(path, identity, { mode: FILE_MODE });
5349
- return true;
5350
- } catch {
5351
- return false;
5352
- }
5353
- }
5354
- function sanitizeFinding(raw) {
5355
- if (!raw || typeof raw !== "object" || Array.isArray(raw))
5356
- return null;
5357
- const f = raw;
5358
- if (typeof f.id !== "string" || !isFindingId(f.id))
5359
- return null;
5360
- const fp = f.fingerprint;
5361
- if (!fp || typeof fp !== "object" || typeof fp.display !== "string" || typeof fp.label !== "string") {
5362
- return null;
5363
- }
5364
- const sightings = Array.isArray(f.sightings) ? f.sightings.filter((s) => {
5365
- if (!s || typeof s !== "object")
5366
- return false;
5367
- const m = s.mechanism;
5368
- return !!m && typeof m === "object" && typeof m.summary === "string";
5369
- }) : [];
5370
- return {
5371
- ...f,
5372
- fingerprint: {
5373
- display: fp.display,
5374
- label: fp.label,
5375
- length: typeof fp.length === "number" && Number.isFinite(fp.length) ? fp.length : 0,
5376
- attributed: fp.attributed === true
5377
- },
5378
- name: typeof f.name === "string" ? f.name : null,
5379
- firstSeen: typeof f.firstSeen === "string" ? f.firstSeen : "",
5380
- lastSeen: typeof f.lastSeen === "string" ? f.lastSeen : "",
5381
- occurrences: typeof f.occurrences === "number" && Number.isFinite(f.occurrences) ? f.occurrences : sightings.length,
5382
- sightings
5383
- };
5384
- }
5385
- function readLeakRecord(home) {
5386
- const identity = readLeakIdentity(home);
5387
- const raw = readJson(auditLeaksFile(home));
5388
- if (!raw || raw.schemaVersion !== LEAK_RECORD_SCHEMA_VERSION || !Array.isArray(raw.findings)) {
5389
- return emptyRecord(identity.salt, new Date().toISOString());
5390
- }
5391
- const findings = raw.findings.map(sanitizeFinding).filter((f) => f !== null);
5392
- return { ...raw, findings, salt: identity.salt };
5393
- }
5394
- function activeFindings(record, home) {
5395
- const dismissed = new Set(readLeakIdentity(home).dismissed);
5396
- return record.findings.filter((f) => !dismissed.has(f.id)).sort((a, b) => a.lastSeen < b.lastSeen ? 1 : a.lastSeen > b.lastSeen ? -1 : 0);
5397
- }
5398
- var FILE_MODE = 384;
5399
- var init_leak_store = __esm(() => {
5400
- init_fp_home();
5401
- init_atomic_write();
5402
- init_leak_fingerprint();
5403
- });
5404
-
5405
- // src/audit/leak-notice.ts
5406
- import { existsSync as existsSync10, mkdirSync as mkdirSync7, readdirSync as readdirSync3, statSync as statSync7, writeFileSync as writeFileSync5, rmSync as rmSync3 } from "node:fs";
5407
- import { resolve as resolve8 } from "node:path";
5408
- function pendingLeakNotice(home, channel = "cli") {
5409
- try {
5410
- const dir = NOTICE_DIR(home, channel);
5411
- const claimed = new Set(existsSync10(dir) ? readdirSync3(dir) : []);
5412
- const ids = activeFindings(readLeakRecord(home), home).map((f) => f.id).filter((id) => !claimed.has(id));
5413
- return { ids, count: ids.length };
5414
- } catch {
5415
- return { ids: [], count: 0 };
5416
- }
5417
- }
5418
- function markLeakNoticeDelivered(ids, home, channel = "cli") {
5419
- const won = [];
5420
- try {
5421
- const dir = NOTICE_DIR(home, channel);
5422
- mkdirSync7(dir, { recursive: true });
5423
- for (const id of ids) {
5424
- if (!isFindingId(id))
5425
- continue;
5426
- try {
5427
- writeFileSync5(resolve8(dir, id), "", { flag: "wx", mode: 384 });
5428
- won.push(id);
5429
- } catch {}
5430
- }
5431
- } catch {}
5432
- return won;
5433
- }
5434
- var NOTICE_DIR = (home, channel = "cli") => resolve8(auditDir(home), channel === "cli" ? "notified" : `notified-${channel}`), MARKER_TTL_MS;
5435
- var init_leak_notice = __esm(() => {
5436
- init_fp_home();
5437
- init_leak_store();
5438
- init_leak_fingerprint();
5439
- MARKER_TTL_MS = 120 * 86400000;
5440
- });
5441
-
5442
5214
  // src/hooks/resolve-cwd.ts
5443
5215
  function resolveCwd(integration, parsed) {
5444
5216
  const direct = typeof parsed.cwd === "string" && parsed.cwd.length > 0 ? parsed.cwd : undefined;
@@ -6128,10 +5900,23 @@ var init_cursor_projects = __esm(() => {
6128
5900
  });
6129
5901
 
6130
5902
  // lib/sqlite-reader.ts
6131
- import { existsSync as existsSync11, readFileSync as readFileSync7 } from "node:fs";
5903
+ import { existsSync as existsSync8, readFileSync as readFileSync6 } from "node:fs";
6132
5904
  import initSqlJs from "sql.js/dist/sql-asm.js";
5905
+ function silenceSqliteExperimentalWarning() {
5906
+ if (warningPatched)
5907
+ return;
5908
+ warningPatched = true;
5909
+ const original = process.emitWarning.bind(process);
5910
+ process.emitWarning = (warning, ...rest) => {
5911
+ const text = typeof warning === "string" ? warning : String(warning?.message ?? "");
5912
+ if (text.includes("SQLite is an experimental feature"))
5913
+ return;
5914
+ return original(warning, ...rest);
5915
+ };
5916
+ }
6133
5917
  async function tryNodeSqlite(dbPath) {
6134
5918
  try {
5919
+ silenceSqliteExperimentalWarning();
6135
5920
  const mod = await import("node:sqlite");
6136
5921
  const db = new mod.DatabaseSync(dbPath, { readOnly: true });
6137
5922
  return {
@@ -6152,10 +5937,21 @@ function loadSqlJs() {
6152
5937
  sqlPromise = initSqlJs();
6153
5938
  return sqlPromise;
6154
5939
  }
5940
+ function clearWalFlag(bytes) {
5941
+ if (bytes.length < 20)
5942
+ return bytes;
5943
+ if (bytes.toString("latin1", 0, 16) !== SQLITE_MAGIC)
5944
+ return bytes;
5945
+ if (bytes[18] === 1 && bytes[19] === 1)
5946
+ return bytes;
5947
+ bytes[18] = 1;
5948
+ bytes[19] = 1;
5949
+ return bytes;
5950
+ }
6155
5951
  async function trySqlJs(dbPath) {
6156
5952
  try {
6157
5953
  const SQL = await loadSqlJs();
6158
- const db = new SQL.Database(readFileSync7(dbPath));
5954
+ const db = new SQL.Database(clearWalFlag(readFileSync6(dbPath)));
6159
5955
  return {
6160
5956
  query(sql, params) {
6161
5957
  const stmt = db.prepare(sql);
@@ -6179,11 +5975,11 @@ async function trySqlJs(dbPath) {
6179
5975
  }
6180
5976
  }
6181
5977
  async function openSqliteReadonly(dbPath) {
6182
- if (!existsSync11(dbPath))
5978
+ if (!existsSync8(dbPath))
6183
5979
  return null;
6184
5980
  return await tryNodeSqlite(dbPath) ?? await trySqlJs(dbPath);
6185
5981
  }
6186
- var sqlPromise = null;
5982
+ var warningPatched = false, sqlPromise = null, SQLITE_MAGIC = "SQLite format 3\x00";
6187
5983
  var init_sqlite_reader = () => {};
6188
5984
 
6189
5985
  // lib/opencode-db.ts
@@ -6514,16 +6310,16 @@ var init_pi_projects = __esm(() => {
6514
6310
  });
6515
6311
 
6516
6312
  // lib/hermes-profiles.ts
6517
- import { readdirSync as readdirSync4 } from "node:fs";
6313
+ import { readdirSync as readdirSync3 } from "node:fs";
6518
6314
  import { homedir as homedir10 } from "node:os";
6519
- import { basename as basename2, dirname as dirname5, join as join11, resolve as resolve9 } from "node:path";
6315
+ import { basename as basename2, dirname as dirname3, join as join11, resolve as resolve8 } from "node:path";
6520
6316
  function hermesRoot() {
6521
6317
  const env = (process.env.HERMES_HOME || "").trim();
6522
6318
  if (env) {
6523
- const home = resolve9(env);
6524
- const parent = dirname5(home);
6319
+ const home = resolve8(env);
6320
+ const parent = dirname3(home);
6525
6321
  if (basename2(parent) === PROFILES_DIR)
6526
- return dirname5(parent);
6322
+ return dirname3(parent);
6527
6323
  return home;
6528
6324
  }
6529
6325
  return join11(homedir10(), ".hermes");
@@ -6534,7 +6330,7 @@ function listHermesProfiles() {
6534
6330
  const seen = new Set([HERMES_DEFAULT_PROFILE]);
6535
6331
  let names;
6536
6332
  try {
6537
- names = readdirSync4(join11(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
6333
+ names = readdirSync3(join11(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
6538
6334
  } catch {
6539
6335
  return out;
6540
6336
  }
@@ -6892,7 +6688,7 @@ var init_hermes_projects = __esm(() => {
6892
6688
 
6893
6689
  // lib/openclaw-sessions.ts
6894
6690
  import { readFile as readFile7 } from "node:fs/promises";
6895
- import { readdirSync as readdirSync5, statSync as statSync8 } from "node:fs";
6691
+ import { readdirSync as readdirSync4, statSync as statSync6 } from "node:fs";
6896
6692
  import { homedir as homedir11 } from "node:os";
6897
6693
  import { join as join13 } from "node:path";
6898
6694
  function openclawHome() {
@@ -7011,7 +6807,7 @@ function openclawLinesToLogEntries(lines, source = "session") {
7011
6807
  }
7012
6808
  function listOpenClawAgents() {
7013
6809
  try {
7014
- return readdirSync5(join13(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
6810
+ return readdirSync4(join13(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
7015
6811
  } catch {
7016
6812
  return [];
7017
6813
  }
@@ -7021,7 +6817,7 @@ function listOpenClawTranscripts() {
7021
6817
  const out = [];
7022
6818
  let agentIds;
7023
6819
  try {
7024
- agentIds = readdirSync5(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
6820
+ agentIds = readdirSync4(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
7025
6821
  } catch {
7026
6822
  return out;
7027
6823
  }
@@ -7029,7 +6825,7 @@ function listOpenClawTranscripts() {
7029
6825
  const sessionsDir = join13(agentsDir, agentId, "sessions");
7030
6826
  let files;
7031
6827
  try {
7032
- files = readdirSync5(sessionsDir);
6828
+ files = readdirSync4(sessionsDir);
7033
6829
  } catch {
7034
6830
  continue;
7035
6831
  }
@@ -7041,7 +6837,7 @@ function listOpenClawTranscripts() {
7041
6837
  continue;
7042
6838
  const transcriptPath = join13(sessionsDir, file);
7043
6839
  try {
7044
- const st = statSync8(transcriptPath);
6840
+ const st = statSync6(transcriptPath);
7045
6841
  out.push({ agentId, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
7046
6842
  } catch {}
7047
6843
  }
@@ -7090,7 +6886,7 @@ var exports_openclaw_projects = {};
7090
6886
  __export(exports_openclaw_projects, {
7091
6887
  getOpenClawProjects: () => getOpenClawProjects
7092
6888
  });
7093
- import { readFileSync as readFileSync8 } from "node:fs";
6889
+ import { readFileSync as readFileSync7 } from "node:fs";
7094
6890
  import { join as join14 } from "node:path";
7095
6891
  function str(v) {
7096
6892
  return typeof v === "string" && v.length > 0 ? v : undefined;
@@ -7100,7 +6896,7 @@ function readSessionsIndex(agentId) {
7100
6896
  const indexPath = join14(openclawHome(), "agents", agentId, "sessions", "sessions.json");
7101
6897
  let raw;
7102
6898
  try {
7103
- raw = JSON.parse(readFileSync8(indexPath, "utf-8"));
6899
+ raw = JSON.parse(readFileSync7(indexPath, "utf-8"));
7104
6900
  } catch {
7105
6901
  return out;
7106
6902
  }
@@ -7249,7 +7045,7 @@ var init_openclaw_projects = __esm(() => {
7249
7045
 
7250
7046
  // lib/factory-sessions.ts
7251
7047
  import { readFile as readFile8 } from "node:fs/promises";
7252
- import { readdirSync as readdirSync6, statSync as statSync9 } from "node:fs";
7048
+ import { readdirSync as readdirSync5, statSync as statSync7 } from "node:fs";
7253
7049
  import { homedir as homedir12 } from "node:os";
7254
7050
  import { join as join15 } from "node:path";
7255
7051
  function factoryHome() {
@@ -7395,7 +7191,7 @@ function listFactoryTranscripts() {
7395
7191
  const out = [];
7396
7192
  let projectDirs;
7397
7193
  try {
7398
- projectDirs = readdirSync6(root, { withFileTypes: true }).filter((d) => d.isDirectory());
7194
+ projectDirs = readdirSync5(root, { withFileTypes: true }).filter((d) => d.isDirectory());
7399
7195
  } catch {
7400
7196
  return out;
7401
7197
  }
@@ -7405,7 +7201,7 @@ function listFactoryTranscripts() {
7405
7201
  const projectPath = join15(root, projectName);
7406
7202
  let files;
7407
7203
  try {
7408
- files = readdirSync6(projectPath);
7204
+ files = readdirSync5(projectPath);
7409
7205
  } catch {
7410
7206
  continue;
7411
7207
  }
@@ -7417,7 +7213,7 @@ function listFactoryTranscripts() {
7417
7213
  continue;
7418
7214
  const transcriptPath = join15(projectPath, file);
7419
7215
  try {
7420
- const st = statSync9(transcriptPath);
7216
+ const st = statSync7(transcriptPath);
7421
7217
  out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
7422
7218
  } catch {}
7423
7219
  }
@@ -7836,7 +7632,7 @@ var init_devin_projects = __esm(() => {
7836
7632
 
7837
7633
  // lib/antigravity-sessions.ts
7838
7634
  import { readFile as readFile9 } from "node:fs/promises";
7839
- import { readdirSync as readdirSync7, statSync as statSync10 } from "node:fs";
7635
+ import { readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
7840
7636
  import { homedir as homedir14 } from "node:os";
7841
7637
  import { join as join17 } from "node:path";
7842
7638
  function antigravityHome() {
@@ -7961,7 +7757,7 @@ function listAntigravityTranscripts() {
7961
7757
  const out = [];
7962
7758
  let convoDirs;
7963
7759
  try {
7964
- convoDirs = readdirSync7(root, { withFileTypes: true }).filter((d) => d.isDirectory());
7760
+ convoDirs = readdirSync6(root, { withFileTypes: true }).filter((d) => d.isDirectory());
7965
7761
  } catch {
7966
7762
  return out;
7967
7763
  }
@@ -7971,7 +7767,7 @@ function listAntigravityTranscripts() {
7971
7767
  continue;
7972
7768
  const transcriptPath = join17(root, conversationId, rel);
7973
7769
  try {
7974
- const st = statSync10(transcriptPath);
7770
+ const st = statSync8(transcriptPath);
7975
7771
  if (!st.isFile())
7976
7772
  continue;
7977
7773
  out.push({ conversationId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
@@ -7984,7 +7780,7 @@ function findAntigravityTranscript(conversationId) {
7984
7780
  return null;
7985
7781
  const transcriptPath = join17(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
7986
7782
  try {
7987
- if (statSync10(transcriptPath).isFile())
7783
+ if (statSync8(transcriptPath).isFile())
7988
7784
  return transcriptPath;
7989
7785
  } catch {}
7990
7786
  return null;
@@ -8434,7 +8230,7 @@ var init_goose_projects = __esm(() => {
8434
8230
 
8435
8231
  // lib/projects.ts
8436
8232
  import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
8437
- import { join as join20, resolve as resolve10, sep } from "node:path";
8233
+ import { join as join20, resolve as resolve9, sep } from "node:path";
8438
8234
  async function getMtime(path, label) {
8439
8235
  try {
8440
8236
  return (await stat4(path)).mtime;
@@ -8586,8 +8382,8 @@ function resolveProjectPath(projectName) {
8586
8382
  throw new RangeError("Empty project name");
8587
8383
  if (/^[/\\]/.test(projectName))
8588
8384
  throw new RangeError("Absolute project name");
8589
- const projectsPath = resolve10(getClaudeProjectsPath());
8590
- const candidate = resolve10(join20(projectsPath, projectName));
8385
+ const projectsPath = resolve9(getClaudeProjectsPath());
8386
+ const candidate = resolve9(join20(projectsPath, projectName));
8591
8387
  if (!candidate.startsWith(projectsPath + sep)) {
8592
8388
  throw new RangeError("Project path escapes root");
8593
8389
  }
@@ -8893,30 +8689,30 @@ var init_log_entries = __esm(() => {
8893
8689
  });
8894
8690
 
8895
8691
  // lib/codex-sessions.ts
8896
- import { readFileSync as readFileSync9, readdirSync as readdirSync8, existsSync as existsSync12, writeFileSync as writeFileSync6, mkdirSync as mkdirSync8, statSync as statSync11 } from "node:fs";
8692
+ import { readFileSync as readFileSync8, readdirSync as readdirSync7, existsSync as existsSync9, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5, statSync as statSync9 } from "node:fs";
8897
8693
  import { readFile as readFile11 } from "node:fs/promises";
8898
- import { dirname as dirname6, join as join23 } from "node:path";
8694
+ import { dirname as dirname4, join as join23 } from "node:path";
8899
8695
  import { homedir as homedir16 } from "node:os";
8900
8696
  function readCache() {
8901
8697
  try {
8902
- if (!existsSync12(CACHE_PATH))
8698
+ if (!existsSync9(CACHE_PATH))
8903
8699
  return {};
8904
- return JSON.parse(readFileSync9(CACHE_PATH, "utf-8"));
8700
+ return JSON.parse(readFileSync8(CACHE_PATH, "utf-8"));
8905
8701
  } catch {
8906
8702
  return {};
8907
8703
  }
8908
8704
  }
8909
8705
  function writeCacheEntry(sessionId, path) {
8910
8706
  try {
8911
- mkdirSync8(dirname6(CACHE_PATH), { recursive: true });
8707
+ mkdirSync5(dirname4(CACHE_PATH), { recursive: true });
8912
8708
  const cache = readCache();
8913
8709
  cache[sessionId] = path;
8914
- writeFileSync6(CACHE_PATH, JSON.stringify(cache), "utf-8");
8710
+ writeFileSync4(CACHE_PATH, JSON.stringify(cache), "utf-8");
8915
8711
  } catch {}
8916
8712
  }
8917
8713
  function dirSearch(dir, sessionId) {
8918
8714
  try {
8919
- for (const f of readdirSync8(dir, { withFileTypes: true })) {
8715
+ for (const f of readdirSync7(dir, { withFileTypes: true })) {
8920
8716
  if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
8921
8717
  return join23(dir, f.name);
8922
8718
  }
@@ -8927,7 +8723,7 @@ function dirSearch(dir, sessionId) {
8927
8723
  function findCodexTranscript(sessionId) {
8928
8724
  const cache = readCache();
8929
8725
  const cached = cache[sessionId];
8930
- if (cached && existsSync12(cached))
8726
+ if (cached && existsSync9(cached))
8931
8727
  return cached;
8932
8728
  const root = join23(homedir16(), ".codex", "sessions");
8933
8729
  const today = new Date;
@@ -8946,13 +8742,13 @@ function findCodexTranscript(sessionId) {
8946
8742
  }
8947
8743
  }
8948
8744
  try {
8949
- for (const y of readdirSync8(root, { withFileTypes: true })) {
8745
+ for (const y of readdirSync7(root, { withFileTypes: true })) {
8950
8746
  if (!y.isDirectory())
8951
8747
  continue;
8952
- for (const m of readdirSync8(join23(root, y.name), { withFileTypes: true })) {
8748
+ for (const m of readdirSync7(join23(root, y.name), { withFileTypes: true })) {
8953
8749
  if (!m.isDirectory())
8954
8750
  continue;
8955
- for (const d of readdirSync8(join23(root, y.name, m.name), { withFileTypes: true })) {
8751
+ for (const d of readdirSync7(join23(root, y.name, m.name), { withFileTypes: true })) {
8956
8752
  if (!d.isDirectory())
8957
8753
  continue;
8958
8754
  const hit = dirSearch(join23(root, y.name, m.name, d.name), sessionId);
@@ -8981,6 +8777,15 @@ function joinTexts(blocks, wantedType) {
8981
8777
  return blocks.filter((b) => b?.type === wantedType && typeof b.text === "string").map((b) => b.text).join(`
8982
8778
  `);
8983
8779
  }
8780
+ function toolOutputText(output) {
8781
+ if (typeof output === "string")
8782
+ return output;
8783
+ if (Array.isArray(output)) {
8784
+ return output.filter((block) => !!block && typeof block === "object").map((block) => typeof block.text === "string" ? block.text : "").filter(Boolean).join(`
8785
+ `);
8786
+ }
8787
+ return output === undefined ? "" : JSON.stringify(output);
8788
+ }
8984
8789
  async function parseCodexLog(fileContent, source = "session") {
8985
8790
  const lines = fileContent.split(`
8986
8791
  `).filter((line) => line.trim() !== "");
@@ -9057,10 +8862,11 @@ async function parseCodexLog(fileContent, source = "session") {
9057
8862
  });
9058
8863
  continue;
9059
8864
  }
9060
- if (subType === "function_call") {
8865
+ if (subType === "function_call" || subType === "custom_tool_call") {
9061
8866
  const callId = payload.call_id;
9062
8867
  const name = payload.name ?? "function_call";
9063
- const input = safeJsonParse4(payload.arguments);
8868
+ const encodedInput = payload.arguments ?? payload.input;
8869
+ const input = safeJsonParse4(encodedInput);
9064
8870
  const toolUse = {
9065
8871
  type: "tool_use",
9066
8872
  id: callId ?? `${timestamp}-${name}`,
@@ -9079,7 +8885,7 @@ async function parseCodexLog(fileContent, source = "session") {
9079
8885
  }
9080
8886
  continue;
9081
8887
  }
9082
- if (subType === "function_call_output") {
8888
+ if (subType === "function_call_output" || subType === "custom_tool_call_output") {
9083
8889
  const callId = payload.call_id;
9084
8890
  const block = callId ? toolUseById.get(callId) : undefined;
9085
8891
  if (block) {
@@ -9088,7 +8894,7 @@ async function parseCodexLog(fileContent, source = "session") {
9088
8894
  block.result = {
9089
8895
  timestamp,
9090
8896
  timestampFormatted: formatTimestamp(date),
9091
- content: typeof payload.output === "string" ? payload.output : JSON.stringify(payload.output),
8897
+ content: toolOutputText(payload.output),
9092
8898
  durationMs: duration,
9093
8899
  durationFormatted: formatDuration(duration)
9094
8900
  };
@@ -9181,7 +8987,7 @@ var init_codex_sessions = __esm(() => {
9181
8987
  });
9182
8988
 
9183
8989
  // src/hooks/resolve-permission-mode.ts
9184
- import { readFileSync as readFileSync10 } from "node:fs";
8990
+ import { readFileSync as readFileSync9 } from "node:fs";
9185
8991
  function resolvePermissionMode(integration, parsed, sessionId) {
9186
8992
  if (integration === "claude") {
9187
8993
  return parsed.permission_mode ?? "default";
@@ -9196,7 +9002,7 @@ function resolveCodexMode(sessionId) {
9196
9002
  const path = findCodexTranscript(sessionId);
9197
9003
  if (!path)
9198
9004
  return;
9199
- for (const line of readFileSync10(path, "utf-8").split(`
9005
+ for (const line of readFileSync9(path, "utf-8").split(`
9200
9006
  `)) {
9201
9007
  if (!line.includes("turn_context"))
9202
9008
  continue;
@@ -9221,9 +9027,9 @@ var init_resolve_permission_mode = __esm(() => {
9221
9027
  });
9222
9028
 
9223
9029
  // lib/copilot-sessions.ts
9224
- import { readFileSync as readFileSync11, readdirSync as readdirSync9, existsSync as existsSync13, statSync as statSync12 } from "node:fs";
9030
+ import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync10, statSync as statSync10 } from "node:fs";
9225
9031
  import { readFile as readFile12 } from "node:fs/promises";
9226
- import { join as join24, resolve as resolve11, sep as sep2 } from "node:path";
9032
+ import { join as join24, resolve as resolve10, sep as sep2 } from "node:path";
9227
9033
  import { homedir as homedir17 } from "node:os";
9228
9034
  function getCopilotHome() {
9229
9035
  return process.env.COPILOT_HOME || join24(homedir17(), ".copilot");
@@ -9234,8 +9040,8 @@ function getCopilotSessionStateRoot2() {
9234
9040
  function getCopilotSessionDir(sessionId) {
9235
9041
  if (!sessionId)
9236
9042
  return null;
9237
- const root = resolve11(getCopilotSessionStateRoot2());
9238
- const candidate = resolve11(root, sessionId);
9043
+ const root = resolve10(getCopilotSessionStateRoot2());
9044
+ const candidate = resolve10(root, sessionId);
9239
9045
  if (candidate === root || !candidate.startsWith(`${root}${sep2}`))
9240
9046
  return null;
9241
9047
  return candidate;
@@ -9250,17 +9056,17 @@ function findCopilotTranscript(sessionId) {
9250
9056
  const candidate = resolveSessionFile(sessionId, "events.jsonl");
9251
9057
  if (!candidate)
9252
9058
  return null;
9253
- return existsSync13(candidate) ? candidate : null;
9059
+ return existsSync10(candidate) ? candidate : null;
9254
9060
  }
9255
9061
  function findCopilotWorkspace(sessionId) {
9256
9062
  const candidate = resolveSessionFile(sessionId, "workspace.yaml");
9257
9063
  if (!candidate)
9258
9064
  return null;
9259
- return existsSync13(candidate) ? candidate : null;
9065
+ return existsSync10(candidate) ? candidate : null;
9260
9066
  }
9261
9067
  function readYamlScalar(path, key) {
9262
9068
  try {
9263
- const text = readFileSync11(path, "utf-8");
9069
+ const text = readFileSync10(path, "utf-8");
9264
9070
  const re = new RegExp(`^${key}\\s*:\\s*(.+?)\\s*$`, "m");
9265
9071
  const m = text.match(re);
9266
9072
  if (!m)
@@ -9283,6 +9089,8 @@ async function parseCopilotLog(fileContent, source = "session") {
9283
9089
  const rawLines = [];
9284
9090
  const toolUseById = new Map;
9285
9091
  const toolUseStartMs = new Map;
9092
+ let mostRecentToolUse;
9093
+ let mostRecentToolUseStartMs = 0;
9286
9094
  let cwd;
9287
9095
  let seenSessionStart = false;
9288
9096
  for (let i = 0;i < lines.length; i++) {
@@ -9378,8 +9186,24 @@ async function parseCopilotLog(fileContent, source = "session") {
9378
9186
  toolUseById.set(callId, toolUse);
9379
9187
  toolUseStartMs.set(callId, date.getTime());
9380
9188
  }
9189
+ mostRecentToolUse = toolUse;
9190
+ mostRecentToolUseStartMs = date.getTime();
9381
9191
  continue;
9382
9192
  }
9193
+ if (recType === "hook.start" && data.hookType === "postToolUse" && mostRecentToolUse) {
9194
+ const input = data.input ?? {};
9195
+ const hookResult = input.toolResult ?? {};
9196
+ const hookContent = hookResult.textResultForLlm ?? hookResult.sessionLog;
9197
+ if (typeof hookContent === "string" && hookContent.length > 0) {
9198
+ mostRecentToolUse.result = {
9199
+ timestamp,
9200
+ timestampFormatted: formatTimestamp(date),
9201
+ content: hookContent,
9202
+ durationMs: Math.max(0, date.getTime() - mostRecentToolUseStartMs),
9203
+ durationFormatted: formatDuration(Math.max(0, date.getTime() - mostRecentToolUseStartMs))
9204
+ };
9205
+ }
9206
+ }
9383
9207
  if (recType === "tool.execution_complete") {
9384
9208
  const callId = data.toolCallId;
9385
9209
  const block = callId ? toolUseById.get(callId) : undefined;
@@ -9389,7 +9213,8 @@ async function parseCopilotLog(fileContent, source = "session") {
9389
9213
  const telemetry = data.toolTelemetry ?? {};
9390
9214
  const reportedMs = telemetry.metrics?.commandTimeMs ?? telemetry.metrics?.durationMs ?? null;
9391
9215
  const durationMs = typeof reportedMs === "number" && reportedMs >= 0 ? reportedMs : Math.max(0, date.getTime() - startMs);
9392
- const content = result.detailedContent ?? result.content ?? "";
9216
+ const completionContent = result.detailedContent ?? result.content ?? "";
9217
+ const content = block.result?.content || completionContent;
9393
9218
  block.result = {
9394
9219
  timestamp,
9395
9220
  timestampFormatted: formatTimestamp(date),
@@ -9438,9 +9263,9 @@ var init_copilot_sessions = __esm(() => {
9438
9263
  });
9439
9264
 
9440
9265
  // lib/cursor-sessions.ts
9441
- import { readFileSync as readFileSync12, readdirSync as readdirSync10, existsSync as existsSync14, statSync as statSync13 } from "node:fs";
9266
+ import { readFileSync as readFileSync11, readdirSync as readdirSync9, existsSync as existsSync11, statSync as statSync11 } from "node:fs";
9442
9267
  import { readFile as readFile13 } from "node:fs/promises";
9443
- import { basename as basename3, join as join25, resolve as resolve12, sep as sep3 } from "node:path";
9268
+ import { basename as basename3, join as join25, resolve as resolve11, sep as sep3 } from "node:path";
9444
9269
  import { homedir as homedir18 } from "node:os";
9445
9270
  function getCursorHome2() {
9446
9271
  return process.env.CURSOR_HOME || join25(homedir18(), ".cursor");
@@ -9448,28 +9273,28 @@ function getCursorHome2() {
9448
9273
  function getCursorSessionDir(sessionId) {
9449
9274
  if (!sessionId)
9450
9275
  return null;
9451
- const home = resolve12(getCursorHome2());
9452
- const projectsRoot = resolve12(home, NEW_PROJECTS_DIR2);
9276
+ const home = resolve11(getCursorHome2());
9277
+ const projectsRoot = resolve11(home, NEW_PROJECTS_DIR2);
9453
9278
  let projectEntries = [];
9454
9279
  try {
9455
- projectEntries = readdirSync10(projectsRoot, { withFileTypes: true });
9280
+ projectEntries = readdirSync9(projectsRoot, { withFileTypes: true });
9456
9281
  } catch {}
9457
9282
  for (const entry of projectEntries) {
9458
9283
  if (!entry.isDirectory())
9459
9284
  continue;
9460
- const candidate = resolve12(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2, sessionId);
9461
- const transcriptRoot = resolve12(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2);
9285
+ const candidate = resolve11(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2, sessionId);
9286
+ const transcriptRoot = resolve11(projectsRoot, entry.name, NEW_AGENT_TRANSCRIPTS_DIR2);
9462
9287
  if (candidate === transcriptRoot || !candidate.startsWith(`${transcriptRoot}${sep3}`))
9463
9288
  continue;
9464
- if (existsSync14(candidate))
9289
+ if (existsSync11(candidate))
9465
9290
  return candidate;
9466
9291
  }
9467
9292
  for (const sub of LEGACY_SESSION_ROOT_CANDIDATES2) {
9468
- const root = resolve12(home, sub);
9469
- const candidate = resolve12(root, sessionId);
9293
+ const root = resolve11(home, sub);
9294
+ const candidate = resolve11(root, sessionId);
9470
9295
  if (candidate === root || !candidate.startsWith(`${root}${sep3}`))
9471
9296
  continue;
9472
- if (existsSync14(candidate))
9297
+ if (existsSync11(candidate))
9473
9298
  return candidate;
9474
9299
  }
9475
9300
  return null;
@@ -9479,11 +9304,11 @@ function findCursorTranscript(sessionId) {
9479
9304
  if (!dir)
9480
9305
  return null;
9481
9306
  const newCandidate = join25(dir, `${basename3(dir)}.jsonl`);
9482
- if (existsSync14(newCandidate))
9307
+ if (existsSync11(newCandidate))
9483
9308
  return newCandidate;
9484
9309
  for (const name of LEGACY_TRANSCRIPT_FILE_CANDIDATES2) {
9485
9310
  const candidate = join25(dir, name);
9486
- if (existsSync14(candidate))
9311
+ if (existsSync11(candidate))
9487
9312
  return candidate;
9488
9313
  }
9489
9314
  return null;
@@ -9513,8 +9338,27 @@ async function parseCursorLog(fileContent, source = "session") {
9513
9338
  if (!raw.type && raw.role && raw.message?.content) {
9514
9339
  const synthDate = new Date(SYNTH_T0 + i);
9515
9340
  const synthTs = synthDate.toISOString();
9516
- const textParts = raw.message.content.filter((c) => c?.type === "text" && typeof c.text === "string").map((c) => c.text).join("");
9341
+ const messageContent = raw.message.content;
9342
+ const textParts = messageContent.filter((c) => c?.type === "text" && typeof c.text === "string").map((c) => c.text).join("");
9517
9343
  if (raw.role === "user") {
9344
+ let attachedResult = false;
9345
+ for (const block of messageContent) {
9346
+ if (block?.type !== "tool_result")
9347
+ continue;
9348
+ const callId = typeof block.tool_use_id === "string" ? block.tool_use_id : undefined;
9349
+ const toolUse = callId ? toolUseById.get(callId) : undefined;
9350
+ if (!toolUse)
9351
+ continue;
9352
+ const durationMs = Math.max(0, synthDate.getTime() - (toolUseStartMs.get(callId) ?? synthDate.getTime()));
9353
+ toolUse.result = {
9354
+ timestamp: synthTs,
9355
+ timestampFormatted: formatTimestamp(synthDate),
9356
+ content: typeof block.content === "string" ? block.content : block.content == null ? "" : JSON.stringify(block.content),
9357
+ durationMs,
9358
+ durationFormatted: formatDuration(durationMs)
9359
+ };
9360
+ attachedResult = true;
9361
+ }
9518
9362
  const queryMatch = /<user_query>\s*([\s\S]*?)\s*<\/user_query>/.exec(textParts);
9519
9363
  const text = queryMatch ? queryMatch[1] : textParts;
9520
9364
  if (text) {
@@ -9523,11 +9367,35 @@ async function parseCursorLog(fileContent, source = "session") {
9523
9367
  ...baseEntry(rawCopy, synthTs, synthDate, source),
9524
9368
  message: { role: "user", content: text }
9525
9369
  });
9370
+ } else if (!attachedResult) {
9371
+ entries.push({
9372
+ type: "system",
9373
+ ...baseEntry(rawCopy, synthTs, synthDate, source),
9374
+ raw: rawCopy
9375
+ });
9526
9376
  }
9527
9377
  continue;
9528
9378
  }
9529
9379
  if (raw.role === "assistant") {
9530
- const blocks = textParts ? [{ type: "text", text: textParts }] : [];
9380
+ const blocks = [];
9381
+ if (textParts)
9382
+ blocks.push({ type: "text", text: textParts });
9383
+ for (let j = 0;j < messageContent.length; j++) {
9384
+ const contentBlock = messageContent[j];
9385
+ if (contentBlock?.type !== "tool_use")
9386
+ continue;
9387
+ const name = typeof contentBlock.name === "string" ? contentBlock.name : "tool";
9388
+ const id = typeof contentBlock.id === "string" && contentBlock.id ? contentBlock.id : `cursor-${i}-${name}-${j}`;
9389
+ const toolUse = {
9390
+ type: "tool_use",
9391
+ id,
9392
+ name,
9393
+ input: contentBlock.input && typeof contentBlock.input === "object" ? contentBlock.input : {}
9394
+ };
9395
+ blocks.push(toolUse);
9396
+ toolUseById.set(id, toolUse);
9397
+ toolUseStartMs.set(id, synthDate.getTime());
9398
+ }
9531
9399
  if (blocks.length === 0) {
9532
9400
  entries.push({
9533
9401
  type: "system",
@@ -9694,9 +9562,9 @@ var init_cursor_sessions = __esm(() => {
9694
9562
  });
9695
9563
 
9696
9564
  // lib/pi-sessions.ts
9697
- import { readFileSync as readFileSync13, readdirSync as readdirSync11, existsSync as existsSync15, statSync as statSync14 } from "node:fs";
9565
+ import { readFileSync as readFileSync12, readdirSync as readdirSync10, existsSync as existsSync12, statSync as statSync12 } from "node:fs";
9698
9566
  import { readFile as readFile14 } from "node:fs/promises";
9699
- import { join as join26, resolve as resolve13, sep as sep4 } from "node:path";
9567
+ import { join as join26, resolve as resolve12, sep as sep4 } from "node:path";
9700
9568
  import { homedir as homedir19 } from "node:os";
9701
9569
  function getPiSessionStateRoot() {
9702
9570
  return process.env.PI_SESSIONS_DIR || join26(homedir19(), ".pi", "agent", "sessions");
@@ -9707,20 +9575,20 @@ function isSafeSessionId(sessionId) {
9707
9575
  function findPiTranscript(sessionId) {
9708
9576
  if (!isSafeSessionId(sessionId))
9709
9577
  return null;
9710
- const root = resolve13(getPiSessionStateRoot());
9578
+ const root = resolve12(getPiSessionStateRoot());
9711
9579
  let cwdDirs;
9712
9580
  try {
9713
- cwdDirs = readdirSync11(root);
9581
+ cwdDirs = readdirSync10(root);
9714
9582
  } catch {
9715
9583
  return null;
9716
9584
  }
9717
9585
  for (const cwdDir of cwdDirs) {
9718
- const cwdPath = resolve13(root, cwdDir);
9586
+ const cwdPath = resolve12(root, cwdDir);
9719
9587
  if (!cwdPath.startsWith(`${root}${sep4}`))
9720
9588
  continue;
9721
9589
  let files;
9722
9590
  try {
9723
- files = readdirSync11(cwdPath);
9591
+ files = readdirSync10(cwdPath);
9724
9592
  } catch {
9725
9593
  continue;
9726
9594
  }
@@ -9728,10 +9596,10 @@ function findPiTranscript(sessionId) {
9728
9596
  const m = SESSION_FILE_RE2.exec(f);
9729
9597
  if (!m || m[1].toLowerCase() !== sessionId.toLowerCase())
9730
9598
  continue;
9731
- const candidate = resolve13(cwdPath, f);
9599
+ const candidate = resolve12(cwdPath, f);
9732
9600
  if (!candidate.startsWith(`${cwdPath}${sep4}`))
9733
9601
  continue;
9734
- if (existsSync15(candidate))
9602
+ if (existsSync12(candidate))
9735
9603
  return candidate;
9736
9604
  }
9737
9605
  }
@@ -10087,14 +9955,17 @@ var init_pack_failclosed = __esm(() => {
10087
9955
  ]);
10088
9956
  });
10089
9957
 
9958
+ // lib/atomic-write.ts
9959
+ var init_atomic_write = () => {};
9960
+
10090
9961
  // src/hooks/session-pause.ts
10091
- import { existsSync as existsSync16, mkdirSync as mkdirSync9, readdirSync as readdirSync12, readFileSync as readFileSync14, rmSync as rmSync4 } from "node:fs";
9962
+ import { existsSync as existsSync13, mkdirSync as mkdirSync6, readdirSync as readdirSync11, readFileSync as readFileSync13, rmSync as rmSync2 } from "node:fs";
10092
9963
  import { createHash as createHash5 } from "node:crypto";
10093
- import { join as join27, resolve as resolve14 } from "node:path";
9964
+ import { join as join27, resolve as resolve13 } from "node:path";
10094
9965
  function pauseStateDir() {
10095
9966
  const override = process.env.FAILPROOFAI_STATE_DIR;
10096
9967
  if (override)
10097
- return resolve14(override, "sessions");
9968
+ return resolve13(override, "sessions");
10098
9969
  return sessionPauseDir();
10099
9970
  }
10100
9971
  function pauseFilePath(sessionId) {
@@ -10128,9 +9999,9 @@ function readActivePause(sessionId, now = Date.now()) {
10128
9999
  return null;
10129
10000
  try {
10130
10001
  const path = pauseFilePath(sessionId);
10131
- if (!existsSync16(path))
10002
+ if (!existsSync13(path))
10132
10003
  return null;
10133
- const stored = parseStored(JSON.parse(readFileSync14(path, "utf8")));
10004
+ const stored = parseStored(JSON.parse(readFileSync13(path, "utf8")));
10134
10005
  if (!stored)
10135
10006
  return null;
10136
10007
  if (stored.expiresAt <= now)
@@ -10169,15 +10040,15 @@ var init_daemon_service = __esm(() => {
10169
10040
  // src/hooks/fp-reset.ts
10170
10041
  import {
10171
10042
  copyFileSync,
10172
- existsSync as existsSync17,
10173
- mkdirSync as mkdirSync10,
10174
- readFileSync as readFileSync15,
10175
- readdirSync as readdirSync13,
10176
- renameSync as renameSync4,
10177
- rmSync as rmSync5,
10043
+ existsSync as existsSync14,
10044
+ mkdirSync as mkdirSync7,
10045
+ readFileSync as readFileSync14,
10046
+ readdirSync as readdirSync12,
10047
+ renameSync as renameSync3,
10048
+ rmSync as rmSync3,
10178
10049
  rmdirSync,
10179
- statSync as statSync15,
10180
- writeFileSync as writeFileSync7
10050
+ statSync as statSync13,
10051
+ writeFileSync as writeFileSync5
10181
10052
  } from "node:fs";
10182
10053
  function layoutWarningForHook() {
10183
10054
  const state = detectLayout();
@@ -10186,7 +10057,7 @@ function layoutWarningForHook() {
10186
10057
  if (state.kind === "future") {
10187
10058
  return `[failproofai] this directory was written by a newer version (layout ${state.found} vs ${LAYOUT_VERSION}) — policies are NOT being enforced. ` + `Upgrade failproofai.`;
10188
10059
  }
10189
- if (existsSync17(globalPolicyConfigFile()))
10060
+ if (existsSync14(globalPolicyConfigFile()))
10190
10061
  return null;
10191
10062
  return `[failproofai] setup predates this version — global policies are NOT being enforced. ` + `Run \`failproofai config\` to re-create it.`;
10192
10063
  }
@@ -10231,31 +10102,6 @@ function canonicalizeEventType(raw, cli) {
10231
10102
  }
10232
10103
  return raw;
10233
10104
  }
10234
- function attachLeakNotice(eventType, cli, outcome) {
10235
- try {
10236
- if (!canDeliverNotice(cli))
10237
- return outcome;
10238
- if (!cli)
10239
- return outcome;
10240
- const canonical = canonicalizeEventType(eventType, cli);
10241
- if (canonical !== "Stop" && canonical !== "SessionStart")
10242
- return outcome;
10243
- const pending = pendingLeakNotice();
10244
- if (pending.count === 0)
10245
- return outcome;
10246
- const shaped = shapeNotice(cli, leakNoticeText(pending.count), outcome.stdout);
10247
- if (shaped.stdout === outcome.stdout && !shaped.stderr)
10248
- return outcome;
10249
- markLeakNoticeDelivered(pending.ids);
10250
- return {
10251
- exitCode: outcome.exitCode,
10252
- stdout: shaped.stdout,
10253
- stderr: outcome.stderr + shaped.stderr
10254
- };
10255
- } catch {
10256
- return outcome;
10257
- }
10258
- }
10259
10105
  async function runObserved(hook, ctx, hookName, eventType, cli) {
10260
10106
  try {
10261
10107
  return await Promise.race([
@@ -10558,12 +10404,7 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
10558
10404
  }
10559
10405
  } catch {}
10560
10406
  }
10561
- const withNotice = attachLeakNotice(eventType, cli, {
10562
- exitCode: result.exitCode,
10563
- stdout: result.stdout,
10564
- stderr: result.stderr
10565
- });
10566
- return withNotice;
10407
+ return { exitCode: result.exitCode, stdout: result.stdout, stderr: result.stderr };
10567
10408
  } finally {
10568
10409
  if (opts?.awaitTelemetryFlush ?? true) {
10569
10410
  await flushHookTelemetry();
@@ -10579,8 +10420,6 @@ var init_handler = __esm(() => {
10579
10420
  init_custom_hooks_loader();
10580
10421
  init_hook_activity_store();
10581
10422
  init_delivery_health();
10582
- init_notice();
10583
- init_leak_notice();
10584
10423
  init_hook_telemetry();
10585
10424
  init_resolve_permission_mode();
10586
10425
  init_resolve_transcript_path();
@@ -10595,7 +10434,7 @@ var init_handler = __esm(() => {
10595
10434
 
10596
10435
  // src/hooks/worker-server.ts
10597
10436
  import { createConnection, createServer } from "node:net";
10598
- import { existsSync as existsSync18, unlinkSync as unlinkSync2 } from "node:fs";
10437
+ import { existsSync as existsSync15, unlinkSync as unlinkSync2 } from "node:fs";
10599
10438
  function isWorkerHookRequest(msg) {
10600
10439
  if (!msg || typeof msg !== "object")
10601
10440
  return false;
@@ -10728,14 +10567,14 @@ function requestExistingWorkerShutdown(socketPath) {
10728
10567
  function startWorkerServer(socketPath, shutdown) {
10729
10568
  const server = createServer((socket) => handleConnection(socket, shutdown ?? (() => server.close())));
10730
10569
  const listen = () => {
10731
- if (existsSync18(socketPath)) {
10570
+ if (existsSync15(socketPath)) {
10732
10571
  try {
10733
10572
  unlinkSync2(socketPath);
10734
10573
  } catch {}
10735
10574
  }
10736
10575
  server.listen(socketPath);
10737
10576
  };
10738
- if (!existsSync18(socketPath))
10577
+ if (!existsSync15(socketPath))
10739
10578
  listen();
10740
10579
  else
10741
10580
  requestExistingWorkerShutdown(socketPath).then(listen, (err) => server.emit("error", err));
@@ -10751,13 +10590,13 @@ var init_worker_server = __esm(() => {
10751
10590
 
10752
10591
  // bin/failproofai-worker.mjs
10753
10592
  import { realpathSync as realpathSync2 } from "node:fs";
10754
- import { dirname as dirname7, resolve as resolve15 } from "node:path";
10593
+ import { dirname as dirname5, resolve as resolve14 } from "node:path";
10755
10594
  import { fileURLToPath } from "node:url";
10756
10595
  if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
10757
- process.env.FAILPROOFAI_PACKAGE_ROOT = resolve15(dirname7(realpathSync2(fileURLToPath(import.meta.url))), "..");
10596
+ process.env.FAILPROOFAI_PACKAGE_ROOT = resolve14(dirname5(realpathSync2(fileURLToPath(import.meta.url))), "..");
10758
10597
  }
10759
10598
  if (!process.env.FAILPROOFAI_DIST_PATH) {
10760
- process.env.FAILPROOFAI_DIST_PATH = resolve15(dirname7(realpathSync2(fileURLToPath(import.meta.url))), "..", "dist");
10599
+ process.env.FAILPROOFAI_DIST_PATH = resolve14(dirname5(realpathSync2(fileURLToPath(import.meta.url))), "..", "dist");
10761
10600
  }
10762
10601
  var socketPath = process.env.FAILPROOFAI_WORKER_SOCKET;
10763
10602
  if (!socketPath) {