failproofai 1.0.0-beta.0 → 1.0.0-beta.10
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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
- package/.next/standalone/.next/build-manifest.json +6 -6
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/routes-manifest.json +6 -0
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js +3 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +3 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js +3 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -3
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js +2 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/reminder/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/reminder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js +3 -2
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js +5 -3
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +3 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +30 -18
- package/.next/standalone/.next/server/app/policies/page.js +5 -3
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +4 -2
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +6 -4
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +4 -2
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +18 -0
- package/.next/standalone/.next/server/app/settings/page/next-font-manifest.json +6 -0
- package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -0
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +53 -0
- package/.next/standalone/.next/server/app/settings/page.js +18 -0
- package/.next/standalone/.next/server/app/settings/page.js.map +5 -0
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
- package/.next/standalone/.next/server/chunks/[externals]__0h9_83k._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[externals]__1nl3dvw._.js → [externals]__0r-zamh._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[externals]__1ifpkx-._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__06hexd0._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__094p1f1._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5z._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ed01_d._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g0vcwt._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0h3lfmp._.js → [root-of-the-server]__0ky_n0r._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__18d-9oi._.js → [root-of-the-server]__0lk_935._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__16le-kd._.js → [root-of-the-server]__0pbp9fe._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q-v9z2._.js +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__10oa-v9._.js → [root-of-the-server]__0v2fpxe._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0sb_5m8._.js → [root-of-the-server]__131ebum._.js} +3 -3
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-dh5jy._.js → [root-of-the-server]__1_ps0jw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0l4vuqm._.js → [root-of-the-server]__1a7i2q4._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ibjy5x._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1iny24d._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1tvn4wf._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1tyedjt._.js +3 -0
- package/.next/standalone/.next/server/chunks/_0lxbzdq._.js +5 -0
- package/.next/standalone/.next/server/chunks/_1zuiiy3._.js +5 -0
- package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +5 -0
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_17k9e3w.js +5 -5
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +2 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +2 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[externals]__1aq139v._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04pwh4t._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__06bp_fg._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__074qmkp._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__170799-._.js → [root-of-the-server]__0spkm68._.js} +11 -11
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__10butu6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1a2hcb_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qapotl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1apb7k_._.js → [root-of-the-server]__1rdruw4._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1rv-sc9._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1tyf0tc._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1u-wx42._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1v185mo._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__01od0m6._.js → [root-of-the-server]__1yw368c._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0-yi74u._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_04mekdy._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0r-dsre._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0rjgfln._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0se484m._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0uz7o9y._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_11_p9y8._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1e19atl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1fahg9e._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1gmzkwj._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/_1w8sola._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1w_6p9g._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1y4qr7u._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0dwo94s.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +2 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +5 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +6 -6
- package/.next/standalone/.next/server/middleware.js +2 -2
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +74 -20
- package/.next/standalone/.next/static/chunks/00adubtgov21s.js +1 -0
- package/.next/standalone/.next/static/chunks/{03fmihek9n986.js → 06zgzyh3wv1ig.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1hdhteui932bq.js → 0qmo2t50kpb30.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1grd7y94-igz9.js → 0yudogeqddpzr.js} +1 -1
- package/.next/standalone/.next/static/chunks/16p68cybetr31.js +1 -0
- package/.next/standalone/.next/static/chunks/1bm0q12hgs22l.css +2 -0
- package/.next/standalone/.next/static/chunks/{1d6ncspjagm53.js → 1fu90ch80qngv.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2vr7aazw6k2-n.js → 1m416lie3qwsj.js} +1 -1
- package/.next/standalone/.next/static/chunks/1v1gqvpjk62jm.js +1 -0
- package/.next/standalone/.next/static/chunks/1ypqzvoal8j56.js +6 -0
- package/.next/standalone/.next/static/chunks/23kev26by1e4f.js +1 -0
- package/.next/standalone/.next/static/chunks/{29k6ef49zppxj.js → 2h4sbmp0ad78w.js} +1 -1
- package/.next/standalone/.next/static/chunks/2obwg4tterjpa.js +1 -0
- package/.next/standalone/.next/static/chunks/2uvhw57mf9lg_.css +2 -0
- package/.next/standalone/.next/static/chunks/{29ydr-8q0zis6.js → 30ufy4_e2n78e.js} +22 -22
- package/.next/standalone/.next/static/chunks/31coz11ia5vc4.js +1 -0
- package/.next/standalone/.next/static/chunks/{1s-_swlc80y43.js → 3p4j0l1o_p-nm.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ip1n8xmgxarv.js → 3uxnxwxcctyj0.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-1lsv92x7klwrn.js → turbopack-3diub4ctvn1n0.js} +1 -1
- package/.next/standalone/app/actions/get-active-pauses.ts +16 -0
- package/.next/standalone/app/actions/get-hooks-config.ts +2 -1
- package/.next/standalone/app/actions/get-scheduled-audit.ts +70 -0
- package/.next/standalone/app/actions/update-scheduled-audit.ts +44 -0
- package/.next/standalone/app/api/audit/run/route.ts +28 -0
- package/.next/standalone/app/api/audit/status/route.ts +13 -1
- package/.next/standalone/app/api/auth/status/route.ts +1 -1
- package/.next/standalone/app/audit/_components/auth-dialog.css +159 -0
- package/.next/standalone/app/audit/_components/auth-dialog.tsx +3 -0
- package/.next/standalone/app/audit/audit-styles.css +6 -149
- package/.next/standalone/app/components/pause-notices.tsx +111 -0
- package/.next/standalone/app/policies/hooks-client.tsx +81 -6
- package/.next/standalone/app/settings/page.tsx +31 -0
- package/.next/standalone/app/settings/settings-client.tsx +488 -0
- package/.next/standalone/components/navbar.tsx +2 -0
- package/.next/standalone/lib/auth/api-server-client.ts +2 -3
- package/.next/standalone/lib/auth/auth-store.ts +4 -4
- package/.next/standalone/lib/codex-sessions.ts +2 -1
- package/.next/standalone/lib/dashboard-host.ts +101 -0
- package/.next/standalone/lib/install-check.ts +22 -7
- package/.next/standalone/lib/pi-sessions.ts +99 -14
- package/.next/standalone/lib/telemetry-enabled.ts +54 -0
- package/.next/standalone/lib/telemetry-id.ts +52 -1
- package/.next/standalone/lib/telemetry.ts +8 -4
- package/.next/standalone/node_modules/react/cjs/react.development.js +1 -1
- package/.next/standalone/node_modules/react/cjs/react.production.js +1 -1
- package/.next/standalone/node_modules/react/package.json +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/package.json +4 -4
- package/.next/standalone/package.json +17 -10
- package/.next/standalone/proxy.ts +89 -1
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +518 -79
- package/dist/cli.mjs +11484 -6046
- package/dist/worker.mjs +2019 -272
- package/lib/auth/api-server-client.ts +2 -3
- package/lib/auth/auth-store.ts +4 -4
- package/lib/codex-sessions.ts +2 -1
- package/lib/dashboard-host.ts +101 -0
- package/lib/install-check.ts +22 -7
- package/lib/pi-sessions.ts +99 -14
- package/lib/telemetry-enabled.ts +54 -0
- package/lib/telemetry-id.ts +52 -1
- package/lib/telemetry.ts +8 -4
- package/package.json +17 -10
- package/scripts/build-daemon-packages.mjs +210 -0
- package/scripts/daemon-platforms.mjs +42 -0
- package/scripts/install-telemetry.mjs +8 -1
- package/scripts/launch.ts +25 -3
- package/scripts/parse-script-args.ts +17 -1
- package/scripts/prune-standalone.mjs +26 -0
- package/scripts/publish-aliases.mjs +62 -41
- package/scripts/repro-npm-install.sh +155 -0
- package/scripts/translate-docs/readme-translator.ts +163 -4
- package/scripts/validate-mdx.ts +153 -13
- package/src/audit/audit-lock.ts +285 -0
- package/src/audit/audit-schedule.ts +111 -0
- package/src/audit/cache.ts +18 -4
- package/src/audit/cli-adapters/goose.ts +2 -1
- package/src/audit/cli-adapters/hermes.ts +28 -10
- package/src/audit/cli.ts +191 -35
- package/src/audit/dashboard-cache.ts +2 -1
- package/src/hooks/backfill-cli.ts +247 -0
- package/src/hooks/builtin-policies.ts +390 -2
- package/src/hooks/cloud-connection.ts +354 -0
- package/src/hooks/cloud-enrollment-cli.ts +325 -0
- package/src/hooks/cloud-enrollment.ts +243 -0
- package/src/hooks/cloud-introspect.ts +147 -0
- package/src/hooks/cloud-managed-policies.ts +169 -0
- package/src/hooks/collector-config.ts +234 -0
- package/src/hooks/configure-wizard.ts +915 -158
- package/src/hooks/custom-hooks-loader.ts +191 -33
- package/src/hooks/daemon-client.ts +136 -17
- package/src/hooks/daemon-download.ts +192 -30
- package/src/hooks/daemon-service.ts +1190 -92
- package/src/hooks/first-run-gate.ts +50 -0
- package/src/hooks/fp-config.ts +497 -0
- package/src/hooks/fp-home.ts +375 -0
- package/src/hooks/fp-reset.ts +464 -0
- package/src/hooks/handler.ts +185 -6
- package/src/hooks/hook-activity-store.ts +85 -20
- package/src/hooks/hook-logger.ts +2 -1
- package/src/hooks/hook-telemetry.ts +5 -1
- package/src/hooks/hooks-config.ts +4 -3
- package/src/hooks/loader-utils.ts +171 -8
- package/src/hooks/manager.ts +5 -4
- package/src/hooks/onboarding-attempt.ts +179 -0
- package/src/hooks/onboarding-lock.ts +119 -0
- package/src/hooks/policy-types.ts +28 -0
- package/src/hooks/session-pause-cli.ts +159 -0
- package/src/hooks/session-pause.ts +268 -0
- package/src/hooks/setup-state.ts +256 -0
- package/src/hooks/tui.ts +119 -4
- package/src/hooks/uninstall-cli.ts +345 -0
- package/src/hooks/worker-server.ts +65 -3
- package/.next/standalone/.next/server/chunks/[externals]__14odj07._.js +0 -3
- package/.next/standalone/.next/server/chunks/[externals]__1s61mel._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0id_xf7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0longh-._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__19120tr._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1fwl2mz._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1myjm-d._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1rhmvod._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[externals]__1_g_b3t._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0114ewg._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0259h38._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02r5bgf._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e8sjqm._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lkzqax._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qucxyj._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u02miy._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0uno39i._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__14dd6h8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ath6v_._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1zj-87g._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1zqz4v8._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/_1m_p7pi._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_1-upb14.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1ezd2jf._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1tnuifj._.js +0 -5
- package/.next/standalone/.next/static/chunks/0h7auy7hzjyhw.js +0 -1
- package/.next/standalone/.next/static/chunks/0u9hc6oxx-gpj.js +0 -6
- package/.next/standalone/.next/static/chunks/0zbxssxh53n-3.js +0 -1
- package/.next/standalone/.next/static/chunks/2mazwb1qmur1p.js +0 -1
- package/.next/standalone/.next/static/chunks/2pujpnfx4pws6.css +0 -2
- package/.next/standalone/.next/static/chunks/33u59vf_8xpd-.js +0 -1
- package/.next/standalone/.next/static/chunks/3i27c3hcriawq.css +0 -1
- package/.next/standalone/.next/static/chunks/3wrgbih-516uj.js +0 -1
- package/.next/standalone/Cargo.lock +0 -428
- package/.next/standalone/Cargo.toml +0 -9
- package/.next/standalone/crates/PROTOCOL.md +0 -122
- package/.next/standalone/crates/failproofaid/Cargo.toml +0 -18
- package/.next/standalone/crates/failproofaid/src/lock.rs +0 -81
- package/.next/standalone/crates/failproofaid/src/main.rs +0 -83
- package/.next/standalone/crates/failproofaid/src/paths.rs +0 -172
- package/.next/standalone/crates/failproofaid/src/server.rs +0 -502
- package/.next/standalone/crates/failproofaid/src/worker.rs +0 -400
- package/.next/standalone/crates/failproofaid/tests/daemon_e2e.rs +0 -241
- package/.next/standalone/crates/fpai-ipc/Cargo.toml +0 -16
- package/.next/standalone/crates/fpai-ipc/src/envelope.rs +0 -175
- package/.next/standalone/crates/fpai-ipc/src/framing.rs +0 -177
- package/.next/standalone/crates/fpai-ipc/src/lib.rs +0 -10
- package/.next/standalone/crates/fpai-ipc/src/peer.rs +0 -80
- package/.next/standalone/docker-hook-sync/Dockerfile +0 -79
- package/.next/standalone/docker-hook-sync/entrypoint.sh +0 -109
- package/.next/standalone/integration-suite/Dockerfile +0 -47
- package/.next/standalone/integration-suite/README.md +0 -129
- package/.next/standalone/integration-suite/canary-policies.mjs +0 -45
- package/.next/standalone/integration-suite/capture-tokens.sh +0 -48
- package/.next/standalone/integration-suite/ci-entrypoint.sh +0 -179
- package/.next/standalone/integration-suite/inject-tokens.sh +0 -44
- package/.next/standalone/integration-suite/install-clis.sh +0 -136
- package/.next/standalone/integration-suite/probe-cli.sh +0 -248
- package/.next/standalone/integration-suite/report.js +0 -120
- package/.next/standalone/integration-suite/run.sh +0 -159
- package/.next/standalone/openclaw-plugin/index.js +0 -223
- package/.next/standalone/openclaw-plugin/openclaw.plugin.json +0 -6
- package/.next/standalone/openclaw-plugin/package.json +0 -12
- package/.next/standalone/osv-scanner.toml +0 -17
- package/.next/standalone/pi-extension/index.ts +0 -524
- package/.next/standalone/pi-extension/package.json +0 -12
- package/.next/standalone/postcss.config.mjs +0 -8
- package/.next/standalone/readme-arch-hq.gif +0 -0
- package/.next/standalone/rust-toolchain.toml +0 -4
- package/src/auth/cli.ts +0 -371
- /package/.next/standalone/.next/static/{7Lxtd352rSaHB-pmm6G8M → pBBcTvE6_VueYGbacy1kg}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{7Lxtd352rSaHB-pmm6G8M → pBBcTvE6_VueYGbacy1kg}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{7Lxtd352rSaHB-pmm6G8M → pBBcTvE6_VueYGbacy1kg}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every path inside `~/.failproofai`, in one place.
|
|
3
|
+
*
|
|
4
|
+
* Before this module the layout was ~40 hardcoded `resolve(homedir(),
|
|
5
|
+
* ".failproofai", …)` calls in TypeScript and ~10 more in Rust, and the two
|
|
6
|
+
* sides had drifted into three different ideas of where things lived
|
|
7
|
+
* (`cache/hook-activity` vs `hook-activity`, `spool` at the root vs under
|
|
8
|
+
* state). Moving anything meant finding every one of them, and missing one
|
|
9
|
+
* meant the daemon wrote where the dashboard did not read — silently, because
|
|
10
|
+
* an absent directory is indistinguishable from an idle one.
|
|
11
|
+
*
|
|
12
|
+
* So: nothing outside this file may join a path onto the failproofai home.
|
|
13
|
+
* The Rust side mirrors it in `crates/failproofaid/src/paths.rs`. The test that
|
|
14
|
+
* asserts the two agree lives THERE, not here —
|
|
15
|
+
* `paths::tests::every_mirrored_path_agrees_with_fp_home_ts` imports this module
|
|
16
|
+
* in a child process and compares every mirrored path against its own.
|
|
17
|
+
*
|
|
18
|
+
* This line used to cite `__tests__/hooks/fp-home.test.ts`, which contains no
|
|
19
|
+
* reference to `crates/` and never checked anything cross-language. While both
|
|
20
|
+
* files claimed the guard existed, three paths were wrong at once: the daemon's
|
|
21
|
+
* `run/` ignored `FAILPROOFAI_HOME` (so a healthy daemon on a fail-closed
|
|
22
|
+
* machine denied every tool call), its cloud policy directory still said
|
|
23
|
+
* `cloud-managed`, and its credential still said `cloud.json`.
|
|
24
|
+
*
|
|
25
|
+
* ## Layout 2
|
|
26
|
+
*
|
|
27
|
+
* ```
|
|
28
|
+
* ~/.failproofai/
|
|
29
|
+
* VERSION layout / cli / daemon versions
|
|
30
|
+
* config.toml 0644 non-secret: mode, daemon, collector prefs
|
|
31
|
+
* credentials.toml 0600 every token
|
|
32
|
+
* bin/ downloaded daemon binaries, one per version
|
|
33
|
+
* policies/
|
|
34
|
+
* local-policies/ the builtin enable/disable set
|
|
35
|
+
* cloud-policies/ content-addressed artifacts + active generation
|
|
36
|
+
* custom-policies/ user convention policies (*.mjs)
|
|
37
|
+
* cursors/<source>/ per-source collector watermarks
|
|
38
|
+
* audit/ audit report + per-session cache
|
|
39
|
+
* hook-activity/ decision log the dashboard reads
|
|
40
|
+
* custom-agents/ SDK spool (events/ + failed/)
|
|
41
|
+
* run/ sockets + flock — MUST stay shallow, see below
|
|
42
|
+
* state/ daemon scratch: spool, failed, health, pauses, shims
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* **`run/` is deliberately NOT under `state/`.** A Unix socket path must fit
|
|
46
|
+
* in `sockaddr_un.sun_path` (~108 bytes) and we have hit that ceiling twice
|
|
47
|
+
* already during development. Every directory level spends part of a budget
|
|
48
|
+
* that a long `$HOME` has already eaten into, so the socket stays as close to
|
|
49
|
+
* the root as it can.
|
|
50
|
+
*
|
|
51
|
+
* ## Project scope is NOT here
|
|
52
|
+
*
|
|
53
|
+
* `<project>/.failproofai/` keeps its old shape — `policies-config.json` and
|
|
54
|
+
* `policies/*.mjs` at the top. Those files are committed to users' git repos,
|
|
55
|
+
* so reorganising them would rewrite history in every repo that adopted
|
|
56
|
+
* failproofai. `hooks-config.ts` still owns those paths.
|
|
57
|
+
*/
|
|
58
|
+
import { homedir } from "node:os";
|
|
59
|
+
import { resolve } from "node:path";
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The on-disk layout this build speaks.
|
|
63
|
+
*
|
|
64
|
+
* Bumped whenever a path in this file moves. Recorded in `VERSION`, and what
|
|
65
|
+
* `detectLayout()` compares against — a home written by a different layout is
|
|
66
|
+
* refused rather than half-read, because reading a moved directory silently
|
|
67
|
+
* yields "no data" instead of an error.
|
|
68
|
+
*
|
|
69
|
+
* 1 — the original flat/`cache`-based layout, through 1.0.0-beta.5.
|
|
70
|
+
* 2 — this file.
|
|
71
|
+
*/
|
|
72
|
+
export const LAYOUT_VERSION = 2;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `~/.failproofai`, or `FAILPROOFAI_HOME`.
|
|
76
|
+
*
|
|
77
|
+
* The override is load-bearing for tests and containers: everything below is
|
|
78
|
+
* derived from it, so pointing it elsewhere relocates the entire layout
|
|
79
|
+
* atomically rather than per-path.
|
|
80
|
+
*/
|
|
81
|
+
export function failproofaiHome(home?: string): string {
|
|
82
|
+
if (home) return resolve(home, ".failproofai");
|
|
83
|
+
return process.env.FAILPROOFAI_HOME || resolve(homedir(), ".failproofai");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const at = (...parts: string[]): string => resolve(failproofaiHome(), ...parts);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Same, against an explicitly supplied HOME (not the failproofai home).
|
|
90
|
+
*
|
|
91
|
+
* `setup-state` and `onboarding-lock` take a `home` parameter purely so their
|
|
92
|
+
* tests can point at a temp directory, and a helper that silently ignored it
|
|
93
|
+
* would send those tests at the developer's real home — which is precisely the
|
|
94
|
+
* bug this overload exists to make impossible.
|
|
95
|
+
*/
|
|
96
|
+
const atHome = (home: string | undefined, ...parts: string[]): string =>
|
|
97
|
+
home ? resolve(failproofaiHome(home), ...parts) : at(...parts);
|
|
98
|
+
|
|
99
|
+
// ── Top level ────────────────────────────────────────────────────────────────
|
|
100
|
+
|
|
101
|
+
/** Layout / CLI / daemon versions. Also the layout marker. */
|
|
102
|
+
export const versionFile = (home?: string) => atHome(home, "VERSION");
|
|
103
|
+
|
|
104
|
+
/** Non-secret configuration. World-readable by design; never holds a token. */
|
|
105
|
+
export const configFile = (home?: string) => atHome(home, "config.toml");
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Every credential, owner-only.
|
|
109
|
+
*
|
|
110
|
+
* Split from `config.toml` because that file is written with a bare
|
|
111
|
+
* `writeFileSync` and inherits the umask (0664 on a normal machine). A token
|
|
112
|
+
* there would be readable by every local user on the box — which is exactly
|
|
113
|
+
* why `ingest.json` and `cloud.json` were separate files before this.
|
|
114
|
+
*/
|
|
115
|
+
export const credentialsFile = (home?: string) => atHome(home, "credentials.toml");
|
|
116
|
+
|
|
117
|
+
// ── Daemon binaries ──────────────────────────────────────────────────────────
|
|
118
|
+
|
|
119
|
+
export const binDir = (home?: string) => atHome(home, "bin");
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* One file per version, never overwritten in place: an in-place write hits
|
|
123
|
+
* `ETXTBSY` against the running daemon on Linux, and would silently repoint a
|
|
124
|
+
* live service unit at a binary built from different source.
|
|
125
|
+
*/
|
|
126
|
+
export const daemonBinary = (version: string, home?: string) =>
|
|
127
|
+
resolve(binDir(home), `failproofaid-${version}`);
|
|
128
|
+
|
|
129
|
+
// ── Policies ─────────────────────────────────────────────────────────────────
|
|
130
|
+
|
|
131
|
+
export const policiesDir = (home?: string) => atHome(home, "policies");
|
|
132
|
+
|
|
133
|
+
/** The builtin enable/disable set and per-policy params, GLOBAL scope only. */
|
|
134
|
+
export const localPoliciesDir = (home?: string) => atHome(home, "policies", "local-policies");
|
|
135
|
+
export const globalPolicyConfigFile = (home?: string) =>
|
|
136
|
+
resolve(localPoliciesDir(home), "policies-config.json");
|
|
137
|
+
|
|
138
|
+
/** Cloud-managed generations: `active.json` plus content-addressed artifacts. */
|
|
139
|
+
export const cloudPoliciesDir = (home?: string) => resolve(policiesDir(home), "cloud-policies");
|
|
140
|
+
|
|
141
|
+
/** User convention policies (`*.mjs`) that load without any flag. */
|
|
142
|
+
export const customPoliciesDir = (home?: string) => resolve(policiesDir(home), "custom-policies");
|
|
143
|
+
|
|
144
|
+
// ── Collector ────────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
/** Per-source watermarks. One directory per source — never shared: the cursor
|
|
147
|
+
* store rewrites its whole map atomically, so two sources sharing a file
|
|
148
|
+
* clobber each other and the loser re-reads from zero after every restart. */
|
|
149
|
+
export const cursorsDir = (source?: string, home?: string) =>
|
|
150
|
+
source ? resolve(atHome(home, "cursors"), source) : atHome(home, "cursors");
|
|
151
|
+
|
|
152
|
+
/** The SDK spool root. Mirrors `~/.agenteye/`, which stays supported. */
|
|
153
|
+
export const customAgentsDir = (home?: string) => atHome(home, "custom-agents");
|
|
154
|
+
export const customAgentsEventsDir = (home?: string) => resolve(customAgentsDir(home), "events");
|
|
155
|
+
export const customAgentsFailedDir = (home?: string) => resolve(customAgentsDir(home), "failed");
|
|
156
|
+
|
|
157
|
+
// ── Audit ────────────────────────────────────────────────────────────────────
|
|
158
|
+
|
|
159
|
+
export const auditDir = (home?: string) => atHome(home, "audit");
|
|
160
|
+
export const auditDashboardFile = (home?: string) => resolve(auditDir(home), "dashboard.json");
|
|
161
|
+
export const auditCacheDir = (home?: string) => resolve(auditDir(home), "cache");
|
|
162
|
+
|
|
163
|
+
// ── Hook activity ────────────────────────────────────────────────────────────
|
|
164
|
+
|
|
165
|
+
/** The decision log: page-sized JSONL the dashboard's activity tab reads. */
|
|
166
|
+
export const hookActivityDir = (home?: string) => atHome(home, "hook-activity");
|
|
167
|
+
|
|
168
|
+
// ── Runtime ──────────────────────────────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
/** Sockets and the singleton flock. Shallow on purpose — see the header note. */
|
|
171
|
+
export const runDir = (home?: string) => atHome(home, "run");
|
|
172
|
+
export const daemonSocket = () =>
|
|
173
|
+
process.env.FAILPROOFAI_DAEMON_SOCKET || resolve(runDir(), "failproofaid.sock");
|
|
174
|
+
export const workerSocket = (home?: string) => resolve(runDir(home), "worker.sock");
|
|
175
|
+
export const daemonLock = (home?: string) => resolve(runDir(home), "failproofaid.lock");
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Single-flight lock for the audit.
|
|
179
|
+
*
|
|
180
|
+
* Three separate processes can start one — a scheduled run, `failproofai
|
|
181
|
+
* audit`, and the dashboard's re-run — and all three write the same
|
|
182
|
+
* sha1-keyed cache files, so the lock has to be visible across processes.
|
|
183
|
+
* It sits in `run/` with the other runtime files rather than under `audit/`,
|
|
184
|
+
* which holds results a human might keep and a reset is expected to clear.
|
|
185
|
+
*
|
|
186
|
+
* NOT mirrored in `crates/failproofaid/src/paths.rs` yet: nothing in Rust
|
|
187
|
+
* takes this lock until the daemon grows its audit lane, and a `pub fn` no
|
|
188
|
+
* caller uses is a dead_code failure under `-D warnings`.
|
|
189
|
+
*/
|
|
190
|
+
export const auditLockFile = (home?: string) => resolve(runDir(home), "audit.lock");
|
|
191
|
+
|
|
192
|
+
// ── Daemon scratch state ─────────────────────────────────────────────────────
|
|
193
|
+
|
|
194
|
+
/** Everything the daemon writes that a human would never open by hand. */
|
|
195
|
+
export const stateDir = (home?: string) => atHome(home, "state");
|
|
196
|
+
/**
|
|
197
|
+
* Where the policy loader writes its ESM shim.
|
|
198
|
+
*
|
|
199
|
+
* Under the user's own home rather than beside the installed package: that
|
|
200
|
+
* directory belongs to whoever installed failproofai, and on a system-wide
|
|
201
|
+
* install it is root-owned, which made every non-root hook fail to load
|
|
202
|
+
* cloud-managed and custom policies — silently, and open.
|
|
203
|
+
*/
|
|
204
|
+
export const shimsDir = (home?: string) => resolve(stateDir(home), "shims");
|
|
205
|
+
export const spoolDir = (home?: string) => resolve(stateDir(home), "spool");
|
|
206
|
+
export const failedDir = (home?: string) => resolve(stateDir(home), "failed");
|
|
207
|
+
export const collectorHealthFile = (home?: string) => resolve(stateDir(home), "collector-health.json");
|
|
208
|
+
/** Per-session enforcement pauses, keyed by a hash of the session id. */
|
|
209
|
+
export const sessionPauseDir = () => resolve(stateDir(), "sessions");
|
|
210
|
+
/**
|
|
211
|
+
* When the scheduled audit last ran, and when the next one is due.
|
|
212
|
+
*
|
|
213
|
+
* The DAEMON is the sole writer (`crates/failproofaid/src/audit_lane.rs`, which
|
|
214
|
+
* mirrors this path in `paths.rs`) — it owns the schedule, and a second writer
|
|
215
|
+
* racing it could hand a machine two full scans back to back. Everything on this
|
|
216
|
+
* side reads it: the interval itself lives in `config.toml`'s `[audit]` table,
|
|
217
|
+
* which a human edits, while this file is derived state a human never opens,
|
|
218
|
+
* which is why it sits under `state/` rather than beside the audit results.
|
|
219
|
+
*/
|
|
220
|
+
export const auditScheduleFile = (home?: string) => resolve(stateDir(home), "audit-schedule.json");
|
|
221
|
+
/**
|
|
222
|
+
* The anonymous instance id this machine reports telemetry under.
|
|
223
|
+
*
|
|
224
|
+
* The mirror image of `auditScheduleFile()` above: here the CLI is the sole
|
|
225
|
+
* writer (`getInstanceId()` in `lib/telemetry-id.ts`, which persists whatever it
|
|
226
|
+
* resolved) and **failproofaid** only reads, through `telemetry_id_path()` in
|
|
227
|
+
* `crates/failproofaid/src/paths.rs`. The daemon cannot re-derive the value —
|
|
228
|
+
* `getInstanceId`'s middle tier hashes Node-formatted strings (`os.arch()` is
|
|
229
|
+
* `x64` where Rust says `x86_64`), and a near-miss there does not fail, it
|
|
230
|
+
* silently files one machine under two PostHog persons — so this file is how the
|
|
231
|
+
* two agree. Derived state a human never opens, hence `state/` rather than
|
|
232
|
+
* beside `config.toml`.
|
|
233
|
+
*/
|
|
234
|
+
export const telemetryIdFile = (home?: string) => resolve(stateDir(home), "telemetry-id");
|
|
235
|
+
export const launcherMarker = (home?: string) => resolve(stateDir(home), "launcher-configured");
|
|
236
|
+
/**
|
|
237
|
+
* The last first-run setup attempt that ABORTED, and why.
|
|
238
|
+
*
|
|
239
|
+
* Deliberately NOT one of `isConfigured()`'s signals: a failed attempt must
|
|
240
|
+
* never make a machine read as set up. It exists only so the next command can
|
|
241
|
+
* tell "never tried" from "tried and could not finish" — the wizard writes
|
|
242
|
+
* nothing on an abort, so without this the two are identical and setup
|
|
243
|
+
* relaunches on every single command forever.
|
|
244
|
+
*
|
|
245
|
+
* Under `state/` with the other derived markers a human never opens.
|
|
246
|
+
*/
|
|
247
|
+
export const onboardingAttemptFile = (home?: string) =>
|
|
248
|
+
resolve(stateDir(home), "onboarding-attempt.json");
|
|
249
|
+
/**
|
|
250
|
+
* The version that last reported an install, so an upgrade is reported once.
|
|
251
|
+
*
|
|
252
|
+
* Under `state/` in layout 2 like every other piece of derived state, and that
|
|
253
|
+
* placement fixes a real bug rather than being tidiness: at the root it was
|
|
254
|
+
* `~/.failproofai/last-version`, which `detectLayout()` lists as a LAYOUT-1
|
|
255
|
+
* MARKER — while the code that writes it still runs under layout 2, and runs
|
|
256
|
+
* BEFORE the layout check. So on a genuinely fresh machine the CLI created the
|
|
257
|
+
* file, then immediately read it back as evidence of an old layout, classified
|
|
258
|
+
* a brand-new home as stale, and opened every new user's first command with
|
|
259
|
+
* "failproofai reorganised … Removed 1 item(s) from the old layout."
|
|
260
|
+
*/
|
|
261
|
+
export const lastVersionFile = (home?: string) => resolve(stateDir(home), "last-version");
|
|
262
|
+
export const onboardingLockFile = (home?: string) => resolve(stateDir(home), "onboarding.lock");
|
|
263
|
+
export const codexSessionPathsFile = (home?: string) => resolve(stateDir(home), "codex-session-paths.json");
|
|
264
|
+
|
|
265
|
+
export const logsDir = (home?: string) => atHome(home, "logs");
|
|
266
|
+
|
|
267
|
+
// ── Layout 1 (legacy) ────────────────────────────────────────────────────────
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Where layout 1 kept things.
|
|
271
|
+
*
|
|
272
|
+
* Retained ONLY so `detectLayout()` can recognise an old home and so the reset
|
|
273
|
+
* can delete it. Nothing reads data from these paths: the decision was
|
|
274
|
+
* wipe-and-re-setup rather than migrate, because a half-migrated home that
|
|
275
|
+
* silently reads "no data" is worse than one that says so.
|
|
276
|
+
*/
|
|
277
|
+
export const legacy = {
|
|
278
|
+
policyConfig: () => at("policies-config.json"),
|
|
279
|
+
policyConfigLocal: () => at("policies-config.local.json"),
|
|
280
|
+
cloudCredentials: () => at("cloud.json"),
|
|
281
|
+
ingestCredentials: () => at("ingest.json"),
|
|
282
|
+
launcherMarker: () => at(".launcher-configured"),
|
|
283
|
+
lastVersion: () => at("last-version"),
|
|
284
|
+
auditDashboard: () => at("audit-dashboard.json"),
|
|
285
|
+
cacheDir: () => at("cache"),
|
|
286
|
+
hookActivityDir: () => at("cache", "hook-activity"),
|
|
287
|
+
auditCacheDir: () => at("cache", "audit"),
|
|
288
|
+
codexSessionPaths: () => at("cache", "codex-session-paths.json"),
|
|
289
|
+
spoolDir: () => at("spool"),
|
|
290
|
+
failedDir: () => at("failed"),
|
|
291
|
+
collectorHealth: () => at("collector-health.json"),
|
|
292
|
+
sessionPauseDir: () => at("state", "sessions"),
|
|
293
|
+
cloudManagedPolicies: () => at("policies", "cloud-managed"),
|
|
294
|
+
onboardingLock: () => at(".onboarding.lock"),
|
|
295
|
+
} as const;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Every path a reset must remove, in the order it should remove them.
|
|
299
|
+
*
|
|
300
|
+
* Enumerated rather than "delete the home directory" so a reset never takes
|
|
301
|
+
* out something a future layout adds and this list has not been taught about
|
|
302
|
+
* — and so the function is auditable at a glance, which matters for anything
|
|
303
|
+
* that deletes user data.
|
|
304
|
+
*/
|
|
305
|
+
export function resettablePaths(): string[] {
|
|
306
|
+
return [
|
|
307
|
+
// Layout 1
|
|
308
|
+
legacy.policyConfig(),
|
|
309
|
+
legacy.policyConfigLocal(),
|
|
310
|
+
legacy.cloudCredentials(),
|
|
311
|
+
legacy.ingestCredentials(),
|
|
312
|
+
legacy.launcherMarker(),
|
|
313
|
+
legacy.lastVersion(),
|
|
314
|
+
legacy.auditDashboard(),
|
|
315
|
+
// `legacy.cacheDir()` — the whole of `cache/` — stood here, and it CONTAINS
|
|
316
|
+
// `cache/hook-activity`: layout 1's decision log. Deleting the parent threw
|
|
317
|
+
// away every decision the machine had ever recorded, which is the data the
|
|
318
|
+
// dashboard's activity tab exists to show. Its children are now named
|
|
319
|
+
// individually so the log can be carried across by
|
|
320
|
+
// `migrateHookActivity()`, and everything else in `cache/` still goes —
|
|
321
|
+
// both remaining entries are re-derived on demand.
|
|
322
|
+
legacy.auditCacheDir(),
|
|
323
|
+
legacy.codexSessionPaths(),
|
|
324
|
+
legacy.spoolDir(),
|
|
325
|
+
legacy.failedDir(),
|
|
326
|
+
legacy.collectorHealth(),
|
|
327
|
+
legacy.onboardingLock(),
|
|
328
|
+
legacy.cloudManagedPolicies(),
|
|
329
|
+
// The MACHINE-OWNED children of `policies/`, never the parent.
|
|
330
|
+
//
|
|
331
|
+
// `at("policies")` stood here, and on layout 1 that directory IS the
|
|
332
|
+
// documented home for hand-written personal policies — `docs/
|
|
333
|
+
// configuration.mdx` names `~/.failproofai/policies/` as the user scope,
|
|
334
|
+
// and `manager.ts` read it. Those are source files a person wrote; nothing
|
|
335
|
+
// regenerates them, nothing backed them up, and the reset message named
|
|
336
|
+
// only "policy config, activity history and audit cache". Worse, the
|
|
337
|
+
// machine then reported itself configured — `isConfigured()` is a union
|
|
338
|
+
// that still sees the agent CLIs' untouched settings files — so the wizard
|
|
339
|
+
// was skipped and hooks kept firing against an empty policy set.
|
|
340
|
+
//
|
|
341
|
+
// `custom-policies/` is deliberately absent from this list for the same
|
|
342
|
+
// reason. Both directories below are re-derived: `local-policies/` by
|
|
343
|
+
// setup, `cloud-policies/` by the next daemon poll.
|
|
344
|
+
localPoliciesDir(),
|
|
345
|
+
cloudPoliciesDir(),
|
|
346
|
+
// `at("cursors")` is deliberately NOT here, and it is load-bearing for the
|
|
347
|
+
// activity migration above rather than a separate opinion. Cursors are keyed
|
|
348
|
+
// on `(device, inode)`; `migrateHookActivity()` MOVES pages, which preserves
|
|
349
|
+
// the inode, so a surviving cursor still points at the file it belongs to
|
|
350
|
+
// and resumes at the right offset. Delete the cursors and every carried page
|
|
351
|
+
// reads as new and re-ships in full — which is the outcome the move exists
|
|
352
|
+
// to avoid. A cursor whose file is gone is inert (`retain_existing` drops
|
|
353
|
+
// it), so keeping them costs nothing when there is nothing to resume.
|
|
354
|
+
at("state"),
|
|
355
|
+
// Layout 2.
|
|
356
|
+
// NOT versionFile() — it is the layout marker, not user data, and the
|
|
357
|
+
// reset rewrites it immediately afterwards. Listing it made a no-op reset
|
|
358
|
+
// report "removed 1 item" for a file it had just recreated.
|
|
359
|
+
configFile(),
|
|
360
|
+
credentialsFile(),
|
|
361
|
+
auditDir(),
|
|
362
|
+
// NOT hookActivityDir(). It is the DESTINATION `migrateHookActivity()` has
|
|
363
|
+
// just moved layout 1's log into, so listing it here deleted the migration
|
|
364
|
+
// moments after it happened — the reset runs every path in this list after
|
|
365
|
+
// the migrations. It is also the one directory here that is neither derived
|
|
366
|
+
// nor re-fetchable: a decision log is the record of what this machine did,
|
|
367
|
+
// and nothing regenerates it.
|
|
368
|
+
customAgentsDir(),
|
|
369
|
+
logsDir(),
|
|
370
|
+
// NOT bin/ — a downloaded daemon binary is large, version-pinned and
|
|
371
|
+
// re-verified on use, so deleting it only forces a needless re-download.
|
|
372
|
+
// NOT run/ — sockets belong to a running daemon; removing them out from
|
|
373
|
+
// under it breaks a live process rather than resetting configuration.
|
|
374
|
+
];
|
|
375
|
+
}
|