failproofai 1.0.6 → 1.0.7-beta.1
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/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/required-server-files.json +1 -1
- 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 +4 -4
- 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 +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- 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 +4 -4
- 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/_not-found/__PAGE__.segment.rsc +14 -14
- 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.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +8 -7
- 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.nft.json +1 -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.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- 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.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js +7 -5
- 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 +14 -14
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +6 -6
- 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/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +13 -11
- 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/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js +8 -7
- 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/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 +7 -7
- 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/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +7 -6
- 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/server-reference-manifest.json +41 -8
- package/.next/standalone/.next/server/app/settings/page.js +12 -9
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1msfs-h._.js → [externals]__19_pzeq._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1_bftcl._.js → [externals]__1j-zsg5._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1_r2rbg._.js → [root-of-the-server]__1bf34x4._.js} +5 -7
- package/.next/standalone/.next/server/chunks/_09dz7xv._.js +21 -21
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +16 -16
- package/.next/standalone/.next/server/chunks/{_1c3k-8x._.js → _1q5i8mb._.js} +2 -2
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +2 -2
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_01frwmb._.js +5 -0
- package/.next/standalone/.next/server/chunks/src_hooks_18qtd42._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3._.js +4 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01bmjsj._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qxnccm._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0soxz2z._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yrsbd_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1svlq8e._.js → [root-of-the-server]__0yxwl6j._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1b2dbet._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0cxe_2_._.js → [root-of-the-server]__1mf3zp6._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0do6d26._.js → _0bn2oo8._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1feuvhb._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/{_1es2j7i._.js → _1gb0ifp._.js} +5 -5
- package/.next/standalone/.next/server/chunks/ssr/{_1_qswah._.js → _1q46vxx._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0h_douw._.js → _1w_5l7t._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_17o744m._.js → _214wgrp._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- 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/app_settings_02tf1h4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_utils_ts_0az0sfq._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_0drixxt._.js → node_modules_next_dist_0w6mzq5._.js} +4 -4
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_18_d8l1._.js +151 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_095a_79._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_18k8rl0._.js +12 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- 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 +56 -23
- package/.next/standalone/.next/static/chunks/0cd-_8-c-m1ea.js +6 -0
- package/.next/standalone/.next/static/chunks/{40-wncjnguy4e.js → 0qrbdkv9qmvli.js} +1 -1
- package/.next/standalone/.next/static/chunks/{3-6zhytp6adkk.js → 0uldbut9y2-e8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2y4ycwcwfjv4k.js → 0vmd180qfntfb.js} +1 -1
- package/.next/standalone/.next/static/chunks/{25m8mg7bosgip.js → 12tvm75t5ffui.js} +1 -1
- package/.next/standalone/.next/static/chunks/1u5zsejmgrir_.js +1 -0
- package/.next/standalone/.next/static/chunks/258668t68du6b.js +1 -0
- package/.next/standalone/.next/static/chunks/285spx855h_3r.css +2 -0
- package/.next/standalone/.next/static/chunks/{35pw7zxhh76n7.js → 29fql3nbnfc9q.js} +1 -1
- package/.next/standalone/.next/static/chunks/2qv4hshejedtx.css +1 -0
- package/.next/standalone/.next/static/chunks/{0bepqeawy72n6.js → 2vkvu9-opa_1z.js} +1 -1
- package/.next/standalone/.next/static/chunks/34jpdb2xjm-x7.js +1 -0
- package/.next/standalone/.next/static/chunks/37lhv7wa3ywt6.js +1 -0
- package/.next/standalone/app/actions/get-jev-config.ts +409 -0
- package/.next/standalone/app/actions/pack-actions.ts +12 -0
- package/.next/standalone/app/actions/update-jev-config.ts +420 -0
- package/.next/standalone/app/components/jev-notices.tsx +96 -0
- package/.next/standalone/app/policies/hooks-client.tsx +9 -0
- package/.next/standalone/app/settings/jev-panel.tsx +469 -0
- package/.next/standalone/app/settings/page.tsx +20 -1
- package/.next/standalone/app/settings/settings-client.tsx +27 -1
- package/.next/standalone/app/settings/settings.css +79 -0
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +51 -3
- package/.next/standalone/fp-cloud-cli/README.md +1 -1
- package/.next/standalone/fp-cloud-cli/fp_cli/_version.py +1 -1
- package/.next/standalone/fp-cloud-cli/fp_cli/client.py +44 -0
- package/.next/standalone/fp-cloud-cli/fp_cli/commands/incidents_cmds.py +226 -5
- package/.next/standalone/fp-cloud-cli/fp_cli/models.py +11 -0
- package/.next/standalone/fp-cloud-cli/fp_cli/output.py +68 -1
- package/.next/standalone/fp-cloud-cli/pyproject.toml +1 -1
- package/.next/standalone/fp-cloud-cli/skill/SKILL.md +17 -2
- package/.next/standalone/fp-cloud-cli/skill/references/commands.md +7 -4
- package/.next/standalone/fp-cloud-cli/tests/test_alerting.py +184 -0
- package/.next/standalone/fp-cloud-cli/uv.lock +3 -3
- package/.next/standalone/package.json +11 -11
- package/.next/standalone/sdk/python/CHANGELOG.md +7 -0
- package/.next/standalone/sdk/python/failproofai_sdk/_version.py +1 -1
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/__init__.py +2 -0
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/authoring.py +24 -1
- package/.next/standalone/sdk/python/failproofai_sdk/evaluator/runtime.py +41 -6
- package/.next/standalone/sdk/python/tests/test_evaluator_runtime.py +88 -0
- package/.next/standalone/sdk/python/uv.lock +15 -15
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +115 -2
- package/dist/cli.mjs +9299 -2151
- package/dist/index.js +19 -1
- package/dist/worker.mjs +13761 -7834
- package/package.json +11 -11
- package/pi-extension/index.ts +11 -0
- package/scripts/build-policy-pack.mjs +39 -2
- package/src/hooks/builtin-policies.ts +21 -3
- package/src/hooks/cloud-enrollment-cli.ts +1 -1
- package/src/hooks/cloud-managed-policies.ts +22 -0
- package/src/hooks/custom-hooks-loader.ts +45 -7
- package/src/hooks/custom-hooks-registry.ts +45 -1
- package/src/hooks/effective-reviewers.ts +79 -0
- package/src/hooks/first-run-gate.ts +5 -0
- package/src/hooks/fp-home.ts +23 -0
- package/src/hooks/handler.ts +265 -6
- package/src/hooks/hook-activity-store.ts +105 -1
- package/src/hooks/hook-telemetry.ts +41 -0
- package/src/hooks/jev-activity.ts +385 -0
- package/src/hooks/jev-cli.ts +1193 -0
- package/src/hooks/loader-utils.ts +6 -0
- package/src/hooks/pack-cli.ts +278 -17
- package/src/hooks/pack-manifest.ts +479 -7
- package/src/hooks/pack-store.ts +156 -10
- package/src/hooks/policy-authority.ts +333 -0
- package/src/hooks/policy-catalog.ts +65 -0
- package/src/hooks/policy-evaluator.ts +940 -796
- package/src/hooks/policy-registry.ts +25 -0
- package/src/hooks/policy-reviewability.ts +229 -0
- package/src/hooks/policy-types.ts +126 -0
- package/src/hooks/semantic/combine.ts +541 -0
- package/src/hooks/semantic/compile.ts +176 -0
- package/src/hooks/semantic/decide.ts +392 -0
- package/src/hooks/semantic/envelope.ts +1296 -0
- package/src/hooks/semantic/evaluator.ts +547 -0
- package/src/hooks/semantic/facts.ts +292 -0
- package/src/hooks/semantic/intent.ts +1190 -0
- package/src/hooks/semantic/jev-client.ts +643 -0
- package/src/hooks/semantic/jev-config.ts +594 -0
- package/src/hooks/semantic/jev-review.ts +374 -0
- package/src/hooks/semantic/jev-stats.ts +289 -0
- package/src/hooks/semantic/jev-throttle.ts +421 -0
- package/src/hooks/semantic/pack-policies.ts +251 -0
- package/src/hooks/semantic/policies.ts +596 -0
- package/src/hooks/semantic/precondition-names.ts +60 -0
- package/src/hooks/semantic/preconditions.ts +58 -0
- package/src/hooks/semantic/redact.ts +2910 -0
- package/src/hooks/semantic/types.ts +145 -0
- package/src/hooks/semver-precedence.ts +128 -0
- package/src/hooks/worker-server.ts +119 -26
- package/src/index.ts +6 -0
- package/.next/standalone/.next/server/chunks/src_hooks_0iu54mz._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_ki57._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cg-bgc._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cpu_mj._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u3w0ll._.js +0 -22
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17d_ffl._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__19d9tgz._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1jiwfsj._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1phc187._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_06imw3p._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +0 -10
- package/.next/standalone/.next/static/chunks/0h-gz8e00478q.js +0 -1
- package/.next/standalone/.next/static/chunks/0qmsunv04x4na.css +0 -2
- package/.next/standalone/.next/static/chunks/2k9f4tyv04809.css +0 -1
- package/.next/standalone/.next/static/chunks/2lvr2pt70qn14.js +0 -1
- package/.next/standalone/.next/static/chunks/319c_91le7-h_.js +0 -1
- package/.next/standalone/.next/static/chunks/35m53kix7uaii.js +0 -6
- package/.next/standalone/.next/static/chunks/3xacd7qmuqlvs.js +0 -1
- /package/.next/standalone/.next/static/{LzR_etPlaZV9JZH09lEp3 → T8YAYM9h_64fKv705vug7}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{LzR_etPlaZV9JZH09lEp3 → T8YAYM9h_64fKv705vug7}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{LzR_etPlaZV9JZH09lEp3 → T8YAYM9h_64fKv705vug7}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the semantic (Jev-backed) evaluator.
|
|
3
|
+
*
|
|
4
|
+
* The regex engine answers "does this string match"; this one asks TypeSafe's
|
|
5
|
+
* Jev a set of typed yes/no questions about the tool call and decides from the
|
|
6
|
+
* probabilities. Everything here is plain data so the decision can be replayed
|
|
7
|
+
* offline from a recorded response — see `decide.ts`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Coarse class of a tool, derived deterministically from its canonical name. */
|
|
11
|
+
export type ToolClass = "shell" | "write" | "read" | "network" | "other";
|
|
12
|
+
|
|
13
|
+
/** A single yes/no question sent to Jev (the `noul` primitive). */
|
|
14
|
+
export interface NoulQuestion {
|
|
15
|
+
type: "noul";
|
|
16
|
+
instructions: string;
|
|
17
|
+
criteria?: { true: string; false: string };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface JevRequest {
|
|
21
|
+
model: string;
|
|
22
|
+
state: Record<string, unknown>;
|
|
23
|
+
questions: Record<string, NoulQuestion>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface JevNoulAnswer {
|
|
27
|
+
type?: "noul";
|
|
28
|
+
noul: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface JevResponse {
|
|
32
|
+
model: string;
|
|
33
|
+
answers: Record<string, JevNoulAnswer>;
|
|
34
|
+
usage?: { input_tokens?: number; output_tokens?: number };
|
|
35
|
+
/** Set when the provider did not report which Jev version answered (Cloudflare's unversioned alias). */
|
|
36
|
+
modelUnverified?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A yes/no probe. A policy fires only when every one of its probes holds. */
|
|
40
|
+
export interface Probe {
|
|
41
|
+
id: string;
|
|
42
|
+
instructions: string;
|
|
43
|
+
criteria?: { true: string; false: string };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface SemanticPolicy {
|
|
47
|
+
/** Short slug; registered as `semantic/<name>` in reasons and logs. */
|
|
48
|
+
name: string;
|
|
49
|
+
/** Past-tense, human-readable description of what was caught. */
|
|
50
|
+
title: string;
|
|
51
|
+
/** Tool classes this policy is asked about. Unknown/MCP tools get every policy. */
|
|
52
|
+
appliesTo: ReadonlyArray<ToolClass>;
|
|
53
|
+
/**
|
|
54
|
+
* `deny` policies block when the evidence is strong and instruct when it is
|
|
55
|
+
* moderate; `instruct` policies only ever warn.
|
|
56
|
+
*/
|
|
57
|
+
mode: "deny" | "instruct";
|
|
58
|
+
/**
|
|
59
|
+
* Whether the user's own explicit request may clear this policy. False for
|
|
60
|
+
* the few things a prompt injection most wants to be approved for.
|
|
61
|
+
*/
|
|
62
|
+
userCanOverride: boolean;
|
|
63
|
+
/** Every probe must hold for the policy to fire (conjunction). */
|
|
64
|
+
probes: ReadonlyArray<Probe>;
|
|
65
|
+
/** If this holds, the policy does not fire — the documented exceptions. */
|
|
66
|
+
exempt?: Probe;
|
|
67
|
+
/** Deterministic precondition over the facts; when false nothing is asked. */
|
|
68
|
+
precondition?: (facts: Facts) => boolean;
|
|
69
|
+
/** Shown to the agent when the policy fires. */
|
|
70
|
+
guidance: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface PathFact {
|
|
74
|
+
asWritten: string;
|
|
75
|
+
resolved: string;
|
|
76
|
+
relation: "inside_project" | "project_root" | "outside_project_in_home" | "home_root" | "system" | "root";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Deterministic facts computed locally, so Jev never has to count or resolve. */
|
|
80
|
+
export interface Facts {
|
|
81
|
+
toolName: string;
|
|
82
|
+
toolClass: ToolClass;
|
|
83
|
+
/** False for tools no canonical map recognised — MCP tools, skills, etc. */
|
|
84
|
+
toolIsKnown: boolean;
|
|
85
|
+
cwd: string | null;
|
|
86
|
+
projectRoot: string | null;
|
|
87
|
+
currentGitBranch: string | null;
|
|
88
|
+
paths: PathFact[];
|
|
89
|
+
permissionMode: string | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface SemanticInput {
|
|
93
|
+
eventType: string;
|
|
94
|
+
toolName: string;
|
|
95
|
+
toolInput: Record<string, unknown>;
|
|
96
|
+
cwd?: string;
|
|
97
|
+
permissionMode?: string;
|
|
98
|
+
/** What the human typed recently, oldest first. Trusted channel only. */
|
|
99
|
+
userSaid: string[];
|
|
100
|
+
/**
|
|
101
|
+
* The agent's last visible message before the human's latest one — what a
|
|
102
|
+
* reply like "yes" or "do it" refers to. Agent-written, so it may only ever
|
|
103
|
+
* explain a human reply; it is never consent on its own.
|
|
104
|
+
*/
|
|
105
|
+
agentLastMessage?: string | null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* How "did the human ask for this?" is put to Jev.
|
|
110
|
+
*
|
|
111
|
+
* - `v0`: one `user_asked` question per policy, phrased as the policy's harm,
|
|
112
|
+
* plus a global `scope` question. Measured to clear a policy 6 times in
|
|
113
|
+
* 1,332 cases.
|
|
114
|
+
* - `v1`: three task-level questions asked once per call — is this a step
|
|
115
|
+
* toward the human's task, did they ask for this exact operation, does it
|
|
116
|
+
* reach beyond what they asked — judged only against the human's own words
|
|
117
|
+
* with harness-written text removed.
|
|
118
|
+
*/
|
|
119
|
+
export type IntentMode = "v0" | "v1";
|
|
120
|
+
|
|
121
|
+
export interface PolicyOutcome {
|
|
122
|
+
policy: string;
|
|
123
|
+
mode: "deny" | "instruct";
|
|
124
|
+
/** min over probe probabilities — one weak probe spoils the evidence. */
|
|
125
|
+
evidence: number;
|
|
126
|
+
exempt: number | null;
|
|
127
|
+
userAsked: number | null;
|
|
128
|
+
targetNamedByUser: boolean;
|
|
129
|
+
/** Fired, and the request also addressed the reviewer — so it was blocked outright. */
|
|
130
|
+
escalatedByInjection: boolean;
|
|
131
|
+
verdict: "deny" | "instruct" | "overridden" | "none";
|
|
132
|
+
/** v1 only: why an override applied, or that a deny was softened to instruct. */
|
|
133
|
+
intent?: "op-requested" | "task-step" | "downgraded-task-step";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface SemanticVerdict {
|
|
137
|
+
decision: "allow" | "deny" | "instruct";
|
|
138
|
+
reason: string | null;
|
|
139
|
+
outcomes: PolicyOutcome[];
|
|
140
|
+
injectionSuspected: number | null;
|
|
141
|
+
/** The `scope` answer: does the request stay within what the user asked? null when not asked. */
|
|
142
|
+
scopeWithinRequest: number | null;
|
|
143
|
+
/** v1 only: set when the call was flagged for reaching beyond the human's task. */
|
|
144
|
+
beyondTask?: boolean;
|
|
145
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semver PRECEDENCE — ordering two version strings — for the one question a
|
|
3
|
+
* pack manifest asks: is the CLI about to run this pack at least the version
|
|
4
|
+
* the pack says it needs?
|
|
5
|
+
*
|
|
6
|
+
* ## Why this is written out rather than reused
|
|
7
|
+
*
|
|
8
|
+
* Nothing in this repo orders two versions. `daemonVersionSkew()` compares them
|
|
9
|
+
* for EQUALITY, which is the right test there — the CLI and the daemon ship
|
|
10
|
+
* from one commit, so anything but identical is skew — and it yields no
|
|
11
|
+
* ordering at all. There is no semver dependency either: this module runs on
|
|
12
|
+
* the hook path, and the loader's rule is that nothing there may pull in a
|
|
13
|
+
* package.
|
|
14
|
+
*
|
|
15
|
+
* ## Why the obvious implementation is wrong here
|
|
16
|
+
*
|
|
17
|
+
* Splitting on dots and comparing numbers gets the release triple right and the
|
|
18
|
+
* PRERELEASE exactly backwards. This package's version is `1.0.7-beta.0`, and
|
|
19
|
+
* the beta cut from that line is the first build that understands
|
|
20
|
+
* `minCliVersion` at all — so it is the build a pack's minimum is aimed at. On
|
|
21
|
+
* numbers alone `1.0.7-beta.0` satisfies a minimum of `1.0.7`, which reads the
|
|
22
|
+
* beta as the newer build when it is the older one, and the pack installs on a
|
|
23
|
+
* CLI that may be missing the feature the minimum exists to require.
|
|
24
|
+
*
|
|
25
|
+
* So precedence follows semver §11 for real:
|
|
26
|
+
*
|
|
27
|
+
* 1.0.6 < 1.0.7-beta.0 < 1.0.7-beta.1 < 1.0.7 < 1.0.8
|
|
28
|
+
*
|
|
29
|
+
* - the release triple is compared numerically, field by field;
|
|
30
|
+
* - a version WITH a prerelease is lower than the same triple without one;
|
|
31
|
+
* - prerelease identifiers are compared left to right, numeric ones
|
|
32
|
+
* numerically and always below alphanumeric ones, and a longer identifier
|
|
33
|
+
* list wins when every shared identifier is equal;
|
|
34
|
+
* - build metadata (`+2026.09.24`) is ignored, because it carries no precedence.
|
|
35
|
+
*
|
|
36
|
+
* Anything this cannot order is reported as unorderable rather than guessed at.
|
|
37
|
+
* A caller comparing versions to decide whether to REFUSE something needs to
|
|
38
|
+
* know the difference between "older" and "I cannot tell".
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/** A version decomposed far enough to be ordered. Build metadata is dropped. */
|
|
42
|
+
export interface SemVer {
|
|
43
|
+
major: number;
|
|
44
|
+
minor: number;
|
|
45
|
+
patch: number;
|
|
46
|
+
/** Dot-separated prerelease identifiers, numeric ones as numbers. Empty for a release. */
|
|
47
|
+
prerelease: ReadonlyArray<string | number>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Strict semver, and strict on purpose. `v1.0.0`, `1.0`, `01.2.3` and
|
|
52
|
+
* `1.0.7-beta.0.` are all things people write and none of them has one
|
|
53
|
+
* unambiguous ordering, so they are refused rather than normalised — a
|
|
54
|
+
* `minCliVersion` nobody can order is a requirement nobody can check.
|
|
55
|
+
*/
|
|
56
|
+
const SEMVER_RE =
|
|
57
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
|
|
58
|
+
|
|
59
|
+
const NUMERIC_ID = /^(?:0|[1-9]\d*)$/;
|
|
60
|
+
|
|
61
|
+
/** Decompose a version, or `null` when it is not one this can order. */
|
|
62
|
+
export function parseSemver(value: unknown): SemVer | null {
|
|
63
|
+
if (typeof value !== "string") return null;
|
|
64
|
+
const m = SEMVER_RE.exec(value);
|
|
65
|
+
if (!m) return null;
|
|
66
|
+
return {
|
|
67
|
+
major: Number(m[1]),
|
|
68
|
+
minor: Number(m[2]),
|
|
69
|
+
patch: Number(m[3]),
|
|
70
|
+
prerelease: m[4] === undefined ? [] : m[4].split(".").map((id) => (NUMERIC_ID.test(id) ? Number(id) : id)),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const cmp = (a: number, b: number): number => (a < b ? -1 : a > b ? 1 : 0);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Compare two prerelease identifier lists. An EMPTY list is a release, and a
|
|
78
|
+
* release outranks every prerelease of the same triple — the rule the naive
|
|
79
|
+
* implementation loses, and the one that decides this release's own case.
|
|
80
|
+
*/
|
|
81
|
+
function comparePrerelease(a: ReadonlyArray<string | number>, b: ReadonlyArray<string | number>): number {
|
|
82
|
+
if (a.length === 0 && b.length === 0) return 0;
|
|
83
|
+
if (a.length === 0) return 1;
|
|
84
|
+
if (b.length === 0) return -1;
|
|
85
|
+
for (let i = 0; i < Math.min(a.length, b.length); i++) {
|
|
86
|
+
const x = a[i];
|
|
87
|
+
const y = b[i];
|
|
88
|
+
if (x === y) continue;
|
|
89
|
+
const xNum = typeof x === "number";
|
|
90
|
+
const yNum = typeof y === "number";
|
|
91
|
+
// "Numeric identifiers always have lower precedence than non-numeric
|
|
92
|
+
// ones" (semver §11.4.3): `1.0.0-1` is below `1.0.0-alpha`, so an `rc.1`
|
|
93
|
+
// line and a `1` line never interleave by accident.
|
|
94
|
+
if (xNum !== yNum) return xNum ? -1 : 1;
|
|
95
|
+
if (xNum && yNum) return cmp(x as number, y as number);
|
|
96
|
+
return (x as string) < (y as string) ? -1 : 1;
|
|
97
|
+
}
|
|
98
|
+
// Every shared identifier is equal, so the longer list is the later build:
|
|
99
|
+
// `1.0.0-beta` < `1.0.0-beta.1`.
|
|
100
|
+
return cmp(a.length, b.length);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** `-1`, `0` or `1` by semver precedence. */
|
|
104
|
+
export function compareSemver(a: SemVer, b: SemVer): number {
|
|
105
|
+
return cmp(a.major, b.major) || cmp(a.minor, b.minor) || cmp(a.patch, b.patch) || comparePrerelease(a.prerelease, b.prerelease);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* `-1` / `0` / `1` for two version STRINGS, or `null` when either one cannot be
|
|
110
|
+
* ordered. Null is deliberately not 0: a caller that treats "unorderable" as
|
|
111
|
+
* "equal" silently accepts the requirement it could not check.
|
|
112
|
+
*
|
|
113
|
+
* There is deliberately NO `meetsMinimum(current, minimum): boolean | null` here.
|
|
114
|
+
* It existed, and it collapsed two situations that need opposite treatment into
|
|
115
|
+
* one value: an ABSENT minimum (every pack published before today has none, so it
|
|
116
|
+
* must satisfy) and a MALFORMED one. A call site reading `=== false` would then
|
|
117
|
+
* ignore a typo'd requirement, and one reading `!== true` would refuse every
|
|
118
|
+
* pre-existing pack — and on an `enforce` pack that means denying every tool call
|
|
119
|
+
* the pack covers. Neither mistake shows up until a user hits it, so the decision
|
|
120
|
+
* is encoded once, where the field lives: `checkPackMinCliVersion` in
|
|
121
|
+
* `pack-manifest.ts`.
|
|
122
|
+
*/
|
|
123
|
+
export function compareVersions(a: unknown, b: unknown): number | null {
|
|
124
|
+
const left = parseSemver(a);
|
|
125
|
+
const right = parseSemver(b);
|
|
126
|
+
if (!left || !right) return null;
|
|
127
|
+
return compareSemver(left, right);
|
|
128
|
+
}
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
* evaluations could have request B's `clearPolicies()` wipe request A's
|
|
18
18
|
* in-flight registration. Serializing keeps the existing registry code
|
|
19
19
|
* correct with zero changes; a worker_threads/process pool is a valid
|
|
20
|
-
* future enhancement if this becomes a real throughput bottleneck.
|
|
20
|
+
* future enhancement if this becomes a real throughput bottleneck. The one
|
|
21
|
+
* exception is the network wait of a two-tier (Jev) review, which happens
|
|
22
|
+
* after the registry is no longer read and so does not hold the queue (see
|
|
23
|
+
* `enqueue`).
|
|
21
24
|
*/
|
|
22
25
|
import { createConnection, createServer, type Server, type Socket } from "node:net";
|
|
23
26
|
import { existsSync, unlinkSync } from "node:fs";
|
|
@@ -97,37 +100,115 @@ const TASK_DEADLINE_MS = 60_000;
|
|
|
97
100
|
* worker whose `try_wait()` reports it gone), which costs one cold start and
|
|
98
101
|
* denies the in-flight requests — the same fail-closed outcome they were headed
|
|
99
102
|
* for anyway, but recovered on the next call instead of never.
|
|
103
|
+
*
|
|
104
|
+
* A task may hand its place in the chain back early by calling `release`:
|
|
105
|
+
* the next request starts while the task finishes on its own. Only the
|
|
106
|
+
* two-tier (Jev) path does, at the point it stops reading the registry and
|
|
107
|
+
* starts waiting on Jev's network answer (`EvaluateHookEventOptions.
|
|
108
|
+
* releaseRegistry`). Without that, every hook on the machine — PostToolUse,
|
|
109
|
+
* UserPromptSubmit, other agents' calls — would queue behind each gated call's
|
|
110
|
+
* round trip, and a slow or unreachable provider would push the calls at the
|
|
111
|
+
* back of the queue past the client's 30 s budget into fail-closed denies.
|
|
112
|
+
* A released task no longer holds the registry, so the deadline it was running
|
|
113
|
+
* under — the one that protects the QUEUE — has done its job. It gets a fresh
|
|
114
|
+
* one of its own instead of none: it is still running, its connection's later
|
|
115
|
+
* replies still queue behind it (see `handleConnection`), and a task that has
|
|
116
|
+
* not settled a minute after handing the queue back is wedged on something
|
|
117
|
+
* that is not going to finish. Its Jev wait is bounded by the configured
|
|
118
|
+
* timeout, so nothing on the intended path comes close.
|
|
119
|
+
*
|
|
120
|
+
* Released tasks therefore run concurrently with each other and with the
|
|
121
|
+
* queue: two gated calls can be waiting on Jev at once (T5's throttle shares
|
|
122
|
+
* one cache and token bucket across them, and does not merge identical
|
|
123
|
+
* in-flight requests). Replies on one connection still leave in request order
|
|
124
|
+
* (see `handleConnection`).
|
|
100
125
|
*/
|
|
101
126
|
const WEDGED_EXIT_CODE = 75;
|
|
127
|
+
/**
|
|
128
|
+
* A released task's own deadline, counted from the moment it handed the queue
|
|
129
|
+
* back. Its Jev wait is bounded by the configured timeout (at most 10 s, plus
|
|
130
|
+
* the review's own backstop), so only a task stuck on something else ever
|
|
131
|
+
* reaches this.
|
|
132
|
+
*/
|
|
133
|
+
const RELEASED_TASK_DEADLINE_MS = 60_000;
|
|
134
|
+
|
|
135
|
+
/** What a wedged task costs: this worker, so the supervisor respawns a clean one. */
|
|
136
|
+
function exitWedged(ms: number, released: boolean): void {
|
|
137
|
+
hookLogWarn(
|
|
138
|
+
`worker: a ${released ? "released " : ""}request did not settle within ${ms}ms; ` +
|
|
139
|
+
`exiting so the supervisor can respawn a clean worker`,
|
|
140
|
+
);
|
|
141
|
+
process.exit(WEDGED_EXIT_CODE);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface QueuedTaskOptions {
|
|
145
|
+
taskMs?: number;
|
|
146
|
+
releasedMs?: number;
|
|
147
|
+
onWedged?: (ms: number, released: boolean) => void;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Runs one queued task under a wedge deadline, calling `settle` when the next
|
|
152
|
+
* task may start — because this one finished, or because it handed its place
|
|
153
|
+
* back early with the `release` it is given. A released task keeps running
|
|
154
|
+
* under a deadline of its own (see `RELEASED_TASK_DEADLINE_MS`); dropping the
|
|
155
|
+
* deadline at that point would have made every wedge past the release
|
|
156
|
+
* invisible.
|
|
157
|
+
*
|
|
158
|
+
* Exported for the deadlines' own tests: they are a minute long and expiry
|
|
159
|
+
* exits the process, so a test passes its own values and its own `onWedged`.
|
|
160
|
+
*/
|
|
161
|
+
export function runQueuedTask(task: (release: () => void) => Promise<void>, settle: () => void, opts: QueuedTaskOptions = {}): void {
|
|
162
|
+
const onWedged = opts.onWedged ?? exitWedged;
|
|
163
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
164
|
+
let finished = false;
|
|
165
|
+
let started = false;
|
|
166
|
+
const arm = (ms: number, released: boolean) => {
|
|
167
|
+
clearTimeout(timer);
|
|
168
|
+
timer = setTimeout(() => onWedged(ms, released), ms);
|
|
169
|
+
// Never let the deadline itself hold the event loop open.
|
|
170
|
+
timer.unref?.();
|
|
171
|
+
};
|
|
172
|
+
/** The next task starts once, whether this one released first or just finished. */
|
|
173
|
+
const startNext = () => {
|
|
174
|
+
if (started) return;
|
|
175
|
+
started = true;
|
|
176
|
+
settle();
|
|
177
|
+
};
|
|
178
|
+
const finish = () => {
|
|
179
|
+
finished = true;
|
|
180
|
+
clearTimeout(timer);
|
|
181
|
+
startNext();
|
|
182
|
+
};
|
|
183
|
+
const release = () => {
|
|
184
|
+
if (finished) return;
|
|
185
|
+
arm(opts.releasedMs ?? RELEASED_TASK_DEADLINE_MS, true);
|
|
186
|
+
startNext();
|
|
187
|
+
};
|
|
188
|
+
arm(opts.taskMs ?? TASK_DEADLINE_MS, false);
|
|
189
|
+
void task(release).then(finish, finish);
|
|
190
|
+
}
|
|
102
191
|
|
|
103
192
|
let processingChain: Promise<void> = Promise.resolve();
|
|
104
|
-
function enqueue(task: () => Promise<void>): void {
|
|
105
|
-
processingChain = processingChain
|
|
106
|
-
.then(
|
|
107
|
-
() =>
|
|
108
|
-
new Promise<void>((settle) => {
|
|
109
|
-
const timer = setTimeout(() => {
|
|
110
|
-
hookLogWarn(
|
|
111
|
-
`worker: a request did not settle within ${TASK_DEADLINE_MS}ms; ` +
|
|
112
|
-
`exiting so the supervisor can respawn a clean worker`,
|
|
113
|
-
);
|
|
114
|
-
process.exit(WEDGED_EXIT_CODE);
|
|
115
|
-
}, TASK_DEADLINE_MS);
|
|
116
|
-
// Never let the deadline itself hold the event loop open.
|
|
117
|
-
timer.unref?.();
|
|
118
|
-
const done = () => {
|
|
119
|
-
clearTimeout(timer);
|
|
120
|
-
settle();
|
|
121
|
-
};
|
|
122
|
-
void task().then(done, done);
|
|
123
|
-
}),
|
|
124
|
-
)
|
|
125
|
-
.catch(() => {});
|
|
193
|
+
function enqueue(task: (release: () => void) => Promise<void>): void {
|
|
194
|
+
processingChain = processingChain.then(() => new Promise<void>((settle) => runQueuedTask(task, settle))).catch(() => {});
|
|
126
195
|
}
|
|
127
196
|
|
|
128
197
|
function handleConnection(socket: Socket, shutdown: () => void): void {
|
|
129
198
|
let recvBuf = Buffer.alloc(0);
|
|
130
199
|
let declaredLen: number | null = null;
|
|
200
|
+
/**
|
|
201
|
+
* Hook replies leave in the order their requests arrived on this
|
|
202
|
+
* connection. The wire carries no request id, so a client that pipelines
|
|
203
|
+
* several requests on one connection can match replies only by order — which
|
|
204
|
+
* the strictly serialized queue used to guarantee by itself. A two-tier task
|
|
205
|
+
* that releases the queue early (see `enqueue`) can finish after a request
|
|
206
|
+
* that arrived behind it, so each reply waits for every earlier one on its
|
|
207
|
+
* connection. The Rust supervisor opens one connection per request, so today
|
|
208
|
+
* this never delays anything; it keeps the ordering true for any client that
|
|
209
|
+
* does pipeline.
|
|
210
|
+
*/
|
|
211
|
+
let replies: Promise<void> = Promise.resolve();
|
|
131
212
|
|
|
132
213
|
socket.on("data", (chunk: Buffer) => {
|
|
133
214
|
recvBuf = Buffer.concat([recvBuf, chunk]);
|
|
@@ -178,15 +259,27 @@ function handleConnection(socket: Socket, shutdown: () => void): void {
|
|
|
178
259
|
}
|
|
179
260
|
const request = message;
|
|
180
261
|
|
|
181
|
-
|
|
262
|
+
let deliver!: (frame: Buffer) => void;
|
|
263
|
+
const reply = new Promise<Buffer>((resolveReply) => {
|
|
264
|
+
deliver = resolveReply;
|
|
265
|
+
});
|
|
266
|
+
replies = replies
|
|
267
|
+
.then(() => reply)
|
|
268
|
+
.then((frame) => {
|
|
269
|
+
socket.write(frame);
|
|
270
|
+
})
|
|
271
|
+
.catch(() => {});
|
|
272
|
+
|
|
273
|
+
enqueue(async (release) => {
|
|
182
274
|
try {
|
|
183
275
|
const result = await evaluateHookEvent(request.hookEvent, request.cli, request.stdin, {
|
|
184
276
|
awaitTelemetryFlush: false,
|
|
185
277
|
// Normalised here so no consumer has to know the wire spells
|
|
186
278
|
// "absent" as null.
|
|
187
279
|
fallbackCwd: request.cwd ?? undefined,
|
|
280
|
+
releaseRegistry: release,
|
|
188
281
|
});
|
|
189
|
-
|
|
282
|
+
deliver(
|
|
190
283
|
encodeFrame({
|
|
191
284
|
type: "hookResult",
|
|
192
285
|
exitCode: result.exitCode,
|
|
@@ -198,7 +291,7 @@ function handleConnection(socket: Socket, shutdown: () => void): void {
|
|
|
198
291
|
} catch (err) {
|
|
199
292
|
const msg = err instanceof Error ? err.message : String(err);
|
|
200
293
|
hookLogWarn(`worker: evaluateHookEvent threw: ${msg}`);
|
|
201
|
-
|
|
294
|
+
deliver(encodeFrame({ type: "error", message: msg }));
|
|
202
295
|
}
|
|
203
296
|
});
|
|
204
297
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export {
|
|
8
8
|
customPolicies,
|
|
9
|
+
semanticPolicies,
|
|
9
10
|
getCustomHooks,
|
|
11
|
+
getSemanticRegistrations,
|
|
10
12
|
clearCustomHooks,
|
|
11
13
|
} from "./hooks/custom-hooks-registry";
|
|
12
14
|
export { allow, deny, instruct } from "./hooks/policy-helpers";
|
|
@@ -16,4 +18,8 @@ export type {
|
|
|
16
18
|
CustomHook,
|
|
17
19
|
PolicyDecision,
|
|
18
20
|
PolicyFunction,
|
|
21
|
+
PolicyAuthority,
|
|
22
|
+
SemanticPolicyDeclaration,
|
|
23
|
+
SemanticProbeDeclaration,
|
|
24
|
+
SemanticToolClass,
|
|
19
25
|
} from "./hooks/policy-types";
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[52306,e=>{"use strict";var t=e.i(66680),r=e.i(2157),o=e.i(50227),s=e.i(79857);let i=[1],a=/^[a-f0-9]{64}$/,n=/^[A-Za-z0-9._-]{1,64}\/[A-Za-z0-9._-]{1,64}$/,l=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/,_=/^[0-9a-f]{7,40}$/,p=/^[A-Za-z0-9._-]{1,128}$/;function c(e){return e instanceof Error?e.message:String(e)}e.s(["readInstalledPacks",0,function(){let e,d=process.env.FAILPROOFAI_PACK_DIR?(0,o.resolve)(process.env.FAILPROOFAI_PACK_DIR,"installed.json"):(0,s.packsInstalledFile)();if(!(0,r.existsSync)(d))return{packs:[],errors:[]};try{e=JSON.parse((0,r.readFileSync)(d,"utf8"))}catch(e){return{packs:[],errors:[{id:null,reason:`unreadable pack manifest: ${c(e)}`}]}}if(!e||"object"!=typeof e)return{packs:[],errors:[{id:null,reason:"pack manifest is not an object"}]};let f=e;if(!i.includes(f.schemaVersion))return{packs:[],errors:[{id:null,reason:`unsupported pack manifest schema ${String(f.schemaVersion)} (supported: ${i.join(", ")})`}]};if(!Array.isArray(f.packs))return{packs:[],errors:[{id:null,reason:"pack manifest packs is not an array"}]};let h=process.env.FAILPROOFAI_PACK_DIR??(0,s.packsDir)(),O=[],E=[],S=new Set;for(let e of f.packs){let s=e&&"object"==typeof e&&"string"==typeof e.id?e.id:null;try{let s=function(e,s){if(!s||"object"!=typeof s)throw Error("pack entry is not an object");let i=function(e){if("string"!=typeof e.id||!n.test(e.id))throw Error(`unsafe pack id ${JSON.stringify(e.id)}`);if("string"!=typeof e.version||!l.test(e.version))throw Error(`invalid version for pack ${e.id}`);if(void 0!==e.effect&&"enforce"!==e.effect&&"observe"!==e.effect)throw Error(`unknown effect ${JSON.stringify(e.effect)} for pack ${e.id}`);let t="string"==typeof e.commit&&_.test(e.commit.trim().toLowerCase())?e.commit.trim().toLowerCase():void 0;return{id:e.id,version:e.version,effect:e.effect??"enforce",...t?{commit:t}:{}}}(s);if("string"!=typeof s.source||0===s.source.length)throw Error(`pack ${s.id} has no source`);if("string"!=typeof s.sha256||!a.test(s.sha256))throw Error(`invalid SHA-256 for pack ${s.id}`);let c=i.effect,d=function(e,t){if(!t||(0,o.isAbsolute)(t))throw Error(`unsafe managed policy path ${JSON.stringify(t)}`);let s=(0,o.resolve)(e,t),i=(0,o.relative)(e,s);if(i.startsWith("..")||(0,o.isAbsolute)(i))throw Error(`managed policy path escapes its root: ${JSON.stringify(t)}`);let a=(0,r.realpathSync)(e),n=(0,r.realpathSync)(s),l=(0,o.relative)(a,n);if(l.startsWith("..")||(0,o.isAbsolute)(l))throw Error(`managed policy symlink escapes its root: ${JSON.stringify(t)}`);return n}(e,s.entry),f=(0,t.createHash)("sha256").update((0,r.readFileSync)(d)).digest("hex");if(f!==s.sha256)throw Error(`pack ${s.id} failed integrity verification: expected ${s.sha256}, got ${f}`);if(!Array.isArray(s.policies))throw Error(`pack ${s.id} policies is not an array`);let h=s.policies.map((e,t)=>(function(e,t,r){let o=`${e} policy #${r}`;if(!t||"object"!=typeof t)throw Error(`${o} is not an object`);let s=t.name;if("string"!=typeof s||!p.test(s))throw Error(`${o} has an unsafe name ${JSON.stringify(s)}`);if("alwaysOn"in t)throw Error(`${o} declares alwaysOn, which packs may not set`);if("string"!=typeof t.description||0===t.description.length)throw Error(`${o} is missing a description`);if("string"!=typeof t.category||0===t.category.length)throw Error(`${o} is missing a category`);if("boolean"!=typeof t.defaultEnabled)throw Error(`${o} is missing defaultEnabled`);if(!t.match||"object"!=typeof t.match)throw Error(`${o} is missing a match`);let i=t.match;for(let e of["events","toolNames"]){let t=i[e];if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e||0===e.length)))throw Error(`${o} has a match.${e} that is not a list of names`)}return t})(s.id,e,t)),O=new Set;for(let e of h){if(O.has(e.name))throw Error(`pack ${s.id} declares ${e.name} twice`);O.add(e.name)}let E=null;if(void 0!==s.enabled){if(!Array.isArray(s.enabled)||s.enabled.some(e=>"string"!=typeof e))throw Error(`pack ${s.id} enabled is not an array of names`);E=s.enabled.filter(e=>O.has(e))}let S=null;if(void 0!==s.clis){if(!Array.isArray(s.clis)||s.clis.some(e=>"string"!=typeof e))throw Error(`pack ${s.id} clis is not an array of agent names`);S=s.clis}return{clis:S,id:i.id,version:i.version,source:s.source,path:d,sha256:s.sha256,effect:c,policies:h,enabled:E}}(h,e);if(S.has(s.id))throw Error(`duplicate pack id ${s.id}`);S.add(s.id),O.push(s)}catch(r){let t=e&&("observe"===e.effect||"enforce"===e.effect)?e.effect:"enforce";E.push({id:s,reason:c(r),effect:t,...Array.isArray(e?.policies)?{declared:function(e){let t=[];for(let r of e)r&&"object"==typeof r&&"string"==typeof r.name&&r.match&&"object"==typeof r.match&&t.push(r);return t}(e.policies)}:{},...Array.isArray(e?.clis)&&e.clis.every(e=>"string"==typeof e)?{clis:e.clis}:{}})}}return{packs:O,errors:E}}],52306)},71194,e=>{"use strict";e.i(66680),e.i(2157),e.i(50227),e.i(52306),e.s(["CORE_SOURCE",0,"FailproofAI/policies","PACK_CHECKSUMS_ASSET",0,"SHA256SUMS","PACK_ENTRY_ASSET",0,"failproofai-pack.mjs","PACK_MANIFEST_ASSET",0,"failproofai-pack.json"])},38441,e=>{"use strict";let t=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PermissionRequest","PermissionDenied","PostToolUse","PostToolUseFailure","Notification","SubagentStart","SubagentStop","TaskCreated","TaskCompleted","Stop","StopFailure","TeammateIdle","InstructionsLoaded","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","PreCompact","PostCompact","Elicitation","ElicitationResult","UserPromptExpansion","PostToolBatch","Setup"].filter(e=>"WorktreeCreate"!==e);e.s(["ANTIGRAVITY_HOOK_EVENT_TYPES",0,["PreToolUse","PostToolUse","PreInvocation","Stop"],"ANTIGRAVITY_HOOK_SCOPES",0,["user","project"],"ANTIGRAVITY_TOOL_INPUT_MAP",0,{Bash:{CommandLine:"command",Cwd:"cwd"},Write:{TargetFile:"file_path",CodeContent:"content"},Edit:{TargetFile:"file_path"},Read:{TargetFile:"file_path",AbsolutePath:"file_path",File:"file_path"}},"ANTIGRAVITY_TOOL_MAP",0,{run_command:"Bash",write_to_file:"Write",read_file:"Read",view_file:"Read",edit_file:"Edit",replace_file_content:"Edit",list_dir:"LS",find_by_name:"Glob",grep_search:"Grep",read_url_content:"WebFetch",search_web:"WebSearch"},"CLAUDE_INSTALL_EVENT_TYPES",0,t,"CODEX_EVENT_MAP",0,{session_start:"SessionStart",pre_tool_use:"PreToolUse",permission_request:"PermissionRequest",post_tool_use:"PostToolUse",user_prompt_submit:"UserPromptSubmit",stop:"Stop",subagent_start:"SubagentStart",pre_compact:"PreCompact",post_compact:"PostCompact",subagent_stop:"SubagentStop"},"CODEX_HOOK_EVENT_TYPES",0,["session_start","pre_tool_use","permission_request","post_tool_use","user_prompt_submit","stop","subagent_start","pre_compact","post_compact","subagent_stop"],"CODEX_HOOK_SCOPES",0,["user","project"],"CODEX_TOOL_MAP",0,{apply_patch:"Edit",write_stdin:"Bash"},"COPILOT_HOOK_EVENT_TYPES",0,["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PostToolUse","Stop","SubagentStop","PostToolUseFailure","ErrorOccurred","PreCompact","PermissionRequest","Notification"],"COPILOT_HOOK_SCOPES",0,["user","project"],"COPILOT_TOOL_INPUT_MAP",0,{Read:{path:"file_path"},Write:{path:"file_path",file_text:"content"},Edit:{path:"file_path",old_str:"old_string",new_str:"new_string"}},"COPILOT_TOOL_MAP",0,{bash:"Bash",powershell:"Bash",list_bash:"Bash",read_bash:"Bash",stop_bash:"Bash",write_bash:"Bash",list_powershell:"Bash",read_powershell:"Bash",stop_powershell:"Bash",write_powershell:"Bash",read:"Read",view:"Read",show_file:"Read",write:"Write",create:"Write",edit:"Edit",apply_patch:"Edit",str_replace_editor:"Edit",glob:"Glob",grep:"Grep",rg:"Grep",ls:"LS",web_fetch:"WebFetch"},"CURSOR_HOOK_EVENT_TYPES",0,["sessionStart","sessionEnd","beforeSubmitPrompt","preToolUse","postToolUse","stop","subagentStop"],"CURSOR_HOOK_SCOPES",0,["user","project"],"CURSOR_TOOL_MAP",0,{Shell:"Bash"},"DEVIN_HOOK_EVENT_TYPES",0,["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","PermissionRequest","Stop","SessionEnd"],"DEVIN_HOOK_SCOPES",0,["user","project"],"DEVIN_TOOL_MAP",0,{exec:"Bash"},"FACTORY_HOOK_EVENT_TYPES",0,["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","Notification","Stop","SubagentStop","PreCompact","SessionEnd"],"FACTORY_HOOK_SCOPES",0,["user","project"],"FACTORY_TOOL_MAP",0,{Execute:"Bash",Read:"Read",Edit:"Edit",Create:"Write",Grep:"Grep",Glob:"Glob",LS:"LS",FetchUrl:"WebFetch",WebSearch:"WebSearch",TodoWrite:"TodoWrite",Task:"Task"},"FAILPROOFAI_HOOK_MARKER",0,"__failproofai_hook__","GOOSE_HOOK_EVENT_TYPES",0,["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","SessionEnd"],"GOOSE_HOOK_SCOPES",0,["user","project"],"GOOSE_TOOL_INPUT_MAP",0,{Read:{path:"file_path",source:"file_path"},Write:{path:"file_path"},Edit:{path:"file_path"},LS:{path:"file_path"}},"GOOSE_TOOL_MAP",0,{shell:"Bash",write:"Write",edit:"Edit",view:"Read",read_image:"Read",glob:"Glob",grep:"Grep",tree:"LS",delegate:"Task",todo__todo_write:"TodoWrite"},"HERMES_HOOK_EVENT_TYPES",0,["pre_tool_call","post_tool_call","on_session_start","on_session_end","subagent_stop"],"HERMES_HOOK_SCOPES",0,["user"],"HERMES_TOOL_INPUT_MAP",0,{Read:{path:"file_path"},Write:{path:"file_path"},Edit:{path:"file_path"}},"HERMES_TOOL_MAP",0,{terminal:"Bash",bash:"Bash",read_file:"Read",write_file:"Write",patch:"Edit",web_search:"WebSearch",web_extract:"WebFetch",search_files:"Grep",todo:"TodoWrite"},"HOOK_SCOPES",0,["user","project","local"],"INTEGRATION_TYPES",0,["claude","codex","copilot","cursor","opencode","pi","hermes","openclaw","factory","devin","antigravity","goose"],"OPENCLAW_HOOK_EVENT_TYPES",0,["before_tool_call","after_tool_call","before_agent_run","before_agent_finalize","session_start","session_end","subagent_ended","before_compaction"],"OPENCLAW_HOOK_SCOPES",0,["user"],"OPENCLAW_TOOL_INPUT_MAP",0,{Read:{path:"file_path"},Write:{path:"file_path"},Edit:{path:"file_path"}},"OPENCLAW_TOOL_MAP",0,{exec:"Bash",read:"Read",write:"Write",edit:"Edit",grep:"Grep",glob:"Glob",web_search:"WebSearch",web_fetch:"WebFetch"},"OPENCODE_HOOK_EVENT_TYPES",0,["tool.execute.before","tool.execute.after","session.created","session.deleted","session.idle","message.updated","permission.ask"],"OPENCODE_HOOK_SCOPES",0,["user","project"],"OPENCODE_TOOL_INPUT_MAP",0,{Read:{filePath:"file_path"},Write:{filePath:"file_path"},Edit:{filePath:"file_path",oldString:"old_string",newString:"new_string",replaceAll:"replace_all"}},"OPENCODE_TOOL_MAP",0,{bash:"Bash",read:"Read",write:"Write",edit:"Edit",apply_patch:"Edit",glob:"Glob",grep:"Grep",list:"LS",webfetch:"WebFetch",websearch:"WebSearch",todowrite:"TodoWrite",todoread:"TodoRead"},"PI_HOOK_EVENT_TYPES",0,["session_start","session_shutdown","input","tool_call","user_bash","tool_result","agent_end"],"PI_HOOK_SCOPES",0,["user","project"],"PI_TOOL_INPUT_MAP",0,{Read:{path:"file_path"},Write:{path:"file_path"},Edit:{path:"file_path"}},"PI_TOOL_MAP",0,{bash:"Bash",read:"Read",write:"Write",edit:"Edit",glob:"Glob",grep:"Grep"}])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=src_hooks_0iu54mz._.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},20213,a=>{"use strict";var b=a.i(36359),c=a.i(36119),d=a.i(37936),e=a.i(21572),f=a.i(81243);async function g(a){if(a&&!await (0,f.whoAmI)()){let a=(0,f.readAuth)();return{ok:!1,reason:a&&1e3*a.refresh_expires_at>Date.now()?"unreachable":"signed-out"}}return{ok:!0,auto:(0,e.updateConfig)({audit:a?{auto:!0,reportsConsentedAt:Date.now()}:{auto:!1}}).audit.auto}}async function h(a){return(0,e.updateConfig)({audit:{intervalDays:a}}),{intervalDays:(0,e.readConfig)().audit.intervalDays}}(0,a.i(13095).ensureServerEntryExports)([g,h]),(0,d.registerServerReference)(g,"40a46a4bfb367205e6de934f38e1e919c3b69ed937",null),(0,d.registerServerReference)(h,"40168692117f80ed35533b6f510d0a483a609cbf47",null),a.s([],14097),a.i(14097),a.s(["002a551863b51d42ffe781e9841b676b82fa895b9b",()=>b.getTelemetryConfig,"00307e102c6f6e4cfdd9201975d1f4ef94ea86924c",()=>c.getScheduledAuditAction,"40168692117f80ed35533b6f510d0a483a609cbf47",0,h,"40a46a4bfb367205e6de934f38e1e919c3b69ed937",0,g],20213)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"002a551863b51d42ffe781e9841b676b82fa895b9b",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},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}.
|
|
2
|
-
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}})},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.6",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","hermes-plugin/","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","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],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.125.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.5.1","@types/react":"19.3.0","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^5.0.0"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.4",browserslist:"4.28.8"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.6","@failproofai/failproofaid-linux-arm64":"1.0.6","@failproofai/failproofaid-darwin-x64":"1.0.6","@failproofai/failproofaid-darwin-arm64":"1.0.6"},failproofaidBinaries:{"linux-x64":"e075f24a3a0950b631979d9370b665da2c3e2920decfb917ff0831d1f17c9740","linux-arm64":"b90ce8c642f2685719f4915695615219860daf3155a9c07344cf1e10395028c3","darwin-x64":"51dd95e9b85226e4f1888c7edaa56ec4464e91eb645d39c5cb7cede16d2da2f1","darwin-arm64":"f6a1b9d63363e8805e0d72b4fa168fde661bdbbd4125b54047f7de8948ea0f39"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0-_ki57._.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},165,a=>{"use strict";var b=a.i(36359);a.s([],84833),a.i(84833),a.s(["002a551863b51d42ffe781e9841b676b82fa895b9b",()=>b.getTelemetryConfig],165)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"002a551863b51d42ffe781e9841b676b82fa895b9b",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},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}.
|
|
2
|
-
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}})},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)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0vmspq5._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js"].map(b=>a.l(b))).then(()=>b(74493)))},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.6",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","hermes-plugin/","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","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],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.125.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.5.1","@types/react":"19.3.0","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^5.0.0"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.4",browserslist:"4.28.8"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.6","@failproofai/failproofaid-linux-arm64":"1.0.6","@failproofai/failproofaid-darwin-x64":"1.0.6","@failproofai/failproofaid-darwin-arm64":"1.0.6"},failproofaidBinaries:{"linux-x64":"e075f24a3a0950b631979d9370b665da2c3e2920decfb917ff0831d1f17c9740","linux-arm64":"b90ce8c642f2685719f4915695615219860daf3155a9c07344cf1e10395028c3","darwin-x64":"51dd95e9b85226e4f1888c7edaa56ec4464e91eb645d39c5cb7cede16d2da2f1","darwin-arm64":"f6a1b9d63363e8805e0d72b4fa168fde661bdbbd4125b54047f7de8948ea0f39"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__013jr2b._.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},7292,1144,a=>{"use strict";var b=a.i(37936),c=a.i(2157),d=a.i(50227),e=a.i(75818);let f="current.jsonl",g=()=>(0,e.hookActivityDir)();function h(){(0,c.existsSync)(g())||(0,c.mkdirSync)(g(),{recursive:!0})}function i(){let a=function(){try{return JSON.parse((0,c.readFileSync)((0,d.join)(g(),"stats.json"),"utf-8"))}catch{return{totalEvents:0,denyCount:0,policyMap:{}}}}(),b=null,e=0;for(let[c,d]of Object.entries(a.policyMap))d>e&&(b=c,e=d);return{totalEvents:a.totalEvents,denyCount:a.denyCount,topPolicy:b,topPolicyCount:e}}function j(a,b){let c=(function(){h();let a=l((0,d.join)(g(),f)).reverse(),b=m(),c=[];for(let a of b){let b=l((0,d.join)(g(),a));c.push(...b.reverse())}return[...a,...c]})().filter(b=>(!a.decision||b.decision===a.decision)&&(!a.eventType||b.eventType===a.eventType)&&(!a.policyName||!!b.policyName&&!!b.policyName.toLowerCase().includes(a.policyName.toLowerCase()))&&(!a.sessionId||!!b.sessionId&&!!b.sessionId.toLowerCase().includes(a.sessionId.toLowerCase()))&&(!a.integration||b.integration===a.integration)&&(!a.source||b.policySource===a.source)&&!0),e=Math.max(1,Math.ceil(c.length/25)),j=(b-1)*25;return{entries:c.slice(j,j+25),totalPages:e,page:b,stats:i()}}function k(a){let b=function(a){if(h(),a<1)return[];if(1===a)return l((0,d.join)(g(),f)).reverse();let b=m(),c=a-2;return c>=b.length?[]:l((0,d.join)(g(),b[c])).reverse()}(a);return{entries:b,totalPages:(h(),1+m().length),page:a,stats:i()}}function l(a){let b=function(a){try{return(0,c.readFileSync)(a,"utf-8")}catch{return""}}(a);if(!b.trim())return[];let d=[];for(let a of b.trim().split("\n"))try{var e;d.push((e=JSON.parse(a),void 0===e.cloudVersion&&"number"==typeof e.cloudRevision&&(e.cloudVersion=e.cloudRevision),void 0===e.cloudDeployment&&"number"==typeof e.cloudGeneration&&(e.cloudDeployment=e.cloudGeneration),e))}catch{}return d}function m(){try{return(0,c.readdirSync)(g()).filter(a=>a.startsWith("page-")&&a.endsWith(".jsonl")).sort((a,b)=>{let c=a.slice(5,-6).split("-"),d=b.slice(5,-6).split("-"),e=parseInt(c[0],10),f=parseInt(d[0],10);if(e!==f)return f-e;let g=c.length>1?parseInt(c[1],10):0;return(d.length>1?parseInt(d[1],10):0)-g})}catch{return[]}}async function n(a){return k(a)}async function o(a,b){return j(a,b)}a.s(["getHookActivityHistory",0,k,"searchHookActivity",0,j],1144),(0,a.i(13095).ensureServerEntryExports)([n,o]),(0,b.registerServerReference)(n,"405d01984e38d9024cc663e19a61a035216c7283cb",null),(0,b.registerServerReference)(o,"607d04cf3dfa7aa40bb77f7c023c14a6ef615e1ad5",null),a.s(["getHookActivityAction",0,n,"searchHookActivityAction",0,o],7292)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"002a551863b51d42ffe781e9841b676b82fa895b9b",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},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}.
|
|
2
|
-
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}})},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.6",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","hermes-plugin/","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","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],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.125.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.5.1","@types/react":"19.3.0","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^5.0.0"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.4",browserslist:"4.28.8"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.6","@failproofai/failproofaid-linux-arm64":"1.0.6","@failproofai/failproofaid-darwin-x64":"1.0.6","@failproofai/failproofaid-darwin-arm64":"1.0.6"},failproofaidBinaries:{"linux-x64":"e075f24a3a0950b631979d9370b665da2c3e2920decfb917ff0831d1f17c9740","linux-arm64":"b90ce8c642f2685719f4915695615219860daf3155a9c07344cf1e10395028c3","darwin-x64":"51dd95e9b85226e4f1888c7edaa56ec4464e91eb645d39c5cb7cede16d2da2f1","darwin-arm64":"f6a1b9d63363e8805e0d72b4fa168fde661bdbbd4125b54047f7de8948ea0f39"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__01wy8d-._.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},37985,a=>{"use strict";var b=a.i(36359);a.s([],80194),a.i(80194),a.s(["002a551863b51d42ffe781e9841b676b82fa895b9b",()=>b.getTelemetryConfig],37985)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"002a551863b51d42ffe781e9841b676b82fa895b9b",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},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}.
|
|
2
|
-
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}})},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)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0vmspq5._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js"].map(b=>a.l(b))).then(()=>b(74493)))},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.6",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","hermes-plugin/","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","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],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.125.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.5.1","@types/react":"19.3.0","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^5.0.0"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.4",browserslist:"4.28.8"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.6","@failproofai/failproofaid-linux-arm64":"1.0.6","@failproofai/failproofaid-darwin-x64":"1.0.6","@failproofai/failproofaid-darwin-arm64":"1.0.6"},failproofaidBinaries:{"linux-x64":"e075f24a3a0950b631979d9370b665da2c3e2920decfb917ff0831d1f17c9740","linux-arm64":"b90ce8c642f2685719f4915695615219860daf3155a9c07344cf1e10395028c3","darwin-x64":"51dd95e9b85226e4f1888c7edaa56ec4464e91eb645d39c5cb7cede16d2da2f1","darwin-arm64":"f6a1b9d63363e8805e0d72b4fa168fde661bdbbd4125b54047f7de8948ea0f39"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__02npjtd._.js.map
|