failproofai 1.0.13-beta.1 → 1.0.13-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) 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.nft.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +2 -2
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
  18. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  20. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  30. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/index.html +1 -1
  33. package/.next/standalone/.next/server/app/index.rsc +3 -3
  34. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  35. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  36. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  37. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  38. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  41. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  44. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  47. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  48. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  51. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
  54. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +1 -1
  57. package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +1 -1
  58. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4vkpxxu7._.js +1 -1
  59. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +1 -1
  60. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +1 -1
  61. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +1 -1
  62. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +1 -1
  63. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +1 -1
  64. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +1 -1
  65. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +1 -1
  66. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0mhtkwwx1pxcq._.js → [root-of-the-server]__19nvo1qfswchs._.js} +2 -2
  67. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +1 -1
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +1 -1
  69. package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +1 -1
  70. package/.next/standalone/.next/server/chunks/ssr/_0ouu886szh6yj._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/ssr/{_0bc4f4quq6w47._.js → _1nvqg4si0splb._.js} +2 -2
  74. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +2 -2
  75. package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +1 -1
  76. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js +1 -1
  77. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +1 -1
  80. package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1jwgv0pf-gy96.js → node_modules_html-to-image_es_index_1gk40bvx2bftt.js} +1 -1
  81. package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +1 -1
  82. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  83. package/.next/standalone/.next/server/pages/404.html +1 -1
  84. package/.next/standalone/.next/server/pages/500.html +1 -1
  85. package/.next/standalone/.next/server/preview-props.json +3 -3
  86. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
  88. package/.next/standalone/.next/static/chunks/{2n-bzb7pxe7hu.js → 061bksch79zq2.js} +1 -1
  89. package/.next/standalone/.next/static/chunks/{38u_i3j5funpi.js → 1l9lji2he-mbw.js} +1 -1
  90. package/.next/standalone/.next/static/chunks/{3vzut6zpdrvtx.js → 1mkf3bas1g5ka.js} +1 -1
  91. package/.next/standalone/.next/static/chunks/{0u5weo5jdn2s8.js → 22gs9785ug-vp.js} +1 -1
  92. package/.next/standalone/.next/static/chunks/{18-icoqze51kl.js → 2f9-xdgd1o3r5.js} +1 -1
  93. package/.next/standalone/.next/static/chunks/{2zc7lg-jq353g.js → 2q-6h4rclnu98.js} +1 -1
  94. package/.next/standalone/.next/static/chunks/{33djjf12bhcsv.js → 2x-77r0k0xm3b.js} +1 -1
  95. package/.next/standalone/.next/static/chunks/{3symuj7t4js-c.js → 2xox4fr0q-ftn.js} +1 -1
  96. package/.next/standalone/.next/static/chunks/{0cbom4-ijx_a_.js → 3lgxb73wehfv2.js} +1 -1
  97. package/.next/standalone/.next/static/chunks/{2d-u90dt4-8rd.js → 44rukkkzacqkl.js} +2 -2
  98. package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
  99. package/.next/standalone/package.json +9 -9
  100. package/.next/standalone/sdk/python/uv.lock +3 -3
  101. package/.next/standalone/server.js +1 -1
  102. package/dist/cli.mjs +368 -221
  103. package/dist/worker.mjs +1 -1
  104. package/hermes-plugin/plugin.yaml +1 -1
  105. package/openclaw-plugin/index.js +211 -17
  106. package/package.json +9 -9
  107. package/src/hooks/daemon-service.ts +168 -3
  108. package/src/hooks/enforcement-capability.ts +1 -1
  109. package/src/hooks/integrations.ts +2 -5
  110. package/src/hooks/uninstall-cli.ts +3 -0
  111. package/openclaw-plugin/daemon-client.js +0 -254
  112. package/openclaw-plugin/hooks.js +0 -187
  113. /package/.next/standalone/.next/static/{1n2dyfTQb0MDajeqlipJy → TdOlUedz_AHC-0Ops67a_}/_buildManifest.js +0 -0
  114. /package/.next/standalone/.next/static/{1n2dyfTQb0MDajeqlipJy → TdOlUedz_AHC-0Ops67a_}/_clientMiddlewareManifest.js +0 -0
  115. /package/.next/standalone/.next/static/{1n2dyfTQb0MDajeqlipJy → TdOlUedz_AHC-0Ops67a_}/_ssgManifest.js +0 -0
