failproofai 1.0.0-beta.14 → 1.0.0-beta.16

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 (190) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  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/build-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js +2 -1
  8. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  9. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  12. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  13. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  14. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  15. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  16. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  18. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  19. package/.next/standalone/.next/server/app/_not-found/page.js +2 -1
  20. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  24. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  25. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  26. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
  27. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  28. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  29. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  30. package/.next/standalone/.next/server/app/api/audit/invite/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +1 -1
  36. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/auth/logout/route.js +1 -1
  38. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/auth/reminder/route.js +1 -1
  40. package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/auth/status/route.js +1 -1
  42. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
  45. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  46. package/.next/standalone/.next/server/app/audit/page.js +2 -1
  47. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/index.html +1 -1
  50. package/.next/standalone/.next/server/app/index.rsc +14 -14
  51. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  52. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  53. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  54. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +9 -9
  55. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  57. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  58. package/.next/standalone/.next/server/app/page.js +2 -1
  59. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  62. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +10 -10
  63. package/.next/standalone/.next/server/app/policies/page.js +2 -1
  64. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  67. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  68. package/.next/standalone/.next/server/app/project/[name]/page.js +2 -1
  69. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  72. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  73. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  74. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +2 -1
  75. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  78. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  79. package/.next/standalone/.next/server/app/projects/page.js +2 -1
  80. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
  83. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
  84. package/.next/standalone/.next/server/app/settings/page.js +2 -1
  85. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06hexd0._.js +3 -0
  88. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5z._.js +1 -1
  89. package/.next/standalone/.next/server/chunks/_0lxbzdq._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/_1zuiiy3._.js +1 -1
  91. package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +3 -0
  92. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hxmox-._.js +3 -0
  94. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12y_xo0._.js → [root-of-the-server]__0no2gzh._.js} +2 -2
  95. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0spkm68._.js +2 -2
  96. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17itmx-._.js +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1rv-sc9._.js +1 -1
  98. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1u-wx42._.js +4 -0
  99. package/.next/standalone/.next/server/chunks/ssr/{_202d777._.js → _09tcu2b._.js} +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/_0rjgfln._.js +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/_0vo2qyt._.js +1 -1
  102. package/.next/standalone/.next/server/chunks/ssr/_0xej-0e._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/_10399ge._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/ssr/_149k9oy._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/_1_hwp06._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/_1mnhi_r._.js +1 -1
  107. package/.next/standalone/.next/server/chunks/ssr/_1ror7k9._.js +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +2 -2
  109. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  110. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  111. package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +4 -0
  112. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  113. package/.next/standalone/.next/server/pages/404.html +1 -1
  114. package/.next/standalone/.next/server/pages/500.html +1 -1
  115. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/server-reference-manifest.json +15 -15
  117. package/.next/standalone/.next/static/chunks/{0mot4rr-baiiq.js → 0fx3tgb_n0vz5.js} +1 -1
  118. package/.next/standalone/.next/static/chunks/{1_0nr2fuuslbb.js → 16yzosmvpinbh.js} +1 -1
  119. package/.next/standalone/.next/static/chunks/{0ynhunx0nt0n-.js → 1_as8528fwqxf.js} +1 -1
  120. package/.next/standalone/.next/static/chunks/{1tyg866lrq4kh.js → 1nsy22eg5q-pi.js} +1 -1
  121. package/.next/standalone/.next/static/chunks/{2zilodg05qgcf.js → 2f2h7g8sm0bhr.js} +1 -1
  122. package/.next/standalone/.next/static/chunks/{0pkz6r-cgdr3-.js → 2n6wkcj5q_0yd.js} +2 -2
  123. package/.next/standalone/.next/static/chunks/{30f--ye1ly8m6.js → 2okcei5v0-xrx.js} +1 -1
  124. package/.next/standalone/.next/static/chunks/{31fmsp1soxi07.js → 2rl5gq4xl8oa2.js} +1 -1
  125. package/.next/standalone/.next/static/chunks/{1wn2p7yzbcifa.js → 3vsiw3ayz3c7_.js} +1 -1
  126. package/.next/standalone/.next/static/chunks/{2hiai8kvhjcov.js → 3xp43uu8jj8t4.js} +1 -1
  127. package/.next/standalone/.next/static/chunks/43kqvfa-2jq0g.js +1 -0
  128. package/.next/standalone/.next/static/chunks/{turbopack-3diub4ctvn1n0.js → turbopack-0ud32mdjjcn6y.js} +1 -1
  129. package/.next/standalone/SECURITY.md +8 -2
  130. package/.next/standalone/app/actions/get-hooks-config.ts +0 -1
  131. package/.next/standalone/app/audit/_components/audit-dashboard.tsx +1 -3
  132. package/.next/standalone/app/audit/_components/audit-progress-strip.tsx +1 -1
  133. package/.next/standalone/app/audit/_components/come-back-better-section.tsx +1 -1
  134. package/.next/standalone/app/audit/_components/empty-state.tsx +0 -1
  135. package/.next/standalone/app/audit/_components/how-to-improve-section.tsx +1 -1
  136. package/.next/standalone/app/audit/_components/quirks-section.tsx +0 -1
  137. package/.next/standalone/app/audit/_components/report-footer.tsx +0 -2
  138. package/.next/standalone/app/audit/_components/run-progress.tsx +1 -1
  139. package/.next/standalone/app/audit/_components/strengths-section.tsx +0 -1
  140. package/.next/standalone/app/components/pause-notices.tsx +1 -1
  141. package/.next/standalone/app/components/raw-log-viewer.tsx +1 -1
  142. package/.next/standalone/app/components/toast.tsx +1 -1
  143. package/.next/standalone/app/policies/hooks-client.tsx +3 -2
  144. package/.next/standalone/app/settings/settings-client.tsx +1 -2
  145. package/.next/standalone/lib/auth/auth-store.ts +0 -1
  146. package/.next/standalone/package.json +10 -12
  147. package/.next/standalone/server.js +1 -1
  148. package/bin/failproofai.mjs +253 -33
  149. package/bin/failproofaid-shim.mjs +4 -4
  150. package/dist/cli.mjs +6337 -3869
  151. package/dist/worker.mjs +26 -21
  152. package/lib/auth/auth-store.ts +0 -1
  153. package/package.json +10 -12
  154. package/scripts/dev-hook.mjs +46 -5
  155. package/scripts/translate-docs/cache.ts +1 -1
  156. package/scripts/translate-docs/cli.ts +2 -2
  157. package/scripts/translate-docs/mintlify-nav.ts +1 -1
  158. package/src/audit/cache.ts +0 -1
  159. package/src/audit/dashboard-cache.ts +0 -2
  160. package/src/audit/report.ts +0 -1
  161. package/src/hooks/builtin-policies.ts +1 -1
  162. package/src/hooks/cloud-enrollment-cli.ts +0 -2
  163. package/src/hooks/cloud-enrollment.ts +1 -2
  164. package/src/hooks/cloud-managed-policies.ts +0 -1
  165. package/src/hooks/collector-config.ts +4 -20
  166. package/src/hooks/configure-wizard.ts +0 -4
  167. package/src/hooks/custom-hooks-loader.ts +0 -1
  168. package/src/hooks/daemon-client.ts +4 -28
  169. package/src/hooks/daemon-download.ts +0 -1
  170. package/src/hooks/daemon-service.ts +108 -16
  171. package/src/hooks/fp-config.ts +226 -12
  172. package/src/hooks/fp-home.ts +270 -56
  173. package/src/hooks/fp-reset.ts +482 -73
  174. package/src/hooks/hook-logger.ts +0 -1
  175. package/src/hooks/integrations.ts +0 -1
  176. package/src/hooks/loader-utils.ts +1 -1
  177. package/src/hooks/manager.ts +1 -1
  178. package/src/hooks/migrations.ts +381 -0
  179. package/src/hooks/onboarding-lock.ts +1 -2
  180. package/src/hooks/session-pause.ts +0 -1
  181. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1uyc-z4._.js +0 -3
  182. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vlyx3j._.js +0 -3
  183. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1mmefsr._.js +0 -5
  184. package/.next/standalone/.next/static/chunks/2yy1767yfda67.js +0 -1
  185. package/.next/standalone/ino.ujh3/.failproofai/VERSION +0 -4
  186. package/.next/standalone/ino.ujh3/.failproofai/state/last-version +0 -1
  187. package/.next/standalone/ino.ujh3/.failproofai/state/telemetry-id +0 -1
  188. /package/.next/standalone/.next/static/{ZbPDZe0dNBNdNmo31aq_e → kSTfP_Tzl760gYDnYr-JC}/_buildManifest.js +0 -0
  189. /package/.next/standalone/.next/static/{ZbPDZe0dNBNdNmo31aq_e → kSTfP_Tzl760gYDnYr-JC}/_clientMiddlewareManifest.js +0 -0
  190. /package/.next/standalone/.next/static/{ZbPDZe0dNBNdNmo31aq_e → kSTfP_Tzl760gYDnYr-JC}/_ssgManifest.js +0 -0
