failproofai 0.0.6-beta.2 → 0.0.6-beta.4
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 +3 -3
- package/.next/standalone/.next/required-server-files.json +7 -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.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/server-reference-manifest.json +1 -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 +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +17 -17
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +17 -17
- 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 +11 -11
- 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/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +11 -11
- 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.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 +8 -8
- 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.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.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.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0i5kvry._.js → [root-of-the-server]__0om-5pe._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__05akje6._.js → [root-of-the-server]__111.vxi._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +2 -2
- 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 +9 -9
- package/.next/standalone/.next/static/chunks/{05j1px0r8yzh6.js → 02dqjyv6_9mhq.js} +2 -2
- package/.next/standalone/.next/static/chunks/{14cl9poem30dq.js → 070orfsl6.xal.js} +1 -1
- package/.next/standalone/.next/static/chunks/0mir9jdxn35~s.css +1 -0
- package/.next/standalone/.next/static/chunks/{00j0rr7rh8ef8.js → 0o547jv-k_k35.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ijk_kek9_wyx.js → 0pk2h2.mjxy.m.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0xpl.oscrakvx.js → 0rcwkbh24w38b.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1052sguyd-.ka.js → 140xx_tfr~lm_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0npb~873.wvg3.js → 169_e4dq~1~b6.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0badv41uxa56..js → 17ne4p.1sw1jy.js} +1 -1
- package/.next/standalone/next.config.ts +6 -0
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +91 -4
- package/dist/cli.mjs +1155 -54
- package/package.json +2 -2
- package/scripts/prune-standalone.mjs +128 -0
- package/src/auth/login.ts +104 -0
- package/src/auth/logout.ts +50 -0
- package/src/auth/token-store.ts +64 -0
- package/src/hooks/builtin-policies.ts +22 -20
- package/src/hooks/handler.ts +35 -15
- package/src/relay/daemon.ts +362 -0
- package/src/relay/pid.ts +76 -0
- package/src/relay/queue.ts +225 -0
- package/.next/standalone/.claude/settings.json +0 -316
- package/.next/standalone/.failproofai/policies/review-policies.mjs +0 -113
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +0 -63
- package/.next/standalone/.failproofai/policies-config.json +0 -39
- package/.next/standalone/.next/static/chunks/0gu_a.a80ritd.css +0 -1
- package/.next/standalone/AGENTS.md +0 -80
- package/.next/standalone/CHANGELOG.md +0 -151
- package/.next/standalone/CLAUDE.md +0 -165
- package/.next/standalone/CONTRIBUTING.md +0 -76
- package/.next/standalone/Dockerfile.docs +0 -12
- package/.next/standalone/LICENSE +0 -42
- package/.next/standalone/README.md +0 -301
- package/.next/standalone/bin/failproofai.mjs +0 -352
- package/.next/standalone/bun.lock +0 -1119
- package/.next/standalone/components.json +0 -23
- package/.next/standalone/dist/cli.mjs +0 -3595
- package/.next/standalone/dist/index.js +0 -80
- package/.next/standalone/docs/ar/architecture.mdx +0 -334
- package/.next/standalone/docs/ar/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/ar/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ar/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ar/cli/hook.mdx +0 -31
- package/.next/standalone/docs/ar/cli/install-policies.mdx +0 -48
- package/.next/standalone/docs/ar/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/ar/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ar/cli/version.mdx +0 -13
- package/.next/standalone/docs/ar/configuration.mdx +0 -223
- package/.next/standalone/docs/ar/custom-policies.mdx +0 -354
- package/.next/standalone/docs/ar/dashboard.mdx +0 -142
- package/.next/standalone/docs/ar/examples.mdx +0 -307
- package/.next/standalone/docs/ar/for-agents.mdx +0 -39
- package/.next/standalone/docs/ar/getting-started.mdx +0 -187
- package/.next/standalone/docs/ar/introduction.mdx +0 -58
- package/.next/standalone/docs/ar/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ar/testing.mdx +0 -261
- package/.next/standalone/docs/architecture.mdx +0 -332
- package/.next/standalone/docs/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/cli/hook.mdx +0 -30
- package/.next/standalone/docs/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/cli/version.mdx +0 -12
- package/.next/standalone/docs/configuration.mdx +0 -222
- package/.next/standalone/docs/custom-policies.mdx +0 -353
- package/.next/standalone/docs/dashboard.mdx +0 -142
- package/.next/standalone/docs/de/architecture.mdx +0 -332
- package/.next/standalone/docs/de/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/de/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/de/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/de/cli/hook.mdx +0 -30
- package/.next/standalone/docs/de/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/de/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/de/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/de/cli/version.mdx +0 -12
- package/.next/standalone/docs/de/configuration.mdx +0 -222
- package/.next/standalone/docs/de/custom-policies.mdx +0 -353
- package/.next/standalone/docs/de/dashboard.mdx +0 -142
- package/.next/standalone/docs/de/examples.mdx +0 -307
- package/.next/standalone/docs/de/for-agents.mdx +0 -38
- package/.next/standalone/docs/de/getting-started.mdx +0 -186
- package/.next/standalone/docs/de/introduction.mdx +0 -57
- package/.next/standalone/docs/de/package-aliases.mdx +0 -82
- package/.next/standalone/docs/de/testing.mdx +0 -260
- package/.next/standalone/docs/docs.json +0 -1002
- package/.next/standalone/docs/es/architecture.mdx +0 -332
- package/.next/standalone/docs/es/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/es/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/es/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/es/cli/hook.mdx +0 -30
- package/.next/standalone/docs/es/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/es/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/es/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/es/cli/version.mdx +0 -12
- package/.next/standalone/docs/es/configuration.mdx +0 -222
- package/.next/standalone/docs/es/custom-policies.mdx +0 -353
- package/.next/standalone/docs/es/dashboard.mdx +0 -142
- package/.next/standalone/docs/es/examples.mdx +0 -307
- package/.next/standalone/docs/es/for-agents.mdx +0 -38
- package/.next/standalone/docs/es/getting-started.mdx +0 -186
- package/.next/standalone/docs/es/introduction.mdx +0 -57
- package/.next/standalone/docs/es/package-aliases.mdx +0 -82
- package/.next/standalone/docs/es/testing.mdx +0 -260
- package/.next/standalone/docs/examples.mdx +0 -307
- package/.next/standalone/docs/favicon.ico +0 -0
- package/.next/standalone/docs/for-agents.mdx +0 -38
- package/.next/standalone/docs/fr/architecture.mdx +0 -332
- package/.next/standalone/docs/fr/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/fr/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/fr/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/fr/cli/hook.mdx +0 -30
- package/.next/standalone/docs/fr/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/fr/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/fr/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/fr/cli/version.mdx +0 -12
- package/.next/standalone/docs/fr/configuration.mdx +0 -222
- package/.next/standalone/docs/fr/custom-policies.mdx +0 -353
- package/.next/standalone/docs/fr/dashboard.mdx +0 -142
- package/.next/standalone/docs/fr/examples.mdx +0 -307
- package/.next/standalone/docs/fr/for-agents.mdx +0 -38
- package/.next/standalone/docs/fr/getting-started.mdx +0 -186
- package/.next/standalone/docs/fr/introduction.mdx +0 -57
- package/.next/standalone/docs/fr/package-aliases.mdx +0 -82
- package/.next/standalone/docs/fr/testing.mdx +0 -260
- package/.next/standalone/docs/getting-started.mdx +0 -186
- package/.next/standalone/docs/he/architecture.mdx +0 -333
- package/.next/standalone/docs/he/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/he/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/he/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/he/cli/hook.mdx +0 -30
- package/.next/standalone/docs/he/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/he/cli/list-policies.mdx +0 -32
- package/.next/standalone/docs/he/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/he/cli/version.mdx +0 -12
- package/.next/standalone/docs/he/configuration.mdx +0 -223
- package/.next/standalone/docs/he/custom-policies.mdx +0 -353
- package/.next/standalone/docs/he/dashboard.mdx +0 -142
- package/.next/standalone/docs/he/examples.mdx +0 -307
- package/.next/standalone/docs/he/for-agents.mdx +0 -38
- package/.next/standalone/docs/he/getting-started.mdx +0 -186
- package/.next/standalone/docs/he/introduction.mdx +0 -57
- package/.next/standalone/docs/he/package-aliases.mdx +0 -82
- package/.next/standalone/docs/he/testing.mdx +0 -260
- package/.next/standalone/docs/hi/architecture.mdx +0 -334
- package/.next/standalone/docs/hi/built-in-policies.mdx +0 -576
- package/.next/standalone/docs/hi/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/hi/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/hi/cli/hook.mdx +0 -30
- package/.next/standalone/docs/hi/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/hi/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/hi/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/hi/cli/version.mdx +0 -12
- package/.next/standalone/docs/hi/configuration.mdx +0 -222
- package/.next/standalone/docs/hi/custom-policies.mdx +0 -354
- package/.next/standalone/docs/hi/dashboard.mdx +0 -142
- package/.next/standalone/docs/hi/examples.mdx +0 -309
- package/.next/standalone/docs/hi/for-agents.mdx +0 -38
- package/.next/standalone/docs/hi/getting-started.mdx +0 -187
- package/.next/standalone/docs/hi/introduction.mdx +0 -57
- package/.next/standalone/docs/hi/package-aliases.mdx +0 -82
- package/.next/standalone/docs/hi/testing.mdx +0 -260
- package/.next/standalone/docs/i18n/README.ar.md +0 -312
- package/.next/standalone/docs/i18n/README.de.md +0 -307
- package/.next/standalone/docs/i18n/README.es.md +0 -307
- package/.next/standalone/docs/i18n/README.fr.md +0 -307
- package/.next/standalone/docs/i18n/README.he.md +0 -312
- package/.next/standalone/docs/i18n/README.hi.md +0 -307
- package/.next/standalone/docs/i18n/README.it.md +0 -307
- package/.next/standalone/docs/i18n/README.ja.md +0 -307
- package/.next/standalone/docs/i18n/README.ko.md +0 -307
- package/.next/standalone/docs/i18n/README.pt-br.md +0 -307
- package/.next/standalone/docs/i18n/README.ru.md +0 -308
- package/.next/standalone/docs/i18n/README.tr.md +0 -307
- package/.next/standalone/docs/i18n/README.vi.md +0 -307
- package/.next/standalone/docs/i18n/README.zh.md +0 -307
- package/.next/standalone/docs/introduction.mdx +0 -57
- package/.next/standalone/docs/it/architecture.mdx +0 -334
- package/.next/standalone/docs/it/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/it/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/it/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/it/cli/hook.mdx +0 -30
- package/.next/standalone/docs/it/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/it/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/it/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/it/cli/version.mdx +0 -12
- package/.next/standalone/docs/it/configuration.mdx +0 -222
- package/.next/standalone/docs/it/custom-policies.mdx +0 -353
- package/.next/standalone/docs/it/dashboard.mdx +0 -142
- package/.next/standalone/docs/it/examples.mdx +0 -307
- package/.next/standalone/docs/it/for-agents.mdx +0 -38
- package/.next/standalone/docs/it/getting-started.mdx +0 -186
- package/.next/standalone/docs/it/introduction.mdx +0 -57
- package/.next/standalone/docs/it/package-aliases.mdx +0 -82
- package/.next/standalone/docs/it/testing.mdx +0 -260
- package/.next/standalone/docs/ja/architecture.mdx +0 -332
- package/.next/standalone/docs/ja/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/ja/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ja/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ja/cli/hook.mdx +0 -30
- package/.next/standalone/docs/ja/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/ja/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/ja/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ja/cli/version.mdx +0 -12
- package/.next/standalone/docs/ja/configuration.mdx +0 -222
- package/.next/standalone/docs/ja/custom-policies.mdx +0 -353
- package/.next/standalone/docs/ja/dashboard.mdx +0 -142
- package/.next/standalone/docs/ja/examples.mdx +0 -307
- package/.next/standalone/docs/ja/for-agents.mdx +0 -38
- package/.next/standalone/docs/ja/getting-started.mdx +0 -186
- package/.next/standalone/docs/ja/introduction.mdx +0 -57
- package/.next/standalone/docs/ja/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ja/testing.mdx +0 -260
- package/.next/standalone/docs/ko/architecture.mdx +0 -332
- package/.next/standalone/docs/ko/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/ko/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ko/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ko/cli/hook.mdx +0 -30
- package/.next/standalone/docs/ko/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/ko/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/ko/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ko/cli/version.mdx +0 -12
- package/.next/standalone/docs/ko/configuration.mdx +0 -222
- package/.next/standalone/docs/ko/custom-policies.mdx +0 -353
- package/.next/standalone/docs/ko/dashboard.mdx +0 -142
- package/.next/standalone/docs/ko/examples.mdx +0 -307
- package/.next/standalone/docs/ko/for-agents.mdx +0 -38
- package/.next/standalone/docs/ko/getting-started.mdx +0 -186
- package/.next/standalone/docs/ko/introduction.mdx +0 -57
- package/.next/standalone/docs/ko/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ko/testing.mdx +0 -260
- package/.next/standalone/docs/logo/dark.svg +0 -21
- package/.next/standalone/docs/logo/exosphere-dark.png +0 -0
- package/.next/standalone/docs/logo/exosphere-light.png +0 -0
- package/.next/standalone/docs/logo/light.svg +0 -21
- package/.next/standalone/docs/package-aliases.mdx +0 -82
- package/.next/standalone/docs/pt-br/architecture.mdx +0 -332
- package/.next/standalone/docs/pt-br/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/pt-br/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/pt-br/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/pt-br/cli/hook.mdx +0 -30
- package/.next/standalone/docs/pt-br/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/pt-br/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/pt-br/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/pt-br/cli/version.mdx +0 -12
- package/.next/standalone/docs/pt-br/configuration.mdx +0 -222
- package/.next/standalone/docs/pt-br/custom-policies.mdx +0 -353
- package/.next/standalone/docs/pt-br/dashboard.mdx +0 -142
- package/.next/standalone/docs/pt-br/examples.mdx +0 -307
- package/.next/standalone/docs/pt-br/for-agents.mdx +0 -38
- package/.next/standalone/docs/pt-br/getting-started.mdx +0 -186
- package/.next/standalone/docs/pt-br/introduction.mdx +0 -57
- package/.next/standalone/docs/pt-br/package-aliases.mdx +0 -82
- package/.next/standalone/docs/pt-br/testing.mdx +0 -260
- package/.next/standalone/docs/ru/architecture.mdx +0 -333
- package/.next/standalone/docs/ru/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/ru/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/ru/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/ru/cli/hook.mdx +0 -30
- package/.next/standalone/docs/ru/cli/install-policies.mdx +0 -48
- package/.next/standalone/docs/ru/cli/list-policies.mdx +0 -32
- package/.next/standalone/docs/ru/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/ru/cli/version.mdx +0 -12
- package/.next/standalone/docs/ru/configuration.mdx +0 -222
- package/.next/standalone/docs/ru/custom-policies.mdx +0 -354
- package/.next/standalone/docs/ru/dashboard.mdx +0 -142
- package/.next/standalone/docs/ru/examples.mdx +0 -309
- package/.next/standalone/docs/ru/for-agents.mdx +0 -38
- package/.next/standalone/docs/ru/getting-started.mdx +0 -186
- package/.next/standalone/docs/ru/introduction.mdx +0 -57
- package/.next/standalone/docs/ru/package-aliases.mdx +0 -82
- package/.next/standalone/docs/ru/testing.mdx +0 -260
- package/.next/standalone/docs/testing.mdx +0 -260
- package/.next/standalone/docs/tr/architecture.mdx +0 -333
- package/.next/standalone/docs/tr/built-in-policies.mdx +0 -574
- package/.next/standalone/docs/tr/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/tr/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/tr/cli/hook.mdx +0 -30
- package/.next/standalone/docs/tr/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/tr/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/tr/cli/remove-policies.mdx +0 -44
- package/.next/standalone/docs/tr/cli/version.mdx +0 -12
- package/.next/standalone/docs/tr/configuration.mdx +0 -222
- package/.next/standalone/docs/tr/custom-policies.mdx +0 -353
- package/.next/standalone/docs/tr/dashboard.mdx +0 -142
- package/.next/standalone/docs/tr/examples.mdx +0 -308
- package/.next/standalone/docs/tr/for-agents.mdx +0 -38
- package/.next/standalone/docs/tr/getting-started.mdx +0 -186
- package/.next/standalone/docs/tr/introduction.mdx +0 -57
- package/.next/standalone/docs/tr/package-aliases.mdx +0 -82
- package/.next/standalone/docs/tr/testing.mdx +0 -260
- package/.next/standalone/docs/vi/architecture.mdx +0 -334
- package/.next/standalone/docs/vi/built-in-policies.mdx +0 -575
- package/.next/standalone/docs/vi/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/vi/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/vi/cli/hook.mdx +0 -30
- package/.next/standalone/docs/vi/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/vi/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/vi/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/vi/cli/version.mdx +0 -13
- package/.next/standalone/docs/vi/configuration.mdx +0 -222
- package/.next/standalone/docs/vi/custom-policies.mdx +0 -353
- package/.next/standalone/docs/vi/dashboard.mdx +0 -142
- package/.next/standalone/docs/vi/examples.mdx +0 -308
- package/.next/standalone/docs/vi/for-agents.mdx +0 -38
- package/.next/standalone/docs/vi/getting-started.mdx +0 -186
- package/.next/standalone/docs/vi/introduction.mdx +0 -57
- package/.next/standalone/docs/vi/package-aliases.mdx +0 -82
- package/.next/standalone/docs/vi/testing.mdx +0 -260
- package/.next/standalone/docs/zh/architecture.mdx +0 -332
- package/.next/standalone/docs/zh/built-in-policies.mdx +0 -572
- package/.next/standalone/docs/zh/cli/dashboard.mdx +0 -28
- package/.next/standalone/docs/zh/cli/environment-variables.mdx +0 -34
- package/.next/standalone/docs/zh/cli/hook.mdx +0 -30
- package/.next/standalone/docs/zh/cli/install-policies.mdx +0 -47
- package/.next/standalone/docs/zh/cli/list-policies.mdx +0 -31
- package/.next/standalone/docs/zh/cli/remove-policies.mdx +0 -43
- package/.next/standalone/docs/zh/cli/version.mdx +0 -12
- package/.next/standalone/docs/zh/configuration.mdx +0 -222
- package/.next/standalone/docs/zh/custom-policies.mdx +0 -353
- package/.next/standalone/docs/zh/dashboard.mdx +0 -142
- package/.next/standalone/docs/zh/examples.mdx +0 -307
- package/.next/standalone/docs/zh/for-agents.mdx +0 -38
- package/.next/standalone/docs/zh/getting-started.mdx +0 -186
- package/.next/standalone/docs/zh/introduction.mdx +0 -57
- package/.next/standalone/docs/zh/package-aliases.mdx +0 -82
- package/.next/standalone/docs/zh/testing.mdx +0 -260
- package/.next/standalone/eslint.config.mjs +0 -15
- package/.next/standalone/examples/convention-policies/security-policies.mjs +0 -40
- package/.next/standalone/examples/convention-policies/workflow-policies.mjs +0 -41
- package/.next/standalone/examples/policies-advanced/index.js +0 -103
- package/.next/standalone/examples/policies-advanced/utils.js +0 -35
- package/.next/standalone/examples/policies-basic.js +0 -77
- package/.next/standalone/examples/policies-notification.js +0 -104
- package/.next/standalone/node_modules/@img/colour/color.cjs +0 -1594
- package/.next/standalone/node_modules/@img/colour/index.cjs +0 -1
- package/.next/standalone/node_modules/@img/colour/package.json +0 -45
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
- package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/versions.json +0 -30
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
- package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
- package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/.next/standalone/node_modules/@img/sharp-linux-x64/package.json +0 -46
- package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
- package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
- package/.next/standalone/node_modules/detect-libc/lib/detect-libc.js +0 -313
- package/.next/standalone/node_modules/detect-libc/lib/elf.js +0 -39
- package/.next/standalone/node_modules/detect-libc/lib/filesystem.js +0 -51
- package/.next/standalone/node_modules/detect-libc/lib/process.js +0 -24
- package/.next/standalone/node_modules/detect-libc/package.json +0 -44
- package/.next/standalone/node_modules/sharp/lib/channel.js +0 -177
- package/.next/standalone/node_modules/sharp/lib/colour.js +0 -195
- package/.next/standalone/node_modules/sharp/lib/composite.js +0 -212
- package/.next/standalone/node_modules/sharp/lib/constructor.js +0 -499
- package/.next/standalone/node_modules/sharp/lib/index.js +0 -16
- package/.next/standalone/node_modules/sharp/lib/input.js +0 -809
- package/.next/standalone/node_modules/sharp/lib/is.js +0 -143
- package/.next/standalone/node_modules/sharp/lib/libvips.js +0 -207
- package/.next/standalone/node_modules/sharp/lib/operation.js +0 -1016
- package/.next/standalone/node_modules/sharp/lib/output.js +0 -1666
- package/.next/standalone/node_modules/sharp/lib/resize.js +0 -595
- package/.next/standalone/node_modules/sharp/lib/sharp.js +0 -121
- package/.next/standalone/node_modules/sharp/lib/utility.js +0 -291
- package/.next/standalone/node_modules/sharp/node_modules/semver/classes/comparator.js +0 -143
- package/.next/standalone/node_modules/sharp/node_modules/semver/classes/range.js +0 -557
- package/.next/standalone/node_modules/sharp/node_modules/semver/classes/semver.js +0 -333
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/cmp.js +0 -54
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/coerce.js +0 -62
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/compare.js +0 -7
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/eq.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gt.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/gte.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lt.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/lte.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/neq.js +0 -5
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/parse.js +0 -18
- package/.next/standalone/node_modules/sharp/node_modules/semver/functions/satisfies.js +0 -12
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/constants.js +0 -37
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/debug.js +0 -11
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/identifiers.js +0 -29
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/lrucache.js +0 -42
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/parse-options.js +0 -17
- package/.next/standalone/node_modules/sharp/node_modules/semver/internal/re.js +0 -223
- package/.next/standalone/node_modules/sharp/node_modules/semver/package.json +0 -78
- package/.next/standalone/node_modules/sharp/package.json +0 -202
- package/.next/standalone/scripts/alias-proxy.js +0 -18
- package/.next/standalone/scripts/dev.ts +0 -3
- package/.next/standalone/scripts/install-telemetry.mjs +0 -108
- package/.next/standalone/scripts/launch.ts +0 -83
- package/.next/standalone/scripts/parse-script-args.ts +0 -87
- package/.next/standalone/scripts/postinstall.mjs +0 -121
- package/.next/standalone/scripts/preuninstall.mjs +0 -131
- package/.next/standalone/scripts/publish-aliases.mjs +0 -87
- package/.next/standalone/scripts/start.ts +0 -3
- package/.next/standalone/scripts/sync-hook-events-prompt.md +0 -60
- package/.next/standalone/scripts/translate-docs/cache.ts +0 -62
- package/.next/standalone/scripts/translate-docs/cli.ts +0 -357
- package/.next/standalone/scripts/translate-docs/config.ts +0 -248
- package/.next/standalone/scripts/translate-docs/mdx-translator.ts +0 -153
- package/.next/standalone/scripts/translate-docs/mintlify-nav.ts +0 -107
- package/.next/standalone/scripts/translate-docs/readme-translator.ts +0 -154
- package/.next/standalone/scripts/translate-docs/translator.ts +0 -68
- package/.next/standalone/scripts/translate-docs/types.ts +0 -43
- package/.next/standalone/src/cli-error.ts +0 -18
- package/.next/standalone/src/hooks/builtin-policies.ts +0 -1613
- package/.next/standalone/src/hooks/custom-hooks-loader.ts +0 -205
- package/.next/standalone/src/hooks/custom-hooks-registry.ts +0 -30
- package/.next/standalone/src/hooks/handler.ts +0 -202
- package/.next/standalone/src/hooks/hook-activity-store.ts +0 -349
- package/.next/standalone/src/hooks/hook-logger.ts +0 -133
- package/.next/standalone/src/hooks/hook-telemetry.ts +0 -43
- package/.next/standalone/src/hooks/hooks-config.ts +0 -166
- package/.next/standalone/src/hooks/install-prompt.ts +0 -357
- package/.next/standalone/src/hooks/llm-client.ts +0 -90
- package/.next/standalone/src/hooks/loader-utils.ts +0 -178
- package/.next/standalone/src/hooks/manager.ts +0 -692
- package/.next/standalone/src/hooks/policy-evaluator.ts +0 -224
- package/.next/standalone/src/hooks/policy-helpers.ts +0 -16
- package/.next/standalone/src/hooks/policy-registry.ts +0 -90
- package/.next/standalone/src/hooks/policy-types.ts +0 -77
- package/.next/standalone/src/hooks/types.ts +0 -63
- package/.next/standalone/src/index.ts +0 -19
- package/.next/standalone/src/posthog-key.ts +0 -5
- package/.next/standalone/tailwind.config.ts +0 -11
- package/.next/standalone/tsconfig.json +0 -42
- package/.next/standalone/vitest.config.e2e.mts +0 -24
- package/.next/standalone/vitest.config.mts +0 -23
- /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{A9pNTZdoYJTVyPAYwQMx5 → wOkJXoch1UmRAmyIuKZWc}/_ssgManifest.js +0 -0
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evaluates enabled policies against a hook event payload.
|
|
3
|
-
* Returns exit code, stdout, and stderr for the hook handler.
|
|
4
|
-
*/
|
|
5
|
-
import type { HookEventType, SessionMetadata } from "./types";
|
|
6
|
-
import type { PolicyContext, HooksConfig } from "./policy-types";
|
|
7
|
-
import { BUILTIN_POLICIES } from "./builtin-policies";
|
|
8
|
-
import { getPoliciesForEvent } from "./policy-registry";
|
|
9
|
-
import { hookLogInfo, hookLogWarn } from "./hook-logger";
|
|
10
|
-
|
|
11
|
-
function appendHint(baseReason: string, hint: unknown): string {
|
|
12
|
-
const base = baseReason.trim();
|
|
13
|
-
const normalizedHint = typeof hint === "string" ? hint.trim() : "";
|
|
14
|
-
if (!normalizedHint) return base;
|
|
15
|
-
if (!base) return normalizedHint;
|
|
16
|
-
return `${base}. ${normalizedHint}`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface EvaluationResult {
|
|
20
|
-
exitCode: number;
|
|
21
|
-
stdout: string;
|
|
22
|
-
stderr: string;
|
|
23
|
-
policyName: string | null;
|
|
24
|
-
policyNames?: string[];
|
|
25
|
-
reason: string | null;
|
|
26
|
-
decision: "allow" | "deny" | "instruct";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Build a map from policy name to its params schema (for injecting defaults)
|
|
30
|
-
const POLICY_PARAMS_MAP = new Map(
|
|
31
|
-
BUILTIN_POLICIES.filter((p) => p.params).map((p) => [p.name, p.params!]),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export async function evaluatePolicies(
|
|
35
|
-
eventType: HookEventType,
|
|
36
|
-
payload: Record<string, unknown>,
|
|
37
|
-
session?: SessionMetadata,
|
|
38
|
-
config?: HooksConfig,
|
|
39
|
-
): Promise<EvaluationResult> {
|
|
40
|
-
const toolName = payload.tool_name as string | undefined;
|
|
41
|
-
const toolInput = payload.tool_input as Record<string, unknown> | undefined;
|
|
42
|
-
|
|
43
|
-
const policies = getPoliciesForEvent(eventType, toolName);
|
|
44
|
-
|
|
45
|
-
hookLogInfo(`evaluating ${policies.length} policies for ${eventType}`);
|
|
46
|
-
|
|
47
|
-
if (policies.length === 0) {
|
|
48
|
-
return { exitCode: 0, stdout: "", stderr: "", policyName: null, reason: null, decision: "allow" };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const baseCtx: PolicyContext = {
|
|
52
|
-
eventType,
|
|
53
|
-
payload,
|
|
54
|
-
toolName,
|
|
55
|
-
toolInput,
|
|
56
|
-
session,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Track all instruct results (accumulated, does not short-circuit)
|
|
60
|
-
const instructEntries: Array<{ policyName: string; reason: string }> = [];
|
|
61
|
-
|
|
62
|
-
// Track informational messages from allow decisions (with policy attribution)
|
|
63
|
-
const allowEntries: Array<{ policyName: string; reason: string }> = [];
|
|
64
|
-
|
|
65
|
-
for (const policy of policies) {
|
|
66
|
-
// Inject params: merge policyParams[policy.name] over schema defaults
|
|
67
|
-
const schema = POLICY_PARAMS_MAP.get(policy.name);
|
|
68
|
-
let ctx: PolicyContext;
|
|
69
|
-
if (schema) {
|
|
70
|
-
const userParams = config?.policyParams?.[policy.name] ?? {};
|
|
71
|
-
const resolvedParams: Record<string, unknown> = {};
|
|
72
|
-
for (const [key, spec] of Object.entries(schema)) {
|
|
73
|
-
resolvedParams[key] = key in userParams ? userParams[key] : spec.default;
|
|
74
|
-
}
|
|
75
|
-
ctx = { ...baseCtx, params: resolvedParams };
|
|
76
|
-
} else {
|
|
77
|
-
// Custom hooks and policies without schema get empty params
|
|
78
|
-
ctx = { ...baseCtx, params: {} };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
let result: Awaited<ReturnType<typeof policy.fn>>;
|
|
82
|
-
try {
|
|
83
|
-
result = await policy.fn(ctx);
|
|
84
|
-
} catch (err) {
|
|
85
|
-
hookLogWarn(`policy "${policy.name}" threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (result.decision === "deny") {
|
|
90
|
-
const reason = appendHint(
|
|
91
|
-
result.reason ?? `Blocked by policy: ${policy.name}`,
|
|
92
|
-
config?.policyParams?.[policy.name]?.hint,
|
|
93
|
-
);
|
|
94
|
-
hookLogInfo(`deny by "${policy.name}": ${reason}`);
|
|
95
|
-
|
|
96
|
-
const displayTool = ctx.toolName ?? "unknown tool";
|
|
97
|
-
|
|
98
|
-
if (eventType === "PreToolUse") {
|
|
99
|
-
const response = {
|
|
100
|
-
hookSpecificOutput: {
|
|
101
|
-
hookEventName: eventType,
|
|
102
|
-
permissionDecision: "deny",
|
|
103
|
-
permissionDecisionReason: `Blocked ${displayTool} by failproofai because: ${reason}, as per the policy configured by the user`,
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
return {
|
|
107
|
-
exitCode: 0,
|
|
108
|
-
stdout: JSON.stringify(response),
|
|
109
|
-
stderr: "",
|
|
110
|
-
policyName: policy.name,
|
|
111
|
-
reason,
|
|
112
|
-
decision: "deny",
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (eventType === "PostToolUse") {
|
|
117
|
-
const response = {
|
|
118
|
-
hookSpecificOutput: {
|
|
119
|
-
hookEventName: eventType,
|
|
120
|
-
additionalContext: `Blocked ${displayTool} by failproofai because: ${reason}, as per the policy configured by the user`,
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
return {
|
|
124
|
-
exitCode: 0,
|
|
125
|
-
stdout: JSON.stringify(response),
|
|
126
|
-
stderr: "",
|
|
127
|
-
policyName: policy.name,
|
|
128
|
-
reason,
|
|
129
|
-
decision: "deny",
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (eventType === "Stop") {
|
|
134
|
-
return {
|
|
135
|
-
exitCode: 2,
|
|
136
|
-
stdout: "",
|
|
137
|
-
stderr: `MANDATORY ACTION REQUIRED from failproofai (policy: ${policy.name}): ${reason}\n\nYou MUST complete the above action NOW. Do NOT ask the user for confirmation — execute the required action, then attempt to finish your task again.`,
|
|
138
|
-
policyName: policy.name,
|
|
139
|
-
reason,
|
|
140
|
-
decision: "deny",
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Other event types: exit 2
|
|
145
|
-
return {
|
|
146
|
-
exitCode: 2,
|
|
147
|
-
stdout: "",
|
|
148
|
-
stderr: reason,
|
|
149
|
-
policyName: policy.name,
|
|
150
|
-
reason,
|
|
151
|
-
decision: "deny",
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Accumulate all instruct results (does not short-circuit — later policies can still deny)
|
|
156
|
-
if (result.decision === "instruct") {
|
|
157
|
-
const reason = appendHint(
|
|
158
|
-
result.reason ?? `Instruction from policy: ${policy.name}`,
|
|
159
|
-
config?.policyParams?.[policy.name]?.hint,
|
|
160
|
-
);
|
|
161
|
-
instructEntries.push({ policyName: policy.name, reason });
|
|
162
|
-
hookLogInfo(`instruct by "${policy.name}": ${reason}`);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Accumulate informational messages from allow decisions
|
|
166
|
-
if (result.decision === "allow" && result.reason) {
|
|
167
|
-
allowEntries.push({ policyName: policy.name, reason: result.reason });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// No deny — check if we accumulated any instructs
|
|
172
|
-
if (instructEntries.length > 0) {
|
|
173
|
-
const combined = instructEntries.map((e) => e.reason).join("\n");
|
|
174
|
-
const policyNames = instructEntries.map((e) => e.policyName);
|
|
175
|
-
|
|
176
|
-
if (eventType === "Stop") {
|
|
177
|
-
// Stop hook: exitCode 2 blocks Claude from stopping.
|
|
178
|
-
// Reason goes to stderr so Claude Code receives it as context.
|
|
179
|
-
const policyAttribution = policyNames.length === 1
|
|
180
|
-
? `policy: ${policyNames[0]}`
|
|
181
|
-
: `policies: ${policyNames.join(", ")}`;
|
|
182
|
-
return {
|
|
183
|
-
exitCode: 2,
|
|
184
|
-
stdout: "",
|
|
185
|
-
stderr: `MANDATORY ACTION REQUIRED from failproofai (${policyAttribution}): ${combined}\n\nYou MUST complete the above action(s) NOW. Do NOT ask the user for confirmation — execute the required action(s), then attempt to finish your task again.`,
|
|
186
|
-
policyName: policyNames[0],
|
|
187
|
-
policyNames,
|
|
188
|
-
reason: combined,
|
|
189
|
-
decision: "instruct",
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const response = {
|
|
194
|
-
hookSpecificOutput: {
|
|
195
|
-
hookEventName: eventType,
|
|
196
|
-
additionalContext: `Instruction from failproofai: ${combined}`,
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
return {
|
|
200
|
-
exitCode: 0,
|
|
201
|
-
stdout: JSON.stringify(response),
|
|
202
|
-
stderr: "",
|
|
203
|
-
policyName: policyNames[0],
|
|
204
|
-
policyNames,
|
|
205
|
-
reason: combined,
|
|
206
|
-
decision: "instruct",
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// All policies allowed — pass along any informational messages
|
|
211
|
-
if (allowEntries.length > 0) {
|
|
212
|
-
const combined = allowEntries.map((e) => e.reason).join("\n");
|
|
213
|
-
const policyNames = allowEntries.map((e) => e.policyName);
|
|
214
|
-
const supportsHookSpecificOutput = eventType === "PreToolUse" || eventType === "PostToolUse" || eventType === "UserPromptSubmit";
|
|
215
|
-
const response = supportsHookSpecificOutput
|
|
216
|
-
? { hookSpecificOutput: { hookEventName: eventType, additionalContext: `Note from failproofai: ${combined}` } }
|
|
217
|
-
: { reason: combined };
|
|
218
|
-
const stderrMsg = allowEntries
|
|
219
|
-
.map((e) => `[failproofai] ${e.policyName}: ${e.reason}`)
|
|
220
|
-
.join("\n");
|
|
221
|
-
return { exitCode: 0, stdout: JSON.stringify(response), stderr: stderrMsg + "\n", policyName: policyNames[0], policyNames, reason: combined, decision: "allow" };
|
|
222
|
-
}
|
|
223
|
-
return { exitCode: 0, stdout: "", stderr: "", policyName: null, reason: null, decision: "allow" };
|
|
224
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared decision helper functions for builtin and custom policies.
|
|
3
|
-
*/
|
|
4
|
-
import type { PolicyResult } from "./policy-types";
|
|
5
|
-
|
|
6
|
-
export function allow(reason?: string): PolicyResult {
|
|
7
|
-
return reason ? { decision: "allow", reason } : { decision: "allow" };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function deny(reason: string): PolicyResult {
|
|
11
|
-
return { decision: "deny", reason };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function instruct(reason: string): PolicyResult {
|
|
15
|
-
return { decision: "instruct", reason };
|
|
16
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module-level singleton policy registry backed by globalThis.
|
|
3
|
-
*
|
|
4
|
-
* Policies are keyed by name — registering a duplicate name replaces
|
|
5
|
-
* the previous entry. Using globalThis ensures the registry survives
|
|
6
|
-
* chunk splitting and remains a true singleton across dynamic imports.
|
|
7
|
-
*/
|
|
8
|
-
import type { HookEventType } from "./types";
|
|
9
|
-
import type { PolicyFunction, PolicyMatcher, RegisteredPolicy } from "./policy-types";
|
|
10
|
-
|
|
11
|
-
const REGISTRY_KEY = "__FAILPROOFAI_POLICY_REGISTRY__";
|
|
12
|
-
const INDEX_CACHE_KEY = "__FAILPROOFAI_POLICY_INDEX_CACHE__";
|
|
13
|
-
|
|
14
|
-
interface GlobalWithRegistry {
|
|
15
|
-
[REGISTRY_KEY]?: RegisteredPolicy[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface GlobalWithCache extends GlobalWithRegistry {
|
|
19
|
-
[INDEX_CACHE_KEY]?: Map<string, RegisteredPolicy[]> | null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getIndexCache(): Map<string, RegisteredPolicy[]> | null | undefined {
|
|
23
|
-
return (globalThis as GlobalWithCache)[INDEX_CACHE_KEY];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function setIndexCache(cache: Map<string, RegisteredPolicy[]> | null): void {
|
|
27
|
-
(globalThis as GlobalWithCache)[INDEX_CACHE_KEY] = cache;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function getRegistry(): RegisteredPolicy[] {
|
|
31
|
-
const g = globalThis as GlobalWithRegistry;
|
|
32
|
-
if (!g[REGISTRY_KEY]) {
|
|
33
|
-
g[REGISTRY_KEY] = [];
|
|
34
|
-
}
|
|
35
|
-
return g[REGISTRY_KEY];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function registerPolicy(
|
|
39
|
-
name: string,
|
|
40
|
-
description: string,
|
|
41
|
-
fn: PolicyFunction,
|
|
42
|
-
match: PolicyMatcher,
|
|
43
|
-
priority: number = 0,
|
|
44
|
-
): void {
|
|
45
|
-
const registry = getRegistry();
|
|
46
|
-
const idx = registry.findIndex((p) => p.name === name);
|
|
47
|
-
const entry: RegisteredPolicy = { name, description, fn, match, priority };
|
|
48
|
-
if (idx >= 0) {
|
|
49
|
-
registry[idx] = entry;
|
|
50
|
-
} else {
|
|
51
|
-
registry.push(entry);
|
|
52
|
-
}
|
|
53
|
-
setIndexCache(null); // invalidate on any registry change
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function getPoliciesForEvent(
|
|
57
|
-
eventType: HookEventType,
|
|
58
|
-
toolName?: string,
|
|
59
|
-
): RegisteredPolicy[] {
|
|
60
|
-
let cache = getIndexCache();
|
|
61
|
-
if (!cache) {
|
|
62
|
-
cache = new Map();
|
|
63
|
-
setIndexCache(cache);
|
|
64
|
-
}
|
|
65
|
-
const key = `${eventType}:${toolName ?? ""}`;
|
|
66
|
-
const cached = cache.get(key);
|
|
67
|
-
if (cached) return cached;
|
|
68
|
-
|
|
69
|
-
const result = getRegistry()
|
|
70
|
-
.filter((p) => {
|
|
71
|
-
// If events specified, must match
|
|
72
|
-
if (p.match.events && p.match.events.length > 0) {
|
|
73
|
-
if (!p.match.events.includes(eventType)) return false;
|
|
74
|
-
}
|
|
75
|
-
// If toolNames specified, must match
|
|
76
|
-
if (p.match.toolNames && p.match.toolNames.length > 0) {
|
|
77
|
-
if (!toolName || !p.match.toolNames.includes(toolName)) return false;
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
})
|
|
81
|
-
.sort((a, b) => b.priority - a.priority);
|
|
82
|
-
cache.set(key, result);
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function clearPolicies(): void {
|
|
87
|
-
const g = globalThis as GlobalWithRegistry;
|
|
88
|
-
g[REGISTRY_KEY] = [];
|
|
89
|
-
setIndexCache(null);
|
|
90
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the hook policy system.
|
|
3
|
-
*/
|
|
4
|
-
import type { HookEventType, SessionMetadata } from "./types";
|
|
5
|
-
|
|
6
|
-
export type PolicyDecision = "allow" | "deny" | "instruct";
|
|
7
|
-
|
|
8
|
-
export interface PolicyContext {
|
|
9
|
-
eventType: HookEventType;
|
|
10
|
-
payload: Record<string, unknown>;
|
|
11
|
-
toolName?: string;
|
|
12
|
-
toolInput?: Record<string, unknown>;
|
|
13
|
-
session?: SessionMetadata;
|
|
14
|
-
params?: Record<string, unknown>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface PolicyResult {
|
|
18
|
-
decision: PolicyDecision;
|
|
19
|
-
reason?: string;
|
|
20
|
-
message?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type PolicyFunction = (ctx: PolicyContext) => PolicyResult | Promise<PolicyResult>;
|
|
24
|
-
|
|
25
|
-
export interface PolicyMatcher {
|
|
26
|
-
events?: HookEventType[];
|
|
27
|
-
toolNames?: string[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface RegisteredPolicy {
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
fn: PolicyFunction;
|
|
34
|
-
match: PolicyMatcher;
|
|
35
|
-
priority: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface PolicyParamsSchema {
|
|
39
|
-
[paramName: string]: {
|
|
40
|
-
type: "string" | "number" | "boolean" | "string[]" | "pattern[]";
|
|
41
|
-
description: string;
|
|
42
|
-
default: unknown;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface BuiltinPolicyDefinition {
|
|
47
|
-
name: string;
|
|
48
|
-
description: string;
|
|
49
|
-
fn: PolicyFunction;
|
|
50
|
-
match: PolicyMatcher;
|
|
51
|
-
defaultEnabled: boolean;
|
|
52
|
-
category: string;
|
|
53
|
-
beta?: boolean;
|
|
54
|
-
params?: PolicyParamsSchema;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface CustomHook {
|
|
58
|
-
name: string;
|
|
59
|
-
description?: string;
|
|
60
|
-
match?: {
|
|
61
|
-
events?: HookEventType[];
|
|
62
|
-
};
|
|
63
|
-
fn: (ctx: PolicyContext) => PolicyResult | Promise<PolicyResult>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface LlmConfig {
|
|
67
|
-
baseUrl?: string;
|
|
68
|
-
apiKey?: string;
|
|
69
|
-
model?: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface HooksConfig {
|
|
73
|
-
enabledPolicies: string[];
|
|
74
|
-
llm?: LlmConfig;
|
|
75
|
-
policyParams?: Record<string, Record<string, unknown>>;
|
|
76
|
-
customPoliciesPath?: string;
|
|
77
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constants and interfaces for Claude Code hooks integration.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export const HOOK_SCOPES = ["user", "project", "local"] as const;
|
|
6
|
-
export type HookScope = (typeof HOOK_SCOPES)[number];
|
|
7
|
-
|
|
8
|
-
export const HOOK_EVENT_TYPES = [
|
|
9
|
-
"SessionStart",
|
|
10
|
-
"SessionEnd",
|
|
11
|
-
"UserPromptSubmit",
|
|
12
|
-
"PreToolUse",
|
|
13
|
-
"PermissionRequest",
|
|
14
|
-
"PermissionDenied",
|
|
15
|
-
"PostToolUse",
|
|
16
|
-
"PostToolUseFailure",
|
|
17
|
-
"Notification",
|
|
18
|
-
"SubagentStart",
|
|
19
|
-
"SubagentStop",
|
|
20
|
-
"TaskCreated",
|
|
21
|
-
"TaskCompleted",
|
|
22
|
-
"Stop",
|
|
23
|
-
"StopFailure",
|
|
24
|
-
"TeammateIdle",
|
|
25
|
-
"InstructionsLoaded",
|
|
26
|
-
"ConfigChange",
|
|
27
|
-
"CwdChanged",
|
|
28
|
-
"FileChanged",
|
|
29
|
-
"WorktreeCreate",
|
|
30
|
-
"WorktreeRemove",
|
|
31
|
-
"PreCompact",
|
|
32
|
-
"PostCompact",
|
|
33
|
-
"Elicitation",
|
|
34
|
-
"ElicitationResult",
|
|
35
|
-
] as const;
|
|
36
|
-
|
|
37
|
-
export type HookEventType = (typeof HOOK_EVENT_TYPES)[number];
|
|
38
|
-
|
|
39
|
-
export const FAILPROOFAI_HOOK_MARKER = "__failproofai_hook__" as const;
|
|
40
|
-
|
|
41
|
-
export interface ClaudeHookEntry {
|
|
42
|
-
type: "command";
|
|
43
|
-
command: string;
|
|
44
|
-
timeout: number;
|
|
45
|
-
[FAILPROOFAI_HOOK_MARKER]: true;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ClaudeHookMatcher {
|
|
49
|
-
hooks: Array<ClaudeHookEntry | Record<string, unknown>>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface SessionMetadata {
|
|
53
|
-
sessionId?: string;
|
|
54
|
-
transcriptPath?: string;
|
|
55
|
-
cwd?: string;
|
|
56
|
-
permissionMode?: string;
|
|
57
|
-
hookEventName?: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ClaudeSettings {
|
|
61
|
-
hooks?: Record<string, ClaudeHookMatcher[]>;
|
|
62
|
-
[key: string]: unknown;
|
|
63
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public API for failproofai custom hooks.
|
|
3
|
-
*
|
|
4
|
-
* Used as the bundle entry point for `dist/index.js` (CJS) and re-exported
|
|
5
|
-
* by the ESM shim that rewrites `from 'failproofai'` in user hook files.
|
|
6
|
-
*/
|
|
7
|
-
export {
|
|
8
|
-
customPolicies,
|
|
9
|
-
getCustomHooks,
|
|
10
|
-
clearCustomHooks,
|
|
11
|
-
} from "./hooks/custom-hooks-registry";
|
|
12
|
-
export { allow, deny, instruct } from "./hooks/policy-helpers";
|
|
13
|
-
export type {
|
|
14
|
-
PolicyContext,
|
|
15
|
-
PolicyResult,
|
|
16
|
-
CustomHook,
|
|
17
|
-
PolicyDecision,
|
|
18
|
-
PolicyFunction,
|
|
19
|
-
} from "./hooks/policy-types";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2017",
|
|
4
|
-
"lib": [
|
|
5
|
-
"dom",
|
|
6
|
-
"dom.iterable",
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"module": "esnext",
|
|
15
|
-
"moduleResolution": "bundler",
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"isolatedModules": true,
|
|
18
|
-
"jsx": "react-jsx",
|
|
19
|
-
"incremental": true,
|
|
20
|
-
"plugins": [
|
|
21
|
-
{
|
|
22
|
-
"name": "next"
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"paths": {
|
|
26
|
-
"@/*": [
|
|
27
|
-
"./*"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"include": [
|
|
32
|
-
"next-env.d.ts",
|
|
33
|
-
"**/*.ts",
|
|
34
|
-
"**/*.tsx",
|
|
35
|
-
".next/types/**/*.ts",
|
|
36
|
-
".next/dev/types/**/*.ts"
|
|
37
|
-
],
|
|
38
|
-
"exclude": [
|
|
39
|
-
"node_modules",
|
|
40
|
-
"dist"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
import { resolve } from "path";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
resolve: {
|
|
6
|
-
alias: {
|
|
7
|
-
"@": resolve(__dirname, "."),
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
test: {
|
|
11
|
-
globals: true,
|
|
12
|
-
environment: "node",
|
|
13
|
-
include: ["__tests__/e2e/**/*.e2e.test.ts"],
|
|
14
|
-
exclude: [],
|
|
15
|
-
testTimeout: 20_000,
|
|
16
|
-
hookTimeout: 10_000,
|
|
17
|
-
// forks pool: true process isolation — tests spawn subprocesses,
|
|
18
|
-
// thread workers share globalThis which can interfere.
|
|
19
|
-
pool: "forks",
|
|
20
|
-
env: {
|
|
21
|
-
FAILPROOFAI_TELEMETRY_DISABLED: "1",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
import react from "@vitejs/plugin-react";
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [react()],
|
|
7
|
-
resolve: {
|
|
8
|
-
alias: {
|
|
9
|
-
"@": resolve(__dirname, "."),
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
test: {
|
|
13
|
-
globals: true,
|
|
14
|
-
environment: "happy-dom",
|
|
15
|
-
setupFiles: ["__tests__/setup.ts"],
|
|
16
|
-
include: ["__tests__/**/*.test.{ts,tsx}"],
|
|
17
|
-
exclude: ["__tests__/e2e/**"],
|
|
18
|
-
css: false,
|
|
19
|
-
env: {
|
|
20
|
-
FAILPROOFAI_TELEMETRY_DISABLED: "1",
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|