package/dist/cli.mjs CHANGED
@@ -29,7 +29,7 @@ var __esm = (fn, res, err) => () => {
29
29
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
30
 
31
31
  // package.json
32
- var version2 = "1.0.13-beta.1", package_default;
32
+ var version2 = "1.0.13-beta.2", package_default;
33
33
  var init_package = __esm(() => {
34
34
  package_default = {
35
35
  name: "failproofai",
@@ -159,16 +159,16 @@ var init_package = __esm(() => {
159
159
  browserslist: "4.28.8"
160
160
  },
161
161
  optionalDependencies: {
162
- "@failproofai/failproofaid-linux-x64": "1.0.13-beta.1",
163
- "@failproofai/failproofaid-linux-arm64": "1.0.13-beta.1",
164
- "@failproofai/failproofaid-darwin-x64": "1.0.13-beta.1",
165
- "@failproofai/failproofaid-darwin-arm64": "1.0.13-beta.1"
162
+ "@failproofai/failproofaid-linux-x64": "1.0.13-beta.2",
163
+ "@failproofai/failproofaid-linux-arm64": "1.0.13-beta.2",
164
+ "@failproofai/failproofaid-darwin-x64": "1.0.13-beta.2",
165
+ "@failproofai/failproofaid-darwin-arm64": "1.0.13-beta.2"
166
166
  },
167
167
  failproofaidBinaries: {
168
- "linux-x64": "d257e616d9f5a7ab76ceabbc7ac918e29555034458468697929fb6d109e35f3f",
169
- "linux-arm64": "583d8e0c5cdae34bb0b2083fd1c8448d06a927ad4ca9ee6978127b54eecb27a0",
170
- "darwin-x64": "68943a0b03c021f693f3c5f57acfc66d096bfd8bc7be57abff9ef826508de11a",
171
- "darwin-arm64": "49fa29ad396b85dccac135cf44ceaeb83efd3934471d86160f75b081fae04eae"
168
+ "linux-x64": "8301567948ddf752b6db30ed5998e62139df4c7e1669b280159a83a9b951b94c",
169
+ "linux-arm64": "ad53ec24d7c09b2dbc07b792c0739dc1e5f443fdb9a795174d3a40453f90bbcf",
170
+ "darwin-x64": "e4e65a1071a5793bafb73625dc49d211ff19d7e0d8c03c804959d1357aebea1e",
171
+ "darwin-arm64": "78aa90272e2ace07ac3648a419b961f8d8bfe56c7fd3a0193d3579085d77e9cb"
172
172
  }
173
173
  };
174
174
  });
@@ -13494,12 +13494,14 @@ import {
13494
13494
  mkdirSync as mkdirSync7,
13495
13495
  mkdtempSync,
13496
13496
  readFileSync as readFileSync7,
13497
+ readdirSync as readdirSync2,
13498
+ statSync as statSync10,
13497
13499
  writeFileSync as writeFileSync5,
13498
13500
  unlinkSync,
13499
13501
  rmSync as rmSync5
13500
13502
  } from "node:fs";
13501
13503
  import { homedir as homedir5, tmpdir, userInfo } from "node:os";
13502
- import { resolve as resolve8 } from "node:path";
13504
+ import { dirname as dirname7, resolve as resolve8 } from "node:path";
13503
13505
  import { execFileSync as execFileSync2 } from "node:child_process";
13504
13506
  function setDaemonConfigured(value, installedVersion) {
13505
13507
  try {
@@ -13611,6 +13613,63 @@ function systemdUnitDir() {
13611
13613
  function systemdUnitPath(user = serviceUser()) {
13612
13614
  return resolve8(systemdUnitDir(), systemdUnitName(user));
13613
13615
  }
13616
+ function systemBinaryRoot(user = serviceUser()) {
13617
+ return resolve8(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
13618
+ }
13619
+ function systemBinaryDir() {
13620
+ return resolve8(systemBinaryRoot(), "bin");
13621
+ }
13622
+ function daemonSystemBinaryDir() {
13623
+ return process.platform === "linux" ? systemBinaryRoot() : null;
13624
+ }
13625
+ function systemBinaryTarget(binaryPath) {
13626
+ if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY)
13627
+ return null;
13628
+ try {
13629
+ if (!statSync10(binaryPath).isFile())
13630
+ return null;
13631
+ } catch {
13632
+ return null;
13633
+ }
13634
+ return resolve8(systemBinaryDir(), `failproofaid-${version2}`);
13635
+ }
13636
+ function selinuxEnabled() {
13637
+ return existsSync11("/sys/fs/selinux/enforce");
13638
+ }
13639
+ function stageSystemBinary(binaryPath) {
13640
+ const target = systemBinaryTarget(binaryPath);
13641
+ if (!target)
13642
+ return binaryPath;
13643
+ const dir = systemBinaryDir();
13644
+ const staging = `${target}.${process.pid}.tmp`;
13645
+ runPrivileged("install", ["-d", "-m", "0755", dir]);
13646
+ try {
13647
+ runPrivileged("install", ["-m", "0755", binaryPath, staging]);
13648
+ runPrivileged("mv", ["-f", staging, target]);
13649
+ } catch (err) {
13650
+ try {
13651
+ runPrivileged("rm", ["-f", staging]);
13652
+ } catch {}
13653
+ throw err;
13654
+ }
13655
+ if (selinuxEnabled()) {
13656
+ const root = systemBinaryRoot();
13657
+ try {
13658
+ runPrivileged("restorecon", ["-R", root]);
13659
+ } catch (err) {
13660
+ hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
13661
+ }
13662
+ }
13663
+ return target;
13664
+ }
13665
+ function pruneSystemBinaries(current) {
13666
+ try {
13667
+ const dir = systemBinaryDir();
13668
+ const stale = readdirSync2(dir).filter((f) => f.startsWith("failproofaid-")).map((f) => resolve8(dir, f)).filter((p) => p !== current).map((p) => ({ p, mtime: statSync10(p).mtimeMs })).sort((a, b) => b.mtime - a.mtime).slice(1);
13669
+ for (const { p } of stale)
13670
+ runPrivileged("rm", ["-f", p]);
13671
+ } catch {}
13672
+ }
13614
13673
  function legacySystemdUserUnitPath() {
13615
13674
  return resolve8(homedir5(), ".config", "systemd", "user", "failproofaid.service");
13616
13675
  }
@@ -13791,9 +13850,17 @@ ${envBlock} <key>StandardOutPath</key>
13791
13850
  }
13792
13851
  function daemonInstallCommands(binaryPath, workerCmd, cliCmd) {
13793
13852
  if (process.platform === "linux") {
13853
+ const target = systemBinaryTarget(binaryPath);
13854
+ const dir = systemBinaryDir();
13855
+ const stage = target ? [
13856
+ `sudo install -d -m 0755 ${dir}`,
13857
+ `sudo install -m 0755 ${binaryPath} ${target}`,
13858
+ `{ sudo restorecon -R ${systemBinaryRoot()} 2>/dev/null || true; }`
13859
+ ] : [];
13794
13860
  return [
13861
+ ...stage,
13795
13862
  `sudo tee ${systemdUnitPath()} <<'EOF'
13796
- ${systemdUnitContents(binaryPath, workerCmd, cliCmd)}EOF`,
13863
+ ${systemdUnitContents(target ?? binaryPath, workerCmd, cliCmd)}EOF`,
13797
13864
  "sudo systemctl daemon-reload",
13798
13865
  `sudo systemctl enable ${systemdUnitName()}`,
13799
13866
  `sudo systemctl restart ${systemdUnitName()}`
@@ -13821,9 +13888,11 @@ async function installDaemonService() {
13821
13888
  };
13822
13889
  }
13823
13890
  removeLegacyUserService();
13891
+ let execPath = binaryPath;
13824
13892
  try {
13825
13893
  if (process.platform === "linux") {
13826
- writePrivilegedFile(systemdUnitPath(), systemdUnitContents(binaryPath, workerCmd, cliCmd));
13894
+ execPath = stageSystemBinary(binaryPath);
13895
+ writePrivilegedFile(systemdUnitPath(), systemdUnitContents(execPath, workerCmd, cliCmd));
13827
13896
  runPrivileged("systemctl", ["daemon-reload"]);
13828
13897
  runPrivileged("systemctl", ["enable", systemdUnitName()]);
13829
13898
  restartSystemdUnit();
@@ -13847,6 +13916,8 @@ async function installDaemonService() {
13847
13916
  hookLogWarn(`daemon service install failed: ${reason}`);
13848
13917
  return { installed: false, reason };
13849
13918
  }
13919
+ if (execPath !== binaryPath)
13920
+ pruneSystemBinaries(execPath);
13850
13921
  return { installed: true };
13851
13922
  }
13852
13923
  async function probeDaemon() {
@@ -14079,6 +14150,13 @@ async function uninstallDaemonService() {
14079
14150
  try {
14080
14151
  runPrivileged("systemctl", ["daemon-reload"]);
14081
14152
  } catch {}
14153
+ const binRoot = systemBinaryRoot();
14154
+ if (existsSync11(binRoot)) {
14155
+ runPrivileged("rm", ["-rf", binRoot]);
14156
+ try {
14157
+ runPrivileged("rmdir", [dirname7(binRoot)]);
14158
+ } catch {}
14159
+ }
14082
14160
  } else {
14083
14161
  const plistPath = launchdPlistPath();
14084
14162
  if (!existsSync11(plistPath))
@@ -14161,9 +14239,9 @@ var init_daemon_service = __esm(() => {
14161
14239
  // src/hooks/codex-system-hooks.ts
14162
14240
  import { execSync as execSync3 } from "node:child_process";
14163
14241
  import { createHash as createHash4 } from "node:crypto";
14164
- import { accessSync, chmodSync as chmodSync5, constants as fsConstants3, existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync6, statSync as statSync10 } from "node:fs";
14242
+ import { accessSync, chmodSync as chmodSync5, constants as fsConstants3, existsSync as existsSync12, readFileSync as readFileSync8, rmSync as rmSync6, statSync as statSync11 } from "node:fs";
14165
14243
  import { homedir as homedir6 } from "node:os";
14166
- import { dirname as dirname7, resolve as resolve9 } from "node:path";
14244
+ import { dirname as dirname8, resolve as resolve9 } from "node:path";
14167
14245
  function codexSystemConfigPath() {
14168
14246
  const override = process.env.FAILPROOFAI_CODEX_SYSTEM_CONFIG;
14169
14247
  if (override !== undefined)
@@ -14285,9 +14363,9 @@ function resolvedPath(deps) {
14285
14363
  return deps.path !== undefined ? deps.path : codexSystemConfigPath();
14286
14364
  }
14287
14365
  function writableDirectly(path) {
14288
- let dir = dirname7(path);
14366
+ let dir = dirname8(path);
14289
14367
  while (!existsSync12(dir)) {
14290
- const parent = dirname7(dir);
14368
+ const parent = dirname8(dir);
14291
14369
  if (parent === dir)
14292
14370
  return false;
14293
14371
  dir = parent;
@@ -14303,7 +14381,7 @@ function writableDirectly(path) {
14303
14381
  }
14304
14382
  function fileMode(path) {
14305
14383
  try {
14306
- return (statSync10(path).mode & 511).toString(8).padStart(4, "0");
14384
+ return (statSync11(path).mode & 511).toString(8).padStart(4, "0");
14307
14385
  } catch {
14308
14386
  return "0644";
14309
14387
  }
@@ -14314,7 +14392,7 @@ function writeSystemFile(path, contents, mode, direct) {
14314
14392
  chmodSync5(path, parseInt(mode, 8));
14315
14393
  return;
14316
14394
  }
14317
- runPrivileged("install", ["-d", "-m", "0755", dirname7(path)]);
14395
+ runPrivileged("install", ["-d", "-m", "0755", dirname8(path)]);
14318
14396
  writePrivilegedFile(path, contents, mode);
14319
14397
  }
14320
14398
  function removeSystemFile(path, direct) {
@@ -14680,19 +14758,19 @@ var init_codex_system_hooks = __esm(() => {
14680
14758
  });
14681
14759
 
14682
14760
  // lib/hermes-profiles.ts
14683
- import { existsSync as existsSync13, readdirSync as readdirSync2 } from "node:fs";
14761
+ import { existsSync as existsSync13, readdirSync as readdirSync3 } from "node:fs";
14684
14762
  import { homedir as homedir7 } from "node:os";
14685
- import { basename as basename2, dirname as dirname8, join as join4, resolve as resolve10 } from "node:path";
14763
+ import { basename as basename2, dirname as dirname9, join as join4, resolve as resolve10 } from "node:path";
14686
14764
  function hermesRoot() {
14687
14765
  const env = (process.env.HERMES_HOME || "").trim();
14688
14766
  if (env) {
14689
14767
  let home = resolve10(env);
14690
- const parent = dirname8(home);
14768
+ const parent = dirname9(home);
14691
14769
  if (basename2(parent) === PROFILES_DIR)
14692
- home = dirname8(parent);
14770
+ home = dirname9(parent);
14693
14771
  const base = basename2(home);
14694
14772
  if (base === STANDARD_HOME || base.startsWith(SIBLING_HOME_PREFIX)) {
14695
- return join4(dirname8(home), STANDARD_HOME);
14773
+ return join4(dirname9(home), STANDARD_HOME);
14696
14774
  }
14697
14775
  return home;
14698
14776
  }
@@ -14715,7 +14793,7 @@ function listHermesProfiles() {
14715
14793
  const seen = new Set([HERMES_DEFAULT_PROFILE]);
14716
14794
  let names = [];
14717
14795
  try {
14718
- names = readdirSync2(join4(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
14796
+ names = readdirSync3(join4(root, PROFILES_DIR), { withFileTypes: true }).filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name).sort();
14719
14797
  } catch {}
14720
14798
  for (const name of names) {
14721
14799
  if (seen.has(name))
@@ -14726,9 +14804,9 @@ function listHermesProfiles() {
14726
14804
  if (basename2(root) !== STANDARD_HOME)
14727
14805
  return out;
14728
14806
  let siblings = [];
14729
- const parent = dirname8(root);
14807
+ const parent = dirname9(root);
14730
14808
  try {
14731
- siblings = readdirSync2(parent, { withFileTypes: true }).filter((entry) => (entry.isDirectory() || entry.isSymbolicLink()) && entry.name.startsWith(SIBLING_HOME_PREFIX) && entry.name.length > SIBLING_HOME_PREFIX.length && existsSync13(join4(parent, entry.name, "config.yaml"))).map((entry) => ({
14809
+ siblings = readdirSync3(parent, { withFileTypes: true }).filter((entry) => (entry.isDirectory() || entry.isSymbolicLink()) && entry.name.startsWith(SIBLING_HOME_PREFIX) && entry.name.length > SIBLING_HOME_PREFIX.length && existsSync13(join4(parent, entry.name, "config.yaml"))).map((entry) => ({
14732
14810
  name: entry.name.slice(SIBLING_HOME_PREFIX.length),
14733
14811
  home: join4(parent, entry.name)
14734
14812
  })).sort((a, b) => a.name.localeCompare(b.name));
@@ -14769,9 +14847,9 @@ var PROFILES_DIR = "profiles", STANDARD_HOME = ".hermes", SIBLING_HOME_PREFIX =
14769
14847
  var init_hermes_profiles = () => {};
14770
14848
 
14771
14849
  // lib/openclaw-profiles.ts
14772
- import { existsSync as existsSync14, readdirSync as readdirSync3 } from "node:fs";
14850
+ import { existsSync as existsSync14, readdirSync as readdirSync4 } from "node:fs";
14773
14851
  import { homedir as homedir8 } from "node:os";
14774
- import { basename as basename3, dirname as dirname9, join as join5, resolve as resolve11 } from "node:path";
14852
+ import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve11 } from "node:path";
14775
14853
  function openclawProfileHome() {
14776
14854
  const stateDir = (process.env.OPENCLAW_STATE_DIR ?? "").trim();
14777
14855
  if (stateDir)
@@ -14781,7 +14859,7 @@ function openclawProfileHome() {
14781
14859
  return resolve11(openclawHome);
14782
14860
  const configPath = (process.env.OPENCLAW_CONFIG_PATH || "").trim();
14783
14861
  if (configPath)
14784
- return dirname9(resolve11(configPath));
14862
+ return dirname10(resolve11(configPath));
14785
14863
  return join5(homedir8(), ".openclaw");
14786
14864
  }
14787
14865
  function listOpenClawProfiles() {
@@ -14790,14 +14868,14 @@ function listOpenClawProfiles() {
14790
14868
  if (activeBase !== ".openclaw" && !activeBase.startsWith(".openclaw-")) {
14791
14869
  return [{ name: OPENCLAW_DEFAULT_PROFILE, home: activeHome }];
14792
14870
  }
14793
- const parent = dirname9(activeHome);
14871
+ const parent = dirname10(activeHome);
14794
14872
  const defaultHome = join5(parent, ".openclaw");
14795
14873
  const out = [
14796
14874
  { name: OPENCLAW_DEFAULT_PROFILE, home: defaultHome }
14797
14875
  ];
14798
14876
  let entries;
14799
14877
  try {
14800
- entries = readdirSync3(parent, { withFileTypes: true });
14878
+ entries = readdirSync4(parent, { withFileTypes: true });
14801
14879
  } catch {
14802
14880
  return out;
14803
14881
  }
@@ -14827,7 +14905,7 @@ import {
14827
14905
  symlinkSync,
14828
14906
  unlinkSync as unlinkSync2
14829
14907
  } from "node:fs";
14830
- import { resolve as resolve12, dirname as dirname10, basename as basename4 } from "node:path";
14908
+ import { resolve as resolve12, dirname as dirname11, basename as basename4 } from "node:path";
14831
14909
  import { fileURLToPath } from "node:url";
14832
14910
  import { homedir as homedir9 } from "node:os";
14833
14911
  function readJsonFile(path) {
@@ -14937,7 +15015,7 @@ function isMarkedCopilotHook(hook) {
14937
15015
  return false;
14938
15016
  }
14939
15017
  function opencodePluginFilePath(settingsPath) {
14940
- return resolve12(dirname10(settingsPath), "plugins", "failproofai.mjs");
15018
+ return resolve12(dirname11(settingsPath), "plugins", "failproofai.mjs");
14941
15019
  }
14942
15020
  function buildOpenCodePluginShim(binaryPath, scope) {
14943
15021
  const useNpx = scope === "project";
@@ -15177,7 +15255,7 @@ function getHermesPluginSourcePath() {
15177
15255
  const fromEnv = process.env.FAILPROOFAI_PACKAGE_ROOT;
15178
15256
  if (fromEnv)
15179
15257
  return resolve12(fromEnv, HERMES_PLUGIN_SOURCE_DIR);
15180
- return findHermesPluginSourcePath(dirname10(fileURLToPath(import.meta.url)));
15258
+ return findHermesPluginSourcePath(dirname11(fileURLToPath(import.meta.url)));
15181
15259
  }
15182
15260
  function findHermesPluginSourcePath(startDir) {
15183
15261
  let dir = resolve12(startDir);
@@ -15185,7 +15263,7 @@ function findHermesPluginSourcePath(startDir) {
15185
15263
  const candidate = resolve12(dir, HERMES_PLUGIN_SOURCE_DIR);
15186
15264
  if (existsSync15(resolve12(candidate, "plugin.yaml")))
15187
15265
  return candidate;
15188
- const parent = dirname10(dir);
15266
+ const parent = dirname11(dir);
15189
15267
  if (parent === dir)
15190
15268
  break;
15191
15269
  dir = parent;
@@ -15193,7 +15271,7 @@ function findHermesPluginSourcePath(startDir) {
15193
15271
  return resolve12(startDir, "..", "..", HERMES_PLUGIN_SOURCE_DIR);
15194
15272
  }
15195
15273
  function hermesPluginPathForSettings(settingsPath) {
15196
- return resolve12(dirname10(settingsPath), "plugins", HERMES_PLUGIN_ID);
15274
+ return resolve12(dirname11(settingsPath), "plugins", HERMES_PLUGIN_ID);
15197
15275
  }
15198
15276
  function pathPresent(path) {
15199
15277
  try {
@@ -15207,7 +15285,7 @@ function hasAllHermesPluginFiles(dir) {
15207
15285
  return HERMES_PLUGIN_FILES.every((file) => existsSync15(resolve12(dir, file)));
15208
15286
  }
15209
15287
  function hermesLinkRecordPath(pluginPath) {
15210
- return resolve12(dirname10(pluginPath), HERMES_LINK_RECORD);
15288
+ return resolve12(dirname11(pluginPath), HERMES_LINK_RECORD);
15211
15289
  }
15212
15290
  function readHermesLinkRecord(pluginPath) {
15213
15291
  try {
@@ -15230,10 +15308,10 @@ function isOwnedHermesPluginLink(pluginPath, target) {
15230
15308
  return true;
15231
15309
  if (samePath(target, getHermesPluginSourcePath()))
15232
15310
  return true;
15233
- const pkgRoot = dirname10(resolve12(target));
15311
+ const pkgRoot = dirname11(resolve12(target));
15234
15312
  if (basename4(resolve12(target)) !== HERMES_PLUGIN_SOURCE_DIR)
15235
15313
  return false;
15236
- if (basename4(pkgRoot) !== "failproofai" || basename4(dirname10(pkgRoot)) !== "node_modules")
15314
+ if (basename4(pkgRoot) !== "failproofai" || basename4(dirname11(pkgRoot)) !== "node_modules")
15237
15315
  return false;
15238
15316
  try {
15239
15317
  const pkg = JSON.parse(readFileSync9(resolve12(pkgRoot, "package.json"), "utf8"));
@@ -15265,7 +15343,7 @@ function hermesPluginState(settingsPath) {
15265
15343
  if (isLink) {
15266
15344
  let target;
15267
15345
  try {
15268
- target = resolve12(dirname10(pluginPath), readlinkSync2(pluginPath));
15346
+ target = resolve12(dirname11(pluginPath), readlinkSync2(pluginPath));
15269
15347
  } catch {
15270
15348
  return { kind: "foreign" };
15271
15349
  }
@@ -15310,7 +15388,7 @@ function installHermesPlugin(settingsPath, deps = {}) {
15310
15388
  }
15311
15389
  return "unchanged";
15312
15390
  }
15313
- mkdirSync8(dirname10(destination), { recursive: true });
15391
+ mkdirSync8(dirname11(destination), { recursive: true });
15314
15392
  const suffix = `${process.pid}-${Date.now()}`;
15315
15393
  const temporary = `${destination}.install-${suffix}`;
15316
15394
  let linked = false;
@@ -16116,7 +16194,7 @@ var init_integrations = __esm(() => {
16116
16194
  const effectiveScope = scope ?? "project";
16117
16195
  const settingsPath = effectiveScope === "user" ? resolve12(homedir9(), ".config", "opencode", "opencode.json") : resolve12(process.cwd(), ".opencode", "opencode.json");
16118
16196
  const pluginPath = opencodePluginFilePath(settingsPath);
16119
- mkdirSync8(dirname10(pluginPath), { recursive: true });
16197
+ mkdirSync8(dirname11(pluginPath), { recursive: true });
16120
16198
  writeConfigFileAtomic(pluginPath, buildOpenCodePluginShim(binaryPath, effectiveScope), { symlinks: "replace" });
16121
16199
  if (!Array.isArray(s.plugin))
16122
16200
  s.plugin = [];
@@ -16336,7 +16414,6 @@ var init_integrations = __esm(() => {
16336
16414
  openclaw = {
16337
16415
  id: "openclaw",
16338
16416
  displayName: "OpenClaw",
16339
- requiresHealthyDaemon: true,
16340
16417
  scopes: OPENCLAW_HOOK_SCOPES,
16341
16418
  eventTypes: OPENCLAW_HOOK_EVENT_TYPES,
16342
16419
  getSettingsPath() {
@@ -19228,7 +19305,7 @@ var init_custom_hooks_registry = __esm(() => {
19228
19305
  // src/hooks/loader-utils.ts
19229
19306
  import { readFile as readFile2, writeFile as writeFile2, unlink, access, mkdir, lstat } from "fs/promises";
19230
19307
  import { tmpdir as tmpdir2 } from "os";
19231
- import { resolve as resolve13, dirname as dirname11, relative as relative2, join as join6 } from "path";
19308
+ import { resolve as resolve13, dirname as dirname12, relative as relative2, join as join6 } from "path";
19232
19309
  import { pathToFileURL } from "url";
19233
19310
  import { createHash as createHash5 } from "crypto";
19234
19311
  function isTmpArtifact(name) {
@@ -19269,7 +19346,7 @@ async function findDistIndex() {
19269
19346
  return candidate;
19270
19347
  }
19271
19348
  const candidates = [
19272
- resolve13(dirname11(process.execPath), "..", "assets", "dist", "index.js"),
19349
+ resolve13(dirname12(process.execPath), "..", "assets", "dist", "index.js"),
19273
19350
  resolve13(process.cwd(), "dist", "index.js"),
19274
19351
  resolve13(process.cwd(), "node_modules", "failproofai", "dist", "index.js")
19275
19352
  ];
@@ -19360,7 +19437,7 @@ async function rewriteFileTree(entryPath, distUrl, distIndex, tmpSuffix = TMP_SU
19360
19437
  if (distIndex) {
19361
19438
  code = code.replace(/require\s*\(\s*(['"])(?:claudeye|failproofai)\1\s*\)/g, `require('${distIndex.replace(/\\/g, "\\\\")}')`);
19362
19439
  }
19363
- const dir = dirname11(filePath);
19440
+ const dir = dirname12(filePath);
19364
19441
  const rewrites = new Map;
19365
19442
  for (const re of [LOCAL_IMPORT_RE, LOCAL_REQUIRE_RE]) {
19366
19443
  const freshRe = new RegExp(re.source, re.flags);
@@ -19583,7 +19660,7 @@ var init_telemetry_id2 = __esm(() => {
19583
19660
  // src/hooks/custom-hooks-loader.ts
19584
19661
  import { resolve as resolve14, isAbsolute as isAbsolute2, basename as basename5 } from "node:path";
19585
19662
  import { randomUUID } from "crypto";
19586
- import { existsSync as existsSync16, readdirSync as readdirSync4 } from "node:fs";
19663
+ import { existsSync as existsSync16, readdirSync as readdirSync5 } from "node:fs";
19587
19664
  import { readFile as readFile3 } from "node:fs/promises";
19588
19665
  import { pathToFileURL as pathToFileURL2 } from "node:url";
19589
19666
  import { createHash as createHash6 } from "node:crypto";
@@ -19591,7 +19668,7 @@ function discoverPolicyFiles(dir) {
19591
19668
  if (!existsSync16(dir))
19592
19669
  return [];
19593
19670
  try {
19594
- const entries = readdirSync4(dir, { withFileTypes: true });
19671
+ const entries = readdirSync5(dir, { withFileTypes: true });
19595
19672
  return entries.filter((e) => e.isFile() && CONVENTION_FILE_RE.test(e.name)).sort((a, b) => a.name.localeCompare(b.name)).map((e) => resolve14(dir, e.name));
19596
19673
  } catch {
19597
19674
  return [];
@@ -19601,7 +19678,7 @@ function findSkippedPolicyFiles(dir) {
19601
19678
  if (!existsSync16(dir))
19602
19679
  return [];
19603
19680
  try {
19604
- return readdirSync4(dir, { withFileTypes: true }).filter((e) => e.isFile() && LOADABLE_EXT_RE.test(e.name) && !CONVENTION_FILE_RE.test(e.name) && !e.name.endsWith(".d.ts") && !isTmpArtifact(e.name)).map((e) => e.name).sort((a, b) => a.localeCompare(b));
19681
+ return readdirSync5(dir, { withFileTypes: true }).filter((e) => e.isFile() && LOADABLE_EXT_RE.test(e.name) && !CONVENTION_FILE_RE.test(e.name) && !e.name.endsWith(".d.ts") && !isTmpArtifact(e.name)).map((e) => e.name).sort((a, b) => a.localeCompare(b));
19605
19682
  } catch {
19606
19683
  return [];
19607
19684
  }
@@ -21448,7 +21525,7 @@ var init_pack_cli = __esm(() => {
21448
21525
  // src/hooks/pack-store.ts
21449
21526
  import { createHash as createHash7 } from "node:crypto";
21450
21527
  import { existsSync as existsSync17, mkdirSync as mkdirSync9, readFileSync as readFileSync10, renameSync as renameSync6, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "node:fs";
21451
- import { dirname as dirname12, resolve as resolve15 } from "node:path";
21528
+ import { dirname as dirname13, resolve as resolve15 } from "node:path";
21452
21529
  function baseUrl2() {
21453
21530
  return (process.env.FAILPROOFAI_PACK_BASE_URL || DEFAULT_BASE_URL2).replace(/\/+$/, "");
21454
21531
  }
@@ -21619,7 +21696,7 @@ function sha256(bytes) {
21619
21696
  function writeAtomic(target, bytes) {
21620
21697
  const tempPath = `${target}.${process.pid}.tmp`;
21621
21698
  try {
21622
- mkdirSync9(dirname12(target), { recursive: true });
21699
+ mkdirSync9(dirname13(target), { recursive: true });
21623
21700
  writeFileSync7(tempPath, bytes);
21624
21701
  renameSync6(tempPath, target);
21625
21702
  } catch (err) {
@@ -22964,10 +23041,10 @@ import {
22964
23041
  writeFileSync as writeFileSync8,
22965
23042
  appendFileSync as appendFileSync2,
22966
23043
  renameSync as renameSync7,
22967
- readdirSync as readdirSync5,
23044
+ readdirSync as readdirSync6,
22968
23045
  mkdirSync as mkdirSync10,
22969
23046
  existsSync as existsSync18,
22970
- statSync as statSync11,
23047
+ statSync as statSync12,
22971
23048
  unlinkSync as unlinkSync3
22972
23049
  } from "node:fs";
22973
23050
  import { join as join7 } from "node:path";
@@ -22988,7 +23065,7 @@ function acquireLock() {
22988
23065
  if (e.code !== "EEXIST")
22989
23066
  return;
22990
23067
  try {
22991
- const s = statSync11(lockPath);
23068
+ const s = statSync12(lockPath);
22992
23069
  if (Date.now() - s.mtimeMs > LOCK_STALE_MS) {
22993
23070
  writeFileSync8(lockPath, String(process.pid), "utf-8");
22994
23071
  return;
@@ -23176,7 +23253,7 @@ function readJsonlFile(filePath) {
23176
23253
  }
23177
23254
  function getArchiveFiles() {
23178
23255
  try {
23179
- const files = readdirSync5(storeDirValue());
23256
+ const files = readdirSync6(storeDirValue());
23180
23257
  return files.filter((f) => f.startsWith("page-") && f.endsWith(".jsonl")).sort((a, b) => {
23181
23258
  const partsA = a.slice(5, -6).split("-");
23182
23259
  const partsB = b.slice(5, -6).split("-");
@@ -23200,7 +23277,7 @@ var init_hook_activity_store = __esm(() => {
23200
23277
  });
23201
23278
 
23202
23279
  // src/hooks/delivery-health.ts
23203
- import { existsSync as existsSync19, readFileSync as readFileSync12, readdirSync as readdirSync6, statSync as statSync12 } from "node:fs";
23280
+ import { existsSync as existsSync19, readFileSync as readFileSync12, readdirSync as readdirSync7, statSync as statSync13 } from "node:fs";
23204
23281
  import { join as join8 } from "node:path";
23205
23282
  function parseParkedName(name) {
23206
23283
  const poison = name.endsWith(POISON_SUFFIX);
@@ -23242,7 +23319,7 @@ function deliveryHealth(home, now = Date.now(), connectedAt = home ? undefined :
23242
23319
  return EMPTY;
23243
23320
  let entries;
23244
23321
  try {
23245
- entries = readdirSync6(dir);
23322
+ entries = readdirSync7(dir);
23246
23323
  } catch {
23247
23324
  return EMPTY;
23248
23325
  }
@@ -23258,7 +23335,7 @@ function deliveryHealth(home, now = Date.now(), connectedAt = home ? undefined :
23258
23335
  const parsed = parseParkedName(name);
23259
23336
  let mtime;
23260
23337
  try {
23261
- mtime = statSync12(join8(dir, name)).mtimeMs;
23338
+ mtime = statSync13(join8(dir, name)).mtimeMs;
23262
23339
  } catch {
23263
23340
  continue;
23264
23341
  }
@@ -24016,7 +24093,7 @@ var init_cursor_projects = __esm(() => {
24016
24093
  });
24017
24094
 
24018
24095
  // lib/sqlite-reader.ts
24019
- import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync13 } from "node:fs";
24096
+ import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync14 } from "node:fs";
24020
24097
  import initSqlJs from "sql.js/dist/sql-asm.js";
24021
24098
  async function tryNodeSqlite(dbPath) {
24022
24099
  try {
@@ -24041,7 +24118,7 @@ function loadSqlJs() {
24041
24118
  return sqlPromise;
24042
24119
  }
24043
24120
  function fileVersion2(path) {
24044
- const stat = statSync13(path);
24121
+ const stat = statSync14(path);
24045
24122
  return { size: stat.size, mtimeMs: stat.mtimeMs, ctimeMs: stat.ctimeMs };
24046
24123
  }
24047
24124
  function sameVersion(a, b) {
@@ -24992,7 +25069,7 @@ var init_openclaw_db = __esm(() => {
24992
25069
 
24993
25070
  // lib/openclaw-sessions.ts
24994
25071
  import { readFile as readFile7 } from "node:fs/promises";
24995
- import { readdirSync as readdirSync7, statSync as statSync14 } from "node:fs";
25072
+ import { readdirSync as readdirSync8, statSync as statSync15 } from "node:fs";
24996
25073
  import { homedir as homedir16 } from "node:os";
24997
25074
  import { join as join17 } from "node:path";
24998
25075
  function openclawHome() {
@@ -25115,7 +25192,7 @@ function openclawLinesToLogEntries(lines, source = "session") {
25115
25192
  }
25116
25193
  function listOpenClawAgents() {
25117
25194
  try {
25118
- return readdirSync7(join17(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
25195
+ return readdirSync8(join17(openclawHome(), "agents"), { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name).sort();
25119
25196
  } catch {
25120
25197
  return [];
25121
25198
  }
@@ -25125,7 +25202,7 @@ function listOpenClawTranscripts() {
25125
25202
  const out = [];
25126
25203
  let agentIds;
25127
25204
  try {
25128
- agentIds = readdirSync7(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
25205
+ agentIds = readdirSync8(agentsDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
25129
25206
  } catch {
25130
25207
  return out;
25131
25208
  }
@@ -25133,7 +25210,7 @@ function listOpenClawTranscripts() {
25133
25210
  const sessionsDir = join17(agentsDir, agentId, "sessions");
25134
25211
  let files;
25135
25212
  try {
25136
- files = readdirSync7(sessionsDir);
25213
+ files = readdirSync8(sessionsDir);
25137
25214
  } catch {
25138
25215
  continue;
25139
25216
  }
@@ -25145,7 +25222,7 @@ function listOpenClawTranscripts() {
25145
25222
  continue;
25146
25223
  const transcriptPath = join17(sessionsDir, file);
25147
25224
  try {
25148
- const st = statSync14(transcriptPath);
25225
+ const st = statSync15(transcriptPath);
25149
25226
  out.push({
25150
25227
  agentId,
25151
25228
  sessionId,
@@ -25390,7 +25467,7 @@ var init_openclaw_projects = __esm(() => {
25390
25467
 
25391
25468
  // lib/factory-sessions.ts
25392
25469
  import { readFile as readFile8 } from "node:fs/promises";
25393
- import { readdirSync as readdirSync8, statSync as statSync15 } from "node:fs";
25470
+ import { readdirSync as readdirSync9, statSync as statSync16 } from "node:fs";
25394
25471
  import { homedir as homedir17 } from "node:os";
25395
25472
  import { join as join19 } from "node:path";
25396
25473
  function factoryHome() {
@@ -25536,7 +25613,7 @@ function listFactoryTranscripts() {
25536
25613
  const out = [];
25537
25614
  let projectDirs;
25538
25615
  try {
25539
- projectDirs = readdirSync8(root, { withFileTypes: true }).filter((d) => d.isDirectory());
25616
+ projectDirs = readdirSync9(root, { withFileTypes: true }).filter((d) => d.isDirectory());
25540
25617
  } catch {
25541
25618
  return out;
25542
25619
  }
@@ -25546,7 +25623,7 @@ function listFactoryTranscripts() {
25546
25623
  const projectPath = join19(root, projectName);
25547
25624
  let files;
25548
25625
  try {
25549
- files = readdirSync8(projectPath);
25626
+ files = readdirSync9(projectPath);
25550
25627
  } catch {
25551
25628
  continue;
25552
25629
  }
@@ -25558,7 +25635,7 @@ function listFactoryTranscripts() {
25558
25635
  continue;
25559
25636
  const transcriptPath = join19(projectPath, file);
25560
25637
  try {
25561
- const st = statSync15(transcriptPath);
25638
+ const st = statSync16(transcriptPath);
25562
25639
  out.push({ projectName, cwd, sessionId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
25563
25640
  } catch {}
25564
25641
  }
@@ -25978,7 +26055,7 @@ var init_devin_projects = __esm(() => {
25978
26055
 
25979
26056
  // lib/antigravity-sessions.ts
25980
26057
  import { readFile as readFile9 } from "node:fs/promises";
25981
- import { readdirSync as readdirSync9, statSync as statSync16 } from "node:fs";
26058
+ import { readdirSync as readdirSync10, statSync as statSync17 } from "node:fs";
25982
26059
  import { homedir as homedir19 } from "node:os";
25983
26060
  import { join as join21 } from "node:path";
25984
26061
  function antigravityHome() {
@@ -26103,7 +26180,7 @@ function listAntigravityTranscripts() {
26103
26180
  const out = [];
26104
26181
  let convoDirs;
26105
26182
  try {
26106
- convoDirs = readdirSync9(root, { withFileTypes: true }).filter((d) => d.isDirectory());
26183
+ convoDirs = readdirSync10(root, { withFileTypes: true }).filter((d) => d.isDirectory());
26107
26184
  } catch {
26108
26185
  return out;
26109
26186
  }
@@ -26113,7 +26190,7 @@ function listAntigravityTranscripts() {
26113
26190
  continue;
26114
26191
  const transcriptPath = join21(root, conversationId, rel);
26115
26192
  try {
26116
- const st = statSync16(transcriptPath);
26193
+ const st = statSync17(transcriptPath);
26117
26194
  if (!st.isFile())
26118
26195
  continue;
26119
26196
  out.push({ conversationId, transcriptPath, mtimeMs: st.mtimeMs, sizeBytes: st.size });
@@ -26126,7 +26203,7 @@ function findAntigravityTranscript(conversationId) {
26126
26203
  return null;
26127
26204
  const transcriptPath = join21(antigravityBrainRoot(), conversationId, antigravityTranscriptRelPath());
26128
26205
  try {
26129
- if (statSync16(transcriptPath).isFile())
26206
+ if (statSync17(transcriptPath).isFile())
26130
26207
  return transcriptPath;
26131
26208
  } catch {}
26132
26209
  return null;
@@ -27041,9 +27118,9 @@ var init_log_entries = __esm(() => {
27041
27118
  });
27042
27119
 
27043
27120
  // lib/codex-sessions.ts
27044
- import { readFileSync as readFileSync15, readdirSync as readdirSync10, existsSync as existsSync22, writeFileSync as writeFileSync9, mkdirSync as mkdirSync11, statSync as statSync17 } from "node:fs";
27121
+ import { readFileSync as readFileSync15, readdirSync as readdirSync11, existsSync as existsSync22, writeFileSync as writeFileSync9, mkdirSync as mkdirSync11, statSync as statSync18 } from "node:fs";
27045
27122
  import { readFile as readFile11 } from "node:fs/promises";
27046
- import { dirname as dirname13, join as join27 } from "node:path";
27123
+ import { dirname as dirname14, join as join27 } from "node:path";
27047
27124
  import { homedir as homedir21 } from "node:os";
27048
27125
  function readCache() {
27049
27126
  try {
@@ -27056,7 +27133,7 @@ function readCache() {
27056
27133
  }
27057
27134
  function writeCacheEntry(sessionId, path) {
27058
27135
  try {
27059
- mkdirSync11(dirname13(CACHE_PATH), { recursive: true });
27136
+ mkdirSync11(dirname14(CACHE_PATH), { recursive: true });
27060
27137
  const cache = readCache();
27061
27138
  cache[sessionId] = path;
27062
27139
  writeFileSync9(CACHE_PATH, JSON.stringify(cache), "utf-8");
@@ -27064,7 +27141,7 @@ function writeCacheEntry(sessionId, path) {
27064
27141
  }
27065
27142
  function dirSearch(dir, sessionId) {
27066
27143
  try {
27067
- for (const f of readdirSync10(dir, { withFileTypes: true })) {
27144
+ for (const f of readdirSync11(dir, { withFileTypes: true })) {
27068
27145
  if (f.isFile() && f.name.includes(sessionId) && f.name.endsWith(".jsonl")) {
27069
27146
  return join27(dir, f.name);
27070
27147
  }
@@ -27094,13 +27171,13 @@ function findCodexTranscript(sessionId) {
27094
27171
  }
27095
27172
  }
27096
27173
  try {
27097
- for (const y of readdirSync10(root, { withFileTypes: true })) {
27174
+ for (const y of readdirSync11(root, { withFileTypes: true })) {
27098
27175
  if (!y.isDirectory())
27099
27176
  continue;
27100
- for (const m of readdirSync10(join27(root, y.name), { withFileTypes: true })) {
27177
+ for (const m of readdirSync11(join27(root, y.name), { withFileTypes: true })) {
27101
27178
  if (!m.isDirectory())
27102
27179
  continue;
27103
- for (const d of readdirSync10(join27(root, y.name, m.name), { withFileTypes: true })) {
27180
+ for (const d of readdirSync11(join27(root, y.name, m.name), { withFileTypes: true })) {
27104
27181
  if (!d.isDirectory())
27105
27182
  continue;
27106
27183
  const hit = dirSearch(join27(root, y.name, m.name, d.name), sessionId);
@@ -27369,7 +27446,7 @@ var init_resolve_permission_mode = __esm(() => {
27369
27446
  });
27370
27447
 
27371
27448
  // lib/copilot-sessions.ts
27372
- import { readFileSync as readFileSync17, readdirSync as readdirSync11, existsSync as existsSync23, statSync as statSync18 } from "node:fs";
27449
+ import { readFileSync as readFileSync17, readdirSync as readdirSync12, existsSync as existsSync23, statSync as statSync19 } from "node:fs";
27373
27450
  import { readFile as readFile12 } from "node:fs/promises";
27374
27451
  import { join as join28, resolve as resolve17, sep as sep2 } from "node:path";
27375
27452
  import { homedir as homedir22 } from "node:os";
@@ -27586,7 +27663,7 @@ var init_copilot_sessions = __esm(() => {
27586
27663
  });
27587
27664
 
27588
27665
  // lib/cursor-sessions.ts
27589
- import { readFileSync as readFileSync18, readdirSync as readdirSync12, existsSync as existsSync24, statSync as statSync19 } from "node:fs";
27666
+ import { readFileSync as readFileSync18, readdirSync as readdirSync13, existsSync as existsSync24, statSync as statSync20 } from "node:fs";
27590
27667
  import { readFile as readFile13 } from "node:fs/promises";
27591
27668
  import { basename as basename6, join as join29, resolve as resolve18, sep as sep3 } from "node:path";
27592
27669
  import { homedir as homedir23 } from "node:os";
@@ -27600,7 +27677,7 @@ function getCursorSessionDir(sessionId) {
27600
27677
  const projectsRoot = resolve18(home, NEW_PROJECTS_DIR2);
27601
27678
  let projectEntries = [];
27602
27679
  try {
27603
- projectEntries = readdirSync12(projectsRoot, { withFileTypes: true });
27680
+ projectEntries = readdirSync13(projectsRoot, { withFileTypes: true });
27604
27681
  } catch {}
27605
27682
  for (const entry of projectEntries) {
27606
27683
  if (!entry.isDirectory())
@@ -27842,7 +27919,7 @@ var init_cursor_sessions = __esm(() => {
27842
27919
  });
27843
27920
 
27844
27921
  // lib/pi-sessions.ts
27845
- import { readFileSync as readFileSync19, readdirSync as readdirSync13, existsSync as existsSync25, statSync as statSync20 } from "node:fs";
27922
+ import { readFileSync as readFileSync19, readdirSync as readdirSync14, existsSync as existsSync25, statSync as statSync21 } from "node:fs";
27846
27923
  import { readFile as readFile14 } from "node:fs/promises";
27847
27924
  import { join as join30, resolve as resolve19, sep as sep4 } from "node:path";
27848
27925
  import { homedir as homedir24 } from "node:os";
@@ -27858,7 +27935,7 @@ function findPiTranscript(sessionId) {
27858
27935
  const root = resolve19(getPiSessionStateRoot());
27859
27936
  let cwdDirs;
27860
27937
  try {
27861
- cwdDirs = readdirSync13(root);
27938
+ cwdDirs = readdirSync14(root);
27862
27939
  } catch {
27863
27940
  return null;
27864
27941
  }
@@ -27868,7 +27945,7 @@ function findPiTranscript(sessionId) {
27868
27945
  continue;
27869
27946
  let files;
27870
27947
  try {
27871
- files = readdirSync13(cwdPath);
27948
+ files = readdirSync14(cwdPath);
27872
27949
  } catch {
27873
27950
  continue;
27874
27951
  }
@@ -28518,7 +28595,7 @@ var init_pack_failclosed = __esm(() => {
28518
28595
  });
28519
28596
 
28520
28597
  // src/hooks/session-pause.ts
28521
- import { existsSync as existsSync27, mkdirSync as mkdirSync12, readdirSync as readdirSync14, readFileSync as readFileSync21, rmSync as rmSync10 } from "node:fs";
28598
+ import { existsSync as existsSync27, mkdirSync as mkdirSync12, readdirSync as readdirSync15, readFileSync as readFileSync21, rmSync as rmSync10 } from "node:fs";
28522
28599
  import { createHash as createHash8 } from "node:crypto";
28523
28600
  import { join as join31, resolve as resolve21 } from "node:path";
28524
28601
  function pauseStateDir() {
@@ -28632,7 +28709,7 @@ function listActivePauses(now = Date.now()) {
28632
28709
  const out = [];
28633
28710
  let names;
28634
28711
  try {
28635
- names = readdirSync14(dir);
28712
+ names = readdirSync15(dir);
28636
28713
  } catch {
28637
28714
  return [];
28638
28715
  }
@@ -28683,14 +28760,14 @@ import {
28683
28760
  existsSync as existsSync28,
28684
28761
  mkdirSync as mkdirSync13,
28685
28762
  readFileSync as readFileSync22,
28686
- readdirSync as readdirSync15,
28763
+ readdirSync as readdirSync16,
28687
28764
  renameSync as renameSync9,
28688
28765
  rmSync as rmSync11,
28689
28766
  rmdirSync,
28690
- statSync as statSync21,
28767
+ statSync as statSync22,
28691
28768
  writeFileSync as writeFileSync11
28692
28769
  } from "node:fs";
28693
- import { dirname as dirname14, isAbsolute as isAbsolute3, relative as relative4, resolve as resolve22 } from "node:path";
28770
+ import { dirname as dirname15, isAbsolute as isAbsolute3, relative as relative4, resolve as resolve22 } from "node:path";
28694
28771
  function migrateConventionPolicies() {
28695
28772
  const from = legacy.customPoliciesDir();
28696
28773
  if (!existsSync28(from))
@@ -28699,7 +28776,7 @@ function migrateConventionPolicies() {
28699
28776
  const mergeInto = (dir, dest, prefix) => {
28700
28777
  let entries;
28701
28778
  try {
28702
- entries = readdirSync15(dir, { withFileTypes: true });
28779
+ entries = readdirSync16(dir, { withFileTypes: true });
28703
28780
  } catch {
28704
28781
  return;
28705
28782
  }
@@ -28721,7 +28798,7 @@ function migrateConventionPolicies() {
28721
28798
  } catch {}
28722
28799
  continue;
28723
28800
  }
28724
- if (entry.isDirectory() && statSync21(target).isDirectory()) {
28801
+ if (entry.isDirectory() && statSync22(target).isDirectory()) {
28725
28802
  mergeInto(source, target, `${name}/`);
28726
28803
  try {
28727
28804
  rmdirSync(source);
@@ -28745,7 +28822,7 @@ function migrateLegacySpool() {
28745
28822
  continue;
28746
28823
  try {
28747
28824
  mkdirSync13(to, { recursive: true });
28748
- for (const entry of readdirSync15(from, { withFileTypes: true })) {
28825
+ for (const entry of readdirSync16(from, { withFileTypes: true })) {
28749
28826
  if (!entry.isFile())
28750
28827
  continue;
28751
28828
  let name = entry.name;
@@ -28772,7 +28849,7 @@ function migrateHookActivity() {
28772
28849
  return [];
28773
28850
  const moved = [];
28774
28851
  try {
28775
- const entries = readdirSync15(from, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl"));
28852
+ const entries = readdirSync16(from, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl"));
28776
28853
  if (entries.length === 0)
28777
28854
  return [];
28778
28855
  const to = hookActivityDir();
@@ -28888,7 +28965,7 @@ function writeCarriedPolicyConfig(carried) {
28888
28965
  }
28889
28966
  } catch {}
28890
28967
  try {
28891
- mkdirSync13(dirname14(to), { recursive: true });
28968
+ mkdirSync13(dirname15(to), { recursive: true });
28892
28969
  writeFileSync11(to, JSON.stringify({ ...existing, ...carried }, null, 2) + `
28893
28970
  `, "utf8");
28894
28971
  } catch {
@@ -29080,12 +29157,12 @@ var init_untraced_note = __esm(() => {
29080
29157
  });
29081
29158
 
29082
29159
  // src/hooks/agent-roster.ts
29083
- import { lstatSync as lstatSync4, readFileSync as readFileSync24, statSync as statSync22 } from "node:fs";
29160
+ import { lstatSync as lstatSync4, readFileSync as readFileSync24, statSync as statSync23 } from "node:fs";
29084
29161
  import { homedir as homedir26 } from "node:os";
29085
- import { dirname as dirname15, resolve as resolve23 } from "node:path";
29162
+ import { dirname as dirname16, resolve as resolve23 } from "node:path";
29086
29163
  function installedHookAt2(path, cli) {
29087
29164
  try {
29088
- const stat = statSync22(path);
29165
+ const stat = statSync23(path);
29089
29166
  if (!stat.isFile() || stat.size > 131072)
29090
29167
  return false;
29091
29168
  const text = readFileSync24(path, "utf8");
@@ -29143,7 +29220,7 @@ function runtimeAgentSettingsPath2(cli, cwd, userHome = homedir26(), hookScope)
29143
29220
  if (installedHookAt2(path, cli))
29144
29221
  matches.add(path);
29145
29222
  }
29146
- const parent = dirname15(dir);
29223
+ const parent = dirname16(dir);
29147
29224
  if (parent === dir)
29148
29225
  break;
29149
29226
  dir = parent;
@@ -29236,8 +29313,8 @@ var init_agent_roster2 = __esm(() => {
29236
29313
  });
29237
29314
 
29238
29315
  // src/hooks/semantic/jev-config.ts
29239
- import { closeSync as closeSync3, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync3, readSync as readSync2, statSync as statSync23 } from "node:fs";
29240
- import { dirname as dirname16 } from "node:path";
29316
+ import { closeSync as closeSync3, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync3, readSync as readSync2, statSync as statSync24 } from "node:fs";
29317
+ import { dirname as dirname17 } from "node:path";
29241
29318
  function parseJevMode(raw) {
29242
29319
  return raw === "off" || raw === "observe" || raw === "enforce" ? raw : null;
29243
29320
  }
@@ -29497,7 +29574,7 @@ function looseConfigDirMode(path) {
29497
29574
  if (!modesAreMeaningful())
29498
29575
  return null;
29499
29576
  try {
29500
- const mode = statSync23(dirname16(path)).mode & 511;
29577
+ const mode = statSync24(dirname17(path)).mode & 511;
29501
29578
  return (mode & DIR_WRITABLE_BY_OTHERS2) !== 0 ? mode : null;
29502
29579
  } catch {
29503
29580
  return null;
@@ -29558,8 +29635,8 @@ function inspectJevConfig() {
29558
29635
  path,
29559
29636
  mode,
29560
29637
  reason: "too-open",
29561
- problem: `its directory ${dirname16(path)} is ${dirMode.toString(8).padStart(4, "0")} — other users can write there, ` + `so they can put their own config in its place; it must be owner-only (chmod 700 ${dirname16(path)})`,
29562
- fix: `chmod 700 ${dirname16(path)}`
29638
+ problem: `its directory ${dirname17(path)} is ${dirMode.toString(8).padStart(4, "0")} — other users can write there, ` + `so they can put their own config in its place; it must be owner-only (chmod 700 ${dirname17(path)})`,
29639
+ fix: `chmod 700 ${dirname17(path)}`
29563
29640
  };
29564
29641
  }
29565
29642
  if (st.size > MAX_CONFIG_BYTES)
@@ -29678,14 +29755,14 @@ function jevInputsVersion() {
29678
29755
  process.platform,
29679
29756
  credentials,
29680
29757
  statVersion(credentials),
29681
- statVersion(dirname16(credentials)),
29758
+ statVersion(dirname17(credentials)),
29682
29759
  config,
29683
29760
  statVersion(config)
29684
29761
  ].join("\x00");
29685
29762
  }
29686
29763
  function statVersion(path) {
29687
29764
  try {
29688
- const st = statSync23(path, { bigint: true });
29765
+ const st = statSync24(path, { bigint: true });
29689
29766
  return `${st.dev}:${st.ino}:${st.mode}:${st.size}:${st.mtimeNs}:${st.ctimeNs}`;
29690
29767
  } catch (err) {
29691
29768
  return `-${err.code ?? "error"}`;
@@ -29913,9 +29990,9 @@ var init_cloud_jev_health = __esm(() => {
29913
29990
  });
29914
29991
 
29915
29992
  // src/hooks/semantic/facts.ts
29916
- import { existsSync as existsSync30, readFileSync as readFileSync25, statSync as statSync24 } from "node:fs";
29993
+ import { existsSync as existsSync30, readFileSync as readFileSync25, statSync as statSync25 } from "node:fs";
29917
29994
  import { homedir as homedir27 } from "node:os";
29918
- import { dirname as dirname17, isAbsolute as isAbsolute4, resolve as resolve24 } from "node:path";
29995
+ import { dirname as dirname18, isAbsolute as isAbsolute4, resolve as resolve24 } from "node:path";
29919
29996
  function classifyTool(toolName) {
29920
29997
  if (SHELL_TOOLS.has(toolName))
29921
29998
  return { toolClass: "shell", toolIsKnown: true };
@@ -30142,7 +30219,7 @@ function findGitDir(start) {
30142
30219
  const candidate = resolve24(dir, ".git");
30143
30220
  if (existsSync30(candidate))
30144
30221
  return candidate;
30145
- const parent = dirname17(dir);
30222
+ const parent = dirname18(dir);
30146
30223
  if (parent === dir)
30147
30224
  return null;
30148
30225
  dir = parent;
@@ -30153,7 +30230,7 @@ function findProjectRoot(cwd) {
30153
30230
  if (!cwd)
30154
30231
  return null;
30155
30232
  const gitDir = findGitDir(cwd);
30156
- return gitDir ? dirname17(gitDir) : cwd;
30233
+ return gitDir ? dirname18(gitDir) : cwd;
30157
30234
  }
30158
30235
  function readCurrentBranch(cwd) {
30159
30236
  if (!cwd)
@@ -30163,12 +30240,12 @@ function readCurrentBranch(cwd) {
30163
30240
  if (!gitPath)
30164
30241
  return null;
30165
30242
  let headFile = resolve24(gitPath, "HEAD");
30166
- if (statSync24(gitPath).isFile()) {
30243
+ if (statSync25(gitPath).isFile()) {
30167
30244
  const pointer = readFileSync25(gitPath, "utf8").trim();
30168
30245
  const m = /^gitdir:\s*(.+)$/.exec(pointer);
30169
30246
  if (!m)
30170
30247
  return null;
30171
- headFile = resolve24(dirname17(gitPath), m[1], "HEAD");
30248
+ headFile = resolve24(dirname18(gitPath), m[1], "HEAD");
30172
30249
  }
30173
30250
  const head = readFileSync25(headFile, "utf8").trim();
30174
30251
  const ref = /^ref:\s*refs\/heads\/(.+)$/.exec(head);
@@ -30563,15 +30640,15 @@ import {
30563
30640
  closeSync as closeSync4,
30564
30641
  mkdirSync as mkdirSync14,
30565
30642
  openSync as openSync4,
30566
- readdirSync as readdirSync16,
30643
+ readdirSync as readdirSync17,
30567
30644
  readFileSync as readFileSync26,
30568
30645
  readSync as readSync3,
30569
30646
  renameSync as renameSync10,
30570
- statSync as statSync25,
30647
+ statSync as statSync26,
30571
30648
  unlinkSync as unlinkSync4,
30572
30649
  writeFileSync as writeFileSync12
30573
30650
  } from "node:fs";
30574
- import { dirname as dirname18, resolve as resolve25 } from "node:path";
30651
+ import { dirname as dirname19, resolve as resolve25 } from "node:path";
30575
30652
  function intentProfileKey(profile) {
30576
30653
  if (validAgentIdentity(profile.agent))
30577
30654
  return `${profile.agent.integration}.${profile.agent.instanceId}`;
@@ -30597,7 +30674,7 @@ function storeDirChain(innermost = sessionsDir()) {
30597
30674
  chain.push(dir);
30598
30675
  if (dir === home)
30599
30676
  break;
30600
- const parent = dirname18(dir);
30677
+ const parent = dirname19(dir);
30601
30678
  if (parent === dir)
30602
30679
  break;
30603
30680
  dir = parent;
@@ -30610,7 +30687,7 @@ function looseIntentStoreDir(innermost) {
30610
30687
  for (const dir of storeDirChain(innermost)) {
30611
30688
  let mode;
30612
30689
  try {
30613
- mode = statSync25(dir).mode & 511;
30690
+ mode = statSync26(dir).mode & 511;
30614
30691
  } catch {
30615
30692
  continue;
30616
30693
  }
@@ -30618,7 +30695,7 @@ function looseIntentStoreDir(innermost) {
30618
30695
  continue;
30619
30696
  try {
30620
30697
  chmodSync7(dir, mode & ~DIR_WRITABLE_BY_OTHERS3);
30621
- if ((statSync25(dir).mode & DIR_WRITABLE_BY_OTHERS3) !== 0)
30698
+ if ((statSync26(dir).mode & DIR_WRITABLE_BY_OTHERS3) !== 0)
30622
30699
  return dir;
30623
30700
  } catch {
30624
30701
  return dir;
@@ -30655,7 +30732,7 @@ function appendPrompt(slot, entry) {
30655
30732
  }
30656
30733
  function fileExists2(path) {
30657
30734
  try {
30658
- statSync25(path);
30735
+ statSync26(path);
30659
30736
  return true;
30660
30737
  } catch {
30661
30738
  return false;
@@ -30665,12 +30742,12 @@ function pruneExpiredSessions(now = Date.now()) {
30665
30742
  const root = sessionsDir();
30666
30743
  let removed = pruneDir(root, now);
30667
30744
  try {
30668
- for (const name of readdirSync16(root)) {
30745
+ for (const name of readdirSync17(root)) {
30669
30746
  if (!PROFILE_DIR_RE.test(name))
30670
30747
  continue;
30671
30748
  const dir = resolve25(root, name);
30672
30749
  try {
30673
- if (statSync25(dir).isDirectory())
30750
+ if (statSync26(dir).isDirectory())
30674
30751
  removed += pruneDir(dir, now);
30675
30752
  } catch {}
30676
30753
  }
@@ -30680,12 +30757,12 @@ function pruneExpiredSessions(now = Date.now()) {
30680
30757
  function pruneDir(dir, now) {
30681
30758
  let removed = 0;
30682
30759
  try {
30683
- for (const name of readdirSync16(dir)) {
30760
+ for (const name of readdirSync17(dir)) {
30684
30761
  if (!SESSION_FILE_RE3.test(name))
30685
30762
  continue;
30686
30763
  const path = resolve25(dir, name);
30687
30764
  try {
30688
- const st = statSync25(path);
30765
+ const st = statSync26(path);
30689
30766
  if (st.isFile() && now - st.mtimeMs > INTENT_MAX_AGE_MS) {
30690
30767
  unlinkSync4(path);
30691
30768
  removed++;
@@ -31000,7 +31077,7 @@ function visitLinesBackwards(transcriptPath, maxBytes, visit) {
31000
31077
  return;
31001
31078
  let fd;
31002
31079
  try {
31003
- const st = statSync25(path);
31080
+ const st = statSync26(path);
31004
31081
  if (!st.isFile() || st.size === 0)
31005
31082
  return;
31006
31083
  fd = openSync4(path, "r");
@@ -31636,7 +31713,7 @@ var init_jev_client = __esm(() => {
31636
31713
 
31637
31714
  // src/hooks/semantic/evaluator.ts
31638
31715
  import { createHash as createHash9 } from "node:crypto";
31639
- import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15, renameSync as renameSync11, statSync as statSync26 } from "node:fs";
31716
+ import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15, renameSync as renameSync11, statSync as statSync27 } from "node:fs";
31640
31717
  import { resolve as resolve26 } from "node:path";
31641
31718
  function storeCut(message) {
31642
31719
  return typeof message === "string" && message.length >= MAX_USER_MESSAGE_CHARS - STORE_CUT_SLACK && OMISSION_MARK.test(message);
@@ -31810,7 +31887,7 @@ function appendVerdictLog(row) {
31810
31887
  const file = verdictLogFile();
31811
31888
  mkdirSync15(semanticDir(), { recursive: true, mode: 448 });
31812
31889
  try {
31813
- if (statSync26(file).size > VERDICT_LOG_MAX_BYTES)
31890
+ if (statSync27(file).size > VERDICT_LOG_MAX_BYTES)
31814
31891
  renameSync11(file, `${file}.1`);
31815
31892
  } catch {}
31816
31893
  appendFileSync3(file, JSON.stringify(row) + `
@@ -32535,7 +32612,7 @@ var init_jev_throttle = __esm(() => {
32535
32612
  });
32536
32613
 
32537
32614
  // src/hooks/semantic/session-root.ts
32538
- import { mkdirSync as mkdirSync16, readdirSync as readdirSync17, readFileSync as readFileSync27, statSync as statSync27, unlinkSync as unlinkSync5, writeFileSync as writeFileSync13 } from "node:fs";
32615
+ import { mkdirSync as mkdirSync16, readdirSync as readdirSync18, readFileSync as readFileSync27, statSync as statSync28, unlinkSync as unlinkSync5, writeFileSync as writeFileSync13 } from "node:fs";
32539
32616
  import { isAbsolute as isAbsolute5, resolve as resolve27 } from "node:path";
32540
32617
  function validRoot(v) {
32541
32618
  return typeof v === "string" && isAbsolute5(v) && resolve27(v) === v && v !== "/";
@@ -32546,7 +32623,7 @@ function storeIsOurs() {
32546
32623
  if (looseIntentStoreDir() !== null)
32547
32624
  return false;
32548
32625
  try {
32549
- const mode = statSync27(rootsDir()).mode & 511;
32626
+ const mode = statSync28(rootsDir()).mode & 511;
32550
32627
  return (mode & DIR_WRITABLE_BY_OTHERS4) === 0;
32551
32628
  } catch {
32552
32629
  return true;
@@ -32564,12 +32641,12 @@ function pruneSessionRoots(now = Date.now()) {
32564
32641
  let removed = 0;
32565
32642
  try {
32566
32643
  const dir = rootsDir();
32567
- for (const name of readdirSync17(dir)) {
32644
+ for (const name of readdirSync18(dir)) {
32568
32645
  if (!ROOT_FILE_RE.test(name))
32569
32646
  continue;
32570
32647
  const path = resolve27(dir, name);
32571
32648
  try {
32572
- const st = statSync27(path);
32649
+ const st = statSync28(path);
32573
32650
  if (st.isFile() && now - st.mtimeMs > SESSION_ROOT_MAX_AGE_MS) {
32574
32651
  unlinkSync5(path);
32575
32652
  removed++;
@@ -34508,8 +34585,8 @@ var init_collector_config = __esm(() => {
34508
34585
  });
34509
34586
 
34510
34587
  // src/hooks/flush-cli.ts
34511
- import { existsSync as existsSync32, mkdirSync as mkdirSync17, writeFileSync as writeFileSync14, readdirSync as readdirSync18, statSync as statSync28 } from "node:fs";
34512
- import { dirname as dirname19, join as join33 } from "node:path";
34588
+ import { existsSync as existsSync32, mkdirSync as mkdirSync17, writeFileSync as writeFileSync14, readdirSync as readdirSync19, statSync as statSync29 } from "node:fs";
34589
+ import { dirname as dirname20, join as join33 } from "node:path";
34513
34590
  function flushRequestPath(home) {
34514
34591
  return join33(failproofaiHome(home), "state", "flush-request.json");
34515
34592
  }
@@ -34519,14 +34596,14 @@ function spoolDirs(home) {
34519
34596
  if (!existsSync32(root))
34520
34597
  return dirs;
34521
34598
  try {
34522
- return dirs.concat(readdirSync18(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join33(root, e.name)));
34599
+ return dirs.concat(readdirSync19(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join33(root, e.name)));
34523
34600
  } catch {
34524
34601
  return dirs;
34525
34602
  }
34526
34603
  }
34527
34604
  function parkedBatches(home) {
34528
34605
  try {
34529
- return readdirSync18(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
34606
+ return readdirSync19(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
34530
34607
  } catch {
34531
34608
  return 0;
34532
34609
  }
@@ -34543,14 +34620,14 @@ function spoolBacklog(home, now = Date.now()) {
34543
34620
  for (const dir of spoolDirs(home)) {
34544
34621
  let names;
34545
34622
  try {
34546
- names = readdirSync18(dir).filter((f) => f.endsWith(".jsonl"));
34623
+ names = readdirSync19(dir).filter((f) => f.endsWith(".jsonl"));
34547
34624
  } catch {
34548
34625
  continue;
34549
34626
  }
34550
34627
  count += names.length;
34551
34628
  for (const name of names) {
34552
34629
  try {
34553
- const mtime = statSync28(join33(dir, name)).mtimeMs;
34630
+ const mtime = statSync29(join33(dir, name)).mtimeMs;
34554
34631
  if (oldest === undefined || mtime < oldest)
34555
34632
  oldest = mtime;
34556
34633
  } catch {}
@@ -34612,7 +34689,7 @@ async function runFlushCommand(opts = {}) {
34612
34689
  return { exitCode: 0, pending: 0, lines: nothing };
34613
34690
  }
34614
34691
  const path = flushRequestPath(home);
34615
- mkdirSync17(dirname19(path), { recursive: true });
34692
+ mkdirSync17(dirname20(path), { recursive: true });
34616
34693
  writeFileSync14(path, `${JSON.stringify({ requestedAtMs: Date.now() }, null, 2)}
34617
34694
  `, {
34618
34695
  mode: 384
@@ -34656,7 +34733,7 @@ import {
34656
34733
  rmSync as rmSync12,
34657
34734
  writeFileSync as writeFileSync15
34658
34735
  } from "node:fs";
34659
- import { basename as basename7, dirname as dirname20, join as join34, resolve as resolve28 } from "node:path";
34736
+ import { basename as basename7, dirname as dirname21, join as join34, resolve as resolve28 } from "node:path";
34660
34737
  function migrateToLayout4() {
34661
34738
  const moves = [
34662
34739
  { from: legacy.authJson(), to: auditSessionFile() },
@@ -34678,7 +34755,7 @@ function migrateToLayout4() {
34678
34755
  rmSync12(from, { force: true });
34679
34756
  continue;
34680
34757
  }
34681
- mkdirSync18(dirname20(to), { recursive: true });
34758
+ mkdirSync18(dirname21(to), { recursive: true });
34682
34759
  try {
34683
34760
  renameSync12(from, to);
34684
34761
  } catch {
@@ -35115,7 +35192,7 @@ var init_install_telemetry = () => {};
35115
35192
 
35116
35193
  // lib/install-check.ts
35117
35194
  import { existsSync as existsSync34, readFileSync as readFileSync30, writeFileSync as writeFileSync17, mkdirSync as mkdirSync20 } from "node:fs";
35118
- import { dirname as dirname21, resolve as resolve29 } from "node:path";
35195
+ import { dirname as dirname22, resolve as resolve29 } from "node:path";
35119
35196
  import { platform as platform2, arch as arch2, release, homedir as homedir29, hostname as hostname2 } from "node:os";
35120
35197
  import { createHmac as createHmac2 } from "node:crypto";
35121
35198
  function hashToId4(raw) {
@@ -35249,7 +35326,7 @@ async function maybeReportInstall(version) {
35249
35326
  enabled_policy_count: hooks.policyCount
35250
35327
  }, { version, timeoutMs: REPORT_TIMEOUT_MS, enabled: telemetryEnabled }));
35251
35328
  try {
35252
- mkdirSync20(dirname21(versionFile), { recursive: true });
35329
+ mkdirSync20(dirname22(versionFile), { recursive: true });
35253
35330
  writeFileSync17(versionFile, version, "utf8");
35254
35331
  } catch {}
35255
35332
  await Promise.all(events.map((p) => p.catch(() => {})));
@@ -36717,7 +36794,7 @@ var init_cloud_introspect = __esm(() => {
36717
36794
 
36718
36795
  // src/hooks/credential-recovery.ts
36719
36796
  import { createHash as createHash11 } from "node:crypto";
36720
- import { existsSync as existsSync40, mkdirSync as mkdirSync22, readdirSync as readdirSync19, renameSync as renameSync13 } from "node:fs";
36797
+ import { existsSync as existsSync40, mkdirSync as mkdirSync22, readdirSync as readdirSync20, renameSync as renameSync13 } from "node:fs";
36721
36798
  import { join as join38 } from "node:path";
36722
36799
  function previousOrgDirectory(id) {
36723
36800
  const safe = id && /^[A-Za-z0-9_-]{1,128}$/.test(id) ? id : id ? createHash11("sha256").update(id).digest("hex") : "unknown";
@@ -36728,7 +36805,7 @@ function recoverCredentialRefusals(sameOrg, oldOrgId) {
36728
36805
  if (!existsSync40(dir))
36729
36806
  return 0;
36730
36807
  let recovered = 0;
36731
- for (const name of readdirSync19(dir)) {
36808
+ for (const name of readdirSync20(dir)) {
36732
36809
  if (!/\.c(401|403)\.jsonl$/.test(name) || name.startsWith("."))
36733
36810
  continue;
36734
36811
  const targetDir = sameOrg ? dir : join38(previousOrgDirectory(oldOrgId), "failed");
@@ -36765,11 +36842,11 @@ import {
36765
36842
  readSync as readSync4,
36766
36843
  renameSync as renameSync14,
36767
36844
  rmSync as rmSync15,
36768
- statSync as statSync29,
36845
+ statSync as statSync30,
36769
36846
  unlinkSync as unlinkSync6,
36770
36847
  writeFileSync as writeFileSync18
36771
36848
  } from "node:fs";
36772
- import { dirname as dirname22 } from "node:path";
36849
+ import { dirname as dirname23 } from "node:path";
36773
36850
  import { randomBytes as randomBytes3 } from "node:crypto";
36774
36851
  function writeCloudJevConfig(cloudBase) {
36775
36852
  const first = writeCloudJevConfigIfAbsent(cloudBase);
@@ -36850,7 +36927,7 @@ function writeCloudJevConfigIfAbsent(cloudBase) {
36850
36927
  return kept(path, cloudBase);
36851
36928
  const body = `${JSON.stringify({ provider: JEV_CLOUD_PROVIDER, baseUrl, mode: CLOUD_JEV_INITIAL_MODE }, null, 2)}
36852
36929
  `;
36853
- const dir = dirname22(path);
36930
+ const dir = dirname23(path);
36854
36931
  const tmp = `${path}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
36855
36932
  try {
36856
36933
  if (!existsSync41(dir))
@@ -36915,7 +36992,7 @@ function tightenDir(dir) {
36915
36992
  if (process.platform === "win32")
36916
36993
  return;
36917
36994
  try {
36918
- const before = statSync29(dir).mode & 511;
36995
+ const before = statSync30(dir).mode & 511;
36919
36996
  if ((before & 18) !== 0)
36920
36997
  chmodSync9(dir, before & ~18);
36921
36998
  } catch {}
@@ -37338,8 +37415,8 @@ var init_cloud_connection = __esm(() => {
37338
37415
  });
37339
37416
 
37340
37417
  // src/hooks/setup-state.ts
37341
- import { existsSync as existsSync42, realpathSync as realpathSync4, statSync as statSync30 } from "node:fs";
37342
- import { dirname as dirname23, resolve as resolve32 } from "node:path";
37418
+ import { existsSync as existsSync42, realpathSync as realpathSync4, statSync as statSync31 } from "node:fs";
37419
+ import { dirname as dirname24, resolve as resolve32 } from "node:path";
37343
37420
  import { homedir as homedir31 } from "node:os";
37344
37421
  function globalConfigPath(home = homedir31()) {
37345
37422
  return globalPolicyConfigFile(home);
@@ -37352,7 +37429,7 @@ function legacyMarkerPath(home) {
37352
37429
  }
37353
37430
  function isDir(path) {
37354
37431
  try {
37355
- return statSync30(path).isDirectory();
37432
+ return statSync31(path).isDirectory();
37356
37433
  } catch {
37357
37434
  return false;
37358
37435
  }
@@ -37363,7 +37440,7 @@ function findProjectRoot2(start, home = homedir31()) {
37363
37440
  while (dir !== resolvedHome) {
37364
37441
  if (isDir(resolve32(dir, ".failproofai")))
37365
37442
  return dir;
37366
- const parent = dirname23(dir);
37443
+ const parent = dirname24(dir);
37367
37444
  if (parent === dir)
37368
37445
  break;
37369
37446
  dir = parent;
@@ -37413,7 +37490,7 @@ var init_setup_state = __esm(() => {
37413
37490
 
37414
37491
  // src/hooks/onboarding-attempt.ts
37415
37492
  import { existsSync as existsSync43, mkdirSync as mkdirSync24, readFileSync as readFileSync34, rmSync as rmSync17, writeFileSync as writeFileSync19 } from "node:fs";
37416
- import { dirname as dirname24 } from "node:path";
37493
+ import { dirname as dirname25 } from "node:path";
37417
37494
  function readOnboardingAttempt() {
37418
37495
  const path = onboardingAttemptFile();
37419
37496
  if (!existsSync43(path))
@@ -37438,7 +37515,7 @@ function readOnboardingAttempt() {
37438
37515
  function recordOnboardingAttempt(reason, cliVersion, daemonStatus, now = Date.now()) {
37439
37516
  try {
37440
37517
  const path = onboardingAttemptFile();
37441
- mkdirSync24(dirname24(path), { recursive: true });
37518
+ mkdirSync24(dirname25(path), { recursive: true });
37442
37519
  const record = {
37443
37520
  schemaVersion: SCHEMA_VERSION3,
37444
37521
  reason,
@@ -37546,7 +37623,7 @@ var init_onboarding_lock = __esm(() => {
37546
37623
  });
37547
37624
 
37548
37625
  // lib/claude-sessions.ts
37549
- import { readdirSync as readdirSync20, statSync as statSync31, existsSync as existsSync44 } from "node:fs";
37626
+ import { readdirSync as readdirSync21, statSync as statSync32, existsSync as existsSync44 } from "node:fs";
37550
37627
  import { join as join39, basename as basename9 } from "node:path";
37551
37628
  function getClaudeProjectsRoot() {
37552
37629
  return getClaudeProjectsPath();
@@ -37555,7 +37632,7 @@ function listClaudeProjects() {
37555
37632
  const root = getClaudeProjectsRoot();
37556
37633
  let entries;
37557
37634
  try {
37558
- entries = readdirSync20(root, { withFileTypes: true });
37635
+ entries = readdirSync21(root, { withFileTypes: true });
37559
37636
  } catch {
37560
37637
  return [];
37561
37638
  }
@@ -37569,7 +37646,7 @@ function listClaudeTranscripts(project) {
37569
37646
  const out = [];
37570
37647
  let entries;
37571
37648
  try {
37572
- entries = readdirSync20(project.path, { withFileTypes: true });
37649
+ entries = readdirSync21(project.path, { withFileTypes: true });
37573
37650
  } catch {
37574
37651
  return out;
37575
37652
  }
@@ -37580,7 +37657,7 @@ function listClaudeTranscripts(project) {
37580
37657
  continue;
37581
37658
  const transcriptPath = join39(project.path, entry.name);
37582
37659
  try {
37583
- const s = statSync31(transcriptPath);
37660
+ const s = statSync32(transcriptPath);
37584
37661
  out.push({
37585
37662
  projectName: project.name,
37586
37663
  cwd: project.cwd,
@@ -37597,7 +37674,7 @@ function listClaudeTranscripts(project) {
37597
37674
  continue;
37598
37675
  let subEntries;
37599
37676
  try {
37600
- subEntries = readdirSync20(subDir, { withFileTypes: true });
37677
+ subEntries = readdirSync21(subDir, { withFileTypes: true });
37601
37678
  } catch {
37602
37679
  continue;
37603
37680
  }
@@ -37607,7 +37684,7 @@ function listClaudeTranscripts(project) {
37607
37684
  const agentId = sub.name.slice(0, -".jsonl".length);
37608
37685
  const transcriptPath = join39(subDir, sub.name);
37609
37686
  try {
37610
- const s = statSync31(transcriptPath);
37687
+ const s = statSync32(transcriptPath);
37611
37688
  out.push({
37612
37689
  projectName: project.name,
37613
37690
  cwd: project.cwd,
@@ -37823,7 +37900,7 @@ var init_claude = __esm(() => {
37823
37900
  });
37824
37901
 
37825
37902
  // src/audit/cli-adapters/codex.ts
37826
- import { statSync as statSync32 } from "node:fs";
37903
+ import { statSync as statSync33 } from "node:fs";
37827
37904
  async function listCodexTranscriptMetadata(opts = {}) {
37828
37905
  const projectFilter = opts.projects ? new Set(opts.projects) : null;
37829
37906
  const sinceMs = opts.sinceMs ?? 0;
@@ -37840,7 +37917,7 @@ async function listCodexTranscriptMetadata(opts = {}) {
37840
37917
  continue;
37841
37918
  let sizeBytes = 0;
37842
37919
  try {
37843
- sizeBytes = statSync32(s.path).size;
37920
+ sizeBytes = statSync33(s.path).size;
37844
37921
  } catch {}
37845
37922
  if (!s.sessionId)
37846
37923
  continue;
@@ -37874,7 +37951,7 @@ var init_codex = __esm(() => {
37874
37951
  });
37875
37952
 
37876
37953
  // src/audit/cli-adapters/copilot.ts
37877
- import { statSync as statSync33 } from "node:fs";
37954
+ import { statSync as statSync34 } from "node:fs";
37878
37955
  async function listCopilotTranscriptMetadata(opts = {}) {
37879
37956
  const projectFilter = opts.projects ? new Set(opts.projects) : null;
37880
37957
  const sinceMs = opts.sinceMs ?? 0;
@@ -37891,7 +37968,7 @@ async function listCopilotTranscriptMetadata(opts = {}) {
37891
37968
  continue;
37892
37969
  let sizeBytes = 0;
37893
37970
  try {
37894
- sizeBytes = statSync33(s.path).size;
37971
+ sizeBytes = statSync34(s.path).size;
37895
37972
  } catch {}
37896
37973
  if (!s.sessionId)
37897
37974
  continue;
@@ -37925,7 +38002,7 @@ var init_copilot = __esm(() => {
37925
38002
  });
37926
38003
 
37927
38004
  // src/audit/cli-adapters/cursor.ts
37928
- import { statSync as statSync34 } from "node:fs";
38005
+ import { statSync as statSync35 } from "node:fs";
37929
38006
  async function listCursorTranscriptMetadata(opts = {}) {
37930
38007
  const projectFilter = opts.projects ? new Set(opts.projects) : null;
37931
38008
  const sinceMs = opts.sinceMs ?? 0;
@@ -37942,7 +38019,7 @@ async function listCursorTranscriptMetadata(opts = {}) {
37942
38019
  continue;
37943
38020
  let sizeBytes = 0;
37944
38021
  try {
37945
- sizeBytes = statSync34(s.path).size;
38022
+ sizeBytes = statSync35(s.path).size;
37946
38023
  } catch {}
37947
38024
  if (!s.sessionId)
37948
38025
  continue;
@@ -38183,7 +38260,7 @@ var init_opencode = __esm(() => {
38183
38260
  });
38184
38261
 
38185
38262
  // src/audit/cli-adapters/pi.ts
38186
- import { statSync as statSync35 } from "node:fs";
38263
+ import { statSync as statSync36 } from "node:fs";
38187
38264
  async function listPiTranscriptMetadata(opts = {}) {
38188
38265
  const projectFilter = opts.projects ? new Set(opts.projects) : null;
38189
38266
  const sinceMs = opts.sinceMs ?? 0;
@@ -38200,7 +38277,7 @@ async function listPiTranscriptMetadata(opts = {}) {
38200
38277
  continue;
38201
38278
  let sizeBytes = 0;
38202
38279
  try {
38203
- sizeBytes = statSync35(s.path).size;
38280
+ sizeBytes = statSync36(s.path).size;
38204
38281
  } catch {}
38205
38282
  if (!s.sessionId)
38206
38283
  continue;
@@ -39859,7 +39936,7 @@ var init_api_server_client = __esm(() => {
39859
39936
  });
39860
39937
 
39861
39938
  // lib/auth/auth-store.ts
39862
- import { existsSync as existsSync47, readFileSync as readFileSync39, readdirSync as readdirSync21, rmSync as rmSync19 } from "node:fs";
39939
+ import { existsSync as existsSync47, readFileSync as readFileSync39, readdirSync as readdirSync22, rmSync as rmSync19 } from "node:fs";
39863
39940
  import { join as join41, resolve as resolve33 } from "node:path";
39864
39941
  function getAuthFilePath() {
39865
39942
  const override = process.env.FAILPROOFAI_AUTH_DIR;
@@ -39900,7 +39977,7 @@ function deleteAuth() {
39900
39977
  const root = migrationsDir();
39901
39978
  if (!existsSync47(root))
39902
39979
  return;
39903
- for (const entry of readdirSync21(root)) {
39980
+ for (const entry of readdirSync22(root)) {
39904
39981
  if (!entry.startsWith("backup-layout"))
39905
39982
  continue;
39906
39983
  const copy = resolve33(root, entry, "auth.json");
@@ -40495,7 +40572,7 @@ var init_cli = __esm(() => {
40495
40572
  // src/hooks/configure-wizard.ts
40496
40573
  import { existsSync as existsSync49, mkdirSync as mkdirSync28, writeFileSync as writeFileSync23, readFileSync as readFileSync41 } from "node:fs";
40497
40574
  import { homedir as homedir34 } from "node:os";
40498
- import { dirname as dirname25, resolve as resolve34, sep as sep5 } from "node:path";
40575
+ import { dirname as dirname26, resolve as resolve34, sep as sep5 } from "node:path";
40499
40576
  async function emit(event, props) {
40500
40577
  try {
40501
40578
  await trackHookEvent2(getInstanceId2(), event, props);
@@ -40684,7 +40761,7 @@ function firstRunMarkerPath() {
40684
40761
  }
40685
40762
  function markLauncherSeen() {
40686
40763
  try {
40687
- mkdirSync28(dirname25(firstRunMarkerPath()), { recursive: true });
40764
+ mkdirSync28(dirname26(firstRunMarkerPath()), { recursive: true });
40688
40765
  writeFileSync23(firstRunMarkerPath(), "1", "utf8");
40689
40766
  } catch {}
40690
40767
  }
@@ -41511,8 +41588,8 @@ var init_configure_wizard = __esm(() => {
41511
41588
  });
41512
41589
 
41513
41590
  // src/hooks/flush-cli.ts
41514
- import { existsSync as existsSync50, mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, readdirSync as readdirSync22, statSync as statSync36 } from "node:fs";
41515
- import { dirname as dirname26, join as join42 } from "node:path";
41591
+ import { existsSync as existsSync50, mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, readdirSync as readdirSync23, statSync as statSync37 } from "node:fs";
41592
+ import { dirname as dirname27, join as join42 } from "node:path";
41516
41593
  function flushRequestPath2(home) {
41517
41594
  return join42(failproofaiHome(home), "state", "flush-request.json");
41518
41595
  }
@@ -41522,14 +41599,14 @@ function spoolDirs2(home) {
41522
41599
  if (!existsSync50(root))
41523
41600
  return dirs;
41524
41601
  try {
41525
- return dirs.concat(readdirSync22(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join42(root, e.name)));
41602
+ return dirs.concat(readdirSync23(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "failed").map((e) => join42(root, e.name)));
41526
41603
  } catch {
41527
41604
  return dirs;
41528
41605
  }
41529
41606
  }
41530
41607
  function parkedBatches2(home) {
41531
41608
  try {
41532
- return readdirSync22(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
41609
+ return readdirSync23(failedDir(home)).filter((f) => f.endsWith(".jsonl")).length;
41533
41610
  } catch {
41534
41611
  return 0;
41535
41612
  }
@@ -41546,14 +41623,14 @@ function spoolBacklog2(home, now = Date.now()) {
41546
41623
  for (const dir of spoolDirs2(home)) {
41547
41624
  let names;
41548
41625
  try {
41549
- names = readdirSync22(dir).filter((f) => f.endsWith(".jsonl"));
41626
+ names = readdirSync23(dir).filter((f) => f.endsWith(".jsonl"));
41550
41627
  } catch {
41551
41628
  continue;
41552
41629
  }
41553
41630
  count += names.length;
41554
41631
  for (const name of names) {
41555
41632
  try {
41556
- const mtime = statSync36(join42(dir, name)).mtimeMs;
41633
+ const mtime = statSync37(join42(dir, name)).mtimeMs;
41557
41634
  if (oldest === undefined || mtime < oldest)
41558
41635
  oldest = mtime;
41559
41636
  } catch {}
@@ -41615,7 +41692,7 @@ async function runFlushCommand2(opts = {}) {
41615
41692
  return { exitCode: 0, pending: 0, lines: nothing };
41616
41693
  }
41617
41694
  const path = flushRequestPath2(home);
41618
- mkdirSync29(dirname26(path), { recursive: true });
41695
+ mkdirSync29(dirname27(path), { recursive: true });
41619
41696
  writeFileSync24(path, `${JSON.stringify({ requestedAtMs: Date.now() }, null, 2)}
41620
41697
  `, {
41621
41698
  mode: 384
@@ -44144,7 +44221,7 @@ var init_main = __esm(() => {
44144
44221
  // src/hooks/otel-writers.ts
44145
44222
  import { homedir as homedir35 } from "node:os";
44146
44223
  import { resolve as resolve35 } from "node:path";
44147
- import { accessSync as accessSync2, constants, readdirSync as readdirSync23, statSync as statSync37 } from "node:fs";
44224
+ import { accessSync as accessSync2, constants, readdirSync as readdirSync24, statSync as statSync38 } from "node:fs";
44148
44225
  function vscodeSettingsPath(home = homedir35(), platform = process.platform) {
44149
44226
  if (platform === "darwin")
44150
44227
  return resolve35(home, "Library/Application Support/Code/User/settings.json");
@@ -44159,7 +44236,7 @@ function vscodeInstalled(home = homedir35(), platform = process.platform) {
44159
44236
  const executable = (path) => {
44160
44237
  try {
44161
44238
  accessSync2(path, platform === "win32" ? constants.F_OK : constants.X_OK);
44162
- return statSync37(path).isFile();
44239
+ return statSync38(path).isFile();
44163
44240
  } catch {
44164
44241
  return false;
44165
44242
  }
@@ -44171,7 +44248,7 @@ function vscodeInstalled(home = homedir35(), platform = process.platform) {
44171
44248
  return true;
44172
44249
  return [".vscode", ".vscode-insiders"].some((folder) => {
44173
44250
  try {
44174
- return readdirSync23(resolve35(home, folder, "extensions"), { withFileTypes: true }).some((entry) => entry.isDirectory() && /^github\.copilot(?:-chat)?-\d/i.test(entry.name));
44251
+ return readdirSync24(resolve35(home, folder, "extensions"), { withFileTypes: true }).some((entry) => entry.isDirectory() && /^github\.copilot(?:-chat)?-\d/i.test(entry.name));
44175
44252
  } catch {
44176
44253
  return false;
44177
44254
  }
@@ -44394,11 +44471,11 @@ import {
44394
44471
  existsSync as existsSync52,
44395
44472
  mkdirSync as mkdirSync30,
44396
44473
  readFileSync as readFileSync42,
44397
- statSync as statSync38,
44474
+ statSync as statSync39,
44398
44475
  unlinkSync as unlinkSync8,
44399
44476
  writeFileSync as writeFileSync25
44400
44477
  } from "node:fs";
44401
- import { dirname as dirname27 } from "node:path";
44478
+ import { dirname as dirname28 } from "node:path";
44402
44479
  import { createHash as createHash13, randomUUID as randomUUID6 } from "node:crypto";
44403
44480
  import { homedir as homedir36 } from "node:os";
44404
44481
  import { connect } from "node:net";
@@ -44458,13 +44535,13 @@ function credential() {
44458
44535
  function backupOnce(path, original) {
44459
44536
  if (existsSync52(`${path}.failproofai-bak`))
44460
44537
  return;
44461
- mkdirSync30(dirname27(path), { recursive: true });
44538
+ mkdirSync30(dirname28(path), { recursive: true });
44462
44539
  writeFileSync25(`${path}.failproofai-bak`, original ?? "", { flag: "wx", mode: 384 });
44463
44540
  chmodSync11(`${path}.failproofai-bak`, 384);
44464
44541
  }
44465
44542
  function savePrivate(agent, state) {
44466
44543
  const path = otelAgentStateFile(agent);
44467
- mkdirSync30(dirname27(path), { recursive: true, mode: 448 });
44544
+ mkdirSync30(dirname28(path), { recursive: true, mode: 448 });
44468
44545
  writeConfigFileAtomic(path, JSON.stringify(state), { backup: false, mode: 384 });
44469
44546
  chmodSync11(path, 384);
44470
44547
  }
@@ -44569,7 +44646,7 @@ async function enableAgent(agent, yes, localFlag, content, options) {
44569
44646
  const next = editAgentConfig(original ?? "", agent, [...released, ...writes]);
44570
44647
  const state = oldState ?? {
44571
44648
  original,
44572
- originalMode: original === null ? undefined : statSync38(file).mode & 511,
44649
+ originalMode: original === null ? undefined : statSync39(file).mode & 511,
44573
44650
  writtenHash: "",
44574
44651
  previous: writes.map((w) => ({ path: w.path, value: getSetting(parsed, w.path) }))
44575
44652
  };
@@ -45247,8 +45324,8 @@ var init_jev_stats = __esm(() => {
45247
45324
  });
45248
45325
 
45249
45326
  // src/hooks/jev-cli.ts
45250
- import { chmodSync as chmodSync12, existsSync as existsSync53, statSync as statSync39, unlinkSync as unlinkSync9 } from "node:fs";
45251
- import { dirname as dirname28 } from "node:path";
45327
+ import { chmodSync as chmodSync12, existsSync as existsSync53, statSync as statSync40, unlinkSync as unlinkSync9 } from "node:fs";
45328
+ import { dirname as dirname29 } from "node:path";
45252
45329
  function jevHeader(name, meta, opts) {
45253
45330
  return [screenKit(opts).header(meta ? `${name} · ${meta}` : name)];
45254
45331
  }
@@ -45829,13 +45906,13 @@ async function setupRun(argv, deps, opts) {
45829
45906
  }
45830
45907
  let fileMode = null;
45831
45908
  try {
45832
- fileMode = statSync39(path).mode & 511;
45909
+ fileMode = statSync40(path).mode & 511;
45833
45910
  } catch {}
45834
- const dir = dirname28(path);
45911
+ const dir = dirname29(path);
45835
45912
  let tightenedDir = null;
45836
45913
  if (process.platform !== "win32") {
45837
45914
  try {
45838
- const before = statSync39(dir).mode & 511;
45915
+ const before = statSync40(dir).mode & 511;
45839
45916
  if ((before & 18) !== 0) {
45840
45917
  const after = before & -19;
45841
45918
  chmodSync12(dir, after);
@@ -45957,15 +46034,15 @@ async function cloudSetup(values, bools, opts) {
45957
46034
  }
45958
46035
  if (process.platform !== "win32") {
45959
46036
  try {
45960
- const dir = dirname28(path);
45961
- const before = statSync39(dir).mode & 511;
46037
+ const dir = dirname29(path);
46038
+ const before = statSync40(dir).mode & 511;
45962
46039
  if ((before & 18) !== 0)
45963
46040
  chmodSync12(dir, before & -19);
45964
46041
  } catch {}
45965
46042
  }
45966
46043
  let fileMode = null;
45967
46044
  try {
45968
- fileMode = statSync39(path).mode & 511;
46045
+ fileMode = statSync40(path).mode & 511;
45969
46046
  } catch {}
45970
46047
  const cfg = checked.value;
45971
46048
  const route = jevRoute(cfg);
@@ -46594,7 +46671,7 @@ import {
46594
46671
  openSync as openSync8,
46595
46672
  readFileSync as readFileSync43,
46596
46673
  readSync as readSync6,
46597
- statSync as statSync40,
46674
+ statSync as statSync41,
46598
46675
  writeFileSync as writeFileSync26
46599
46676
  } from "node:fs";
46600
46677
  function detectLayout2() {
@@ -46678,7 +46755,7 @@ import {
46678
46755
  rmSync as rmSync21,
46679
46756
  writeFileSync as writeFileSync27
46680
46757
  } from "node:fs";
46681
- import { basename as basename10, dirname as dirname29, join as join43, resolve as resolve38 } from "node:path";
46758
+ import { basename as basename10, dirname as dirname30, join as join43, resolve as resolve38 } from "node:path";
46682
46759
  function migrateToLayout42() {
46683
46760
  const moves = [
46684
46761
  { from: legacy.authJson(), to: auditSessionFile() },
@@ -46700,7 +46777,7 @@ function migrateToLayout42() {
46700
46777
  rmSync21(from, { force: true });
46701
46778
  continue;
46702
46779
  }
46703
- mkdirSync32(dirname29(to), { recursive: true });
46780
+ mkdirSync32(dirname30(to), { recursive: true });
46704
46781
  try {
46705
46782
  renameSync15(from, to);
46706
46783
  } catch {
@@ -46939,12 +47016,14 @@ import {
46939
47016
  mkdirSync as mkdirSync33,
46940
47017
  mkdtempSync as mkdtempSync2,
46941
47018
  readFileSync as readFileSync45,
47019
+ readdirSync as readdirSync25,
47020
+ statSync as statSync42,
46942
47021
  writeFileSync as writeFileSync28,
46943
47022
  unlinkSync as unlinkSync10,
46944
47023
  rmSync as rmSync22
46945
47024
  } from "node:fs";
46946
47025
  import { homedir as homedir38, tmpdir as tmpdir3, userInfo as userInfo2 } from "node:os";
46947
- import { resolve as resolve39 } from "node:path";
47026
+ import { dirname as dirname31, resolve as resolve39 } from "node:path";
46948
47027
  import { execFileSync as execFileSync3 } from "node:child_process";
46949
47028
  function isDaemonSupportedPlatform2() {
46950
47029
  return process.platform === "linux" || process.platform === "darwin";
@@ -47050,6 +47129,60 @@ function systemdUnitDir2() {
47050
47129
  function systemdUnitPath2(user = serviceUser2()) {
47051
47130
  return resolve39(systemdUnitDir2(), systemdUnitName2(user));
47052
47131
  }
47132
+ function systemBinaryRoot2(user = serviceUser2()) {
47133
+ return resolve39(process.env.FAILPROOFAI_SYSTEM_BIN_DIR || "/opt/failproofai", user);
47134
+ }
47135
+ function systemBinaryDir2() {
47136
+ return resolve39(systemBinaryRoot2(), "bin");
47137
+ }
47138
+ function systemBinaryTarget2(binaryPath) {
47139
+ if (process.platform !== "linux" || process.env.FAILPROOFAI_DAEMON_BINARY)
47140
+ return null;
47141
+ try {
47142
+ if (!statSync42(binaryPath).isFile())
47143
+ return null;
47144
+ } catch {
47145
+ return null;
47146
+ }
47147
+ return resolve39(systemBinaryDir2(), `failproofaid-${version2}`);
47148
+ }
47149
+ function selinuxEnabled2() {
47150
+ return existsSync56("/sys/fs/selinux/enforce");
47151
+ }
47152
+ function stageSystemBinary2(binaryPath) {
47153
+ const target = systemBinaryTarget2(binaryPath);
47154
+ if (!target)
47155
+ return binaryPath;
47156
+ const dir = systemBinaryDir2();
47157
+ const staging = `${target}.${process.pid}.tmp`;
47158
+ runPrivileged2("install", ["-d", "-m", "0755", dir]);
47159
+ try {
47160
+ runPrivileged2("install", ["-m", "0755", binaryPath, staging]);
47161
+ runPrivileged2("mv", ["-f", staging, target]);
47162
+ } catch (err) {
47163
+ try {
47164
+ runPrivileged2("rm", ["-f", staging]);
47165
+ } catch {}
47166
+ throw err;
47167
+ }
47168
+ if (selinuxEnabled2()) {
47169
+ const root = systemBinaryRoot2();
47170
+ try {
47171
+ runPrivileged2("restorecon", ["-R", root]);
47172
+ } catch (err) {
47173
+ hookLogWarn(`restorecon on ${root} failed: ${err instanceof Error ? err.message : String(err)}`);
47174
+ }
47175
+ }
47176
+ return target;
47177
+ }
47178
+ function pruneSystemBinaries2(current) {
47179
+ try {
47180
+ const dir = systemBinaryDir2();
47181
+ const stale = readdirSync25(dir).filter((f) => f.startsWith("failproofaid-")).map((f) => resolve39(dir, f)).filter((p) => p !== current).map((p) => ({ p, mtime: statSync42(p).mtimeMs })).sort((a, b) => b.mtime - a.mtime).slice(1);
47182
+ for (const { p } of stale)
47183
+ runPrivileged2("rm", ["-f", p]);
47184
+ } catch {}
47185
+ }
47053
47186
  function legacySystemdUserUnitPath2() {
47054
47187
  return resolve39(homedir38(), ".config", "systemd", "user", "failproofaid.service");
47055
47188
  }
@@ -47222,9 +47355,17 @@ ${envBlock} <key>StandardOutPath</key>
47222
47355
  }
47223
47356
  function daemonInstallCommands2(binaryPath, workerCmd, cliCmd) {
47224
47357
  if (process.platform === "linux") {
47358
+ const target = systemBinaryTarget2(binaryPath);
47359
+ const dir = systemBinaryDir2();
47360
+ const stage = target ? [
47361
+ `sudo install -d -m 0755 ${dir}`,
47362
+ `sudo install -m 0755 ${binaryPath} ${target}`,
47363
+ `{ sudo restorecon -R ${systemBinaryRoot2()} 2>/dev/null || true; }`
47364
+ ] : [];
47225
47365
  return [
47366
+ ...stage,
47226
47367
  `sudo tee ${systemdUnitPath2()} <<'EOF'
47227
- ${systemdUnitContents2(binaryPath, workerCmd, cliCmd)}EOF`,
47368
+ ${systemdUnitContents2(target ?? binaryPath, workerCmd, cliCmd)}EOF`,
47228
47369
  "sudo systemctl daemon-reload",
47229
47370
  `sudo systemctl enable ${systemdUnitName2()}`,
47230
47371
  `sudo systemctl restart ${systemdUnitName2()}`
@@ -47252,9 +47393,11 @@ async function installDaemonService2() {
47252
47393
  };
47253
47394
  }
47254
47395
  removeLegacyUserService2();
47396
+ let execPath = binaryPath;
47255
47397
  try {
47256
47398
  if (process.platform === "linux") {
47257
- writePrivilegedFile2(systemdUnitPath2(), systemdUnitContents2(binaryPath, workerCmd, cliCmd));
47399
+ execPath = stageSystemBinary2(binaryPath);
47400
+ writePrivilegedFile2(systemdUnitPath2(), systemdUnitContents2(execPath, workerCmd, cliCmd));
47258
47401
  runPrivileged2("systemctl", ["daemon-reload"]);
47259
47402
  runPrivileged2("systemctl", ["enable", systemdUnitName2()]);
47260
47403
  restartSystemdUnit2();
@@ -47278,6 +47421,8 @@ async function installDaemonService2() {
47278
47421
  hookLogWarn(`daemon service install failed: ${reason}`);
47279
47422
  return { installed: false, reason };
47280
47423
  }
47424
+ if (execPath !== binaryPath)
47425
+ pruneSystemBinaries2(execPath);
47281
47426
  return { installed: true };
47282
47427
  }
47283
47428
  async function probeDaemon2() {
@@ -47686,10 +47831,12 @@ function manualServiceRemoval(servicePath) {
47686
47831
  return [`sudo launchctl unload -w ${servicePath}`, `sudo rm -f ${servicePath}`];
47687
47832
  }
47688
47833
  const unit = servicePath.split("/").pop() ?? servicePath;
47834
+ const binDir = daemonSystemBinaryDir();
47689
47835
  return [
47690
47836
  `sudo systemctl disable --now ${unit}`,
47691
47837
  `sudo rm -f ${servicePath}`,
47692
- `sudo systemctl daemon-reload`
47838
+ `sudo systemctl daemon-reload`,
47839
+ ...binDir ? [`sudo rm -rf ${binDir}`] : []
47693
47840
  ];
47694
47841
  }
47695
47842
  var init_uninstall_cli = __esm(() => {
@@ -47707,8 +47854,8 @@ var init_uninstall_cli = __esm(() => {
47707
47854
  import { execFileSync as execFileSync4 } from "node:child_process";
47708
47855
  import { homedir as homedir39, tmpdir as tmpdir4 } from "node:os";
47709
47856
  import { createHash as createHash14 } from "node:crypto";
47710
- import { copyFileSync as copyFileSync5, existsSync as existsSync58, mkdirSync as mkdirSync34, mkdtempSync as mkdtempSync3, readFileSync as readFileSync46, readdirSync as readdirSync24, realpathSync as realpathSync5, rmSync as rmSync24, statSync as statSync41, writeFileSync as writeFileSync29 } from "node:fs";
47711
- import { basename as basename11, dirname as dirname30, isAbsolute as isAbsolute6, join as join44, relative as relative5, resolve as resolve40, sep as sep6 } from "node:path";
47857
+ import { copyFileSync as copyFileSync5, existsSync as existsSync58, mkdirSync as mkdirSync34, mkdtempSync as mkdtempSync3, readFileSync as readFileSync46, readdirSync as readdirSync26, realpathSync as realpathSync5, rmSync as rmSync24, statSync as statSync43, writeFileSync as writeFileSync29 } from "node:fs";
47858
+ import { basename as basename11, dirname as dirname32, isAbsolute as isAbsolute6, join as join44, relative as relative5, resolve as resolve40, sep as sep6 } from "node:path";
47712
47859
  function parseList(rest, ...flags) {
47713
47860
  let found = false;
47714
47861
  const out = [];
@@ -48298,7 +48445,7 @@ function inferTaggedVersion(entryPath, sources) {
48298
48445
  function findEntry(dir) {
48299
48446
  let names;
48300
48447
  try {
48301
- names = readdirSync24(dir);
48448
+ names = readdirSync26(dir);
48302
48449
  } catch {
48303
48450
  return [];
48304
48451
  }
@@ -48308,7 +48455,7 @@ function findEntry(dir) {
48308
48455
  continue;
48309
48456
  const full = resolve40(dir, name);
48310
48457
  try {
48311
- if (statSync41(full).size > 512 * 1024)
48458
+ if (statSync43(full).size > 512 * 1024)
48312
48459
  continue;
48313
48460
  const text = readFileSync46(full, "utf8");
48314
48461
  if (/from\s+["']failproofai["']/.test(text) && /(?:customPolicies|semanticPolicies)\s*\.\s*add\s*\(/.test(text)) {
@@ -48327,7 +48474,7 @@ function withLocalImports(sources) {
48327
48474
  const file = queue.shift();
48328
48475
  let text;
48329
48476
  try {
48330
- if (statSync41(file).size > 512 * 1024)
48477
+ if (statSync43(file).size > 512 * 1024)
48331
48478
  continue;
48332
48479
  text = readFileSync46(file, "utf8");
48333
48480
  } catch {
@@ -48335,13 +48482,13 @@ function withLocalImports(sources) {
48335
48482
  }
48336
48483
  for (const re of LOCAL_IMPORT_RES) {
48337
48484
  for (const match of text.matchAll(re)) {
48338
- const base = resolve40(dirname30(file), match[1]);
48485
+ const base = resolve40(dirname32(file), match[1]);
48339
48486
  for (const ext of LOCAL_IMPORT_EXTENSIONS) {
48340
48487
  const candidate = base + ext;
48341
48488
  if (seen.has(candidate))
48342
48489
  break;
48343
48490
  try {
48344
- if (!statSync41(candidate).isFile())
48491
+ if (!statSync43(candidate).isFile())
48345
48492
  continue;
48346
48493
  } catch {
48347
48494
  continue;
@@ -48588,7 +48735,7 @@ esac
48588
48735
  return true;
48589
48736
  } finally {
48590
48737
  try {
48591
- rmSync24(dirname30(askpass), { recursive: true, force: true });
48738
+ rmSync24(dirname32(askpass), { recursive: true, force: true });
48592
48739
  } catch {}
48593
48740
  }
48594
48741
  }
@@ -51100,14 +51247,14 @@ var init_parse_script_args = () => {};
51100
51247
 
51101
51248
  // scripts/install-diagnosis.mjs
51102
51249
  import { existsSync as existsSync60, readFileSync as readFileSync48, realpathSync as realpathSync6 } from "node:fs";
51103
- import { dirname as dirname31, resolve as resolve43 } from "node:path";
51250
+ import { dirname as dirname33, resolve as resolve43 } from "node:path";
51104
51251
  import { homedir as homedir40, platform as platform5 } from "node:os";
51105
51252
  import { spawnSync } from "node:child_process";
51106
51253
  function findPackageRoot(start) {
51107
51254
  try {
51108
51255
  let dir = realpathSync6(start);
51109
51256
  if (existsSync60(dir) && !existsSync60(resolve43(dir, "package.json"))) {
51110
- dir = dirname31(dir);
51257
+ dir = dirname33(dir);
51111
51258
  }
51112
51259
  while (true) {
51113
51260
  const pkgPath = resolve43(dir, "package.json");
@@ -51118,7 +51265,7 @@ function findPackageRoot(start) {
51118
51265
  return dir;
51119
51266
  } catch {}
51120
51267
  }
51121
- const parent = dirname31(dir);
51268
+ const parent = dirname33(dir);
51122
51269
  if (parent === dir)
51123
51270
  return null;
51124
51271
  dir = parent;
@@ -51649,7 +51796,7 @@ var init_launch_ready = () => {};
51649
51796
  // scripts/launch.ts
51650
51797
  import { spawn as spawn2 } from "child_process";
51651
51798
  import { realpathSync as realpathSync7, existsSync as existsSync61 } from "node:fs";
51652
- import { resolve as resolve44, dirname as dirname32 } from "node:path";
51799
+ import { resolve as resolve44, dirname as dirname34 } from "node:path";
51653
51800
  import { fileURLToPath as fileURLToPath2 } from "node:url";
51654
51801
  function launch(mode, options = {}) {
51655
51802
  const { loggingLevel, disableTelemetry, allowedDevOrigins, host, remainingArgs } = parseScriptArgs(process.argv.slice(2));
@@ -51685,7 +51832,7 @@ ${k.caution(exposedBindWarning(exposed.host))}
51685
51832
  process.env.PORT = port;
51686
51833
  process.env.HOSTNAME = bindHost;
51687
51834
  cmd = "node";
51688
- const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve44(dirname32(realpathSync7(fileURLToPath2(import.meta.url))), "..");
51835
+ const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve44(dirname34(realpathSync7(fileURLToPath2(import.meta.url))), "..");
51689
51836
  const serverJsPath = resolve44(packageRoot, ".next/standalone/server.js");
51690
51837
  if (!existsSync61(serverJsPath)) {
51691
51838
  let shadowMessage = null;
@@ -52914,7 +53061,7 @@ var init_session_pause_cli2 = __esm(() => {
52914
53061
  // scripts/launch.ts
52915
53062
  import { spawn as spawn3 } from "child_process";
52916
53063
  import { realpathSync as realpathSync8, existsSync as existsSync62 } from "node:fs";
52917
- import { resolve as resolve46, dirname as dirname33 } from "node:path";
53064
+ import { resolve as resolve46, dirname as dirname35 } from "node:path";
52918
53065
  import { fileURLToPath as fileURLToPath3 } from "node:url";
52919
53066
  function launch2(mode, options = {}) {
52920
53067
  const { loggingLevel, disableTelemetry, allowedDevOrigins, host, remainingArgs } = parseScriptArgs(process.argv.slice(2));
@@ -52950,7 +53097,7 @@ ${k.caution(exposedBindWarning(exposed.host))}
52950
53097
  process.env.PORT = port;
52951
53098
  process.env.HOSTNAME = bindHost;
52952
53099
  cmd = "node";
52953
- const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve46(dirname33(realpathSync8(fileURLToPath3(import.meta.url))), "..");
53100
+ const packageRoot = process.env.FAILPROOFAI_PACKAGE_ROOT ?? resolve46(dirname35(realpathSync8(fileURLToPath3(import.meta.url))), "..");
52954
53101
  const serverJsPath = resolve46(packageRoot, ".next/standalone/server.js");
52955
53102
  if (!existsSync62(serverJsPath)) {
52956
53103
  let shadowMessage = null;
@@ -53072,17 +53219,17 @@ var init_cli_error2 = __esm(() => {
53072
53219
 
53073
53220
  // bin/failproofai.mjs
53074
53221
  import { realpathSync as realpathSync9 } from "fs";
53075
- import { dirname as dirname34, resolve as resolve47 } from "path";
53222
+ import { dirname as dirname36, resolve as resolve47 } from "path";
53076
53223
  import { fileURLToPath as fileURLToPath4 } from "url";
53077
53224
  // package.json
53078
- var version = "1.0.13-beta.1";
53225
+ var version = "1.0.13-beta.2";
53079
53226
 
53080
53227
  // bin/failproofai.mjs
53081
53228
  if (!process.env.FAILPROOFAI_PACKAGE_ROOT) {
53082
- process.env.FAILPROOFAI_PACKAGE_ROOT = resolve47(dirname34(realpathSync9(fileURLToPath4(import.meta.url))), "..");
53229
+ process.env.FAILPROOFAI_PACKAGE_ROOT = resolve47(dirname36(realpathSync9(fileURLToPath4(import.meta.url))), "..");
53083
53230
  }
53084
53231
  if (!process.env.FAILPROOFAI_DIST_PATH) {
53085
- process.env.FAILPROOFAI_DIST_PATH = resolve47(dirname34(realpathSync9(fileURLToPath4(import.meta.url))), "..", "dist");
53232
+ process.env.FAILPROOFAI_DIST_PATH = resolve47(dirname36(realpathSync9(fileURLToPath4(import.meta.url))), "..", "dist");
53086
53233
  }
53087
53234
  var args = process.argv.slice(2);
53088
53235
  if (args[0] === "p" || args[0] === "policy")