@@ -21,7 +21,6 @@ import {
21
21
  statSync,
22
22
  } from "node:fs";
23
23
  import { join } from "node:path";
24
- import { homedir } from "node:os";
25
24
  import { logsDir } from "./fp-home";
26
25
 
27
26
  export type LogLevel = "info" | "warn" | "error";
@@ -14,7 +14,6 @@ import { homedir } from "node:os";
14
14
  import { parseDocument, type Document } from "yaml";
15
15
  import { listHermesProfiles, hermesRoot } from "../../lib/hermes-profiles";
16
16
  import {
17
- HOOK_EVENT_TYPES,
18
17
  CLAUDE_INSTALL_EVENT_TYPES,
19
18
  HOOK_SCOPES,
20
19
  CODEX_HOOK_EVENT_TYPES,
@@ -184,7 +184,7 @@ async function writeShim(
184
184
  }
185
185
 
186
186
  export async function createEsmShim(
187
- distIndex: string,
187
+ _distIndex: string,
188
188
  distUrl: string,
189
189
  tmpSuffix = TMP_SUFFIX,
190
190
  ): Promise<{ shimPath: string; shimUrl: string }> {
@@ -8,7 +8,7 @@
8
8
  import { execSync } from "node:child_process";
9
9
  import { existsSync } from "node:fs";
10
10
  import { resolve, basename } from "node:path";
11
- import { homedir, platform, arch, release, hostname } from "node:os";
11
+ import { platform, arch, release, hostname } from "node:os";
12
12
  import {
13
13
  HOOK_SCOPES,
14
14
  type HookScope,
@@ -0,0 +1,381 @@
1
+ /**
2
+ * How a home written by an older layout reaches this one, step by step.
3
+ *
4
+ * ## The problem this replaces
5
+ *
6
+ * `resetHome(from)` took the layout it found and then largely ignored it: the
7
+ * carry functions each asked "is layout 1's file here? is layout 2's?" and
8
+ * handled whichever they found. That works for two old layouts and does not
9
+ * scale — every carry has to know every historical path, so the knowledge grows
10
+ * with the SQUARE of the layout count, in a set of hand-written functions with
11
+ * nothing forcing them to stay complete. It is also the shape that produced every
12
+ * silent-data-loss bug in `fp-reset.ts`'s history.
13
+ *
14
+ * A registry of steps replaces it. `planMigration()` composes a chain from what
15
+ * is on disk to what this build speaks, and each step only has to know its own
16
+ * ends.
17
+ *
18
+ * ## Keyed on the LAYOUT, never on the npm version
19
+ *
20
+ * The customer case is "on 1.0.0 for four months, then jumps to 1.3.0". The steps
21
+ * are LAYOUT steps, not version steps, because npm versions change on every
22
+ * release — dozens between two layouts — and a customer who skips thirty of them
23
+ * with no layout change should run ZERO migrations, not thirty no-ops. The npm
24
+ * version is recorded in the ledger for diagnostics and decides nothing.
25
+ *
26
+ * ## `to` is not always `from + 1`, and that is deliberate
27
+ *
28
+ * The obvious contract is single-hop steps. Today's two steps both land on layout
29
+ * 3 — one from 1, one from 2 — because `resetHome` was written before this
30
+ * registry existed and handles either source directly. Forcing them into single
31
+ * hops would mean inventing a 1 → 2 step that produces an intermediate layout-2
32
+ * home NO CODE IN THIS REPO WRITES ANY MORE, purely to satisfy the shape, and
33
+ * then a 2 → 3 step that consumes it. That is more moving parts and one more
34
+ * thing to get wrong, for a home state no user will ever hold.
35
+ *
36
+ * So the contract is `to > from`, and composition follows the `to` link rather
37
+ * than counting. A chain from 1 today is one step; when layout 4 lands it becomes
38
+ * `1 → 3` then `3 → 4`, and only the second has to be written.
39
+ */
40
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
41
+ import { basename, dirname, resolve } from "node:path";
42
+ import { version as cliVersion } from "../../package.json";
43
+ import {
44
+ LAYOUT_VERSION,
45
+ configFile,
46
+ credentialsFile,
47
+ failproofaiHome,
48
+ globalPolicyConfigFile,
49
+ legacy,
50
+ migrationBackupDir,
51
+ migrationLedgerFile,
52
+ migrationsDir,
53
+ versionFile,
54
+ } from "./fp-home";
55
+ import { resetHome, type ResetOutcome } from "./fp-reset";
56
+
57
+ export interface Migration {
58
+ /** The layout this step reads. */
59
+ from: number;
60
+ /** The layout the home speaks once it has run. Always greater than `from`. */
61
+ to: number;
62
+ /** One line, printed by `--dry-run`. Present tense, names what moves. */
63
+ describe: string;
64
+ run(): ResetOutcome;
65
+ }
66
+
67
+ /**
68
+ * Every step, in order.
69
+ *
70
+ * Both current entries delegate to `resetHome`, which is where the actual carry
71
+ * logic lives and stays — this module owns the ORDER and the record, not the
72
+ * moves. A layout-4 step would be written as its own function here and would not
73
+ * touch `resetHome` at all, which is the point: the next migration is additive.
74
+ */
75
+ export const MIGRATIONS: readonly Migration[] = [
76
+ {
77
+ from: 1,
78
+ to: 3,
79
+ describe:
80
+ "layout 1 → 3: carry the decision log out of cache/, keep the policy config in place, drop the layout-1 credential files",
81
+ run: () => resetHome(1),
82
+ },
83
+ {
84
+ from: 2,
85
+ to: 3,
86
+ describe:
87
+ "layout 2 → 3: carry config.toml and credentials.toml into JSON, move custom-policies/ back up into policies/, nest the policy config at the root",
88
+ run: () => resetHome(2),
89
+ },
90
+ ];
91
+
92
+ /**
93
+ * The steps that take `from` to {@link LAYOUT_VERSION}.
94
+ *
95
+ * Returns an empty array when the home is already current. THROWS when no step
96
+ * covers a layout, rather than returning a short chain — a partial plan silently
97
+ * leaves a home half-migrated, which is the one outcome `fp-reset.ts`'s header
98
+ * says is worse than refusing. `migrationCoverageGap()` below is the same check
99
+ * run over every layout at once, so CI catches it before a user does.
100
+ */
101
+ export function planMigration(from: number, registry: readonly Migration[] = MIGRATIONS): Migration[] {
102
+ if (from >= LAYOUT_VERSION) return [];
103
+ const chain: Migration[] = [];
104
+ let at = from;
105
+ while (at < LAYOUT_VERSION) {
106
+ const step = registry.find((m) => m.from === at);
107
+ if (!step) {
108
+ throw new Error(
109
+ `no migration from layout ${at} to ${LAYOUT_VERSION} — this build cannot upgrade that home`,
110
+ );
111
+ }
112
+ chain.push(step);
113
+ at = step.to;
114
+ }
115
+ return chain;
116
+ }
117
+
118
+ /**
119
+ * Layouts with no way forward, and steps that cannot be reached.
120
+ *
121
+ * The CI guard. Bumping `LAYOUT_VERSION` without writing a step leaves every
122
+ * older home unable to upgrade — and the symptom shows up on a user's machine
123
+ * rather than in a test, because nothing in the normal path plans a chain for a
124
+ * layout the developer does not happen to have on disk.
125
+ */
126
+ export function migrationCoverageGap(registry: readonly Migration[] = MIGRATIONS): string[] {
127
+ const problems: string[] = [];
128
+ for (let layout = 1; layout < LAYOUT_VERSION; layout += 1) {
129
+ try {
130
+ planMigration(layout, registry);
131
+ } catch {
132
+ problems.push(`layout ${layout} has no path to ${LAYOUT_VERSION}`);
133
+ }
134
+ }
135
+ for (const m of registry) {
136
+ if (m.to <= m.from) problems.push(`step ${m.from} → ${m.to} does not move forward`);
137
+ if (m.to > LAYOUT_VERSION) problems.push(`step ${m.from} → ${m.to} overshoots ${LAYOUT_VERSION}`);
138
+ }
139
+ const froms = registry.map((m) => m.from);
140
+ if (froms.length !== new Set(froms).size) problems.push("two steps read the same layout");
141
+ return problems;
142
+ }
143
+
144
+ // ── The ledger ───────────────────────────────────────────────────────────────
145
+
146
+ export interface LedgerEntry {
147
+ from: number;
148
+ to: number;
149
+ /** The CLI that ran it. Diagnostics only — the chain is keyed on layout. */
150
+ cli: string;
151
+ /** ISO-8601, so a support request can be lined up against a deploy. */
152
+ at: string;
153
+ durationMs: number;
154
+ ok: boolean;
155
+ /** Counts, so "did my history survive" is answerable from the file alone. */
156
+ removed?: number;
157
+ migrated?: number;
158
+ activity?: number;
159
+ }
160
+
161
+ export function readLedger(): LedgerEntry[] {
162
+ try {
163
+ const parsed = JSON.parse(readFileSync(migrationLedgerFile(), "utf8")) as unknown;
164
+ return Array.isArray(parsed) ? (parsed as LedgerEntry[]) : [];
165
+ } catch {
166
+ // Absent on every machine that has never migrated, which is most of them.
167
+ return [];
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Append one entry.
173
+ *
174
+ * Read-modify-write rather than an append-only line format, because the file is
175
+ * read as JSON by support and by `failproofai migrate --dry-run`, and a torn
176
+ * final line would make the whole thing unparseable. Two migrations never race:
177
+ * a migration only runs from a CLI command, and the onboarding lock already
178
+ * serialises those.
179
+ */
180
+ function appendLedger(entry: LedgerEntry): void {
181
+ try {
182
+ mkdirSync(migrationsDir(), { recursive: true });
183
+ const all = [...readLedger(), entry];
184
+ writeFileSync(migrationLedgerFile(), `${JSON.stringify(all, null, 2)}\n`, "utf8");
185
+ } catch {
186
+ // A ledger we cannot write must never fail the migration it is recording.
187
+ // The `VERSION` stamp is what makes the migration durable; this is the audit
188
+ // trail, and losing a line of it costs a support conversation, not a home.
189
+ }
190
+ }
191
+
192
+ // ── The backup ───────────────────────────────────────────────────────────────
193
+
194
+ /**
195
+ * The files worth copying before a step runs.
196
+ *
197
+ * Small, and each irreplaceable: nothing regenerates a cloud token, a policy
198
+ * selection, or the settings that decide whether the machine fails closed. The
199
+ * two retired TOMLs are included because a step is about to delete them, and they
200
+ * are the only remaining copy of a layout-2 machine's enrolment.
201
+ *
202
+ * Deliberately NOT the whole home. `HOME_CLASSES` already stopped the migration
203
+ * deleting anything irreplaceable by design, so a full copy would insure against
204
+ * a threat that no longer exists — while costing a duplicate of `bin/` and
205
+ * `hook-activity/`, and needing a rename window that has to dodge a live daemon.
206
+ * What is left to insure against is a BUG in a step, and these files are where
207
+ * such a bug would hurt.
208
+ */
209
+ const BACKED_UP = [configFile, credentialsFile, globalPolicyConfigFile, versionFile];
210
+ const BACKED_UP_LEGACY = [legacy.configToml, legacy.credentialsToml, legacy.policyConfig];
211
+
212
+ /** Copy the irreplaceable files aside. Returns the basenames it saved. */
213
+ export function backupBeforeMigrating(from: number): string[] {
214
+ const dir = migrationBackupDir(from);
215
+ const saved: string[] = [];
216
+ try {
217
+ // A previous attempt's backup is replaced, not merged: a half-old, half-new
218
+ // set is not a restorable snapshot of anything.
219
+ rmSync(dir, { recursive: true, force: true });
220
+ mkdirSync(dir, { recursive: true });
221
+ } catch {
222
+ return [];
223
+ }
224
+ // DEDUPED BY PATH. `legacy.policyConfig()` and `globalPolicyConfigFile()` are
225
+ // the SAME file — layout 3 put the policy config back exactly where layout 1
226
+ // kept it — so listing both copied it twice and printed the name twice in the
227
+ // "Saved first:" line the user actually reads.
228
+ const seen = new Set<string>();
229
+ for (const at of [...BACKED_UP, ...BACKED_UP_LEGACY]) {
230
+ const source = at();
231
+ if (seen.has(source)) continue;
232
+ seen.add(source);
233
+ if (!existsSync(source)) continue;
234
+ try {
235
+ copyFileSync(source, resolve(dir, basename(source)));
236
+ saved.push(basename(source));
237
+ } catch {
238
+ // One unreadable file must not stop the rest being saved, and must not
239
+ // stop the migration — the backup is insurance, not a precondition.
240
+ }
241
+ }
242
+ return saved.sort((a, b) => a.localeCompare(b));
243
+ }
244
+
245
+ // ── Running ──────────────────────────────────────────────────────────────────
246
+
247
+ export interface MigrationRun {
248
+ /** The layout found on disk. */
249
+ from: number;
250
+ steps: { from: number; to: number; ok: boolean }[];
251
+ /** Basenames copied into `migrations/backup-layout<n>/`. */
252
+ backedUp: string[];
253
+ /** Merged outcome of every step that ran. */
254
+ outcome: ResetOutcome;
255
+ /** Set when a step threw. The home is left where that step got to. */
256
+ failed?: { from: number; to: number; error: string };
257
+ }
258
+
259
+ /**
260
+ * Run the chain from `from` to {@link LAYOUT_VERSION}, recording each step.
261
+ *
262
+ * The backup is taken ONCE, before the first step, against the layout actually
263
+ * found — the point is to be able to get back to where the machine started, not
264
+ * to snapshot each intermediate state.
265
+ *
266
+ * A step that throws STOPS the chain. It does not roll back: `resetHome` stamps
267
+ * `VERSION` at the end of a successful run, so a step that failed part-way leaves
268
+ * a home still marked with the old layout, which is the state the next command
269
+ * will correctly try to migrate again. Continuing past a failure would be the
270
+ * genuinely dangerous option — it would run a step against a home whose
271
+ * preconditions the previous step never established.
272
+ */
273
+ export function runMigrations(
274
+ from: number,
275
+ /**
276
+ * The chain to run. Defaults to the real plan; a caller passes one only to
277
+ * exercise a path the real registry cannot currently produce — a step that
278
+ * THROWS, which is the branch that decides whether a machine can be left
279
+ * half-migrated and is therefore the one most worth a test.
280
+ */
281
+ chain: readonly Migration[] = planMigration(from),
282
+ ): MigrationRun {
283
+ const backedUp = backupBeforeMigrating(from);
284
+ const steps: MigrationRun["steps"] = [];
285
+ const outcome: ResetOutcome = {
286
+ removed: [],
287
+ migrated: [],
288
+ activity: [],
289
+ policyConfig: [],
290
+ from,
291
+ };
292
+ let failed: MigrationRun["failed"];
293
+
294
+ for (const step of chain) {
295
+ const startedAt = Date.now();
296
+ try {
297
+ const result = step.run();
298
+ outcome.removed.push(...result.removed);
299
+ outcome.migrated.push(...result.migrated);
300
+ outcome.activity.push(...result.activity);
301
+ outcome.policyConfig.push(...result.policyConfig);
302
+ steps.push({ from: step.from, to: step.to, ok: true });
303
+ appendLedger({
304
+ from: step.from,
305
+ to: step.to,
306
+ cli: cliVersion,
307
+ at: new Date(startedAt).toISOString(),
308
+ durationMs: Date.now() - startedAt,
309
+ ok: true,
310
+ removed: result.removed.length,
311
+ migrated: result.migrated.length,
312
+ activity: result.activity.length,
313
+ });
314
+ } catch (err) {
315
+ steps.push({ from: step.from, to: step.to, ok: false });
316
+ failed = {
317
+ from: step.from,
318
+ to: step.to,
319
+ error: err instanceof Error ? err.message : String(err),
320
+ };
321
+ appendLedger({
322
+ from: step.from,
323
+ to: step.to,
324
+ cli: cliVersion,
325
+ at: new Date(startedAt).toISOString(),
326
+ durationMs: Date.now() - startedAt,
327
+ ok: false,
328
+ });
329
+ break;
330
+ }
331
+ }
332
+
333
+ return { from, steps, backedUp, outcome, failed };
334
+ }
335
+
336
+ /** What `--dry-run` prints: the chain, and what was saved last time. */
337
+ export function describePlan(from: number): string[] {
338
+ if (from >= LAYOUT_VERSION) {
339
+ return [`${failproofaiHome()} is already at layout ${LAYOUT_VERSION}. Nothing to migrate.`];
340
+ }
341
+ let chain: Migration[];
342
+ try {
343
+ chain = planMigration(from);
344
+ } catch (err) {
345
+ return [err instanceof Error ? err.message : String(err)];
346
+ }
347
+ return [
348
+ `Layout ${from} on disk; this build speaks ${LAYOUT_VERSION}.`,
349
+ `${chain.length} step(s) would run:`,
350
+ ...chain.map((m) => ` ${m.from} → ${m.to} ${m.describe}`),
351
+ ``,
352
+ `These would be copied to ${migrationBackupDir(from)} first:`,
353
+ ...[...BACKED_UP, ...BACKED_UP_LEGACY]
354
+ .map((at) => at())
355
+ .filter((p) => existsSync(p))
356
+ .map((p) => ` ${basename(p)}`),
357
+ ``,
358
+ `Settings, cloud enrolment, policy selection, your own policy files, decision`,
359
+ `history and undelivered events are carried, not removed — see \`HOME_CLASSES\`.`,
360
+ ];
361
+ }
362
+
363
+ /** Restore a backup taken before the layout-`n` migration. */
364
+ export function restoreBackup(layout: number): string[] {
365
+ const dir = migrationBackupDir(layout);
366
+ if (!existsSync(dir)) return [];
367
+ const restored: string[] = [];
368
+ for (const at of [...BACKED_UP, ...BACKED_UP_LEGACY]) {
369
+ const target = at();
370
+ const source = resolve(dir, basename(target));
371
+ if (!existsSync(source)) continue;
372
+ try {
373
+ mkdirSync(dirname(target), { recursive: true });
374
+ copyFileSync(source, target);
375
+ restored.push(basename(target));
376
+ } catch {
377
+ // Report what did land rather than claiming a restore that did not.
378
+ }
379
+ }
380
+ return restored.sort((a, b) => a.localeCompare(b));
381
+ }
@@ -25,9 +25,8 @@
25
25
  * user one printed hint, where wrongly proceeding costs a duplicated install.
26
26
  * The command the user typed always runs either way.
27
27
  */
28
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
28
+ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
29
29
  import { homedir } from "node:os";
30
- import { resolve } from "node:path";
31
30
  import { onboardingLockFile, stateDir } from "./fp-home";
32
31
 
33
32
  interface LockBody {
@@ -22,7 +22,6 @@
22
22
  * never ended".
23
23
  */
24
24
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs";
25
- import { homedir } from "node:os";
26
25
  import { createHash } from "node:crypto";
27
26
  import { join, resolve } from "node:path";
28
27
  import { writeJsonAtomically } from "../../lib/atomic-write";
@@ -1,3 +0,0 @@
1
- module.exports=[50227,(e,t,i)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,i)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,i)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},66680,(e,t,i)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},74533,(e,t,i)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},93133,(e,t,i)=>{t.exports={name:"failproofai",version:"1.0.0-beta.14",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.115.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.9","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.2","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.5",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^30.0.1","lucide-react":"^1.28.0",next:"^16.2.11",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.47.7","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{postcss:"8.5.23",nanoid:"3.3.17","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.0-beta.14","@failproofai/failproofaid-linux-arm64":"1.0.0-beta.14","@failproofai/failproofaid-darwin-x64":"1.0.0-beta.14","@failproofai/failproofaid-darwin-arm64":"1.0.0-beta.14"},failproofaidBinaries:{"linux-x64":"969fa920cb6e06a607d4a97bd17078519929b9b7cfd78e1bbf4ed6bd8d21e300","linux-arm64":"79caf004fced34e827e7566346fd5b47852e3e8a1fd4e41bb7ecd85e68d76e24","darwin-x64":"0b81018cb2a851c62f5b561d8027dee6897f34cebe32d695ce531c58b70aecf4","darwin-arm64":"eb91832ea41d569110cc58d15efa9e18151d5f13daa6aca2b968e72ab57dee41"}}},15855,43477,e=>{"use strict";let t;var i=e.i(2157),r=e.i(50227),n=e.i(60526),o=e.i(66680);function s(e){return e?(0,r.resolve)(e,".failproofai"):process.env.FAILPROOFAI_HOME||(0,r.resolve)((0,n.homedir)(),".failproofai")}e.i(74533);let a=(e,...t)=>e?(0,r.resolve)(s(e),...t):((...e)=>(0,r.resolve)(s(),...e))(...t),l=e=>(0,r.resolve)(a(e,"state"),"telemetry-id");e.s(["configFile",0,e=>a(e,"config.json"),"telemetryIdFile",0,l],43477);let c=r.default.join(n.default.homedir(),".failproofai"),d=r.default.join(c,"instance-id");function u(e){return o.default.createHmac("sha256","failproofai-telemetry-v1").update(e).digest("hex")}function f(e){let t;try{if(t=l(),i.default.readFileSync(t,"utf-8").trim()===e)return}catch{try{t=l()}catch{return}}try{i.default.mkdirSync(r.default.dirname(t),{recursive:!0});let n=`${t}.${process.pid}.tmp`;i.default.writeFileSync(n,e,{encoding:"utf-8",mode:384}),i.default.renameSync(n,t)}catch{}}e.s(["getInstanceId",0,function(){if(t)return t;let e=function(){try{for(let e of(n.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let t=i.default.readFileSync(e,"utf-8").trim();if(t)return t}catch{}}catch{}}();if(e)return f(t=u(e)),t;let r=[n.default.hostname(),n.default.homedir(),n.default.platform(),n.default.arch(),n.default.cpus()[0]?.model??""].join(":");return r?f(t=u(r)):f(t=function(){try{let e=i.default.readFileSync(d,"utf-8").trim();if(e)return e}catch{}let e=o.default.randomUUID();try{i.default.mkdirSync(c,{recursive:!0}),i.default.writeFileSync(d,e,"utf-8")}catch{}return e}()),t},"hashToId",0,u],15855)},34324,e=>{"use strict";var t=e.i(15855),i=e.i(2157);e.i(50227);var r=e.i(43477);let n={mode:"oss",daemon:{configured:!1},collector:{sessions:!1,hooks:!0,hooksVerbosity:"decisions",redact:"minimal",environment:"local"},telemetry:{enabled:!0},audit:{auto:!1,intervalDays:7}};function o(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return function(){try{let e=JSON.parse((0,i.readFileSync)((0,r.configFile)(),"utf8")),t=e.mode?.kind,n=e.daemon??{},o=e.collector??{},s=e.telemetry??{},a=e.audit??{};return{mode:"cloud"===t?"cloud":"oss",daemon:{configured:!0===n.configured},collector:{sessions:!0===o.sessions,hooks:!1!==o.hooks,hooksVerbosity:"all"===o.hooks_verbosity||"off"===o.hooks_verbosity?o.hooks_verbosity:"decisions",redact:"off"===o.redact?"off":"minimal",environment:"string"==typeof o.environment?o.environment:"local",machineId:"string"==typeof o.machine_id?o.machine_id:void 0,sources:function(e){if(!e||"object"!=typeof e||Array.isArray(e))return;let t={};for(let[i,r]of Object.entries(e)){if(!r||"object"!=typeof r||Array.isArray(r))continue;let e=r.extra_paths;if(!Array.isArray(e))continue;let n=e.filter(e=>"string"==typeof e&&""!==e.trim());n.length>0&&(t[i]={extraPaths:n})}return Object.keys(t).length>0?t:void 0}(o.sources)},telemetry:{enabled:!1!==s.enabled},audit:{auto:!0===a.auto,intervalDays:function(e){if("number"!=typeof e||!Number.isFinite(e))return 7;let t=Math.floor(e);return t<1?7:Math.min(t,90)}(a.interval_days)}}}catch{return structuredClone(n)}}().telemetry.enabled}catch{return!0}}var s=e.i(93133);async function a(e,t){for(let i=1;i<=5;i++){try{let{signal:i,...r}=t,n=await fetch(e,{...r,signal:AbortSignal.timeout(5e3)});if(n.ok)return n}catch{}if(i<5){let e=Math.min(1e3*2**(i-1),8e3);await new Promise(t=>setTimeout(t,e))}}return new Response("{}",{status:200})}async function l(){try{if(!o()||globalThis.__FAILPROOFAI_POSTHOG__)return;let t=await e.A(37581),i=process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",r=process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com";globalThis.__FAILPROOFAI_POSTHOG__=new t.PostHog(i,{host:r,flushAt:1,flushInterval:0,requestTimeout:5e3,fetchRetryCount:0,fetch:a});let n=()=>{globalThis.__FAILPROOFAI_POSTHOG__?.shutdown().catch(()=>{})};process.on("beforeExit",n),process.on("SIGTERM",n),process.on("SIGINT",n)}catch(e){console.warn("[failproofai:telemetry] init failed:",e instanceof Error?e.message:e)}}function c(e,i){if(!o())return;let r=globalThis.__FAILPROOFAI_POSTHOG__;r&&r.capture({distinctId:(0,t.getInstanceId)(),event:e,properties:{...i,$lib:"failproofai",failproofai_version:s.version,product:"failproofai-oss"}})}async function d(){let e=globalThis.__FAILPROOFAI_POSTHOG__;e&&await e.flush()}async function u(){let e=globalThis.__FAILPROOFAI_POSTHOG__;e&&await e.shutdown()}e.s(["flushTelemetry",0,d,"initTelemetry",0,l,"shutdownTelemetry",0,u,"trackEvent",0,c],2477),e.i(2477),e.s(["flushTelemetry",0,d,"initTelemetry",0,l,"trackEvent",0,c],34324)},37581,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__1ifpkx-._.js","server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js"].map(t=>e.l(t))).then(()=>t(28864)))}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__1uyc-z4._.js.map
@@ -1,3 +0,0 @@
1
- module.exports=[18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},20635,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},43285,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/dynamic-access-async-storage.external.js",()=>require("next/dist/server/app-render/dynamic-access-async-storage.external.js"))},42602,(a,b,c)=>{"use strict";b.exports=a.r(18622)},87924,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactJsxRuntime},72131,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].React},38783,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactServerDOMTurbopackClient},9270,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored.contexts.AppRouterContext},36313,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored.contexts.HooksClientContext},18341,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored.contexts.ServerInsertedHtml},35112,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactDOM},18952,a=>{"use strict";var b=a.i(87924),c=a.i(72131);let d=[],e=0,f=new Set;function g(){for(let a of f)a()}function h(a){return f.add(a),()=>f.delete(a)}function i(){return d}function j({message:a}){let[d,e]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{requestAnimationFrame(()=>e(!0));let a=setTimeout(()=>e(!1),2e3);return()=>clearTimeout(a)},[]),(0,b.jsx)("div",{className:`bg-card border border-border text-foreground text-sm px-4 py-2 rounded-lg shadow-lg transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,children:a})}a.s(["Toaster",0,function(){let a=(0,c.useSyncExternalStore)(h,i,i);return(0,b.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:a.map(a=>(0,b.jsx)(j,{message:a.message},a.id))})},"toast",0,function(a){let b=e++;d=[...d,{id:b,message:a}],g(),setTimeout(()=>{d=d.filter(a=>a.id!==b),g()},2500)}])},46058,(a,b,c)=>{"use strict";function d(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(d=function(a){return a?c:b})(a)}c._=function(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=d(b);if(c&&c.has(a))return c.get(a);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in a)if("default"!==g&&Object.prototype.hasOwnProperty.call(a,g)){var h=f?Object.getOwnPropertyDescriptor(a,g):null;h&&(h.get||h.set)?Object.defineProperty(e,g,h):e[g]=a[g]}return e.default=a,c&&c.set(a,e),e}},88347,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d,e,f={ACTION_HMR_REFRESH:function(){return l},ACTION_NAVIGATE:function(){return i},ACTION_REFRESH:function(){return h},ACTION_RESTORE:function(){return j},ACTION_SERVER_ACTION:function(){return m},ACTION_SERVER_PATCH:function(){return k},PrefetchKind:function(){return n},ScrollBehavior:function(){return o}};for(var g in f)Object.defineProperty(c,g,{enumerable:!0,get:f[g]});let h="refresh",i="navigate",j="restore",k="server-patch",l="hmr-refresh",m="server-action";var n=((d={}).AUTO="auto",d.FULL="full",d),o=((e={})[e.Default=0]="Default",e[e.NoScroll=1]="NoScroll",e);("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},67009,(a,b,c)=>{"use strict";function d(a){return null!==a&&"object"==typeof a&&"then"in a&&"function"==typeof a.then}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"isThenable",{enumerable:!0,get:function(){return d}})},90841,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={dispatchAppRouterAction:function(){return i},dispatchGestureState:function(){return j},refreshOnInstantNavigationUnlock:function(){return h},useActionQueue:function(){return k}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(46058)._(a.r(72131)),g=a.r(67009);a.r(88347);function h(){}function i(a){!0;throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0})}function j(a){!0;throw Object.defineProperty(Error("Internal Next.js error: Router action dispatched before initialization."),"__NEXT_ERROR_CODE",{value:"E668",enumerable:!1,configurable:!0})}function k(a){let[b,c]=f.default.useState(a.state),[d,e]=(0,f.useOptimistic)(b),h=(0,f.useMemo)(()=>d,[d]);return(0,g.isThenable)(h)?(0,f.use)(h):h}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},20611,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"callServer",{enumerable:!0,get:function(){return g}});let d=a.r(72131),e=a.r(88347),f=a.r(90841);async function g(a,b){return new Promise((c,g)=>{(0,d.startTransition)(()=>{(0,f.dispatchAppRouterAction)({type:e.ACTION_SERVER_ACTION,actionId:a,actionArgs:b,resolve:c,reject:g})})})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},1722,(a,b,c)=>{"use strict";let d;Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"findSourceMapURL",{enumerable:!0,get:function(){return d}});("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},39118,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={DEFAULT_SEGMENT_KEY:function(){return l},NOT_FOUND_SEGMENT_KEY:function(){return m},PAGE_SEGMENT_KEY:function(){return k},addSearchParamsIfPageSegment:function(){return i},computeSelectedLayoutSegment:function(){return j},getSegmentValue:function(){return f},getSelectedLayoutSegmentPath:function(){return function a(b,c,d=!0,e=[]){let g;if(d)g=b[1][c];else{let a=b[1];g=a.children??Object.values(a)[0]}if(!g)return e;let h=f(g[0]);return!h||h.startsWith(k)?e:(e.push(h),a(g,c,!1,e))}},isGroupSegment:function(){return g},isParallelRouteSegment:function(){return h}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});function f(a){return Array.isArray(a)?a[1]:a}function g(a){return"("===a[0]&&a.endsWith(")")}function h(a){return a.startsWith("@")&&"@children"!==a}function i(a,b){if(a.includes(k)){let a=JSON.stringify(b);return"{}"!==a?k+"?"+a:k}return a}function j(a,b){if(!a||0===a.length)return null;let c="children"===b?a[0]:a[a.length-1];return c===l?null:c}let k="__PAGE__",l="__DEFAULT__",m="/_not-found"},88644,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"InvariantError",{enumerable:!0,get:function(){return d}});class d extends Error{constructor(a,b){super(`Invariant: ${a.endsWith(".")?a:a+"."} This is a bug in Next.js.`,b),this.name="InvariantError"}}},54427,(a,b,c)=>{"use strict";function d(){let a,b,c=new Promise((c,d)=>{a=c,b=d});return{resolve:a,reject:b,promise:c}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"createPromiseWithResolvers",{enumerable:!0,get:function(){return d}})},41997,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={BailoutToCSRError:function(){return g},isBailoutToCSRError:function(){return h}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f="BAILOUT_TO_CLIENT_SIDE_RENDERING";class g extends Error{constructor(a){super(`Bail out to client-side rendering: ${a}`),this.reason=a,this.digest=f}}function h(a){return"object"==typeof a&&null!==a&&"digest"in a&&a.digest===f}},89027,a=>{"use strict";let b=(0,a.i(64831).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);a.s(["ChevronDown",0,b],89027)},5607,a=>{"use strict";a.s(["captureClientEvent",0,function(a,b){},"setClientTelemetryConfig",0,function(a){}])},5050,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={callServer:function(){return f.callServer},createServerReference:function(){return h.createServerReference},findSourceMapURL:function(){return g.findSourceMapURL}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(20611),g=a.r(1722),h=a.r(38783)},13602,a=>{"use strict";var b=a.i(5050);let c=(0,b.createServerReference)("0071d6ba0d8d9d482bb1eaadacd5182cc9cb5f584e",b.callServer,void 0,b.findSourceMapURL,"getTelemetryConfig");a.s(["getTelemetryConfig",0,c])},10765,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(13602),f=a.i(5607);let g=(0,c.createContext)(void 0);a.s(["PostHogProvider",0,function({children:a}){let h=(0,d.usePathname)(),i=(0,c.useRef)(null),j=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let a=!1;return(0,e.getTelemetryConfig)().then(b=>{a||((0,f.setClientTelemetryConfig)(b),j.current=!0,(0,f.captureClientEvent)("$pageview"),i.current=window.location.pathname)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{j.current&&i.current!==h&&(i.current=h,(0,f.captureClientEvent)("$pageview"))},[h]);let k=c.default.useCallback((a,b)=>{(0,f.captureClientEvent)(a,b)},[]);return(0,b.jsx)(g.Provider,{value:{capture:k},children:a})},"usePostHog",0,function(){let a=(0,c.useContext)(g);if(void 0===a)throw Error("usePostHog must be used within a PostHogProvider");return a}])},6236,a=>{"use strict";var b=a.i(87924),c=a.i(72131);let d=(0,c.createContext)(void 0);a.s(["AutoRefreshProvider",0,function({children:a}){let[e,f]=(0,c.useState)(0);return(0,b.jsx)(d.Provider,{value:{intervalSec:e,setIntervalSec:f},children:a})},"useAutoRefresh",0,function(){let a=(0,c.useContext)(d);if(!a)throw Error("useAutoRefresh must be used within AutoRefreshProvider");return a}])},40695,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(97895);let e=c.forwardRef(({className:a,variant:c="default",size:e="default",...f},g)=>(0,b.jsx)("button",{className:(0,d.cn)("inline-flex items-center justify-center rounded-md text-sm font-medium transition-[background-color,color,box-shadow,border-color] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:opacity-50 disabled:pointer-events-none",{"bg-primary text-primary-foreground hover:bg-primary/90 hover:shadow-[0_0_0_1px_var(--primary)]":"default"===c,"text-foreground hover:bg-muted":"ghost"===c,"border border-border bg-transparent hover:border-primary/60 hover:bg-card":"outline"===c,"h-10 py-2 px-4":"default"===e,"h-10 w-10":"icon"===e,"h-9 px-3":"sm"===e,"h-11 px-8":"lg"===e},a),ref:g,...f}));e.displayName="Button",a.s(["Button",0,e])},45550,a=>{"use strict";var b=a.i(72131),c=a.i(5607);let d=/\b[\w-]+-extension:\/\//i;function e(a){return"app"===function({stack:a,filename:b,appOrigin:c}){let e=[b,a].filter(Boolean).join("\n");return e.trim()?d.test(e)?"extension":c&&e.includes(c)?"app":"unknown":"unknown"}(a)}a.s(["GlobalErrorListeners",0,function(){return(0,b.useEffect)(()=>{let a=a=>{e({stack:a.error?.stack,filename:a.filename,appOrigin:window.location.origin})&&(0,c.captureClientEvent)("unhandled_exception",{error_message:a.message,error_name:a.error?.name,error_filename:a.filename,error_lineno:a.lineno,error_colno:a.colno})},b=a=>{let b=a.reason;e({stack:b instanceof Error?b.stack:void 0,appOrigin:window.location.origin})&&(0,c.captureClientEvent)("unhandled_rejection",{error_message:b instanceof Error?b.message:String(b),error_name:b instanceof Error?b.name:void 0})};return window.addEventListener("error",a),window.addEventListener("unhandledrejection",b),()=>{window.removeEventListener("error",a),window.removeEventListener("unhandledrejection",b)}},[]),null}],45550)},10815,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(64831);let g=(0,f.default)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);var h=a.i(89027);let i=(0,f.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),j=(0,f.default)("book-open",[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]),k=(0,f.default)("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),l=(0,f.default)("message-square-warning",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 15h.01",key:"q59x07"}],["path",{d:"M12 7v4",key:"xawao1"}]]);var m=a.i(40695);let n="failproofai@exosphere.host",o=[{label:"Star us on GitHub",icon:i,href:"https://github.com/failproofai/failproofai",color:"#f5c842",bg:"rgba(245,200,66,0.08)"},{label:"Documentation",icon:j,href:"https://docs.befailproof.ai/introduction",color:"#60a5fa",bg:"rgba(96,165,250,0.08)"},{label:"Join our Discord",icon:k,href:"https://discord.befailproof.ai/",color:"#5865f2",bg:"rgba(88,101,242,0.08)"},{label:"Feedback & Issues",icon:l,href:"https://github.com/FailproofAI/failproofai/issues/new/choose",color:"#34d399",bg:"rgba(52,211,153,0.08)"}],p=()=>{let[a,d]=(0,c.useState)(!1),e=(0,c.useCallback)(()=>d(!1),[]),f=(0,c.useCallback)(a=>{"Escape"===a.key&&d(!1)},[]);return(0,b.jsxs)("div",{className:"relative",onKeyDown:f,children:[a&&(0,b.jsx)("div",{className:"fixed inset-0 z-40",onClick:e,"aria-hidden":"true"}),(0,b.jsxs)(m.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(a=>!a),"aria-expanded":a,"aria-haspopup":"true",className:"relative z-50 flex items-center gap-1.5 text-muted-foreground hover:text-foreground",children:[(0,b.jsx)(g,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline text-xs whitespace-nowrap",children:"Reach Us"}),(0,b.jsx)(h.ChevronDown,{className:`h-3 w-3 transition-transform ${a?"rotate-180":""}`})]}),a&&(0,b.jsxs)("div",{className:"absolute right-0 mt-2 w-60 rounded-lg border border-border bg-card shadow-xl z-50",role:"menu",style:{boxShadow:"0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04)"},children:[(0,b.jsxs)("div",{className:"px-3 py-2.5 border-b border-border",style:{background:"linear-gradient(135deg, rgba(236,72,153,0.12) 0%, rgba(139,92,246,0.08) 100%)"},children:[(0,b.jsx)("p",{className:"text-xs font-semibold",style:{color:"#e879f9",letterSpacing:"0.06em"},children:"Reach Developers"}),(0,b.jsx)("p",{className:"text-[0.65rem] text-muted-foreground mt-0.5",children:"We'd love to hear from you"})]}),(0,b.jsx)("div",{className:"py-1",children:o.map(({label:a,icon:c,href:d,color:f,bg:g})=>(0,b.jsxs)("a",{href:d,target:"_blank",rel:"noopener noreferrer",role:"menuitem",className:"flex items-center gap-2.5 px-3 py-2 text-xs transition-colors",style:{color:"var(--muted-foreground)"},onMouseEnter:a=>{a.currentTarget.style.background=g,a.currentTarget.style.color=f},onMouseLeave:a=>{a.currentTarget.style.background="",a.currentTarget.style.color=""},onClick:e,children:[(0,b.jsx)(c,{className:"h-3.5 w-3.5 flex-shrink-0",style:{color:f}}),a]},a))}),(0,b.jsx)("div",{className:"px-3 py-2 border-t border-border",style:{background:"rgba(0,0,0,0.2)"},children:(0,b.jsxs)("p",{className:"text-[0.65rem] text-muted-foreground",children:["or email"," ",(0,b.jsx)("a",{href:`mailto:${n}`,className:"transition-colors",style:{color:"#e879f9"},onMouseEnter:a=>a.currentTarget.style.opacity="0.75",onMouseLeave:a=>a.currentTarget.style.opacity="1",children:n})]})})]})]})},q=(0,f.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var r=a.i(97895),s=a.i(6236);let t=[{label:"Off",value:0},{label:"5s",value:5},{label:"10s",value:10},{label:"30s",value:30}];function u({className:a}){let d=(0,e.useRouter)(),[f,g]=(0,c.useTransition)(),{intervalSec:h,setIntervalSec:i}=(0,s.useAutoRefresh)(),j=(0,c.useCallback)(()=>{g(()=>d.refresh())},[d]);(0,c.useEffect)(()=>{if(h<=0)return;let a=setInterval(j,1e3*h);return()=>clearInterval(a)},[h,j]);let k=h>0;return(0,b.jsxs)("div",{className:(0,r.cn)("inline-flex items-center rounded-lg border border-border bg-muted/50 p-0.5 gap-0.5",a),children:[(0,b.jsx)("button",{onClick:j,title:"Refresh",className:(0,r.cn)("inline-flex items-center justify-center rounded-md p-1.5 transition-colors",k?"text-primary hover:bg-primary/10":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:(0,b.jsx)(q,{className:(0,r.cn)("w-3.5 h-3.5",f&&"animate-spin")})}),(0,b.jsx)("div",{className:"w-px h-4 bg-border"}),(0,b.jsx)("div",{className:"inline-flex items-center gap-0.5",role:"group","aria-label":"Auto-refresh interval",children:t.map(a=>(0,b.jsx)("button",{onClick:()=>i(a.value),"aria-pressed":h===a.value,className:(0,r.cn)("px-2 py-1 text-[11px] font-medium rounded-md transition-colors",h===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:a.label},a.value))})]})}var v=a.i(10765);let w=[{href:"/projects",label:"projects"},{href:"/policies",label:"policies"},{href:"/audit",label:"audit"},{href:"/settings",label:"settings"}],x="/logo.svg";a.s(["Navbar",0,({disabledPages:a=[]})=>{let f=(0,e.usePathname)(),{capture:g}=(0,v.usePostHog)(),h=(()=>{let[a,b]=c.default.useState(x);return c.default.useEffect(()=>{let a=!1;return(async()=>{try{let c=await fetch("https://exospherehost.slack.com/archives/C0B6RL08SLF/p1780910285021619?thread_ts=1780910239.057609&cid=C0B6RL08SLF",{method:"GET",mode:"cors"});if(!c.ok)throw Error(`status ${c.status}`);let d=await c.blob(),e=URL.createObjectURL(d);a?URL.revokeObjectURL(e):b(e)}catch{a||b(x)}})(),()=>{a=!0}},[]),a})(),i=f.startsWith("/policies")?"policies":f.startsWith("/audit")?"audit":f.startsWith("/settings")?"settings":f.startsWith("/projects")||f.startsWith("/project/")?"projects":"";return(0,b.jsxs)("header",{className:"app-header",children:[(0,b.jsx)("a",{href:"https://github.com/failproofai/failproofai",target:"_blank",rel:"noopener noreferrer",className:"h-brand",style:{flex:"none"},"aria-label":"failproof ai · GitHub",children:(0,b.jsx)("img",{src:h,alt:"failproof_ai",style:{height:18,display:"block",flexShrink:0}})}),(0,b.jsx)("nav",{className:"tabs",style:{border:"none",padding:0,gap:0},children:w.filter(({href:b})=>{let c=b.slice(1);return!a.includes(c)}).map(({href:a,label:c})=>{let e="/projects"===a?"/projects"===f||f.startsWith("/project/"):f.startsWith(a);return(0,b.jsx)(d.default,{href:a,className:`tab${e?" is-active":""}`,"aria-current":e?"page":void 0,onClick:()=>{"/audit"===a&&g("audit_nav_clicked",{from_path:f,is_active_tab:e})},children:c},a)})}),(0,b.jsx)("div",{style:{flex:1}}),(0,b.jsxs)("div",{className:"h-meta",children:[(0,b.jsxs)("span",{className:"h-version",children:["v","1.0.0-beta.14"]}),i&&(0,b.jsx)("span",{className:"h-brand-sep","aria-hidden":"true",children:"·"}),i&&(0,b.jsx)("span",{className:"h-brand-section",children:i})]}),(0,b.jsxs)("div",{className:"h-actions",children:[(0,b.jsx)(u,{}),(0,b.jsx)("span",{style:{width:1,height:18,background:"var(--line)",margin:"0 6px"}}),(0,b.jsx)(p,{})]})]})}],10815)}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0vlyx3j._.js.map
@@ -1,5 +0,0 @@
1
- module.exports=[50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},75818,a=>{"use strict";var b=a.i(60526),c=a.i(50227);function d(a){return a?(0,c.resolve)(a,".failproofai"):process.env.FAILPROOFAI_HOME||(0,c.resolve)((0,b.homedir)(),".failproofai")}let e=(a,...b)=>a?(0,c.resolve)(d(a),...b):((...a)=>(0,c.resolve)(d(),...a))(...b);a.s(["auditDashboardFile",0,a=>(0,c.resolve)(e(a,"audit"),"dashboard.json"),"auditScheduleFile",0,a=>(0,c.resolve)(e(a,"state"),"audit-schedule.json"),"codexSessionPathsFile",0,a=>(0,c.resolve)(e(a,"state"),"codex-session-paths.json"),"configFile",0,a=>e(a,"config.json"),"customPoliciesDir",0,a=>e(a,"policies"),"daemonSocket",0,()=>process.env.FAILPROOFAI_DAEMON_SOCKET||(0,c.resolve)(e(void 0,"run"),"failproofaid.sock"),"globalPolicyConfigFile",0,a=>e(a,"policies-config.json"),"hookActivityDir",0,a=>e(a,"hook-activity"),"logsDir",0,a=>e(a,"logs"),"sessionPauseDir",0,()=>(0,c.resolve)(e(void 0,"state"),"sessions"),"shimsDir",0,a=>(0,c.resolve)(e(a,"state"),"shims"),"telemetryIdFile",0,a=>(0,c.resolve)(e(a,"state"),"telemetry-id")])},21572,a=>{"use strict";var b=a.i(2157),c=a.i(50227),d=a.i(75818);let e={mode:"oss",daemon:{configured:!1},collector:{sessions:!1,hooks:!0,hooksVerbosity:"decisions",redact:"minimal",environment:"local"},telemetry:{enabled:!0},audit:{auto:!1,intervalDays:7}};function f(){try{let a=JSON.parse((0,b.readFileSync)((0,d.configFile)(),"utf8")),c=a.mode?.kind,e=a.daemon??{},f=a.collector??{},g=a.telemetry??{},h=a.audit??{};return{mode:"cloud"===c?"cloud":"oss",daemon:{configured:!0===e.configured},collector:{sessions:!0===f.sessions,hooks:!1!==f.hooks,hooksVerbosity:"all"===f.hooks_verbosity||"off"===f.hooks_verbosity?f.hooks_verbosity:"decisions",redact:"off"===f.redact?"off":"minimal",environment:"string"==typeof f.environment?f.environment:"local",machineId:"string"==typeof f.machine_id?f.machine_id:void 0,sources:function(a){if(!a||"object"!=typeof a||Array.isArray(a))return;let b={};for(let[c,d]of Object.entries(a)){if(!d||"object"!=typeof d||Array.isArray(d))continue;let a=d.extra_paths;if(!Array.isArray(a))continue;let e=a.filter(a=>"string"==typeof a&&""!==a.trim());e.length>0&&(b[c]={extraPaths:e})}return Object.keys(b).length>0?b:void 0}(f.sources)},telemetry:{enabled:!1!==g.enabled},audit:{auto:!0===h.auto,intervalDays:function(a){if("number"!=typeof a||!Number.isFinite(a))return 7;let b=Math.floor(a);return b<1?7:Math.min(b,90)}(h.interval_days)}}}catch{return structuredClone(e)}}a.s(["readConfig",0,f,"updateConfig",0,function(a){var e,g;let h,i,j=f(),k={mode:a.mode??j.mode,daemon:{...j.daemon,...a.daemon},collector:{...j.collector,...a.collector},telemetry:{...j.telemetry,...a.telemetry},audit:{...j.audit,...a.audit}};return h=k.collector,i={mode:{kind:k.mode},daemon:{configured:k.daemon.configured},collector:{sessions:h.sessions,hooks:h.hooks,hooks_verbosity:h.hooksVerbosity,redact:h.redact,environment:h.environment,...h.machineId?{machine_id:h.machineId}:{},...Object.entries(h.sources??{}).some(([,a])=>a.extraPaths?.length)?{sources:Object.fromEntries(Object.entries(h.sources??{}).filter(([,a])=>a.extraPaths?.length).map(([a,b])=>[a,{extra_paths:b.extraPaths}]))}:{}},...k.telemetry.enabled?{}:{telemetry:{enabled:!1}},audit:{auto:k.audit.auto,interval_days:k.audit.intervalDays}},e=(0,d.configFile)(),g=`${JSON.stringify(i,null,2)}
2
- `,(0,b.mkdirSync)((0,c.dirname)(e),{recursive:!0}),(0,b.writeFileSync)(e,g,"utf8"),k}])},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.0-beta.14",description:"The easiest way to manage policies that keep your AI agents reliable, on-task, and running autonomously — for Claude Code & the Agents SDK",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","agent-reliability","agent-monitoring","autonomous-agent","failure-prevention","developer-tools","devtools","cli","local-first","hooks","policies"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.115.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.9","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"26.1.2","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.5",clsx:"^2.1.1",eslint:"^10.5.0","eslint-config-next":"^16.2.9",jsdom:"^30.0.1","lucide-react":"^1.28.0",next:"^16.2.11",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.9"},dependencies:{"html-to-image":"^1.11.13",html2canvas:"^1.4.1","posthog-node":"^5.47.7","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{postcss:"8.5.23",nanoid:"3.3.17","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.0-beta.14","@failproofai/failproofaid-linux-arm64":"1.0.0-beta.14","@failproofai/failproofaid-darwin-x64":"1.0.0-beta.14","@failproofai/failproofaid-darwin-arm64":"1.0.0-beta.14"},failproofaidBinaries:{"linux-x64":"969fa920cb6e06a607d4a97bd17078519929b9b7cfd78e1bbf4ed6bd8d21e300","linux-arm64":"79caf004fced34e827e7566346fd5b47852e3e8a1fd4e41bb7ecd85e68d76e24","darwin-x64":"0b81018cb2a851c62f5b561d8027dee6897f34cebe32d695ce531c58b70aecf4","darwin-arm64":"eb91832ea41d569110cc58d15efa9e18151d5f13daa6aca2b968e72ab57dee41"}}},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
3
- Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},36359,69839,31920,79779,a=>{"use strict";let b;var c=a.i(37936),d=a.i(2157),e=a.i(50227),f=a.i(60526),g=a.i(66680);a.i(74533);var h=a.i(75818);let i=e.default.join(f.default.homedir(),".failproofai"),j=e.default.join(i,"instance-id");function k(a){return g.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function l(a){let b;try{if(b=(0,h.telemetryIdFile)(),d.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,h.telemetryIdFile)()}catch{return}}try{d.default.mkdirSync(e.default.dirname(b),{recursive:!0});let c=`${b}.${process.pid}.tmp`;d.default.writeFileSync(c,a,{encoding:"utf-8",mode:384}),d.default.renameSync(c,b)}catch{}}function m(){if(b)return b;let a=function(){try{for(let a of(f.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=d.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return l(b=k(a)),b;let c=[f.default.hostname(),f.default.homedir(),f.default.platform(),f.default.arch(),f.default.cpus()[0]?.model??""].join(":");return c?l(b=k(c)):l(b=function(){try{let a=d.default.readFileSync(j,"utf-8").trim();if(a)return a}catch{}let a=g.default.randomUUID();try{d.default.mkdirSync(i,{recursive:!0}),d.default.writeFileSync(j,a,"utf-8")}catch{}return a}()),b}a.s(["getInstanceId",0,m,"hashToId",0,k],69839);var n=a.i(21572);function o(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,n.readConfig)().telemetry.enabled}catch{return!0}}a.s(["isTelemetryEnabled",0,o],31920),a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"],79779);var p=a.i(12072);async function q(){let a=o();return{enabled:a,distinctId:a?m():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:p.version}}(0,a.i(13095).ensureServerEntryExports)([q]),(0,c.registerServerReference)(q,"0071d6ba0d8d9d482bb1eaadacd5182cc9cb5f584e",null),a.s(["getTelemetryConfig",0,q],36359)}];
4
-
5
- //# sourceMappingURL=%5Broot-of-the-server%5D__1mmefsr._.js.map
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53348,e=>{"use strict";var r=e.i(43476),t=e.i(71645),n=e.i(754),i=e.i(9969);e.s(["default",0,function({error:e,reset:o}){return(0,t.useEffect)(()=>{(0,n.getTelemetryConfig)().then(r=>{(0,i.setClientTelemetryConfig)(r),(0,i.captureClientEvent)("client_error",{error_message:e.message,error_name:e.name,error_digest:e.digest,boundary:"global"})}).catch(()=>{})},[e]),(0,r.jsx)("html",{children:(0,r.jsx)("body",{children:(0,r.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,r.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,r.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:e.message||"An unexpected error occurred."}),(0,r.jsx)("button",{onClick:o,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}]);
@@ -1,4 +0,0 @@
1
- {
2
- "layout": 3,
3
- "cli": "1.0.0-beta.13"
4
- }
@@ -1 +0,0 @@
1
- 1.0.0-beta.13
@@ -1 +0,0 @@
1
- c28ef0cc54d247aca79c7208bf5ce8e4459c18a62d922cc600fa902f49161b1c