failproofai 1.0.7-beta.1 → 1.0.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +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.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.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.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.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.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.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/app/settings/page/server-reference-manifest.json +7 -7
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- 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/[root-of-the-server]__0l3yhx4._.js +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- 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/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_18qtd42._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0yxwl6j._.js → [root-of-the-server]__0l44ual._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_214wgrp._.js → _1mel6y1._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0bn2oo8._.js → _1v-jvrv._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.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 +22 -22
- package/.next/standalone/.next/static/chunks/043j99m8ykg__.css +2 -0
- package/.next/standalone/.next/static/chunks/0fqd7m_u81mi5.js +1 -0
- package/.next/standalone/.next/static/chunks/129ag2bw93bdh.js +1 -0
- package/.next/standalone/.next/static/chunks/{29fql3nbnfc9q.js → 1qd741hzlmjbo.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0vmd180qfntfb.js → 2_pltstd8-xgs.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1u5zsejmgrir_.js → 2c8j9l6j_b1ci.js} +1 -1
- package/.next/standalone/.next/static/chunks/3-k569wzcli8q.js +1 -0
- package/.next/standalone/.next/static/chunks/{258668t68du6b.js → 3brze37td_wnc.js} +1 -1
- package/.next/standalone/.next/static/chunks/3otmypm6j_xfo.js +6 -0
- package/.next/standalone/.next/static/chunks/{12tvm75t5ffui.js → 3ugmd_7dyn0id.js} +1 -1
- package/.next/standalone/.next/static/chunks/3yxro_r2_o9ad.js +69 -0
- package/.next/standalone/PROBE-FOLLOWUP.md +186 -0
- package/.next/standalone/app/actions/get-jev-config.ts +38 -23
- package/.next/standalone/app/actions/update-jev-config.ts +1 -1
- package/.next/standalone/app/settings/jev-panel.tsx +33 -29
- package/.next/standalone/package.json +10 -10
- package/.next/standalone/sdk/python/skill/SKILL.md +60 -14
- package/.next/standalone/sdk/python/skill/agents/openai.yaml +2 -1
- package/.next/standalone/sdk/python/skill/references/evaluator.md +255 -0
- package/.next/standalone/sdk/python/skill/references/events.md +17 -8
- package/.next/standalone/sdk/python/skill/references/frameworks.md +3 -0
- package/.next/standalone/sdk/python/skill/references/install.md +3 -0
- package/.next/standalone/sdk/python/skill/references/integration.md +6 -2
- package/.next/standalone/sdk/python/skill/references/typescript.md +568 -0
- package/.next/standalone/sdk/typescript/CHANGELOG.md +119 -0
- package/.next/standalone/sdk/typescript/LICENSE +42 -0
- package/.next/standalone/sdk/typescript/README.md +552 -0
- package/.next/standalone/sdk/typescript/eslint.config.mjs +59 -0
- package/.next/standalone/sdk/typescript/examples/research-agent.ts +197 -0
- package/.next/standalone/sdk/typescript/integration/ai.test.ts +920 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/agent.ts +337 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package-lock.json +281 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/surfaces.ts +605 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/agent.ts +342 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package-lock.json +168 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/surfaces.ts +628 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/agent.ts +346 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/package-lock.json +156 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/surfaces.ts +651 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/agent.ts +350 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/package-lock.json +153 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/surfaces.ts +651 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/agent.ts +623 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package-lock.json +463 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/agent-v1.ts +99 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/agent.ts +623 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/package-lock.json +336 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/agent.ts +96 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package-lock.json +579 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/index.cjs +53 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/index.mjs +55 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/package.json +18 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/agent.ts +659 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/package-lock.json +635 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/agent.ts +659 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/package-lock.json +553 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/agent.ts +877 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/mcp-server.mjs +66 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package-lock.json +6417 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/agent.ts +872 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/mcp-server.mjs +66 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package-lock.json +2540 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/actions.ts +18 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/ai/route.ts +42 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/edge/route.ts +29 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/langgraph/route.ts +21 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/llamaindex/route.ts +11 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/mastra/route.ts +19 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/status/route.ts +7 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/layout.tsx +9 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/page.tsx +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/instrumentation.ts +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/ai.ts +61 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/langgraph.ts +68 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/llamaindex.ts +98 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/mastra.ts +90 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/next.config.ts +52 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package-lock.json +4343 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package.json +28 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/agent.ts +51 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/deno-npm.ts +76 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/package-lock.json +484 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/types/agent.ts +79 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/types/package-lock.json +740 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/types/package.json +11 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/agent.ts +197 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/package-lock.json +70 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/package.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/global-setup.ts +29 -0
- package/.next/standalone/sdk/typescript/integration/harness.ts +451 -0
- package/.next/standalone/sdk/typescript/integration/langchain.test.ts +682 -0
- package/.next/standalone/sdk/typescript/integration/llamaindex.test.ts +709 -0
- package/.next/standalone/sdk/typescript/integration/mastra-coverage.test.ts +386 -0
- package/.next/standalone/sdk/typescript/integration/mastra.test.ts +311 -0
- package/.next/standalone/sdk/typescript/integration/nextjs.test.ts +341 -0
- package/.next/standalone/sdk/typescript/integration/runtime-parity.ts +180 -0
- package/.next/standalone/sdk/typescript/integration/runtimes.bun.test.ts +15 -0
- package/.next/standalone/sdk/typescript/integration/runtimes.core.test.ts +113 -0
- package/.next/standalone/sdk/typescript/integration/runtimes.deno.test.ts +19 -0
- package/.next/standalone/sdk/typescript/integration/types.test.ts +141 -0
- package/.next/standalone/sdk/typescript/integration/vanilla.test.ts +255 -0
- package/.next/standalone/sdk/typescript/package-lock.json +2640 -0
- package/.next/standalone/sdk/typescript/package.json +401 -0
- package/.next/standalone/sdk/typescript/scripts/finalize-build.mjs +123 -0
- package/.next/standalone/sdk/typescript/scripts/release.mjs +177 -0
- package/.next/standalone/sdk/typescript/src/clock.ts +58 -0
- package/.next/standalone/sdk/typescript/src/context.ts +214 -0
- package/.next/standalone/sdk/typescript/src/edge/adapter.ts +18 -0
- package/.next/standalone/sdk/typescript/src/edge/ai.ts +116 -0
- package/.next/standalone/sdk/typescript/src/edge/index.ts +238 -0
- package/.next/standalone/sdk/typescript/src/edge/langchain.ts +18 -0
- package/.next/standalone/sdk/typescript/src/edge/llamaindex.ts +12 -0
- package/.next/standalone/sdk/typescript/src/edge/mastra.ts +17 -0
- package/.next/standalone/sdk/typescript/src/edge/notice.ts +33 -0
- package/.next/standalone/sdk/typescript/src/environment.ts +75 -0
- package/.next/standalone/sdk/typescript/src/evaluator/authoring.ts +480 -0
- package/.next/standalone/sdk/typescript/src/evaluator/cli.ts +96 -0
- package/.next/standalone/sdk/typescript/src/evaluator/client.ts +421 -0
- package/.next/standalone/sdk/typescript/src/evaluator/expression.ts +1292 -0
- package/.next/standalone/sdk/typescript/src/evaluator/index.ts +144 -0
- package/.next/standalone/sdk/typescript/src/evaluator/protocol.ts +747 -0
- package/.next/standalone/sdk/typescript/src/evaluator/runtime.ts +930 -0
- package/.next/standalone/sdk/typescript/src/evaluator/sandbox-worker.ts +171 -0
- package/.next/standalone/sdk/typescript/src/evaluator/source-limits.ts +27 -0
- package/.next/standalone/sdk/typescript/src/evaluator/source.ts +509 -0
- package/.next/standalone/sdk/typescript/src/events.ts +879 -0
- package/.next/standalone/sdk/typescript/src/exit.ts +117 -0
- package/.next/standalone/sdk/typescript/src/index.ts +186 -0
- package/.next/standalone/sdk/typescript/src/integrations/ai.ts +1566 -0
- package/.next/standalone/sdk/typescript/src/integrations/compat.ts +322 -0
- package/.next/standalone/sdk/typescript/src/integrations/core.ts +1321 -0
- package/.next/standalone/sdk/typescript/src/integrations/index.ts +355 -0
- package/.next/standalone/sdk/typescript/src/integrations/langchain.ts +2340 -0
- package/.next/standalone/sdk/typescript/src/integrations/llamaindex.ts +2111 -0
- package/.next/standalone/sdk/typescript/src/integrations/mastra.ts +1802 -0
- package/.next/standalone/sdk/typescript/src/logger.ts +98 -0
- package/.next/standalone/sdk/typescript/src/next.ts +115 -0
- package/.next/standalone/sdk/typescript/src/node-require.ts +446 -0
- package/.next/standalone/sdk/typescript/src/redact.ts +305 -0
- package/.next/standalone/sdk/typescript/src/resolver.ts +120 -0
- package/.next/standalone/sdk/typescript/src/runtime.ts +29 -0
- package/.next/standalone/sdk/typescript/src/schema.ts +410 -0
- package/.next/standalone/sdk/typescript/src/scopes.ts +701 -0
- package/.next/standalone/sdk/typescript/src/shared.ts +33 -0
- package/.next/standalone/sdk/typescript/src/version.ts +5 -0
- package/.next/standalone/sdk/typescript/src/writer.ts +934 -0
- package/.next/standalone/sdk/typescript/test/adapters.test.ts +397 -0
- package/.next/standalone/sdk/typescript/test/ai.test.ts +1076 -0
- package/.next/standalone/sdk/typescript/test/copies.test.ts +204 -0
- package/.next/standalone/sdk/typescript/test/edge.test.ts +183 -0
- package/.next/standalone/sdk/typescript/test/evaluator-client.test.ts +234 -0
- package/.next/standalone/sdk/typescript/test/evaluator-protocol.test.ts +225 -0
- package/.next/standalone/sdk/typescript/test/events.test.ts +193 -0
- package/.next/standalone/sdk/typescript/test/expression.test.ts +181 -0
- package/.next/standalone/sdk/typescript/test/global-setup.ts +26 -0
- package/.next/standalone/sdk/typescript/test/helpers.ts +130 -0
- package/.next/standalone/sdk/typescript/test/integrations.test.ts +369 -0
- package/.next/standalone/sdk/typescript/test/langchain-copies.test.ts +204 -0
- package/.next/standalone/sdk/typescript/test/langchain.test.ts +999 -0
- package/.next/standalone/sdk/typescript/test/llamaindex.test.ts +1760 -0
- package/.next/standalone/sdk/typescript/test/mastra-coverage.test.ts +501 -0
- package/.next/standalone/sdk/typescript/test/mastra-lifecycle.test.ts +479 -0
- package/.next/standalone/sdk/typescript/test/mastra.test.ts +285 -0
- package/.next/standalone/sdk/typescript/test/next.test.ts +109 -0
- package/.next/standalone/sdk/typescript/test/packaging.test.ts +312 -0
- package/.next/standalone/sdk/typescript/test/redaction.test.ts +171 -0
- package/.next/standalone/sdk/typescript/test/runtimes.test.ts +101 -0
- package/.next/standalone/sdk/typescript/test/sandbox.test.ts +189 -0
- package/.next/standalone/sdk/typescript/test/scopes.test.ts +271 -0
- package/.next/standalone/sdk/typescript/test/setup.ts +19 -0
- package/.next/standalone/sdk/typescript/test/skill-snippets.test.ts +73 -0
- package/.next/standalone/sdk/typescript/test/spool-contract.test.ts +124 -0
- package/.next/standalone/sdk/typescript/test/tracker-bounds.test.ts +191 -0
- package/.next/standalone/sdk/typescript/test/wire-format.test.ts +214 -0
- package/.next/standalone/sdk/typescript/test/writer.test.ts +407 -0
- package/.next/standalone/sdk/typescript/tsconfig.build.json +15 -0
- package/.next/standalone/sdk/typescript/tsconfig.cjs.json +19 -0
- package/.next/standalone/sdk/typescript/tsconfig.json +28 -0
- package/.next/standalone/sdk/typescript/vitest.config.ts +33 -0
- package/.next/standalone/sdk/typescript/vitest.integration.config.ts +23 -0
- package/.next/standalone/server.js +1 -1
- package/README.md +2 -2
- package/dist/cli.mjs +208 -27
- package/dist/worker.mjs +120 -14
- package/package.json +10 -10
- package/scripts/build-policy-pack.mjs +14 -0
- package/src/audit/features.ts +3 -2
- package/src/hooks/builtin-policies.ts +156 -5
- package/src/hooks/jev-cli.ts +57 -1
- package/src/hooks/manager.ts +1 -1
- package/src/hooks/pack-cli.ts +150 -18
- package/src/hooks/pack-store.ts +1 -1
- package/src/hooks/policy-catalog.ts +148 -9
- package/src/hooks/types.ts +1 -1
- package/.next/standalone/.next/static/chunks/0cd-_8-c-m1ea.js +0 -6
- package/.next/standalone/.next/static/chunks/0qrbdkv9qmvli.js +0 -69
- package/.next/standalone/.next/static/chunks/0uldbut9y2-e8.js +0 -1
- package/.next/standalone/.next/static/chunks/285spx855h_3r.css +0 -2
- package/.next/standalone/.next/static/chunks/2vkvu9-opa_1z.js +0 -1
- package/.next/standalone/.next/static/chunks/37lhv7wa3ywt6.js +0 -1
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → gbEOjBgZAxF2UIUwZVHNu}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → gbEOjBgZAxF2UIUwZVHNu}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → gbEOjBgZAxF2UIUwZVHNu}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[4614,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("003cf8cf6fa84a66423a2f59b779aa93edfbd80bd4",d.callServer,void 0,d.findSourceMapURL,"getJevSettingsAction"),f=(0,d.createServerReference)("00dd0def23d79715a77049f83bd44d3e571a3f9e35",d.callServer,void 0,d.findSourceMapURL,"removeJevConfigAction"),g=(0,d.createServerReference)("403e29806edfbe288ff52c6c81371bd44545e988aa",d.callServer,void 0,d.findSourceMapURL,"saveJevConfigAction");var h=a.i(18952);let i=[{value:"typesafe",label:"typesafe"},{value:"openrouter",label:"openrouter"},{value:"vercel",label:"vercel ai gateway"},{value:"cloudflare",label:"cloudflare workers ai"},{value:"custom",label:"custom endpoint"}],j=[{value:"enforce",label:"enforce — jev's verdict counts"},{value:"shadow",label:"shadow — log only, regex decides"}];function k(a){return{provider:a.provider??"typesafe",baseUrl:a.baseUrl,accountId:a.accountId,mode:a.mode}}function l({id:a,label:c,hint:d,children:e}){return(0,b.jsxs)("div",{className:"set-field",children:[(0,b.jsx)("label",{className:"set-field-label",htmlFor:a,children:c}),e,d?(0,b.jsx)("span",{className:"set-hint",children:d}):null]})}a.s(["default",0,function({initial:a}){var d,m;let n,[o,p]=(0,c.useState)(a),[q,r]=(0,c.useState)(a?k(a):{provider:"typesafe",baseUrl:"",accountId:"",mode:"enforce"}),[s,t]=(0,c.useState)(""),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(null),[y,z]=(0,c.useState)(!1),A=(0,c.useRef)(!0),B=(0,c.useRef)(!1),C=(0,c.useCallback)(async()=>{try{let a=await e();if(!A.current)return;p(a),B.current||r(k(a))}catch{}},[]);(0,c.useEffect)(()=>(A.current=!0,C(),()=>{A.current=!1}),[C]),(0,c.useEffect)(()=>{let a=()=>void C();return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[C]);let D=(0,c.useCallback)((a,b)=>{B.current=!0,r(c=>({...c,[a]:b}))},[]),E=(0,c.useCallback)(async()=>{v(!0),x(null);try{let a=await g({provider:q.provider,baseUrl:q.baseUrl,accountId:q.accountId,mode:q.mode,token:s});if(!a.ok){x(a.problem),z(!0===a.needsToken);return}B.current=!1,z(!1),t(""),p(a.view),r(k(a.view)),(0,h.toast)(a.view.on?"jev is on.":"saved.")}catch{x("could not save that.")}finally{v(!1)}},[q,s]),F=(0,c.useCallback)(async()=>{v(!0),x(null),z(!1);try{let a=await f();if(!a.ok)return void x(a.problem);B.current=!1,t(""),p(a.view),r(k(a.view)),(0,h.toast)("jev is off. hooks run the regex policies.")}catch{x("could not turn that off.")}finally{v(!1)}},[]),G=null!==o&&"absent"!==o.status,H=o?.token,I=y?"needed for this save — type the token for this endpoint":H?"env"===H.source?"configured, read from the environment — leave blank to keep it":H.hint?`configured, ending ${H.hint} — leave blank to keep it`:"configured — leave blank to keep it":o?.status==="key-missing"?"read from the environment, which is not set in this shell — leave blank to keep it that way":"sent as a bearer token; stored owner-only at 0600";return(0,b.jsxs)("div",{className:"set-cell set-jev",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"jev · semantic evaluation"}),(0,b.jsx)("div",{className:"set-row set-row-main",children:(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:o?.on?"set-strong":"set-dim",children:null===o?"reading…":o.on?`on. every judged command is also asked of ${o.provider}.`:"off. hooks run the regex policies exactly as before."}),(0,b.jsx)("span",{className:"set-dim",children:o?.on?"shadow"===o.mode?"shadow: jev's answers are logged, the regex result is what gets enforced.":"enforce: jev's answers can clear a reviewable deny.":"a second opinion on the commands the regex policies flag. needs your own endpoint and token."})]})}),o&&G&&(0,b.jsxs)("dl",{className:"set-how-list",children:[o.endpoint&&(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"endpoint"}),(0,b.jsx)("dd",{className:"set-how-body",children:o.endpoint})]}),(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"model"}),(0,b.jsx)("dd",{className:"set-how-body",children:function(a){switch(a.kind){case"id":return a.id;case"withheld":return"set to something that is not a model id — not shown here, in case it is a key";default:return"the provider's default"}}(o.model)})]}),(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"token"}),(0,b.jsx)("dd",{className:"set-how-body",children:H?"env"===H.source?"from FAILPROOFAI_JEV_API_KEY":H.hint?`configured, ending ${H.hint}`:"configured":"none stored"})]}),o.permissions&&(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"file"}),(0,b.jsx)("dd",{className:"set-how-body",children:`${o.path} \xb7 ${o.permissions}`})]}),o.reviewable&&(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"reviewable"}),(0,b.jsx)("dd",{className:"set-how-body",children:o.reviewable.summary})]}),o.stats&&o.stats.total>0&&(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"fallbacks"}),(0,b.jsx)("dd",{className:"set-how-body",children:`${(d=o.stats.fallbackRate,`${Math.round(100*d)}%`)} of ${o.stats.total} calls in the last ${Number.isInteger(n=(m=o.stats.windowMs)/36e5)&&n>=1?n%24==0?`${n/24}d`:`${n}h`:`${Math.max(1,Math.round(m/6e4))}m`} fell back to the regex engine.`})]})]}),o?.problem&&(0,b.jsxs)("p",{className:"set-warn",children:[o.problem,o.fix?` — ${o.fix}`:""]}),o?.reviewable?.problem&&(0,b.jsx)("p",{className:"set-warn",children:o.reviewable.problem}),(0,b.jsx)("div",{className:"set-rule"}),(0,b.jsxs)("div",{className:"set-jev-fields",children:[(0,b.jsx)(l,{id:"jev-provider",label:"provider",children:(0,b.jsx)("select",{id:"jev-provider",className:"set-select",value:q.provider,disabled:u,onChange:a=>D("provider",a.target.value),children:i.map(a=>(0,b.jsx)("option",{value:a.value,children:a.label},a.value))})}),(0,b.jsx)(l,{id:"jev-url",label:"endpoint url",hint:"custom"===q.provider?"required — https, or http to localhost in shadow mode":"leave blank for the provider's own api",children:(0,b.jsx)("input",{id:"jev-url",type:"text",className:"set-text",inputMode:"url",autoComplete:"off",spellCheck:!1,placeholder:"custom"===q.provider?"https://…":"the provider's own api",value:q.baseUrl,disabled:u,onChange:a=>D("baseUrl",a.target.value)})}),"cloudflare"===q.provider&&(0,b.jsx)(l,{id:"jev-account",label:"account id",hint:"32 lowercase hex characters",children:(0,b.jsx)("input",{id:"jev-account",type:"text",className:"set-text",autoComplete:"off",spellCheck:!1,value:q.accountId,disabled:u,onChange:a=>D("accountId",a.target.value)})}),(0,b.jsx)(l,{id:"jev-token",label:"token",hint:I,children:(0,b.jsx)("input",{id:"jev-token",type:"password",className:"set-text",autoComplete:"off",spellCheck:!1,placeholder:H?"•••• kept":"",value:s,disabled:u,"aria-invalid":y||void 0,onChange:a=>{B.current=!0,t(a.target.value)}})}),(0,b.jsx)(l,{id:"jev-mode",label:"mode",children:(0,b.jsx)("select",{id:"jev-mode",className:"set-select",value:q.mode,disabled:u,onChange:a=>D("mode",a.target.value),children:j.map(a=>(0,b.jsx)("option",{value:a.value,children:a.label},a.value))})})]}),w&&(0,b.jsx)("p",{className:"set-warn",children:w}),(0,b.jsxs)("div",{className:"set-actions set-jev-actions",children:[(0,b.jsx)("button",{type:"button",className:"btn btn-press",disabled:u,onClick:()=>void E(),children:u?"[ saving… ]":G?"[ save changes ]":"[ turn jev on ]"}),G&&(0,b.jsx)("button",{type:"button",className:"set-link",disabled:u,onClick:()=>void F(),children:"turn jev off"})]})]})}],4614)},41857,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("002eb5166525ca4405347da654e6c3feb16e203ec5",d.callServer,void 0,d.findSourceMapURL,"getScheduledAuditAction"),f=(0,d.createServerReference)("4077a262ce50f7cbcf3025517e5801a9e3c7ec0a44",d.callServer,void 0,d.findSourceMapURL,"setAutoAuditAction"),g=(0,d.createServerReference)("401bab636c01ff92a891caacddd8f29f62aa73ddec",d.callServer,void 0,d.findSourceMapURL,"setAuditIntervalAction");var h=a.i(89564),i=a.i(4543),j=a.i(18952),k=a.i(80977);function l(a){return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function m(a,b){let c=a-b;if(c<=0)return"now";let d=Math.floor(c/864e5),e=Math.floor(c%864e5/36e5);return d>0?e>0?`${d}d ${e}h`:`${d}d`:e>0?`${e}h`:`${Math.max(1,Math.floor(c/6e4))}m`}function n(a){return a.toLocaleString("en-US")}function o({label:a,value:c,sub:d,tone:e}){return(0,b.jsxs)("div",{className:"set-stat",children:[(0,b.jsx)("div",{className:"set-stat-label",children:a}),(0,b.jsx)("div",{className:`set-stat-value${e?` ${e}`:""}`,children:c}),(0,b.jsx)("div",{className:"set-stat-sub",children:d??" "})]})}function p({lastRunAtMs:a,nextDueAtMs:c,now:d}){if(null==a||null==c||c<=a)return null;let e=Math.min(100,Math.max(0,(d-a)/(c-a)*100));return(0,b.jsxs)("div",{className:"tape","aria-hidden":"true",children:[(0,b.jsxs)("div",{className:"tape-rail",children:[(0,b.jsx)("div",{className:"tape-fill",style:{width:`${e}%`}}),(0,b.jsx)("div",{className:"tape-now",style:{left:`${e}%`}})]}),(0,b.jsxs)("div",{className:"tape-ends",children:[(0,b.jsxs)("span",{children:["last scan · ",l(a)]}),(0,b.jsxs)("span",{className:"tape-next",children:["next · ",m(c,d)]})]})]})}function q({enabled:a,onChange:c,disabled:d,label:e}){return(0,b.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-label":e,disabled:d,onClick:c,className:"sw","data-on":a?"true":"false",children:(0,b.jsx)("span",{className:"sw-knob"})})}let r=[{label:"reads",body:"every session transcript on disk — your prompts, the files your agents read and wrote, and command output."},{label:"runs",body:"entirely on this machine. the transcripts never leave it."},{label:"sends",body:"counts, redacted examples, and this machine's name — and only when a scan finds something harmful."}];a.s(["default",0,function({initial:a,jevPanel:d}){let[s,t]=(0,c.useState)(a),[u,v]=(0,c.useState)(a?.auto??!1),[w,x]=(0,c.useState)(a?.intervalDays??7),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(null===a),[G,H]=(0,c.useState)(0),I=(0,c.useRef)(!0),J=(0,c.useRef)(null!==a),K=(0,c.useCallback)(async()=>{try{let a=await e();if(!I.current)return;t(a),J.current=!0,v(a.auto),x(a.intervalDays),H(Date.now()),F(!1)}catch{I.current&&!J.current&&F(!0)}},[]);(0,c.useEffect)(()=>(I.current=!0,K(),()=>{I.current=!1}),[K]),(0,c.useEffect)(()=>{let a=()=>void K();return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[K]);let L=s?.signedInAs??null,M=s?.daemon==="running",N=s?.daemon==="unsupported-platform",O=s?.schedule??null,P=s?.lastScan??null,Q=O?.lastExitCode!=null&&0!==O.lastExitCode&&75!==O.lastExitCode,R=(0,c.useCallback)(async()=>{z(!0);try{let a=await f(!0);if(!a.ok){if(v(!1),"unreachable"===a.reason)return void(0,j.toast)("could not reach the server. check your connection and try again.");await K(),D(!0),(0,j.toast)("that sign-in expired. one more code and it's on.");return}v(a.auto),(0,j.toast)("scheduled audits on."),await K()}catch{v(!1),(0,j.toast)("could not turn that on.")}finally{z(!1)}},[K]),S=(0,c.useCallback)(async()=>{if(u){z(!0);try{let a=await f(!1);a.ok&&v(a.auto),(0,j.toast)("scheduled audits off."),await K()}catch{(0,j.toast)("could not turn that off.")}finally{z(!1)}return}L?await R():D(!0)},[u,R,K,L]),T=(0,c.useCallback)(async a=>{z(!0);try{let b=await g(a);x(b.intervalDays),t(a=>a?{...a,intervalDays:b.intervalDays}:a),(0,j.toast)(`scanning every ${b.intervalDays} day${1===b.intervalDays?"":"s"}.`)}catch{x(s?.intervalDays??7),(0,j.toast)("could not save that.")}finally{z(!1)}},[s?.intervalDays]),U=(0,c.useCallback)(async()=>{z(!0);try{await fetch("/api/auth/logout",{method:"POST"}),(0,j.toast)("signed out. scans continue; digests pause."),await K()}catch{(0,j.toast)("could not sign out.")}finally{z(!1)}},[K]),V=(0,c.useCallback)(async()=>{if(!A){B(!0);try{await (0,h.triggerRun)({cli:[],since:"all",noCache:!1}),(0,j.toast)("scan complete."),await K()}catch(a){(0,j.toast)(a instanceof h.RerunError&&"timeout"===a.kind?"the scan is taking a while — it will finish in the background.":"the scan could not be completed.")}finally{B(!1)}}},[K,A]),W=(0,c.useCallback)(async a=>{D(!1),await K(),await R()},[R,K]),X=s?M?{value:"running",sub:null!=s.daemonStartedAtMs&&G>0?`up ${function(a){let b=Math.floor(a/864e5);if(b>0)return`${b}d`;let c=Math.floor(a/36e5);return c>0?`${c}h`:`${Math.max(1,Math.floor(a/6e4))}m`}(Math.max(0,G-s.daemonStartedAtMs))}`:"",tone:"ok"}:N?{value:"unavailable",sub:"not on this platform"}:"not-installed"===s.daemon?{value:"not installed",sub:"run failproofai config",tone:"warn"}:"unknown"===s.daemon?{value:"unknown",sub:"could not read it"}:{value:"stopped",sub:"run failproofai config",tone:"warn"}:{value:"…",sub:"reading"},Y=u?O?.nextDueAtMs==null?{value:"pending",sub:"after the next scan"}:{value:G>0?m(O.nextDueAtMs,G):"—",sub:l(O.nextDueAtMs)}:{value:"off",sub:"nothing scheduled"},Z=P?{value:(0,k.formatRelativeTime)(Date.parse(P.finishedAt)),sub:null!=P.sessionsScanned?`${n(P.sessionsScanned)} sessions`:"scanned"}:{value:"none yet",sub:"run one below"},$=P?null==P.findings?{value:"—",sub:"unreadable"}:{value:n(P.findings),sub:"this scan",...P.findings>0?{tone:"warn"}:{}}:{value:"—",sub:"no scan yet"};return(0,b.jsxs)("main",{className:"report",children:[(0,b.jsxs)("section",{className:"section set-sec",children:[(0,b.jsxs)("div",{className:"set-mast",children:[(0,b.jsx)("h1",{className:"set-title",children:"settings"}),(0,b.jsx)("p",{className:"set-lede",children:"keeping watch, so you don't have to."})]}),E?(0,b.jsxs)("div",{className:"set-console",children:[(0,b.jsx)("div",{className:"set-cell",children:(0,b.jsxs)("p",{className:"set-warn",children:["could not read this machine's settings. check that the dashboard can reach ",(0,b.jsx)("code",{children:"~/.failproofai/config.json"}),"."]})}),d]}):(0,b.jsxs)("div",{className:"set-console",children:[(0,b.jsxs)("div",{className:"set-stats",children:[(0,b.jsx)(o,{label:"daemon",...X}),(0,b.jsx)(o,{label:"next scan",...Y}),(0,b.jsx)(o,{label:"last scan",...Z}),(0,b.jsx)(o,{label:"findings",...$})]}),(0,b.jsxs)("div",{className:"set-cols",children:[(0,b.jsxs)("div",{className:"set-cell set-config",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"scheduled audit"}),(0,b.jsxs)("div",{className:"set-row set-row-main",children:[(0,b.jsx)(q,{enabled:u,disabled:y||null===s,onChange:()=>void S(),label:u?"turn off scheduled audits":"turn on scheduled audits"}),(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:"set-strong",children:u?"scanning on a schedule.":"scan on a schedule."}),(0,b.jsx)("span",{className:"set-dim",children:u?"you'll get an email only when a scan finds something.":"off. nothing runs and nothing is sent."})]})]}),(0,b.jsxs)("div",{className:"set-row set-row-interval",children:[(0,b.jsx)("span",{className:"set-dim",children:"scan every"}),(0,b.jsx)("input",{type:"number",className:"set-num",min:1,max:90,value:w,disabled:y||null===s,"aria-label":"days between scheduled scans",onChange:a=>x(Number(a.target.value)),onBlur:a=>{let b=Number(a.target.value);Number.isFinite(b)?b!==s?.intervalDays&&T(b):x(s?.intervalDays??7)}}),(0,b.jsx)("span",{className:"set-dim",children:"days"}),(0,b.jsxs)("span",{className:"set-hint",children:[1,"–",90]})]}),(0,b.jsx)("div",{className:"set-rule"}),(0,b.jsx)("div",{className:"set-row set-row-identity",children:L?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-dim",children:"reports go to"}),(0,b.jsx)("span",{className:"set-email",children:L.email}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:y,onClick:()=>void U(),children:"sign out"})]}):u?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-warn",children:"signed out — scans continue, digests are paused."}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:y,onClick:()=>D(!0),children:"sign in to resume"})]}):(0,b.jsx)("span",{className:"set-dim",children:"turning this on asks for an email, so there is somewhere to send the report."})}),u&&s&&!M&&(0,b.jsx)("p",{className:"set-warn",children:N?"the background service isn't available on this platform, so scheduled scans can't run here. you can still run one now.":"not-installed"===s.daemon?"the background service isn't installed, so nothing will run on the timer. install it with `failproofai config`.":"the background service is stopped, so nothing will run until it starts. repair it with `failproofai config`."}),Q&&(0,b.jsxs)("p",{className:"set-warn",children:["the last scheduled scan exited ",O?.lastExitCode,". the next one will still run."]}),(0,b.jsx)("div",{className:"set-actions",children:(0,b.jsx)("button",{type:"button",className:"btn btn-press",disabled:A,onClick:()=>void V(),children:A?"[ scanning… ]":"[ run a scan now ]"})})]}),(0,b.jsxs)("div",{className:"set-cell set-how",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"how it works"}),(0,b.jsx)("dl",{className:"set-how-list",children:r.map(a=>(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:a.label}),(0,b.jsx)("dd",{className:"set-how-body",children:a.body})]},a.label))})]})]}),d]}),u&&G>0&&(0,b.jsx)(p,{lastRunAtMs:O?.lastRunAtMs??null,nextDueAtMs:O?.nextDueAtMs??null,now:G})]}),(0,b.jsx)(i.AuthDialog,{open:C,source:"settings_scheduled_audit",headline:"where should the report go?",subhead:"we'll send a one-time code to confirm.",onClose:()=>D(!1),onAuthed:a=>void W(a)})]})}],41857)}];
|
|
1
|
+
module.exports=[4614,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("009f2c356e1ecca672488e0a9ca9d91805e10452d4",d.callServer,void 0,d.findSourceMapURL,"getJevSettingsAction"),f=(0,d.createServerReference)("00c9b97719a27a14474dc2c1d948426fe0411c114d",d.callServer,void 0,d.findSourceMapURL,"removeJevConfigAction"),g=(0,d.createServerReference)("400ac0bee03c66df8951bd0aa5500863fda9e57e42",d.callServer,void 0,d.findSourceMapURL,"saveJevConfigAction");var h=a.i(18952);let i=[{value:"typesafe",label:"typesafe"},{value:"openrouter",label:"openrouter"},{value:"vercel",label:"vercel ai gateway"},{value:"cloudflare",label:"cloudflare workers ai"},{value:"custom",label:"custom endpoint"}],j=[{value:"enforce",label:"enforce — jev's verdict counts"},{value:"shadow",label:"shadow — log only, regex decides"}];function k(a){return{provider:a.provider??"typesafe",baseUrl:a.baseUrl,accountId:a.accountId,mode:a.mode}}function l({id:a,label:c,hint:d,children:e}){return(0,b.jsxs)("div",{className:"set-field",children:[(0,b.jsx)("label",{className:"set-field-label",htmlFor:a,children:c}),e,d?(0,b.jsx)("span",{className:"set-hint",children:d}):null]})}a.s(["default",0,function({initial:a}){var d,m;let n,[o,p]=(0,c.useState)(a),[q,r]=(0,c.useState)(a?k(a):{provider:"typesafe",baseUrl:"",accountId:"",mode:"enforce"}),[s,t]=(0,c.useState)(""),[u,v]=(0,c.useState)(!1),[w,x]=(0,c.useState)(null),[y,z]=(0,c.useState)(!1),A=(0,c.useRef)(!0),B=(0,c.useRef)(!1),C=(0,c.useCallback)(async()=>{try{let a=await e();if(!A.current)return;p(a),B.current||r(k(a))}catch{}},[]);(0,c.useEffect)(()=>(A.current=!0,C(),()=>{A.current=!1}),[C]),(0,c.useEffect)(()=>{let a=()=>void C();return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[C]);let D=(0,c.useCallback)((a,b)=>{B.current=!0,r(c=>({...c,[a]:b}))},[]),E=(0,c.useCallback)(async()=>{v(!0),x(null);try{let a=await g({provider:q.provider,baseUrl:q.baseUrl,accountId:q.accountId,mode:q.mode,token:s});if(!a.ok){x(a.problem),z(!0===a.needsToken);return}B.current=!1,z(!1),t(""),p(a.view),r(k(a.view)),(0,h.toast)(a.view.on?"jev is on.":"saved.")}catch{x("could not save that.")}finally{v(!1)}},[q,s]),F=(0,c.useCallback)(async()=>{v(!0),x(null),z(!1);try{let a=await f();if(!a.ok)return void x(a.problem);B.current=!1,t(""),p(a.view),r(k(a.view)),(0,h.toast)("jev is off. hooks run the regex policies.")}catch{x("could not turn that off.")}finally{v(!1)}},[]),G=null!==o&&"absent"!==o.status,H=o?.token,I=y?"needed for this save — type the token for this endpoint":H?"env"===H.source?"configured, read from the environment — leave blank to keep it":"configured — leave blank to keep it":o?.status==="key-missing"?"read from the environment, which is not set in this shell — leave blank to keep it that way":"sent as a bearer token; stored owner-only at 0600";return(0,b.jsxs)("div",{className:"set-cell set-jev",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"jev · semantic evaluation"}),(0,b.jsx)("div",{className:"set-row set-row-main",children:(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:o?.on?"set-strong":"set-dim",children:null===o?"reading…":o.on?`on. every judged command is also asked of ${o.provider}.`:"off. hooks run the regex policies exactly as before."}),(0,b.jsx)("span",{className:"set-dim",children:o?.on?"shadow"===o.mode?"shadow: jev's answers are logged, the regex result is what gets enforced.":"enforce: jev's answers can clear a reviewable deny.":"a second opinion on the commands the regex policies flag. needs your own endpoint and token."})]})}),o&&G&&(0,b.jsxs)("dl",{className:"set-how-list",children:[(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"model"}),(0,b.jsx)("dd",{className:"set-how-body",children:function(a){switch(a.kind){case"id":return a.id;case"withheld":return"set to something that is not a model id — not shown here, in case it is a key";default:return"the provider's default"}}(o.model)})]}),(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"token"}),(0,b.jsx)("dd",{className:"set-how-body",children:H?"env"===H.source?"from FAILPROOFAI_JEV_API_KEY":"configured":"none stored"})]}),o.reviewable&&(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"reviewable"}),(0,b.jsx)("dd",{className:"set-how-body",children:o.reviewable.summary})]}),o.stats&&o.stats.total>0&&(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:"fallbacks"}),(0,b.jsx)("dd",{className:"set-how-body",children:`${(d=o.stats.fallbackRate,`${Math.round(100*d)}%`)} of ${o.stats.total} calls in the last ${Number.isInteger(n=(m=o.stats.windowMs)/36e5)&&n>=1?n%24==0?`${n/24}d`:`${n}h`:`${Math.max(1,Math.round(m/6e4))}m`} fell back to the regex engine.`})]})]}),o?.problem&&(0,b.jsxs)("p",{className:"set-warn",children:[o.problem,o.fix?` — ${o.fix}`:""]}),o?.reviewable?.problem&&(0,b.jsx)("p",{className:"set-warn",children:o.reviewable.problem}),(0,b.jsx)("div",{className:"set-rule"}),(0,b.jsxs)("div",{className:"set-jev-fields",children:[(0,b.jsx)(l,{id:"jev-provider",label:"provider",children:(0,b.jsx)("select",{id:"jev-provider",className:"set-select",value:q.provider,disabled:u,onChange:a=>D("provider",a.target.value),children:i.map(a=>(0,b.jsx)("option",{value:a.value,children:a.label},a.value))})}),(0,b.jsx)(l,{id:"jev-url",label:"endpoint url",hint:"custom"===q.provider?"required — https, or http to localhost in shadow mode":"leave blank for the provider's own api",children:(0,b.jsx)("input",{id:"jev-url",type:"text",className:"set-text",inputMode:"url",autoComplete:"off",spellCheck:!1,placeholder:"custom"===q.provider?"https://…":"the provider's own api",value:q.baseUrl,disabled:u,onChange:a=>D("baseUrl",a.target.value)})}),"cloudflare"===q.provider&&(0,b.jsx)(l,{id:"jev-account",label:"account id",hint:"32 lowercase hex characters",children:(0,b.jsx)("input",{id:"jev-account",type:"text",className:"set-text",autoComplete:"off",spellCheck:!1,value:q.accountId,disabled:u,onChange:a=>D("accountId",a.target.value)})}),(0,b.jsx)(l,{id:"jev-token",label:"token",hint:I,children:(0,b.jsx)("input",{id:"jev-token",type:"password",className:"set-text",autoComplete:"off",spellCheck:!1,placeholder:H?"•••• kept":"",value:s,disabled:u,"aria-invalid":y||void 0,onChange:a=>{B.current=!0,t(a.target.value)}})}),(0,b.jsx)(l,{id:"jev-mode",label:"mode",children:(0,b.jsx)("select",{id:"jev-mode",className:"set-select",value:q.mode,disabled:u,onChange:a=>D("mode",a.target.value),children:j.map(a=>(0,b.jsx)("option",{value:a.value,children:a.label},a.value))})})]}),w&&(0,b.jsx)("p",{className:"set-warn",children:w}),(0,b.jsxs)("div",{className:"set-actions set-jev-actions",children:[(0,b.jsx)("button",{type:"button",className:"btn btn-press",disabled:u,onClick:()=>void E(),children:u?"[ saving… ]":G?"[ save changes ]":"[ turn jev on ]"}),G&&(0,b.jsx)("button",{type:"button",className:"set-link",disabled:u,onClick:()=>void F(),children:"turn jev off"})]})]})}],4614)},41857,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(5050);let e=(0,d.createServerReference)("004a676a7a4e57ef48e450b3f16b70a9779118a86f",d.callServer,void 0,d.findSourceMapURL,"getScheduledAuditAction"),f=(0,d.createServerReference)("4029ec9fd2b24afbeb7afa249dcdb17c2ad3b3ab8a",d.callServer,void 0,d.findSourceMapURL,"setAutoAuditAction"),g=(0,d.createServerReference)("40e8703df45b812ed671fe405568c16f1c092ff4f5",d.callServer,void 0,d.findSourceMapURL,"setAuditIntervalAction");var h=a.i(89564),i=a.i(4543),j=a.i(18952),k=a.i(80977);function l(a){return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function m(a,b){let c=a-b;if(c<=0)return"now";let d=Math.floor(c/864e5),e=Math.floor(c%864e5/36e5);return d>0?e>0?`${d}d ${e}h`:`${d}d`:e>0?`${e}h`:`${Math.max(1,Math.floor(c/6e4))}m`}function n(a){return a.toLocaleString("en-US")}function o({label:a,value:c,sub:d,tone:e}){return(0,b.jsxs)("div",{className:"set-stat",children:[(0,b.jsx)("div",{className:"set-stat-label",children:a}),(0,b.jsx)("div",{className:`set-stat-value${e?` ${e}`:""}`,children:c}),(0,b.jsx)("div",{className:"set-stat-sub",children:d??" "})]})}function p({lastRunAtMs:a,nextDueAtMs:c,now:d}){if(null==a||null==c||c<=a)return null;let e=Math.min(100,Math.max(0,(d-a)/(c-a)*100));return(0,b.jsxs)("div",{className:"tape","aria-hidden":"true",children:[(0,b.jsxs)("div",{className:"tape-rail",children:[(0,b.jsx)("div",{className:"tape-fill",style:{width:`${e}%`}}),(0,b.jsx)("div",{className:"tape-now",style:{left:`${e}%`}})]}),(0,b.jsxs)("div",{className:"tape-ends",children:[(0,b.jsxs)("span",{children:["last scan · ",l(a)]}),(0,b.jsxs)("span",{className:"tape-next",children:["next · ",m(c,d)]})]})]})}function q({enabled:a,onChange:c,disabled:d,label:e}){return(0,b.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-label":e,disabled:d,onClick:c,className:"sw","data-on":a?"true":"false",children:(0,b.jsx)("span",{className:"sw-knob"})})}let r=[{label:"reads",body:"every session transcript on disk — your prompts, the files your agents read and wrote, and command output."},{label:"runs",body:"entirely on this machine. the transcripts never leave it."},{label:"sends",body:"counts, redacted examples, and this machine's name — and only when a scan finds something harmful."}];a.s(["default",0,function({initial:a,jevPanel:d}){let[s,t]=(0,c.useState)(a),[u,v]=(0,c.useState)(a?.auto??!1),[w,x]=(0,c.useState)(a?.intervalDays??7),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(null===a),[G,H]=(0,c.useState)(0),I=(0,c.useRef)(!0),J=(0,c.useRef)(null!==a),K=(0,c.useCallback)(async()=>{try{let a=await e();if(!I.current)return;t(a),J.current=!0,v(a.auto),x(a.intervalDays),H(Date.now()),F(!1)}catch{I.current&&!J.current&&F(!0)}},[]);(0,c.useEffect)(()=>(I.current=!0,K(),()=>{I.current=!1}),[K]),(0,c.useEffect)(()=>{let a=()=>void K();return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[K]);let L=s?.signedInAs??null,M=s?.daemon==="running",N=s?.daemon==="unsupported-platform",O=s?.schedule??null,P=s?.lastScan??null,Q=O?.lastExitCode!=null&&0!==O.lastExitCode&&75!==O.lastExitCode,R=(0,c.useCallback)(async()=>{z(!0);try{let a=await f(!0);if(!a.ok){if(v(!1),"unreachable"===a.reason)return void(0,j.toast)("could not reach the server. check your connection and try again.");await K(),D(!0),(0,j.toast)("that sign-in expired. one more code and it's on.");return}v(a.auto),(0,j.toast)("scheduled audits on."),await K()}catch{v(!1),(0,j.toast)("could not turn that on.")}finally{z(!1)}},[K]),S=(0,c.useCallback)(async()=>{if(u){z(!0);try{let a=await f(!1);a.ok&&v(a.auto),(0,j.toast)("scheduled audits off."),await K()}catch{(0,j.toast)("could not turn that off.")}finally{z(!1)}return}L?await R():D(!0)},[u,R,K,L]),T=(0,c.useCallback)(async a=>{z(!0);try{let b=await g(a);x(b.intervalDays),t(a=>a?{...a,intervalDays:b.intervalDays}:a),(0,j.toast)(`scanning every ${b.intervalDays} day${1===b.intervalDays?"":"s"}.`)}catch{x(s?.intervalDays??7),(0,j.toast)("could not save that.")}finally{z(!1)}},[s?.intervalDays]),U=(0,c.useCallback)(async()=>{z(!0);try{await fetch("/api/auth/logout",{method:"POST"}),(0,j.toast)("signed out. scans continue; digests pause."),await K()}catch{(0,j.toast)("could not sign out.")}finally{z(!1)}},[K]),V=(0,c.useCallback)(async()=>{if(!A){B(!0);try{await (0,h.triggerRun)({cli:[],since:"all",noCache:!1}),(0,j.toast)("scan complete."),await K()}catch(a){(0,j.toast)(a instanceof h.RerunError&&"timeout"===a.kind?"the scan is taking a while — it will finish in the background.":"the scan could not be completed.")}finally{B(!1)}}},[K,A]),W=(0,c.useCallback)(async a=>{D(!1),await K(),await R()},[R,K]),X=s?M?{value:"running",sub:null!=s.daemonStartedAtMs&&G>0?`up ${function(a){let b=Math.floor(a/864e5);if(b>0)return`${b}d`;let c=Math.floor(a/36e5);return c>0?`${c}h`:`${Math.max(1,Math.floor(a/6e4))}m`}(Math.max(0,G-s.daemonStartedAtMs))}`:"",tone:"ok"}:N?{value:"unavailable",sub:"not on this platform"}:"not-installed"===s.daemon?{value:"not installed",sub:"run failproofai config",tone:"warn"}:"unknown"===s.daemon?{value:"unknown",sub:"could not read it"}:{value:"stopped",sub:"run failproofai config",tone:"warn"}:{value:"…",sub:"reading"},Y=u?O?.nextDueAtMs==null?{value:"pending",sub:"after the next scan"}:{value:G>0?m(O.nextDueAtMs,G):"—",sub:l(O.nextDueAtMs)}:{value:"off",sub:"nothing scheduled"},Z=P?{value:(0,k.formatRelativeTime)(Date.parse(P.finishedAt)),sub:null!=P.sessionsScanned?`${n(P.sessionsScanned)} sessions`:"scanned"}:{value:"none yet",sub:"run one below"},$=P?null==P.findings?{value:"—",sub:"unreadable"}:{value:n(P.findings),sub:"this scan",...P.findings>0?{tone:"warn"}:{}}:{value:"—",sub:"no scan yet"};return(0,b.jsxs)("main",{className:"report",children:[(0,b.jsxs)("section",{className:"section set-sec",children:[(0,b.jsxs)("div",{className:"set-mast",children:[(0,b.jsx)("h1",{className:"set-title",children:"settings"}),(0,b.jsx)("p",{className:"set-lede",children:"keeping watch, so you don't have to."})]}),E?(0,b.jsxs)("div",{className:"set-console",children:[(0,b.jsx)("div",{className:"set-cell",children:(0,b.jsxs)("p",{className:"set-warn",children:["could not read this machine's settings. check that the dashboard can reach ",(0,b.jsx)("code",{children:"~/.failproofai/config.json"}),"."]})}),d]}):(0,b.jsxs)("div",{className:"set-console",children:[(0,b.jsxs)("div",{className:"set-stats",children:[(0,b.jsx)(o,{label:"daemon",...X}),(0,b.jsx)(o,{label:"next scan",...Y}),(0,b.jsx)(o,{label:"last scan",...Z}),(0,b.jsx)(o,{label:"findings",...$})]}),(0,b.jsxs)("div",{className:"set-cols",children:[(0,b.jsxs)("div",{className:"set-cell set-config",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"scheduled audit"}),(0,b.jsxs)("div",{className:"set-row set-row-main",children:[(0,b.jsx)(q,{enabled:u,disabled:y||null===s,onChange:()=>void S(),label:u?"turn off scheduled audits":"turn on scheduled audits"}),(0,b.jsxs)("div",{className:"set-row-copy",children:[(0,b.jsx)("span",{className:"set-strong",children:u?"scanning on a schedule.":"scan on a schedule."}),(0,b.jsx)("span",{className:"set-dim",children:u?"you'll get an email only when a scan finds something.":"off. nothing runs and nothing is sent."})]})]}),(0,b.jsxs)("div",{className:"set-row set-row-interval",children:[(0,b.jsx)("span",{className:"set-dim",children:"scan every"}),(0,b.jsx)("input",{type:"number",className:"set-num",min:1,max:90,value:w,disabled:y||null===s,"aria-label":"days between scheduled scans",onChange:a=>x(Number(a.target.value)),onBlur:a=>{let b=Number(a.target.value);Number.isFinite(b)?b!==s?.intervalDays&&T(b):x(s?.intervalDays??7)}}),(0,b.jsx)("span",{className:"set-dim",children:"days"}),(0,b.jsxs)("span",{className:"set-hint",children:[1,"–",90]})]}),(0,b.jsx)("div",{className:"set-rule"}),(0,b.jsx)("div",{className:"set-row set-row-identity",children:L?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-dim",children:"reports go to"}),(0,b.jsx)("span",{className:"set-email",children:L.email}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:y,onClick:()=>void U(),children:"sign out"})]}):u?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"set-warn",children:"signed out — scans continue, digests are paused."}),(0,b.jsx)("button",{type:"button",className:"set-link",disabled:y,onClick:()=>D(!0),children:"sign in to resume"})]}):(0,b.jsx)("span",{className:"set-dim",children:"turning this on asks for an email, so there is somewhere to send the report."})}),u&&s&&!M&&(0,b.jsx)("p",{className:"set-warn",children:N?"the background service isn't available on this platform, so scheduled scans can't run here. you can still run one now.":"not-installed"===s.daemon?"the background service isn't installed, so nothing will run on the timer. install it with `failproofai config`.":"the background service is stopped, so nothing will run until it starts. repair it with `failproofai config`."}),Q&&(0,b.jsxs)("p",{className:"set-warn",children:["the last scheduled scan exited ",O?.lastExitCode,". the next one will still run."]}),(0,b.jsx)("div",{className:"set-actions",children:(0,b.jsx)("button",{type:"button",className:"btn btn-press",disabled:A,onClick:()=>void V(),children:A?"[ scanning… ]":"[ run a scan now ]"})})]}),(0,b.jsxs)("div",{className:"set-cell set-how",children:[(0,b.jsx)("h2",{className:"set-cell-title",children:"how it works"}),(0,b.jsx)("dl",{className:"set-how-list",children:r.map(a=>(0,b.jsxs)("div",{className:"set-how-row",children:[(0,b.jsx)("dt",{className:"set-how-label",children:a.label}),(0,b.jsx)("dd",{className:"set-how-body",children:a.body})]},a.label))})]})]}),d]}),u&&G>0&&(0,b.jsx)(p,{lastRunAtMs:O?.lastRunAtMs??null,nextDueAtMs:O?.nextDueAtMs??null,now:G})]}),(0,b.jsx)(i.AuthDialog,{open:C,source:"settings_scheduled_audit",headline:"where should the report go?",subhead:"we'll send a one-time code to confirm.",onClose:()=>D(!1),onAuthed:a=>void W(a)})]})}],41857)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_settings_02tf1h4._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[9909,89790,48630,a=>{"use strict";var b=a.i(66680),c=a.i(2157),d=a.i(50227),e=a.i(12072),f=a.i(75818),g=a.i(91609);let h=[1,2],i=/^[a-f0-9]{64}$/,j=/^[A-Za-z0-9._-]{1,128}$/;function k(a,b){if(!b||(0,d.isAbsolute)(b))throw Error(`unsafe managed policy path ${JSON.stringify(b)}`);let e=(0,d.resolve)(a,b),f=(0,d.relative)(a,e);if(f.startsWith("..")||(0,d.isAbsolute)(f))throw Error(`managed policy path escapes its root: ${JSON.stringify(b)}`);let g=(0,c.realpathSync)(a),h=(0,c.realpathSync)(e),i=(0,d.relative)(g,h);if(i.startsWith("..")||(0,d.isAbsolute)(i))throw Error(`managed policy symlink escapes its root: ${JSON.stringify(b)}`);return h}a.s(["readActiveCloudManagedPolicies",0,function(){let a,e=process.env.FAILPROOFAI_CLOUD_POLICY_DIR??(0,f.cloudPoliciesDir)(),l=(0,d.resolve)(e,"active.json");if(!(0,c.existsSync)(l))return[];try{a=JSON.parse((0,c.readFileSync)(l,"utf8"))}catch(a){throw Error(`failed to read cloud-managed active manifest: ${a instanceof Error?a.message:String(a)}`)}let m=function(a){if(!a||"object"!=typeof a)throw Error("active manifest is not an object");if(!h.includes(a.schemaVersion))throw Error(`unsupported active manifest schema ${String(a.schemaVersion)} (supported: ${h.join(", ")})`);let b=a.deployment??a.generation;if(!Number.isSafeInteger(b)||(b??-1)<0)throw Error("active manifest deployment is invalid");if(!Array.isArray(a.policies))throw Error("active manifest policies is not an array");let c=a.policies.map(a=>({...a,version:a.version??a.revision}));return{schemaVersion:a.schemaVersion,deployment:b,policies:c}}(a),n=new Set;return m.policies.map(a=>{if(!j.test(a.id)||"."===a.id||".."===a.id)throw Error(`unsafe cloud-managed policy id ${JSON.stringify(a.id)}`);if(!Number.isSafeInteger(a.version)||a.version<0)throw Error(`invalid version for cloud-managed policy ${a.id}`);if(!i.test(a.sha256))throw Error(`invalid SHA-256 for cloud-managed policy ${a.id}`);if(n.has(a.id))throw Error(`duplicate cloud-managed policy id ${a.id}`);n.add(a.id);let d=k(e,a.path),f=(0,c.readFileSync)(d),h=(0,b.createHash)("sha256").update(f).digest("hex");if(h!==a.sha256)throw Error(`cloud-managed policy ${a.id} failed integrity verification: expected ${a.sha256}, got ${h}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for cloud-managed policy ${a.id}`);return{id:a.id,version:a.version,effect:a.effect??"enforce",sha256:a.sha256,path:d,deployment:m.deployment,...(0,g.authorityFieldsOf)(a)}})},"resolveManagedPath",0,k],89790);let l=/^(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-]+)*))?$/,m=/^(?:0|[1-9]\d*)$/;function n(a){if("string"!=typeof a)return null;let b=l.exec(a);return b?{major:Number(b[1]),minor:Number(b[2]),patch:Number(b[3]),prerelease:void 0===b[4]?[]:b[4].split(".").map(a=>m.test(a)?Number(a):a)}:null}let o=(a,b)=>a<b?-1:+(a>b),p=["always","protected_branch","in_git_repo","has_paths","paths_outside_project","system_or_root_paths"];function q(a){return"string"==typeof a&&p.includes(a)}a.s(["PACK_PRECONDITION_NAMES",0,p,"isPackPreconditionName",0,q],48630);let r=[1],s=/^[a-f0-9]{64}$/,t=/^[A-Za-z0-9._-]{1,64}\/[A-Za-z0-9._-]{1,64}$/,u=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/,v=/^[0-9a-f]{7,40}$/,w=/^[A-Za-z0-9._-]{1,128}$/,x=/^[a-z][a-z0-9_]{0,31}$/,y=new Set(["exempt","user_asked"]),z=new Set(["shell","write","read","network","other"]);function A(){return process.env.FAILPROOFAI_PACK_DIR??(0,f.packsDir)()}function B(a){if("string"!=typeof a.id||!t.test(a.id))throw Error(`unsafe pack id ${JSON.stringify(a.id)}`);if("string"!=typeof a.version||!u.test(a.version))throw Error(`invalid version for pack ${a.id}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for pack ${a.id}`);let b="string"==typeof a.commit&&v.test(a.commit.trim().toLowerCase())?a.commit.trim().toLowerCase():void 0;return{id:a.id,version:a.version,effect:a.effect??"enforce",...b?{commit:b}:{}}}function C(){return process.env.FAILPROOFAI_PACK_DIR?(0,d.resolve)(process.env.FAILPROOFAI_PACK_DIR,"installed.json"):(0,f.packsInstalledFile)()}let D=new Set(["string","number","boolean","string[]","pattern[]"]);function E(a,b,c,d){let e=`${a} policy #${c}`;if(!b||"object"!=typeof b)throw Error(`${e} is not an object`);let f=b.name;if("string"!=typeof f||!w.test(f))throw Error(`${e} has an unsafe name ${JSON.stringify(f)}`);if("alwaysOn"in b)throw Error(`${e} declares alwaysOn, which packs may not set`);if("string"!=typeof b.description||0===b.description.length)throw Error(`${e} is missing a description`);if("string"!=typeof b.category||0===b.category.length)throw Error(`${e} is missing a category`);if("boolean"!=typeof b.defaultEnabled)throw Error(`${e} is missing defaultEnabled`);if(!b.match||"object"!=typeof b.match)throw Error(`${e} is missing a match`);let h=b.match;for(let a of["events","toolNames"]){let b=h[a];if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a||0===a.length)))throw Error(`${e} has a match.${a} that is not a list of names`)}let i=(0,g.authorityFieldsOf)(b),j=["authority","reviewedBy"].filter(a=>a in b&&!(a in i));if("params"in b){let a=function(a){if(!a||"object"!=typeof a||Array.isArray(a))return"params is not an object";for(let[b,c]of Object.entries(a)){if(0===b.length)return"params has an empty parameter name";if(!c||"object"!=typeof c||Array.isArray(c))return`params.${b} is not an object`;if("string"!=typeof c.type||!D.has(c.type))return`params.${b} has type ${JSON.stringify(c.type)}, which is not one of ${[...D].join(", ")}`;if("string"!=typeof c.description||0===c.description.length)return`params.${b} is missing a description`;if(!("default"in c))return`params.${b} is missing a default`}}(b.params);a&&(d?.push(`${e} declares a params schema that was dropped: ${a}`),j.push("params"))}return j.length>0?Object.fromEntries(Object.entries(b).filter(([a])=>!j.includes(a))):b}function F(a,b,c=e.version){if(void 0===b)return{kind:"satisfied"};let d=function(a,b){let c=n(a),d=n(b);return c&&d?o(c.major,d.major)||o(c.minor,d.minor)||o(c.patch,d.patch)||function(a,b){if(0===a.length&&0===b.length)return 0;if(0===a.length)return 1;if(0===b.length)return -1;for(let c=0;c<Math.min(a.length,b.length);c++){let d=a[c],e=b[c];if(d===e)continue;let f="number"==typeof d,g="number"==typeof e;if(f!==g)return f?-1:1;if(f&&g)return o(d,e);return d<e?-1:1}return o(a.length,b.length)}(c.prerelease,d.prerelease):null}(c,b);return null===d?{kind:"unreadable",reason:`pack ${a} declares minCliVersion ${JSON.stringify(b)}, which is not a version this CLI can compare against its own (${c}) — the requirement was ignored`}:d<0?{kind:"too-old",reason:`pack ${a} needs failproofai ${String(b)} or newer and this is ${c} — run \`npm i -g failproofai && failproofai update\``}:{kind:"satisfied",declared:b}}function G(a,b,c,d){if("string"!=typeof c||0===c.length)throw Error(`${a} is missing ${b}`);if(c.length>d)throw Error(`${a} has a ${b} of ${c.length} characters, over the ${d}-character cap`);return c}function H(a,b,c){let d;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${a} is not an object`);if(null!==c)d=c;else{if("string"!=typeof b.id||!x.test(b.id))throw Error(`${a} has an unsafe id ${JSON.stringify(b.id)}`);if(y.has(b.id))throw Error(`${a} uses the reserved probe id ${JSON.stringify(b.id)}`);d=b.id}let e=G(a,"instructions",b.instructions,600);if(void 0===b.criteria)return{id:d,instructions:e};if(!b.criteria||"object"!=typeof b.criteria||Array.isArray(b.criteria))throw Error(`${a} has criteria that is not an object`);let f=b.criteria;return{id:d,instructions:e,criteria:{true:G(a,"criteria.true",f.true,300),false:G(a,"criteria.false",f.false,300)}}}function I(a,b,c){let d=`${a} semantic policy #${c}`;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${d} is not an object`);let e=b.name;if("string"!=typeof e||!w.test(e))throw Error(`${d} has an unsafe name ${JSON.stringify(e)}`);if("alwaysOn"in b)throw Error(`${d} declares alwaysOn, which packs may not set`);let f=G(`${a} semantic policy ${e}`,"title",b.title,120),g=`${a} semantic policy ${e}`;if(!Array.isArray(b.appliesTo)||0===b.appliesTo.length)throw Error(`${g} has no appliesTo tool classes`);let h=b.appliesTo.find(a=>"string"!=typeof a||!z.has(a));if(void 0!==h)throw Error(`${g} applies to ${JSON.stringify(h)}, which is not a tool class (${[...z].join(", ")})`);if("deny"!==b.mode&&"instruct"!==b.mode)throw Error(`${g} has mode ${JSON.stringify(b.mode)}, which must be "deny" or "instruct"`);if("boolean"!=typeof b.userCanOverride)throw Error(`${g} is missing userCanOverride, which has no default`);if(!Array.isArray(b.probes)||0===b.probes.length)throw Error(`${g} declares no probes`);if(b.probes.length>6)throw Error(`${g} declares ${b.probes.length} probes, over the cap of 6`);let i=b.probes.map((a,b)=>H(`${g} probe #${b}`,a,null)),j=new Set;for(let a of i){if(j.has(a.id))throw Error(`${g} declares probe ${a.id} twice`);j.add(a.id)}let k=void 0===b.exempt?void 0:H(`${g} exempt`,b.exempt,"exempt");if(void 0!==b.precondition&&!q(b.precondition))throw Error(`${g} names precondition ${JSON.stringify(b.precondition)}, which this build does not have (${p.join(", ")})`);let l=G(g,"guidance",b.guidance,600);return{name:e,title:f,appliesTo:b.appliesTo,mode:b.mode,userCanOverride:b.userCanOverride,probes:i,...k?{exempt:k}:{},...void 0!==b.precondition?{precondition:b.precondition}:{},guidance:l}}function J(a){return a instanceof Error?a.message:String(a)}a.s(["MAX_SEMANTIC_POLICIES_PER_PACK",0,24,"PACK_COMMIT_RE",0,v,"checkPackMinCliVersion",0,F,"hasInstalledPacks",0,function(){try{let a=JSON.parse((0,c.readFileSync)(C(),"utf8"));return Array.isArray(a.packs)&&a.packs.length>0}catch{return!1}},"packSemantic",0,function(a){return a.semantic??[]},"packsRoot",0,A,"parsePackIdentity",0,B,"parsePackPolicy",0,E,"parsePackSemanticPolicy",0,I,"readInstalledPacks",0,function(){let a,d=C();if(!(0,c.existsSync)(d))return{packs:[],errors:[]};try{a=JSON.parse((0,c.readFileSync)(d,"utf8"))}catch(a){return{packs:[],errors:[{id:null,reason:`unreadable pack manifest: ${J(a)}`}]}}if(!a||"object"!=typeof a)return{packs:[],errors:[{id:null,reason:"pack manifest is not an object"}]};let e=a;if(!r.includes(e.schemaVersion))return{packs:[],errors:[{id:null,reason:`unsupported pack manifest schema ${String(e.schemaVersion)} (supported: ${r.join(", ")})`}]};if(!Array.isArray(e.packs))return{packs:[],errors:[{id:null,reason:"pack manifest packs is not an array"}]};let f=A(),g=[],h=[],i=[],j=new Set;for(let a of e.packs){let d=a&&"object"==typeof a&&"string"==typeof a.id?a.id:null,e=[];try{let d=function(a,d,e){if(!d||"object"!=typeof d)throw Error("pack entry is not an object");let f=B(d);if("string"!=typeof d.source||0===d.source.length)throw Error(`pack ${d.id} has no source`);if("string"!=typeof d.sha256||!s.test(d.sha256))throw Error(`invalid SHA-256 for pack ${d.id}`);let g=f.effect,h=F(f.id,d.minCliVersion);if("too-old"===h.kind)throw Error(h.reason);"unreadable"===h.kind&&e.push(h.reason);let i=k(a,d.entry),j=(0,b.createHash)("sha256").update((0,c.readFileSync)(i)).digest("hex");if(j!==d.sha256)throw Error(`pack ${d.id} failed integrity verification: expected ${d.sha256}, got ${j}`);if(!Array.isArray(d.policies))throw Error(`pack ${d.id} policies is not an array`);let l=d.policies.map((a,b)=>E(d.id,a,b,e)),m=new Set;for(let a of l){if(m.has(a.name))throw Error(`pack ${d.id} declares ${a.name} twice`);m.add(a.name)}let n=null;if(void 0!==d.enabled){if(!Array.isArray(d.enabled)||d.enabled.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} enabled is not an array of names`);n=d.enabled.filter(a=>m.has(a))}let o=null;if(void 0!==d.clis){if(!Array.isArray(d.clis)||d.clis.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} clis is not an array of agent names`);o=d.clis}return{clis:o,id:f.id,version:f.version,source:d.source,path:i,sha256:d.sha256,effect:g,policies:l,semantic:function(a,b,c){if(void 0===b)return[];if(!Array.isArray(b))return c.push(`pack ${a} semantic is not an array, so none of it was loaded`),[];let d=[],e=new Set;for(let[f,g]of b.entries()){if(d.length>=24){c.push(`pack ${a} declares more than 24 semantic policies; the ${b.length-24} past that cap were dropped`);break}try{let b=I(a,g,f);if(e.has(b.name))throw Error(`pack ${a} declares semantic policy ${b.name} twice`);e.add(b.name),d.push(b)}catch(a){c.push(J(a))}}return d}(f.id,d.semantic,e),..."satisfied"===h.kind&&h.declared?{minCliVersion:h.declared}:{},enabled:n}}(f,a,e);if(j.has(d.id))throw Error(`duplicate pack id ${d.id}`);j.add(d.id),g.push(d),i.push(...e)}catch(c){let b=a&&("observe"===a.effect||"enforce"===a.effect)?a.effect:"enforce";h.push({id:d,reason:J(c),effect:b,...Array.isArray(a?.policies)?{declared:function(a){let b=[];for(let c of a)c&&"object"==typeof c&&"string"==typeof c.name&&c.match&&"object"==typeof c.match&&b.push(c);return b}(a.policies)}:{},...Array.isArray(a?.clis)&&a.clis.every(a=>"string"==typeof a)?{clis:a.clis}:{}})}}return{packs:g,errors:h,...i.length>0?{warnings:i}:{}}}],9909)},65917,a=>{"use strict";a.s(["POLICY_CATALOG",0,[{name:"sanitize-jwt",description:"Stop Claude from reading JWTs in tool responses",displayTitle:"Redacted JWT tokens from tool output",impact:"Stops the agent from echoing auth tokens it saw in command output.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-api-keys",description:"Stop Claude from reading API keys (OpenAI, Anthropic, GitHub, AWS, Stripe, Google) in tool responses",displayTitle:"Redacted API keys from tool output",impact:"Catches OpenAI / Anthropic / GitHub / AWS / Stripe / Google keys before the model sees them.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize",params:{additionalPatterns:{type:"pattern[]",description:"Additional API key patterns to scrub, each with { regex, label }",default:[]}}},{name:"sanitize-connection-strings",description:"Stop Claude from reading database connection strings with embedded credentials in tool responses",displayTitle:"Redacted database connection strings from tool output",impact:"Strips embedded DB credentials before they reach the model context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-private-key-content",description:"Stop Claude from reading PEM private key content in tool responses",displayTitle:"Redacted PEM private keys from tool output",impact:"Prevents private key bodies from being echoed into chat context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-bearer-tokens",displayTitle:"Redacted bearer tokens from tool output",impact:"Strips Authorization: Bearer values before they hit the model.",description:"Stop Claude from reading Authorization Bearer tokens in tool responses",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"protect-env-vars",displayTitle:"Tried to dump environment variables to chat",impact:"Env vars often contain secrets; blocking `env` / `printenv` keeps them out of the model context.",description:"Prevent commands that read environment variables",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["env-secrets-dump","secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-env-files",displayTitle:"Tried to read or write a .env file",impact:"`.env` files routinely contain API keys and DB credentials.",description:"Block reading/writing .env files",match:{events:["PreToolUse"]},authority:"reviewable",reviewedBy:["secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-read-outside-cwd",displayTitle:"Tried to read files outside your project directory",impact:"Stops the agent from peeking at neighboring repos or your home directory.",description:"Block file reads outside the session working directory",match:{events:["PreToolUse"],toolNames:["Read","Glob","Grep","Bash"]},authority:"reviewable",reviewedBy:["read-outside-workspace"],defaultEnabled:!1,category:"Environment",params:{allowPaths:{type:"string[]",description:"Absolute paths outside cwd that are allowed to be read",default:[]}}},{name:"block-sudo",displayTitle:"Tried to run a command with sudo",impact:"Sudo gives the agent root — blocked unless explicitly allow-listed.",description:"Block sudo commands",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands",params:{allowPatterns:{type:"string[]",description:"Sudo command patterns to allow, matched token-by-token (e.g. 'sudo systemctl status')",default:[]}}},{name:"block-curl-pipe-sh",displayTitle:"Tried to pipe a downloaded script straight to a shell",impact:"`curl ... | sh` runs unverified remote code on your machine.",description:"Block piping downloads to shell",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands"},{name:"block-rm-rf",displayTitle:"Tried to recursively delete a system path",impact:"Catches catastrophic `rm -rf /` and Windows equivalents.",description:"Prevent catastrophic deletions",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Dangerous Commands",params:{allowPaths:{type:"string[]",description:"Paths that are allowed to be recursively deleted",default:[]}}},{name:"block-failproofai-commands",displayTitle:"Tried to disable, pause or modify failproofai itself",impact:"An agent that can pause or remove enforcement can switch off every other policy.",description:"Block failproofai CLI commands, self-pause and uninstallation",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash","Write","Edit","NotebookEdit"]},defaultEnabled:!0,alwaysOn:!0,authority:"hard",category:"Dangerous Commands"},{name:"block-kubectl",displayTitle:"Tried to run a Kubernetes command",impact:"kubectl can change live cluster state — gated unless allow-listed.",description:"Block kubectl commands (Kubernetes cluster mutations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"kubectl command patterns to allow, matched token-by-token (e.g. 'kubectl get *', 'kubectl describe *')",default:[]}}},{name:"block-terraform",displayTitle:"Tried to run a Terraform/OpenTofu command",impact:"Terraform mutates real infrastructure — gated unless allow-listed.",description:"Block terraform and tofu (OpenTofu) commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"terraform/tofu command patterns to allow (e.g. 'terraform plan', 'terraform validate')",default:[]}}},{name:"block-aws-cli",displayTitle:"Tried to run an AWS CLI command",impact:"AWS CLI can spend money or break prod — gated.",description:"Block aws CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"aws CLI command patterns to allow (e.g. 'aws s3 ls *', 'aws sts get-caller-identity')",default:[]}}},{name:"block-gcloud",displayTitle:"Tried to run a Google Cloud command",impact:"gcloud can spend money or break prod — gated.",description:"Block gcloud (Google Cloud) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gcloud command patterns to allow (e.g. 'gcloud auth list', 'gcloud config list')",default:[]}}},{name:"block-az-cli",displayTitle:"Tried to run an Azure CLI command",impact:"az can spend money or break prod — gated.",description:"Block az (Azure) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"az CLI command patterns to allow (e.g. 'az account show', 'az group list')",default:[]}}},{name:"block-helm",displayTitle:"Tried to run a Helm command",impact:"Helm releases mutate cluster state — gated.",description:"Block helm commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"helm command patterns to allow (e.g. 'helm list', 'helm status *')",default:[]}}},{name:"block-gh-pipeline",displayTitle:"Tried to run a privileged GitHub CLI pipeline command",impact:"Catches `gh workflow run`, `gh pr merge`, `gh secret set`, etc.",description:"Block gh CLI pipeline-trigger subcommands (workflow run, run rerun/cancel, pr merge, release create/delete, cache delete, secret set/delete)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gh pipeline command patterns to allow (e.g. specific scripted invocations); read-only gh subcommands like 'gh pr view' and 'gh run list' are not matched by this policy",default:[]}}},{name:"block-secrets-write",displayTitle:"Tried to write a secret-key file",impact:"Stops the agent from creating `.pem`, `id_rsa`, `credentials.json`, etc.",description:"Block writing secret key files",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"hard",defaultEnabled:!1,category:"Dangerous Commands",params:{additionalPatterns:{type:"string[]",description:"Additional filename patterns (substrings) to block",default:[]}}},{name:"block-push-master",displayTitle:"Tried to push directly to main/master",impact:"Direct pushes to a protected branch bypass review.",description:"Block pushing to main/master",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names to protect from direct pushes",default:["main","master"]}}},{name:"block-force-push",displayTitle:"Tried to force-push",impact:"Force-pushes rewrite history and can clobber teammates' work.",description:"Prevent force-pushing to any branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"block-work-on-main",displayTitle:"Tried to commit or merge on main/master",impact:"Work should land via PR — direct commits skip review.",description:"Block git commits and merges on main/master branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names where commits/merges are blocked",default:["main","master"]}}},{name:"warn-git-amend",displayTitle:"Used git commit --amend",impact:"Amending after a push rewrites history that others may have pulled.",description:"Warns before amending git commits, which rewrites history",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["git-history-rewrite"],defaultEnabled:!1,category:"Git"},{name:"warn-git-stash-drop",displayTitle:"Tried to drop or clear git stash",impact:"Stash deletions are permanent and silent.",description:"Warns before permanently deleting stashed changes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-all-files-staged",displayTitle:"Staged all files with git add -A / .",impact:"Wide stages routinely catch generated files or secrets you didn't intend to commit.",description:"Warns before staging all working tree files with git add -A / . / --all",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-destructive-sql",displayTitle:"Ran destructive SQL (DROP / TRUNCATE / DELETE without WHERE)",impact:"Easy way to wipe a table by accident.",description:"Warn before executing destructive SQL (DROP/TRUNCATE/DELETE without WHERE) via database clients",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["database-destruction"],defaultEnabled:!1,category:"Database"},{name:"warn-schema-alteration",displayTitle:"Altered a database schema column",impact:"ALTER TABLE operations can lock tables and break readers.",description:"Warns before SQL schema changes (ALTER TABLE with column or rename operations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Database"},{name:"warn-package-publish",displayTitle:"Tried to publish a package",impact:"Publishes are irreversible — `npm publish` / `cargo publish` shouldn't happen without intent.",description:"Warn before publishing packages to public registries (npm, PyPI, crates.io, RubyGems, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-global-package-install",displayTitle:"Installed a package globally",impact:"`npm i -g`, `cargo install`, `pip --user` pollute your machine outside the project.",description:"Warns before installing packages globally (npm -g, cargo install, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["system-modification"],defaultEnabled:!1,category:"Packages & System"},{name:"prefer-package-manager",displayTitle:"Used a non-preferred package manager",impact:"Mixing package managers creates lockfile churn for your team.",description:"Blocks non-preferred package managers and tells Claude to use an allowed one (e.g., uv instead of pip)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{allowed:{type:"string[]",description:"Allowed package manager names (e.g. ['uv', 'bun']). Any detected manager not in this list is blocked.",default:[]},blocked:{type:"string[]",description:"Additional manager names to block beyond the built-in list (e.g. ['pdm', 'pipx']).",default:[]}}},{name:"warn-large-file-write",displayTitle:"Wrote a file larger than the configured threshold",impact:"Catches accidentally large file writes (logs, binaries, model dumps).",description:"Warn before writing files larger than 1MB (configurable via thresholdKb param)",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{thresholdKb:{type:"number",description:"File size threshold in KB above which a warning is issued",default:1024}}},{name:"warn-background-process",displayTitle:"Started a long-lived background process",impact:"Catches `nohup` / `&` / `screen` / `tmux` / `disown` patterns that the agent often forgets to clean up.",description:"Warns before starting detached or background processes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-repeated-tool-calls",displayTitle:"Called the same tool 3+ times with identical arguments",impact:"Usually a sign of a stuck loop burning tokens.",description:"Warn when the same tool is called 3+ times with identical parameters",match:{events:["PreToolUse"]},authority:"hard",defaultEnabled:!1,category:"AI Behavior"},{name:"require-commit-before-stop",displayTitle:"Stopped with uncommitted changes",impact:"Work not in a commit is invisible to teammates and easy to lose.",description:"Require all changes to be committed before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"},{name:"require-push-before-stop",displayTitle:"Stopped with unpushed commits",impact:"Local-only commits won't trigger CI or be reviewable.",description:"Require all commits to be pushed to remote before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{remote:{type:"string",description:"Remote name to push to (default: origin)",default:"origin"},baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-pr-before-stop",displayTitle:"Stopped without a PR for the branch",impact:"Branches without PRs don't get reviewed.",description:"Require a pull request to exist for the current branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-no-conflicts-before-stop",displayTitle:"Stopped with a branch that conflicts with main",impact:"Conflicting branches can't merge — surface them early.",description:"Require the current branch to merge cleanly with the base branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to check for conflicts against (default: main)",default:"main"}}},{name:"require-ci-green-before-stop",displayTitle:"Stopped with failing CI",impact:"Failing CI blocks deploy.",description:"Require CI checks to pass on the current HEAD commit before Claude stops (ignores stale runs on prior commits)",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"}]])},75534,a=>{"use strict";a.i(9909),a.i(91609),a.s(["normalizePolicyName",0,function(a){return a.includes("/")?a:`failproofai/${a}`}],75534)}];
|
|
1
|
+
module.exports=[9909,89790,48630,a=>{"use strict";var b=a.i(66680),c=a.i(2157),d=a.i(50227),e=a.i(12072),f=a.i(75818),g=a.i(91609);let h=[1,2],i=/^[a-f0-9]{64}$/,j=/^[A-Za-z0-9._-]{1,128}$/;function k(a,b){if(!b||(0,d.isAbsolute)(b))throw Error(`unsafe managed policy path ${JSON.stringify(b)}`);let e=(0,d.resolve)(a,b),f=(0,d.relative)(a,e);if(f.startsWith("..")||(0,d.isAbsolute)(f))throw Error(`managed policy path escapes its root: ${JSON.stringify(b)}`);let g=(0,c.realpathSync)(a),h=(0,c.realpathSync)(e),i=(0,d.relative)(g,h);if(i.startsWith("..")||(0,d.isAbsolute)(i))throw Error(`managed policy symlink escapes its root: ${JSON.stringify(b)}`);return h}a.s(["readActiveCloudManagedPolicies",0,function(){let a,e=process.env.FAILPROOFAI_CLOUD_POLICY_DIR??(0,f.cloudPoliciesDir)(),l=(0,d.resolve)(e,"active.json");if(!(0,c.existsSync)(l))return[];try{a=JSON.parse((0,c.readFileSync)(l,"utf8"))}catch(a){throw Error(`failed to read cloud-managed active manifest: ${a instanceof Error?a.message:String(a)}`)}let m=function(a){if(!a||"object"!=typeof a)throw Error("active manifest is not an object");if(!h.includes(a.schemaVersion))throw Error(`unsupported active manifest schema ${String(a.schemaVersion)} (supported: ${h.join(", ")})`);let b=a.deployment??a.generation;if(!Number.isSafeInteger(b)||(b??-1)<0)throw Error("active manifest deployment is invalid");if(!Array.isArray(a.policies))throw Error("active manifest policies is not an array");let c=a.policies.map(a=>({...a,version:a.version??a.revision}));return{schemaVersion:a.schemaVersion,deployment:b,policies:c}}(a),n=new Set;return m.policies.map(a=>{if(!j.test(a.id)||"."===a.id||".."===a.id)throw Error(`unsafe cloud-managed policy id ${JSON.stringify(a.id)}`);if(!Number.isSafeInteger(a.version)||a.version<0)throw Error(`invalid version for cloud-managed policy ${a.id}`);if(!i.test(a.sha256))throw Error(`invalid SHA-256 for cloud-managed policy ${a.id}`);if(n.has(a.id))throw Error(`duplicate cloud-managed policy id ${a.id}`);n.add(a.id);let d=k(e,a.path),f=(0,c.readFileSync)(d),h=(0,b.createHash)("sha256").update(f).digest("hex");if(h!==a.sha256)throw Error(`cloud-managed policy ${a.id} failed integrity verification: expected ${a.sha256}, got ${h}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for cloud-managed policy ${a.id}`);return{id:a.id,version:a.version,effect:a.effect??"enforce",sha256:a.sha256,path:d,deployment:m.deployment,...(0,g.authorityFieldsOf)(a)}})},"resolveManagedPath",0,k],89790);let l=/^(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-]+)*))?$/,m=/^(?:0|[1-9]\d*)$/;function n(a){if("string"!=typeof a)return null;let b=l.exec(a);return b?{major:Number(b[1]),minor:Number(b[2]),patch:Number(b[3]),prerelease:void 0===b[4]?[]:b[4].split(".").map(a=>m.test(a)?Number(a):a)}:null}let o=(a,b)=>a<b?-1:+(a>b),p=["always","protected_branch","in_git_repo","has_paths","paths_outside_project","system_or_root_paths"];function q(a){return"string"==typeof a&&p.includes(a)}a.s(["PACK_PRECONDITION_NAMES",0,p,"isPackPreconditionName",0,q],48630);let r=[1],s=/^[a-f0-9]{64}$/,t=/^[A-Za-z0-9._-]{1,64}\/[A-Za-z0-9._-]{1,64}$/,u=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/,v=/^[0-9a-f]{7,40}$/,w=/^[A-Za-z0-9._-]{1,128}$/,x=/^[a-z][a-z0-9_]{0,31}$/,y=new Set(["exempt","user_asked"]),z=new Set(["shell","write","read","network","other"]);function A(){return process.env.FAILPROOFAI_PACK_DIR??(0,f.packsDir)()}function B(a){if("string"!=typeof a.id||!t.test(a.id))throw Error(`unsafe pack id ${JSON.stringify(a.id)}`);if("string"!=typeof a.version||!u.test(a.version))throw Error(`invalid version for pack ${a.id}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for pack ${a.id}`);let b="string"==typeof a.commit&&v.test(a.commit.trim().toLowerCase())?a.commit.trim().toLowerCase():void 0;return{id:a.id,version:a.version,effect:a.effect??"enforce",...b?{commit:b}:{}}}function C(){return process.env.FAILPROOFAI_PACK_DIR?(0,d.resolve)(process.env.FAILPROOFAI_PACK_DIR,"installed.json"):(0,f.packsInstalledFile)()}let D=new Set(["string","number","boolean","string[]","pattern[]"]);function E(a,b,c,d){let e=`${a} policy #${c}`;if(!b||"object"!=typeof b)throw Error(`${e} is not an object`);let f=b.name;if("string"!=typeof f||!w.test(f))throw Error(`${e} has an unsafe name ${JSON.stringify(f)}`);if("alwaysOn"in b)throw Error(`${e} declares alwaysOn, which packs may not set`);if("string"!=typeof b.description||0===b.description.length)throw Error(`${e} is missing a description`);if("string"!=typeof b.category||0===b.category.length)throw Error(`${e} is missing a category`);if("boolean"!=typeof b.defaultEnabled)throw Error(`${e} is missing defaultEnabled`);if(!b.match||"object"!=typeof b.match)throw Error(`${e} is missing a match`);let h=b.match;for(let a of["events","toolNames"]){let b=h[a];if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a||0===a.length)))throw Error(`${e} has a match.${a} that is not a list of names`)}let i=(0,g.authorityFieldsOf)(b),j=["authority","reviewedBy"].filter(a=>a in b&&!(a in i));if("params"in b){let a=function(a){if(!a||"object"!=typeof a||Array.isArray(a))return"params is not an object";for(let[b,c]of Object.entries(a)){if(0===b.length)return"params has an empty parameter name";if(!c||"object"!=typeof c||Array.isArray(c))return`params.${b} is not an object`;if("string"!=typeof c.type||!D.has(c.type))return`params.${b} has type ${JSON.stringify(c.type)}, which is not one of ${[...D].join(", ")}`;if("string"!=typeof c.description||0===c.description.length)return`params.${b} is missing a description`;if(!("default"in c))return`params.${b} is missing a default`}}(b.params);a&&(d?.push(`${e} declares a params schema that was dropped: ${a}`),j.push("params"))}return j.length>0?Object.fromEntries(Object.entries(b).filter(([a])=>!j.includes(a))):b}function F(a,b,c=e.version){if(void 0===b)return{kind:"satisfied"};let d=function(a,b){let c=n(a),d=n(b);return c&&d?o(c.major,d.major)||o(c.minor,d.minor)||o(c.patch,d.patch)||function(a,b){if(0===a.length&&0===b.length)return 0;if(0===a.length)return 1;if(0===b.length)return -1;for(let c=0;c<Math.min(a.length,b.length);c++){let d=a[c],e=b[c];if(d===e)continue;let f="number"==typeof d,g="number"==typeof e;if(f!==g)return f?-1:1;if(f&&g)return o(d,e);return d<e?-1:1}return o(a.length,b.length)}(c.prerelease,d.prerelease):null}(c,b);return null===d?{kind:"unreadable",reason:`pack ${a} declares minCliVersion ${JSON.stringify(b)}, which is not a version this CLI can compare against its own (${c}) — the requirement was ignored`}:d<0?{kind:"too-old",reason:`pack ${a} needs failproofai ${String(b)} or newer and this is ${c} — run \`npm i -g failproofai && failproofai update\``}:{kind:"satisfied",declared:b}}function G(a,b,c,d){if("string"!=typeof c||0===c.length)throw Error(`${a} is missing ${b}`);if(c.length>d)throw Error(`${a} has a ${b} of ${c.length} characters, over the ${d}-character cap`);return c}function H(a,b,c){let d;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${a} is not an object`);if(null!==c)d=c;else{if("string"!=typeof b.id||!x.test(b.id))throw Error(`${a} has an unsafe id ${JSON.stringify(b.id)}`);if(y.has(b.id))throw Error(`${a} uses the reserved probe id ${JSON.stringify(b.id)}`);d=b.id}let e=G(a,"instructions",b.instructions,600);if(void 0===b.criteria)return{id:d,instructions:e};if(!b.criteria||"object"!=typeof b.criteria||Array.isArray(b.criteria))throw Error(`${a} has criteria that is not an object`);let f=b.criteria;return{id:d,instructions:e,criteria:{true:G(a,"criteria.true",f.true,300),false:G(a,"criteria.false",f.false,300)}}}function I(a,b,c){let d=`${a} semantic policy #${c}`;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${d} is not an object`);let e=b.name;if("string"!=typeof e||!w.test(e))throw Error(`${d} has an unsafe name ${JSON.stringify(e)}`);if("alwaysOn"in b)throw Error(`${d} declares alwaysOn, which packs may not set`);let f=G(`${a} semantic policy ${e}`,"title",b.title,120),g=`${a} semantic policy ${e}`;if(!Array.isArray(b.appliesTo)||0===b.appliesTo.length)throw Error(`${g} has no appliesTo tool classes`);let h=b.appliesTo.find(a=>"string"!=typeof a||!z.has(a));if(void 0!==h)throw Error(`${g} applies to ${JSON.stringify(h)}, which is not a tool class (${[...z].join(", ")})`);if("deny"!==b.mode&&"instruct"!==b.mode)throw Error(`${g} has mode ${JSON.stringify(b.mode)}, which must be "deny" or "instruct"`);if("boolean"!=typeof b.userCanOverride)throw Error(`${g} is missing userCanOverride, which has no default`);if(!Array.isArray(b.probes)||0===b.probes.length)throw Error(`${g} declares no probes`);if(b.probes.length>6)throw Error(`${g} declares ${b.probes.length} probes, over the cap of 6`);let i=b.probes.map((a,b)=>H(`${g} probe #${b}`,a,null)),j=new Set;for(let a of i){if(j.has(a.id))throw Error(`${g} declares probe ${a.id} twice`);j.add(a.id)}let k=void 0===b.exempt?void 0:H(`${g} exempt`,b.exempt,"exempt");if(void 0!==b.precondition&&!q(b.precondition))throw Error(`${g} names precondition ${JSON.stringify(b.precondition)}, which this build does not have (${p.join(", ")})`);let l=G(g,"guidance",b.guidance,600);return{name:e,title:f,appliesTo:b.appliesTo,mode:b.mode,userCanOverride:b.userCanOverride,probes:i,...k?{exempt:k}:{},...void 0!==b.precondition?{precondition:b.precondition}:{},guidance:l}}function J(a){return a instanceof Error?a.message:String(a)}a.s(["MAX_SEMANTIC_POLICIES_PER_PACK",0,24,"PACK_COMMIT_RE",0,v,"checkPackMinCliVersion",0,F,"hasInstalledPacks",0,function(){try{let a=JSON.parse((0,c.readFileSync)(C(),"utf8"));return Array.isArray(a.packs)&&a.packs.length>0}catch{return!1}},"packSemantic",0,function(a){return a.semantic??[]},"packsRoot",0,A,"parsePackIdentity",0,B,"parsePackPolicy",0,E,"parsePackSemanticPolicy",0,I,"readInstalledPacks",0,function(){let a,d=C();if(!(0,c.existsSync)(d))return{packs:[],errors:[]};try{a=JSON.parse((0,c.readFileSync)(d,"utf8"))}catch(a){return{packs:[],errors:[{id:null,reason:`unreadable pack manifest: ${J(a)}`}]}}if(!a||"object"!=typeof a)return{packs:[],errors:[{id:null,reason:"pack manifest is not an object"}]};let e=a;if(!r.includes(e.schemaVersion))return{packs:[],errors:[{id:null,reason:`unsupported pack manifest schema ${String(e.schemaVersion)} (supported: ${r.join(", ")})`}]};if(!Array.isArray(e.packs))return{packs:[],errors:[{id:null,reason:"pack manifest packs is not an array"}]};let f=A(),g=[],h=[],i=[],j=new Set;for(let a of e.packs){let d=a&&"object"==typeof a&&"string"==typeof a.id?a.id:null,e=[];try{let d=function(a,d,e){if(!d||"object"!=typeof d)throw Error("pack entry is not an object");let f=B(d);if("string"!=typeof d.source||0===d.source.length)throw Error(`pack ${d.id} has no source`);if("string"!=typeof d.sha256||!s.test(d.sha256))throw Error(`invalid SHA-256 for pack ${d.id}`);let g=f.effect,h=F(f.id,d.minCliVersion);if("too-old"===h.kind)throw Error(h.reason);"unreadable"===h.kind&&e.push(h.reason);let i=k(a,d.entry),j=(0,b.createHash)("sha256").update((0,c.readFileSync)(i)).digest("hex");if(j!==d.sha256)throw Error(`pack ${d.id} failed integrity verification: expected ${d.sha256}, got ${j}`);if(!Array.isArray(d.policies))throw Error(`pack ${d.id} policies is not an array`);let l=d.policies.map((a,b)=>E(d.id,a,b,e)),m=new Set;for(let a of l){if(m.has(a.name))throw Error(`pack ${d.id} declares ${a.name} twice`);m.add(a.name)}let n=null;if(void 0!==d.enabled){if(!Array.isArray(d.enabled)||d.enabled.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} enabled is not an array of names`);n=d.enabled.filter(a=>m.has(a))}let o=null;if(void 0!==d.clis){if(!Array.isArray(d.clis)||d.clis.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} clis is not an array of agent names`);o=d.clis}return{clis:o,id:f.id,version:f.version,source:d.source,path:i,sha256:d.sha256,effect:g,policies:l,semantic:function(a,b,c){if(void 0===b)return[];if(!Array.isArray(b))return c.push(`pack ${a} semantic is not an array, so none of it was loaded`),[];let d=[],e=new Set;for(let[f,g]of b.entries()){if(d.length>=24){c.push(`pack ${a} declares more than 24 semantic policies; the ${b.length-24} past that cap were dropped`);break}try{let b=I(a,g,f);if(e.has(b.name))throw Error(`pack ${a} declares semantic policy ${b.name} twice`);e.add(b.name),d.push(b)}catch(a){c.push(J(a))}}return d}(f.id,d.semantic,e),..."satisfied"===h.kind&&h.declared?{minCliVersion:h.declared}:{},enabled:n}}(f,a,e);if(j.has(d.id))throw Error(`duplicate pack id ${d.id}`);j.add(d.id),g.push(d),i.push(...e)}catch(c){let b=a&&("observe"===a.effect||"enforce"===a.effect)?a.effect:"enforce";h.push({id:d,reason:J(c),effect:b,...Array.isArray(a?.policies)?{declared:function(a){let b=[];for(let c of a)c&&"object"==typeof c&&"string"==typeof c.name&&c.match&&"object"==typeof c.match&&b.push(c);return b}(a.policies)}:{},...Array.isArray(a?.clis)&&a.clis.every(a=>"string"==typeof a)?{clis:a.clis}:{}})}}return{packs:g,errors:h,...i.length>0?{warnings:i}:{}}}],9909)},65917,a=>{"use strict";a.s(["POLICY_CATALOG",0,[{name:"sanitize-jwt",description:"Stop Claude from reading JWTs in tool responses",displayTitle:"Redacted JWT tokens from tool output",impact:"Stops the agent from echoing auth tokens it saw in command output.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-api-keys",description:"Stop Claude from reading API keys (OpenAI, Anthropic, GitHub, AWS, Stripe, Google) in tool responses",displayTitle:"Redacted API keys from tool output",impact:"Catches OpenAI / Anthropic / GitHub / AWS / Stripe / Google keys before the model sees them.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize",params:{additionalPatterns:{type:"pattern[]",description:"Additional API key patterns to scrub, each with { regex, label }",default:[]}}},{name:"sanitize-connection-strings",description:"Stop Claude from reading database connection strings with embedded credentials in tool responses",displayTitle:"Redacted database connection strings from tool output",impact:"Strips embedded DB credentials before they reach the model context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-private-key-content",description:"Stop Claude from reading PEM private key content in tool responses",displayTitle:"Redacted PEM private keys from tool output",impact:"Prevents private key bodies from being echoed into chat context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-bearer-tokens",displayTitle:"Redacted bearer tokens from tool output",impact:"Strips Authorization: Bearer values before they hit the model.",description:"Stop Claude from reading Authorization Bearer tokens in tool responses",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"protect-env-vars",displayTitle:"Tried to dump environment variables to chat",impact:"Env vars often contain secrets; blocking `env` / `printenv` keeps them out of the model context.",description:"Prevent commands that read environment variables",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["env-secrets-dump","secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-env-files",displayTitle:"Tried to read or write a .env file",impact:"`.env` files routinely contain API keys and DB credentials.",description:"Block reading/writing .env files",match:{events:["PreToolUse"]},authority:"reviewable",reviewedBy:["secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-read-outside-cwd",displayTitle:"Tried to read files outside your project directory",impact:"Stops the agent from peeking at neighboring repos or your home directory.",description:"Block file reads outside the session working directory",match:{events:["PreToolUse"],toolNames:["Read","Glob","Grep","Bash"]},authority:"reviewable",reviewedBy:["read-outside-workspace"],defaultEnabled:!1,category:"Environment",params:{allowPaths:{type:"string[]",description:"Absolute paths outside cwd that are allowed to be read",default:[]}}},{name:"block-sudo",displayTitle:"Tried to run a command with sudo",impact:"Sudo gives the agent root — blocked unless explicitly allow-listed.",description:"Block sudo commands",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands",params:{allowPatterns:{type:"string[]",description:"Sudo command patterns to allow, matched token-by-token (e.g. 'sudo systemctl status')",default:[]}}},{name:"block-curl-pipe-sh",displayTitle:"Tried to pipe a downloaded script straight to a shell",impact:"`curl ... | sh` runs unverified remote code on your machine.",description:"Block piping downloads to shell",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands"},{name:"block-rm-rf",displayTitle:"Tried to recursively delete a system path",impact:"Catches catastrophic `rm -rf /` and Windows equivalents.",description:"Prevent catastrophic deletions",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["destructive-deletion"],defaultEnabled:!1,category:"Dangerous Commands",params:{allowPaths:{type:"string[]",description:"Paths that are allowed to be recursively deleted",default:[]}}},{name:"block-failproofai-commands",displayTitle:"Tried to disable, pause or modify failproofai itself",impact:"An agent that can pause or remove enforcement can switch off every other policy.",description:"Block failproofai CLI commands, self-pause and uninstallation",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash","Write","Edit","NotebookEdit"]},defaultEnabled:!0,alwaysOn:!0,authority:"hard",category:"Dangerous Commands"},{name:"block-kubectl",displayTitle:"Tried to run a Kubernetes command",impact:"kubectl can change live cluster state — gated unless allow-listed.",description:"Block kubectl commands (Kubernetes cluster mutations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"kubectl command patterns to allow, matched token-by-token (e.g. 'kubectl get *', 'kubectl describe *')",default:[]}}},{name:"block-terraform",displayTitle:"Tried to run a Terraform/OpenTofu command",impact:"Terraform mutates real infrastructure — gated unless allow-listed.",description:"Block terraform and tofu (OpenTofu) commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"terraform/tofu command patterns to allow (e.g. 'terraform plan', 'terraform validate')",default:[]}}},{name:"block-aws-cli",displayTitle:"Tried to run an AWS CLI command",impact:"AWS CLI can spend money or break prod — gated.",description:"Block aws CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"aws CLI command patterns to allow (e.g. 'aws s3 ls *', 'aws sts get-caller-identity')",default:[]}}},{name:"block-gcloud",displayTitle:"Tried to run a Google Cloud command",impact:"gcloud can spend money or break prod — gated.",description:"Block gcloud (Google Cloud) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gcloud command patterns to allow (e.g. 'gcloud auth list', 'gcloud config list')",default:[]}}},{name:"block-az-cli",displayTitle:"Tried to run an Azure CLI command",impact:"az can spend money or break prod — gated.",description:"Block az (Azure) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"az CLI command patterns to allow (e.g. 'az account show', 'az group list')",default:[]}}},{name:"block-helm",displayTitle:"Tried to run a Helm command",impact:"Helm releases mutate cluster state — gated.",description:"Block helm commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"helm command patterns to allow (e.g. 'helm list', 'helm status *')",default:[]}}},{name:"block-gh-pipeline",displayTitle:"Tried to run a privileged GitHub CLI pipeline command",impact:"Catches `gh workflow run`, `gh pr merge`, `gh secret set`, etc.",description:"Block gh CLI pipeline-trigger subcommands (workflow run, run rerun/cancel, pr merge, release create/delete, cache delete, secret set/delete)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gh pipeline command patterns to allow (e.g. specific scripted invocations); read-only gh subcommands like 'gh pr view' and 'gh run list' are not matched by this policy",default:[]}}},{name:"block-secrets-write",displayTitle:"Tried to write a secret-key file",impact:"Stops the agent from creating `.pem`, `id_rsa`, `credentials.json`, etc.",description:"Block writing secret key files",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"reviewable",reviewedBy:["secret-exposure"],defaultEnabled:!1,category:"Dangerous Commands",params:{additionalPatterns:{type:"string[]",description:"Additional filename patterns (substrings) to block",default:[]}}},{name:"block-push-master",displayTitle:"Tried to push directly to main/master",impact:"Direct pushes to a protected branch bypass review.",description:"Block pushing to main/master",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names to protect from direct pushes",default:["main","master"]}}},{name:"block-force-push",displayTitle:"Tried to force-push",impact:"Force-pushes rewrite history and can clobber teammates' work.",description:"Prevent force-pushing to any branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["git-history-rewrite"],defaultEnabled:!1,category:"Git"},{name:"block-work-on-main",displayTitle:"Tried to commit or merge on main/master",impact:"Work should land via PR — direct commits skip review.",description:"Block git commits and merges on main/master branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names where commits/merges are blocked",default:["main","master"]}}},{name:"warn-git-amend",displayTitle:"Used git commit --amend",impact:"Amending after a push rewrites history that others may have pulled.",description:"Warns before amending git commits, which rewrites history",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["git-history-rewrite"],defaultEnabled:!1,category:"Git"},{name:"warn-git-stash-drop",displayTitle:"Tried to drop or clear git stash",impact:"Stash deletions are permanent and silent.",description:"Warns before permanently deleting stashed changes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-git-clean",displayTitle:"Tried to delete untracked or ignored files with git clean",impact:"`git clean -fdx` takes `.env`, local config and unstaged work — git never had a copy of any of it.",description:"Warns before git clean deletes untracked directories (-d) or ignored files (-x / -X)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git",params:{destructiveFlags:{type:"string[]",description:"git clean flag letters that make it worth warning about, checked alongside --force. Narrow to ['x','X'] to allow `git clean -fd`, or widen with 'f' to warn on a bare `git clean -f`.",default:["d","x","X"]}}},{name:"warn-all-files-staged",displayTitle:"Staged all files with git add -A / .",impact:"Wide stages routinely catch generated files or secrets you didn't intend to commit.",description:"Warns before staging all working tree files with git add -A / . / --all",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-destructive-sql",displayTitle:"Ran destructive SQL (DROP / TRUNCATE / DELETE without WHERE)",impact:"Easy way to wipe a table by accident.",description:"Warn before executing destructive SQL (DROP/TRUNCATE/DELETE without WHERE) via database clients",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["database-destruction"],defaultEnabled:!1,category:"Database"},{name:"warn-schema-alteration",displayTitle:"Altered a database schema column",impact:"ALTER TABLE operations can lock tables and break readers.",description:"Warns before SQL schema changes (ALTER TABLE with column or rename operations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Database"},{name:"warn-package-publish",displayTitle:"Tried to publish a package",impact:"Publishes are irreversible — `npm publish` / `cargo publish` shouldn't happen without intent.",description:"Warn before publishing packages to public registries (npm, PyPI, crates.io, RubyGems, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-global-package-install",displayTitle:"Installed a package globally",impact:"`npm i -g`, `cargo install`, `pip --user` pollute your machine outside the project.",description:"Warns before installing packages globally (npm -g, cargo install, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["system-modification"],defaultEnabled:!1,category:"Packages & System"},{name:"prefer-package-manager",displayTitle:"Used a non-preferred package manager",impact:"Mixing package managers creates lockfile churn for your team.",description:"Blocks non-preferred package managers and tells Claude to use an allowed one (e.g., uv instead of pip)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{allowed:{type:"string[]",description:"Allowed package manager names (e.g. ['uv', 'bun']). Any detected manager not in this list is blocked.",default:[]},blocked:{type:"string[]",description:"Additional manager names to block beyond the built-in list (e.g. ['pdm', 'pipx']).",default:[]}}},{name:"warn-large-file-write",displayTitle:"Wrote a file larger than the configured threshold",impact:"Catches accidentally large file writes (logs, binaries, model dumps).",description:"Warn before writing files larger than 1MB (configurable via thresholdKb param)",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{thresholdKb:{type:"number",description:"File size threshold in KB above which a warning is issued",default:1024}}},{name:"warn-background-process",displayTitle:"Started a long-lived background process",impact:"Catches `nohup` / `&` / `screen` / `tmux` / `disown` patterns that the agent often forgets to clean up.",description:"Warns before starting detached or background processes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-repeated-tool-calls",displayTitle:"Called the same tool 3+ times with identical arguments",impact:"Usually a sign of a stuck loop burning tokens.",description:"Warn when the same tool is called 3+ times with identical parameters",match:{events:["PreToolUse"]},authority:"hard",defaultEnabled:!1,category:"AI Behavior"},{name:"require-commit-before-stop",displayTitle:"Stopped with uncommitted changes",impact:"Work not in a commit is invisible to teammates and easy to lose.",description:"Require all changes to be committed before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"},{name:"require-push-before-stop",displayTitle:"Stopped with unpushed commits",impact:"Local-only commits won't trigger CI or be reviewable.",description:"Require all commits to be pushed to remote before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{remote:{type:"string",description:"Remote name to push to (default: origin)",default:"origin"},baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-pr-before-stop",displayTitle:"Stopped without a PR for the branch",impact:"Branches without PRs don't get reviewed.",description:"Require a pull request to exist for the current branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-no-conflicts-before-stop",displayTitle:"Stopped with a branch that conflicts with main",impact:"Conflicting branches can't merge — surface them early.",description:"Require the current branch to merge cleanly with the base branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to check for conflicts against (default: main)",default:"main"}}},{name:"require-ci-green-before-stop",displayTitle:"Stopped with failing CI",impact:"Failing CI blocks deploy.",description:"Require CI checks to pass on the current HEAD commit before Claude stops (ignores stale runs on prior commits)",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"}]])},75534,a=>{"use strict";a.i(9909),a.i(91609),a.s(["normalizePolicyName",0,function(a){return a.includes("/")?a:`failproofai/${a}`}],75534)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_hooks_15t8kqj._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[9909,89790,48630,a=>{"use strict";var b=a.i(66680),c=a.i(2157),d=a.i(50227),e=a.i(12072),f=a.i(75818),g=a.i(91609);let h=[1,2],i=/^[a-f0-9]{64}$/,j=/^[A-Za-z0-9._-]{1,128}$/;function k(a,b){if(!b||(0,d.isAbsolute)(b))throw Error(`unsafe managed policy path ${JSON.stringify(b)}`);let e=(0,d.resolve)(a,b),f=(0,d.relative)(a,e);if(f.startsWith("..")||(0,d.isAbsolute)(f))throw Error(`managed policy path escapes its root: ${JSON.stringify(b)}`);let g=(0,c.realpathSync)(a),h=(0,c.realpathSync)(e),i=(0,d.relative)(g,h);if(i.startsWith("..")||(0,d.isAbsolute)(i))throw Error(`managed policy symlink escapes its root: ${JSON.stringify(b)}`);return h}a.s(["readActiveCloudManagedPolicies",0,function(){let a,e=process.env.FAILPROOFAI_CLOUD_POLICY_DIR??(0,f.cloudPoliciesDir)(),l=(0,d.resolve)(e,"active.json");if(!(0,c.existsSync)(l))return[];try{a=JSON.parse((0,c.readFileSync)(l,"utf8"))}catch(a){throw Error(`failed to read cloud-managed active manifest: ${a instanceof Error?a.message:String(a)}`)}let m=function(a){if(!a||"object"!=typeof a)throw Error("active manifest is not an object");if(!h.includes(a.schemaVersion))throw Error(`unsupported active manifest schema ${String(a.schemaVersion)} (supported: ${h.join(", ")})`);let b=a.deployment??a.generation;if(!Number.isSafeInteger(b)||(b??-1)<0)throw Error("active manifest deployment is invalid");if(!Array.isArray(a.policies))throw Error("active manifest policies is not an array");let c=a.policies.map(a=>({...a,version:a.version??a.revision}));return{schemaVersion:a.schemaVersion,deployment:b,policies:c}}(a),n=new Set;return m.policies.map(a=>{if(!j.test(a.id)||"."===a.id||".."===a.id)throw Error(`unsafe cloud-managed policy id ${JSON.stringify(a.id)}`);if(!Number.isSafeInteger(a.version)||a.version<0)throw Error(`invalid version for cloud-managed policy ${a.id}`);if(!i.test(a.sha256))throw Error(`invalid SHA-256 for cloud-managed policy ${a.id}`);if(n.has(a.id))throw Error(`duplicate cloud-managed policy id ${a.id}`);n.add(a.id);let d=k(e,a.path),f=(0,c.readFileSync)(d),h=(0,b.createHash)("sha256").update(f).digest("hex");if(h!==a.sha256)throw Error(`cloud-managed policy ${a.id} failed integrity verification: expected ${a.sha256}, got ${h}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for cloud-managed policy ${a.id}`);return{id:a.id,version:a.version,effect:a.effect??"enforce",sha256:a.sha256,path:d,deployment:m.deployment,...(0,g.authorityFieldsOf)(a)}})},"resolveManagedPath",0,k],89790);let l=/^(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-]+)*))?$/,m=/^(?:0|[1-9]\d*)$/;function n(a){if("string"!=typeof a)return null;let b=l.exec(a);return b?{major:Number(b[1]),minor:Number(b[2]),patch:Number(b[3]),prerelease:void 0===b[4]?[]:b[4].split(".").map(a=>m.test(a)?Number(a):a)}:null}let o=(a,b)=>a<b?-1:+(a>b),p=["always","protected_branch","in_git_repo","has_paths","paths_outside_project","system_or_root_paths"];function q(a){return"string"==typeof a&&p.includes(a)}a.s(["PACK_PRECONDITION_NAMES",0,p,"isPackPreconditionName",0,q],48630);let r=[1],s=/^[a-f0-9]{64}$/,t=/^[A-Za-z0-9._-]{1,64}\/[A-Za-z0-9._-]{1,64}$/,u=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/,v=/^[0-9a-f]{7,40}$/,w=/^[A-Za-z0-9._-]{1,128}$/,x=/^[a-z][a-z0-9_]{0,31}$/,y=new Set(["exempt","user_asked"]),z=new Set(["shell","write","read","network","other"]);function A(){return process.env.FAILPROOFAI_PACK_DIR??(0,f.packsDir)()}function B(a){if("string"!=typeof a.id||!t.test(a.id))throw Error(`unsafe pack id ${JSON.stringify(a.id)}`);if("string"!=typeof a.version||!u.test(a.version))throw Error(`invalid version for pack ${a.id}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for pack ${a.id}`);let b="string"==typeof a.commit&&v.test(a.commit.trim().toLowerCase())?a.commit.trim().toLowerCase():void 0;return{id:a.id,version:a.version,effect:a.effect??"enforce",...b?{commit:b}:{}}}function C(){return process.env.FAILPROOFAI_PACK_DIR?(0,d.resolve)(process.env.FAILPROOFAI_PACK_DIR,"installed.json"):(0,f.packsInstalledFile)()}let D=new Set(["string","number","boolean","string[]","pattern[]"]);function E(a,b,c,d){let e=`${a} policy #${c}`;if(!b||"object"!=typeof b)throw Error(`${e} is not an object`);let f=b.name;if("string"!=typeof f||!w.test(f))throw Error(`${e} has an unsafe name ${JSON.stringify(f)}`);if("alwaysOn"in b)throw Error(`${e} declares alwaysOn, which packs may not set`);if("string"!=typeof b.description||0===b.description.length)throw Error(`${e} is missing a description`);if("string"!=typeof b.category||0===b.category.length)throw Error(`${e} is missing a category`);if("boolean"!=typeof b.defaultEnabled)throw Error(`${e} is missing defaultEnabled`);if(!b.match||"object"!=typeof b.match)throw Error(`${e} is missing a match`);let h=b.match;for(let a of["events","toolNames"]){let b=h[a];if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a||0===a.length)))throw Error(`${e} has a match.${a} that is not a list of names`)}let i=(0,g.authorityFieldsOf)(b),j=["authority","reviewedBy"].filter(a=>a in b&&!(a in i));if("params"in b){let a=function(a){if(!a||"object"!=typeof a||Array.isArray(a))return"params is not an object";for(let[b,c]of Object.entries(a)){if(0===b.length)return"params has an empty parameter name";if(!c||"object"!=typeof c||Array.isArray(c))return`params.${b} is not an object`;if("string"!=typeof c.type||!D.has(c.type))return`params.${b} has type ${JSON.stringify(c.type)}, which is not one of ${[...D].join(", ")}`;if("string"!=typeof c.description||0===c.description.length)return`params.${b} is missing a description`;if(!("default"in c))return`params.${b} is missing a default`}}(b.params);a&&(d?.push(`${e} declares a params schema that was dropped: ${a}`),j.push("params"))}return j.length>0?Object.fromEntries(Object.entries(b).filter(([a])=>!j.includes(a))):b}function F(a,b,c=e.version){if(void 0===b)return{kind:"satisfied"};let d=function(a,b){let c=n(a),d=n(b);return c&&d?o(c.major,d.major)||o(c.minor,d.minor)||o(c.patch,d.patch)||function(a,b){if(0===a.length&&0===b.length)return 0;if(0===a.length)return 1;if(0===b.length)return -1;for(let c=0;c<Math.min(a.length,b.length);c++){let d=a[c],e=b[c];if(d===e)continue;let f="number"==typeof d,g="number"==typeof e;if(f!==g)return f?-1:1;if(f&&g)return o(d,e);return d<e?-1:1}return o(a.length,b.length)}(c.prerelease,d.prerelease):null}(c,b);return null===d?{kind:"unreadable",reason:`pack ${a} declares minCliVersion ${JSON.stringify(b)}, which is not a version this CLI can compare against its own (${c}) — the requirement was ignored`}:d<0?{kind:"too-old",reason:`pack ${a} needs failproofai ${String(b)} or newer and this is ${c} — run \`npm i -g failproofai && failproofai update\``}:{kind:"satisfied",declared:b}}function G(a,b,c,d){if("string"!=typeof c||0===c.length)throw Error(`${a} is missing ${b}`);if(c.length>d)throw Error(`${a} has a ${b} of ${c.length} characters, over the ${d}-character cap`);return c}function H(a,b,c){let d;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${a} is not an object`);if(null!==c)d=c;else{if("string"!=typeof b.id||!x.test(b.id))throw Error(`${a} has an unsafe id ${JSON.stringify(b.id)}`);if(y.has(b.id))throw Error(`${a} uses the reserved probe id ${JSON.stringify(b.id)}`);d=b.id}let e=G(a,"instructions",b.instructions,600);if(void 0===b.criteria)return{id:d,instructions:e};if(!b.criteria||"object"!=typeof b.criteria||Array.isArray(b.criteria))throw Error(`${a} has criteria that is not an object`);let f=b.criteria;return{id:d,instructions:e,criteria:{true:G(a,"criteria.true",f.true,300),false:G(a,"criteria.false",f.false,300)}}}function I(a,b,c){let d=`${a} semantic policy #${c}`;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${d} is not an object`);let e=b.name;if("string"!=typeof e||!w.test(e))throw Error(`${d} has an unsafe name ${JSON.stringify(e)}`);if("alwaysOn"in b)throw Error(`${d} declares alwaysOn, which packs may not set`);let f=G(`${a} semantic policy ${e}`,"title",b.title,120),g=`${a} semantic policy ${e}`;if(!Array.isArray(b.appliesTo)||0===b.appliesTo.length)throw Error(`${g} has no appliesTo tool classes`);let h=b.appliesTo.find(a=>"string"!=typeof a||!z.has(a));if(void 0!==h)throw Error(`${g} applies to ${JSON.stringify(h)}, which is not a tool class (${[...z].join(", ")})`);if("deny"!==b.mode&&"instruct"!==b.mode)throw Error(`${g} has mode ${JSON.stringify(b.mode)}, which must be "deny" or "instruct"`);if("boolean"!=typeof b.userCanOverride)throw Error(`${g} is missing userCanOverride, which has no default`);if(!Array.isArray(b.probes)||0===b.probes.length)throw Error(`${g} declares no probes`);if(b.probes.length>6)throw Error(`${g} declares ${b.probes.length} probes, over the cap of 6`);let i=b.probes.map((a,b)=>H(`${g} probe #${b}`,a,null)),j=new Set;for(let a of i){if(j.has(a.id))throw Error(`${g} declares probe ${a.id} twice`);j.add(a.id)}let k=void 0===b.exempt?void 0:H(`${g} exempt`,b.exempt,"exempt");if(void 0!==b.precondition&&!q(b.precondition))throw Error(`${g} names precondition ${JSON.stringify(b.precondition)}, which this build does not have (${p.join(", ")})`);let l=G(g,"guidance",b.guidance,600);return{name:e,title:f,appliesTo:b.appliesTo,mode:b.mode,userCanOverride:b.userCanOverride,probes:i,...k?{exempt:k}:{},...void 0!==b.precondition?{precondition:b.precondition}:{},guidance:l}}function J(a){return a instanceof Error?a.message:String(a)}a.s(["MAX_SEMANTIC_POLICIES_PER_PACK",0,24,"PACK_COMMIT_RE",0,v,"checkPackMinCliVersion",0,F,"hasInstalledPacks",0,function(){try{let a=JSON.parse((0,c.readFileSync)(C(),"utf8"));return Array.isArray(a.packs)&&a.packs.length>0}catch{return!1}},"packSemantic",0,function(a){return a.semantic??[]},"packsRoot",0,A,"parsePackIdentity",0,B,"parsePackPolicy",0,E,"parsePackSemanticPolicy",0,I,"readInstalledPacks",0,function(){let a,d=C();if(!(0,c.existsSync)(d))return{packs:[],errors:[]};try{a=JSON.parse((0,c.readFileSync)(d,"utf8"))}catch(a){return{packs:[],errors:[{id:null,reason:`unreadable pack manifest: ${J(a)}`}]}}if(!a||"object"!=typeof a)return{packs:[],errors:[{id:null,reason:"pack manifest is not an object"}]};let e=a;if(!r.includes(e.schemaVersion))return{packs:[],errors:[{id:null,reason:`unsupported pack manifest schema ${String(e.schemaVersion)} (supported: ${r.join(", ")})`}]};if(!Array.isArray(e.packs))return{packs:[],errors:[{id:null,reason:"pack manifest packs is not an array"}]};let f=A(),g=[],h=[],i=[],j=new Set;for(let a of e.packs){let d=a&&"object"==typeof a&&"string"==typeof a.id?a.id:null,e=[];try{let d=function(a,d,e){if(!d||"object"!=typeof d)throw Error("pack entry is not an object");let f=B(d);if("string"!=typeof d.source||0===d.source.length)throw Error(`pack ${d.id} has no source`);if("string"!=typeof d.sha256||!s.test(d.sha256))throw Error(`invalid SHA-256 for pack ${d.id}`);let g=f.effect,h=F(f.id,d.minCliVersion);if("too-old"===h.kind)throw Error(h.reason);"unreadable"===h.kind&&e.push(h.reason);let i=k(a,d.entry),j=(0,b.createHash)("sha256").update((0,c.readFileSync)(i)).digest("hex");if(j!==d.sha256)throw Error(`pack ${d.id} failed integrity verification: expected ${d.sha256}, got ${j}`);if(!Array.isArray(d.policies))throw Error(`pack ${d.id} policies is not an array`);let l=d.policies.map((a,b)=>E(d.id,a,b,e)),m=new Set;for(let a of l){if(m.has(a.name))throw Error(`pack ${d.id} declares ${a.name} twice`);m.add(a.name)}let n=null;if(void 0!==d.enabled){if(!Array.isArray(d.enabled)||d.enabled.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} enabled is not an array of names`);n=d.enabled.filter(a=>m.has(a))}let o=null;if(void 0!==d.clis){if(!Array.isArray(d.clis)||d.clis.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} clis is not an array of agent names`);o=d.clis}return{clis:o,id:f.id,version:f.version,source:d.source,path:i,sha256:d.sha256,effect:g,policies:l,semantic:function(a,b,c){if(void 0===b)return[];if(!Array.isArray(b))return c.push(`pack ${a} semantic is not an array, so none of it was loaded`),[];let d=[],e=new Set;for(let[f,g]of b.entries()){if(d.length>=24){c.push(`pack ${a} declares more than 24 semantic policies; the ${b.length-24} past that cap were dropped`);break}try{let b=I(a,g,f);if(e.has(b.name))throw Error(`pack ${a} declares semantic policy ${b.name} twice`);e.add(b.name),d.push(b)}catch(a){c.push(J(a))}}return d}(f.id,d.semantic,e),..."satisfied"===h.kind&&h.declared?{minCliVersion:h.declared}:{},enabled:n}}(f,a,e);if(j.has(d.id))throw Error(`duplicate pack id ${d.id}`);j.add(d.id),g.push(d),i.push(...e)}catch(c){let b=a&&("observe"===a.effect||"enforce"===a.effect)?a.effect:"enforce";h.push({id:d,reason:J(c),effect:b,...Array.isArray(a?.policies)?{declared:function(a){let b=[];for(let c of a)c&&"object"==typeof c&&"string"==typeof c.name&&c.match&&"object"==typeof c.match&&b.push(c);return b}(a.policies)}:{},...Array.isArray(a?.clis)&&a.clis.every(a=>"string"==typeof a)?{clis:a.clis}:{}})}}return{packs:g,errors:h,...i.length>0?{warnings:i}:{}}}],9909)},65917,a=>{"use strict";a.s(["POLICY_CATALOG",0,[{name:"sanitize-jwt",description:"Stop Claude from reading JWTs in tool responses",displayTitle:"Redacted JWT tokens from tool output",impact:"Stops the agent from echoing auth tokens it saw in command output.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-api-keys",description:"Stop Claude from reading API keys (OpenAI, Anthropic, GitHub, AWS, Stripe, Google) in tool responses",displayTitle:"Redacted API keys from tool output",impact:"Catches OpenAI / Anthropic / GitHub / AWS / Stripe / Google keys before the model sees them.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize",params:{additionalPatterns:{type:"pattern[]",description:"Additional API key patterns to scrub, each with { regex, label }",default:[]}}},{name:"sanitize-connection-strings",description:"Stop Claude from reading database connection strings with embedded credentials in tool responses",displayTitle:"Redacted database connection strings from tool output",impact:"Strips embedded DB credentials before they reach the model context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-private-key-content",description:"Stop Claude from reading PEM private key content in tool responses",displayTitle:"Redacted PEM private keys from tool output",impact:"Prevents private key bodies from being echoed into chat context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-bearer-tokens",displayTitle:"Redacted bearer tokens from tool output",impact:"Strips Authorization: Bearer values before they hit the model.",description:"Stop Claude from reading Authorization Bearer tokens in tool responses",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"protect-env-vars",displayTitle:"Tried to dump environment variables to chat",impact:"Env vars often contain secrets; blocking `env` / `printenv` keeps them out of the model context.",description:"Prevent commands that read environment variables",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["env-secrets-dump","secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-env-files",displayTitle:"Tried to read or write a .env file",impact:"`.env` files routinely contain API keys and DB credentials.",description:"Block reading/writing .env files",match:{events:["PreToolUse"]},authority:"reviewable",reviewedBy:["secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-read-outside-cwd",displayTitle:"Tried to read files outside your project directory",impact:"Stops the agent from peeking at neighboring repos or your home directory.",description:"Block file reads outside the session working directory",match:{events:["PreToolUse"],toolNames:["Read","Glob","Grep","Bash"]},authority:"reviewable",reviewedBy:["read-outside-workspace"],defaultEnabled:!1,category:"Environment",params:{allowPaths:{type:"string[]",description:"Absolute paths outside cwd that are allowed to be read",default:[]}}},{name:"block-sudo",displayTitle:"Tried to run a command with sudo",impact:"Sudo gives the agent root — blocked unless explicitly allow-listed.",description:"Block sudo commands",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands",params:{allowPatterns:{type:"string[]",description:"Sudo command patterns to allow, matched token-by-token (e.g. 'sudo systemctl status')",default:[]}}},{name:"block-curl-pipe-sh",displayTitle:"Tried to pipe a downloaded script straight to a shell",impact:"`curl ... | sh` runs unverified remote code on your machine.",description:"Block piping downloads to shell",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands"},{name:"block-rm-rf",displayTitle:"Tried to recursively delete a system path",impact:"Catches catastrophic `rm -rf /` and Windows equivalents.",description:"Prevent catastrophic deletions",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Dangerous Commands",params:{allowPaths:{type:"string[]",description:"Paths that are allowed to be recursively deleted",default:[]}}},{name:"block-failproofai-commands",displayTitle:"Tried to disable, pause or modify failproofai itself",impact:"An agent that can pause or remove enforcement can switch off every other policy.",description:"Block failproofai CLI commands, self-pause and uninstallation",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash","Write","Edit","NotebookEdit"]},defaultEnabled:!0,alwaysOn:!0,authority:"hard",category:"Dangerous Commands"},{name:"block-kubectl",displayTitle:"Tried to run a Kubernetes command",impact:"kubectl can change live cluster state — gated unless allow-listed.",description:"Block kubectl commands (Kubernetes cluster mutations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"kubectl command patterns to allow, matched token-by-token (e.g. 'kubectl get *', 'kubectl describe *')",default:[]}}},{name:"block-terraform",displayTitle:"Tried to run a Terraform/OpenTofu command",impact:"Terraform mutates real infrastructure — gated unless allow-listed.",description:"Block terraform and tofu (OpenTofu) commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"terraform/tofu command patterns to allow (e.g. 'terraform plan', 'terraform validate')",default:[]}}},{name:"block-aws-cli",displayTitle:"Tried to run an AWS CLI command",impact:"AWS CLI can spend money or break prod — gated.",description:"Block aws CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"aws CLI command patterns to allow (e.g. 'aws s3 ls *', 'aws sts get-caller-identity')",default:[]}}},{name:"block-gcloud",displayTitle:"Tried to run a Google Cloud command",impact:"gcloud can spend money or break prod — gated.",description:"Block gcloud (Google Cloud) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gcloud command patterns to allow (e.g. 'gcloud auth list', 'gcloud config list')",default:[]}}},{name:"block-az-cli",displayTitle:"Tried to run an Azure CLI command",impact:"az can spend money or break prod — gated.",description:"Block az (Azure) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"az CLI command patterns to allow (e.g. 'az account show', 'az group list')",default:[]}}},{name:"block-helm",displayTitle:"Tried to run a Helm command",impact:"Helm releases mutate cluster state — gated.",description:"Block helm commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"helm command patterns to allow (e.g. 'helm list', 'helm status *')",default:[]}}},{name:"block-gh-pipeline",displayTitle:"Tried to run a privileged GitHub CLI pipeline command",impact:"Catches `gh workflow run`, `gh pr merge`, `gh secret set`, etc.",description:"Block gh CLI pipeline-trigger subcommands (workflow run, run rerun/cancel, pr merge, release create/delete, cache delete, secret set/delete)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gh pipeline command patterns to allow (e.g. specific scripted invocations); read-only gh subcommands like 'gh pr view' and 'gh run list' are not matched by this policy",default:[]}}},{name:"block-secrets-write",displayTitle:"Tried to write a secret-key file",impact:"Stops the agent from creating `.pem`, `id_rsa`, `credentials.json`, etc.",description:"Block writing secret key files",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"hard",defaultEnabled:!1,category:"Dangerous Commands",params:{additionalPatterns:{type:"string[]",description:"Additional filename patterns (substrings) to block",default:[]}}},{name:"block-push-master",displayTitle:"Tried to push directly to main/master",impact:"Direct pushes to a protected branch bypass review.",description:"Block pushing to main/master",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names to protect from direct pushes",default:["main","master"]}}},{name:"block-force-push",displayTitle:"Tried to force-push",impact:"Force-pushes rewrite history and can clobber teammates' work.",description:"Prevent force-pushing to any branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"block-work-on-main",displayTitle:"Tried to commit or merge on main/master",impact:"Work should land via PR — direct commits skip review.",description:"Block git commits and merges on main/master branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names where commits/merges are blocked",default:["main","master"]}}},{name:"warn-git-amend",displayTitle:"Used git commit --amend",impact:"Amending after a push rewrites history that others may have pulled.",description:"Warns before amending git commits, which rewrites history",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["git-history-rewrite"],defaultEnabled:!1,category:"Git"},{name:"warn-git-stash-drop",displayTitle:"Tried to drop or clear git stash",impact:"Stash deletions are permanent and silent.",description:"Warns before permanently deleting stashed changes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-all-files-staged",displayTitle:"Staged all files with git add -A / .",impact:"Wide stages routinely catch generated files or secrets you didn't intend to commit.",description:"Warns before staging all working tree files with git add -A / . / --all",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-destructive-sql",displayTitle:"Ran destructive SQL (DROP / TRUNCATE / DELETE without WHERE)",impact:"Easy way to wipe a table by accident.",description:"Warn before executing destructive SQL (DROP/TRUNCATE/DELETE without WHERE) via database clients",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["database-destruction"],defaultEnabled:!1,category:"Database"},{name:"warn-schema-alteration",displayTitle:"Altered a database schema column",impact:"ALTER TABLE operations can lock tables and break readers.",description:"Warns before SQL schema changes (ALTER TABLE with column or rename operations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Database"},{name:"warn-package-publish",displayTitle:"Tried to publish a package",impact:"Publishes are irreversible — `npm publish` / `cargo publish` shouldn't happen without intent.",description:"Warn before publishing packages to public registries (npm, PyPI, crates.io, RubyGems, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-global-package-install",displayTitle:"Installed a package globally",impact:"`npm i -g`, `cargo install`, `pip --user` pollute your machine outside the project.",description:"Warns before installing packages globally (npm -g, cargo install, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["system-modification"],defaultEnabled:!1,category:"Packages & System"},{name:"prefer-package-manager",displayTitle:"Used a non-preferred package manager",impact:"Mixing package managers creates lockfile churn for your team.",description:"Blocks non-preferred package managers and tells Claude to use an allowed one (e.g., uv instead of pip)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{allowed:{type:"string[]",description:"Allowed package manager names (e.g. ['uv', 'bun']). Any detected manager not in this list is blocked.",default:[]},blocked:{type:"string[]",description:"Additional manager names to block beyond the built-in list (e.g. ['pdm', 'pipx']).",default:[]}}},{name:"warn-large-file-write",displayTitle:"Wrote a file larger than the configured threshold",impact:"Catches accidentally large file writes (logs, binaries, model dumps).",description:"Warn before writing files larger than 1MB (configurable via thresholdKb param)",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{thresholdKb:{type:"number",description:"File size threshold in KB above which a warning is issued",default:1024}}},{name:"warn-background-process",displayTitle:"Started a long-lived background process",impact:"Catches `nohup` / `&` / `screen` / `tmux` / `disown` patterns that the agent often forgets to clean up.",description:"Warns before starting detached or background processes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-repeated-tool-calls",displayTitle:"Called the same tool 3+ times with identical arguments",impact:"Usually a sign of a stuck loop burning tokens.",description:"Warn when the same tool is called 3+ times with identical parameters",match:{events:["PreToolUse"]},authority:"hard",defaultEnabled:!1,category:"AI Behavior"},{name:"require-commit-before-stop",displayTitle:"Stopped with uncommitted changes",impact:"Work not in a commit is invisible to teammates and easy to lose.",description:"Require all changes to be committed before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"},{name:"require-push-before-stop",displayTitle:"Stopped with unpushed commits",impact:"Local-only commits won't trigger CI or be reviewable.",description:"Require all commits to be pushed to remote before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{remote:{type:"string",description:"Remote name to push to (default: origin)",default:"origin"},baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-pr-before-stop",displayTitle:"Stopped without a PR for the branch",impact:"Branches without PRs don't get reviewed.",description:"Require a pull request to exist for the current branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-no-conflicts-before-stop",displayTitle:"Stopped with a branch that conflicts with main",impact:"Conflicting branches can't merge — surface them early.",description:"Require the current branch to merge cleanly with the base branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to check for conflicts against (default: main)",default:"main"}}},{name:"require-ci-green-before-stop",displayTitle:"Stopped with failing CI",impact:"Failing CI blocks deploy.",description:"Require CI checks to pass on the current HEAD commit before Claude stops (ignores stale runs on prior commits)",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"}]])},75534,a=>{"use strict";a.i(9909),a.i(91609),a.s(["normalizePolicyName",0,function(a){return a.includes("/")?a:`failproofai/${a}`}],75534)}];
|
|
1
|
+
module.exports=[9909,89790,48630,a=>{"use strict";var b=a.i(66680),c=a.i(2157),d=a.i(50227),e=a.i(12072),f=a.i(75818),g=a.i(91609);let h=[1,2],i=/^[a-f0-9]{64}$/,j=/^[A-Za-z0-9._-]{1,128}$/;function k(a,b){if(!b||(0,d.isAbsolute)(b))throw Error(`unsafe managed policy path ${JSON.stringify(b)}`);let e=(0,d.resolve)(a,b),f=(0,d.relative)(a,e);if(f.startsWith("..")||(0,d.isAbsolute)(f))throw Error(`managed policy path escapes its root: ${JSON.stringify(b)}`);let g=(0,c.realpathSync)(a),h=(0,c.realpathSync)(e),i=(0,d.relative)(g,h);if(i.startsWith("..")||(0,d.isAbsolute)(i))throw Error(`managed policy symlink escapes its root: ${JSON.stringify(b)}`);return h}a.s(["readActiveCloudManagedPolicies",0,function(){let a,e=process.env.FAILPROOFAI_CLOUD_POLICY_DIR??(0,f.cloudPoliciesDir)(),l=(0,d.resolve)(e,"active.json");if(!(0,c.existsSync)(l))return[];try{a=JSON.parse((0,c.readFileSync)(l,"utf8"))}catch(a){throw Error(`failed to read cloud-managed active manifest: ${a instanceof Error?a.message:String(a)}`)}let m=function(a){if(!a||"object"!=typeof a)throw Error("active manifest is not an object");if(!h.includes(a.schemaVersion))throw Error(`unsupported active manifest schema ${String(a.schemaVersion)} (supported: ${h.join(", ")})`);let b=a.deployment??a.generation;if(!Number.isSafeInteger(b)||(b??-1)<0)throw Error("active manifest deployment is invalid");if(!Array.isArray(a.policies))throw Error("active manifest policies is not an array");let c=a.policies.map(a=>({...a,version:a.version??a.revision}));return{schemaVersion:a.schemaVersion,deployment:b,policies:c}}(a),n=new Set;return m.policies.map(a=>{if(!j.test(a.id)||"."===a.id||".."===a.id)throw Error(`unsafe cloud-managed policy id ${JSON.stringify(a.id)}`);if(!Number.isSafeInteger(a.version)||a.version<0)throw Error(`invalid version for cloud-managed policy ${a.id}`);if(!i.test(a.sha256))throw Error(`invalid SHA-256 for cloud-managed policy ${a.id}`);if(n.has(a.id))throw Error(`duplicate cloud-managed policy id ${a.id}`);n.add(a.id);let d=k(e,a.path),f=(0,c.readFileSync)(d),h=(0,b.createHash)("sha256").update(f).digest("hex");if(h!==a.sha256)throw Error(`cloud-managed policy ${a.id} failed integrity verification: expected ${a.sha256}, got ${h}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for cloud-managed policy ${a.id}`);return{id:a.id,version:a.version,effect:a.effect??"enforce",sha256:a.sha256,path:d,deployment:m.deployment,...(0,g.authorityFieldsOf)(a)}})},"resolveManagedPath",0,k],89790);let l=/^(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-]+)*))?$/,m=/^(?:0|[1-9]\d*)$/;function n(a){if("string"!=typeof a)return null;let b=l.exec(a);return b?{major:Number(b[1]),minor:Number(b[2]),patch:Number(b[3]),prerelease:void 0===b[4]?[]:b[4].split(".").map(a=>m.test(a)?Number(a):a)}:null}let o=(a,b)=>a<b?-1:+(a>b),p=["always","protected_branch","in_git_repo","has_paths","paths_outside_project","system_or_root_paths"];function q(a){return"string"==typeof a&&p.includes(a)}a.s(["PACK_PRECONDITION_NAMES",0,p,"isPackPreconditionName",0,q],48630);let r=[1],s=/^[a-f0-9]{64}$/,t=/^[A-Za-z0-9._-]{1,64}\/[A-Za-z0-9._-]{1,64}$/,u=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/,v=/^[0-9a-f]{7,40}$/,w=/^[A-Za-z0-9._-]{1,128}$/,x=/^[a-z][a-z0-9_]{0,31}$/,y=new Set(["exempt","user_asked"]),z=new Set(["shell","write","read","network","other"]);function A(){return process.env.FAILPROOFAI_PACK_DIR??(0,f.packsDir)()}function B(a){if("string"!=typeof a.id||!t.test(a.id))throw Error(`unsafe pack id ${JSON.stringify(a.id)}`);if("string"!=typeof a.version||!u.test(a.version))throw Error(`invalid version for pack ${a.id}`);if(void 0!==a.effect&&"enforce"!==a.effect&&"observe"!==a.effect)throw Error(`unknown effect ${JSON.stringify(a.effect)} for pack ${a.id}`);let b="string"==typeof a.commit&&v.test(a.commit.trim().toLowerCase())?a.commit.trim().toLowerCase():void 0;return{id:a.id,version:a.version,effect:a.effect??"enforce",...b?{commit:b}:{}}}function C(){return process.env.FAILPROOFAI_PACK_DIR?(0,d.resolve)(process.env.FAILPROOFAI_PACK_DIR,"installed.json"):(0,f.packsInstalledFile)()}let D=new Set(["string","number","boolean","string[]","pattern[]"]);function E(a,b,c,d){let e=`${a} policy #${c}`;if(!b||"object"!=typeof b)throw Error(`${e} is not an object`);let f=b.name;if("string"!=typeof f||!w.test(f))throw Error(`${e} has an unsafe name ${JSON.stringify(f)}`);if("alwaysOn"in b)throw Error(`${e} declares alwaysOn, which packs may not set`);if("string"!=typeof b.description||0===b.description.length)throw Error(`${e} is missing a description`);if("string"!=typeof b.category||0===b.category.length)throw Error(`${e} is missing a category`);if("boolean"!=typeof b.defaultEnabled)throw Error(`${e} is missing defaultEnabled`);if(!b.match||"object"!=typeof b.match)throw Error(`${e} is missing a match`);let h=b.match;for(let a of["events","toolNames"]){let b=h[a];if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a||0===a.length)))throw Error(`${e} has a match.${a} that is not a list of names`)}let i=(0,g.authorityFieldsOf)(b),j=["authority","reviewedBy"].filter(a=>a in b&&!(a in i));if("params"in b){let a=function(a){if(!a||"object"!=typeof a||Array.isArray(a))return"params is not an object";for(let[b,c]of Object.entries(a)){if(0===b.length)return"params has an empty parameter name";if(!c||"object"!=typeof c||Array.isArray(c))return`params.${b} is not an object`;if("string"!=typeof c.type||!D.has(c.type))return`params.${b} has type ${JSON.stringify(c.type)}, which is not one of ${[...D].join(", ")}`;if("string"!=typeof c.description||0===c.description.length)return`params.${b} is missing a description`;if(!("default"in c))return`params.${b} is missing a default`}}(b.params);a&&(d?.push(`${e} declares a params schema that was dropped: ${a}`),j.push("params"))}return j.length>0?Object.fromEntries(Object.entries(b).filter(([a])=>!j.includes(a))):b}function F(a,b,c=e.version){if(void 0===b)return{kind:"satisfied"};let d=function(a,b){let c=n(a),d=n(b);return c&&d?o(c.major,d.major)||o(c.minor,d.minor)||o(c.patch,d.patch)||function(a,b){if(0===a.length&&0===b.length)return 0;if(0===a.length)return 1;if(0===b.length)return -1;for(let c=0;c<Math.min(a.length,b.length);c++){let d=a[c],e=b[c];if(d===e)continue;let f="number"==typeof d,g="number"==typeof e;if(f!==g)return f?-1:1;if(f&&g)return o(d,e);return d<e?-1:1}return o(a.length,b.length)}(c.prerelease,d.prerelease):null}(c,b);return null===d?{kind:"unreadable",reason:`pack ${a} declares minCliVersion ${JSON.stringify(b)}, which is not a version this CLI can compare against its own (${c}) — the requirement was ignored`}:d<0?{kind:"too-old",reason:`pack ${a} needs failproofai ${String(b)} or newer and this is ${c} — run \`npm i -g failproofai && failproofai update\``}:{kind:"satisfied",declared:b}}function G(a,b,c,d){if("string"!=typeof c||0===c.length)throw Error(`${a} is missing ${b}`);if(c.length>d)throw Error(`${a} has a ${b} of ${c.length} characters, over the ${d}-character cap`);return c}function H(a,b,c){let d;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${a} is not an object`);if(null!==c)d=c;else{if("string"!=typeof b.id||!x.test(b.id))throw Error(`${a} has an unsafe id ${JSON.stringify(b.id)}`);if(y.has(b.id))throw Error(`${a} uses the reserved probe id ${JSON.stringify(b.id)}`);d=b.id}let e=G(a,"instructions",b.instructions,600);if(void 0===b.criteria)return{id:d,instructions:e};if(!b.criteria||"object"!=typeof b.criteria||Array.isArray(b.criteria))throw Error(`${a} has criteria that is not an object`);let f=b.criteria;return{id:d,instructions:e,criteria:{true:G(a,"criteria.true",f.true,300),false:G(a,"criteria.false",f.false,300)}}}function I(a,b,c){let d=`${a} semantic policy #${c}`;if(!b||"object"!=typeof b||Array.isArray(b))throw Error(`${d} is not an object`);let e=b.name;if("string"!=typeof e||!w.test(e))throw Error(`${d} has an unsafe name ${JSON.stringify(e)}`);if("alwaysOn"in b)throw Error(`${d} declares alwaysOn, which packs may not set`);let f=G(`${a} semantic policy ${e}`,"title",b.title,120),g=`${a} semantic policy ${e}`;if(!Array.isArray(b.appliesTo)||0===b.appliesTo.length)throw Error(`${g} has no appliesTo tool classes`);let h=b.appliesTo.find(a=>"string"!=typeof a||!z.has(a));if(void 0!==h)throw Error(`${g} applies to ${JSON.stringify(h)}, which is not a tool class (${[...z].join(", ")})`);if("deny"!==b.mode&&"instruct"!==b.mode)throw Error(`${g} has mode ${JSON.stringify(b.mode)}, which must be "deny" or "instruct"`);if("boolean"!=typeof b.userCanOverride)throw Error(`${g} is missing userCanOverride, which has no default`);if(!Array.isArray(b.probes)||0===b.probes.length)throw Error(`${g} declares no probes`);if(b.probes.length>6)throw Error(`${g} declares ${b.probes.length} probes, over the cap of 6`);let i=b.probes.map((a,b)=>H(`${g} probe #${b}`,a,null)),j=new Set;for(let a of i){if(j.has(a.id))throw Error(`${g} declares probe ${a.id} twice`);j.add(a.id)}let k=void 0===b.exempt?void 0:H(`${g} exempt`,b.exempt,"exempt");if(void 0!==b.precondition&&!q(b.precondition))throw Error(`${g} names precondition ${JSON.stringify(b.precondition)}, which this build does not have (${p.join(", ")})`);let l=G(g,"guidance",b.guidance,600);return{name:e,title:f,appliesTo:b.appliesTo,mode:b.mode,userCanOverride:b.userCanOverride,probes:i,...k?{exempt:k}:{},...void 0!==b.precondition?{precondition:b.precondition}:{},guidance:l}}function J(a){return a instanceof Error?a.message:String(a)}a.s(["MAX_SEMANTIC_POLICIES_PER_PACK",0,24,"PACK_COMMIT_RE",0,v,"checkPackMinCliVersion",0,F,"hasInstalledPacks",0,function(){try{let a=JSON.parse((0,c.readFileSync)(C(),"utf8"));return Array.isArray(a.packs)&&a.packs.length>0}catch{return!1}},"packSemantic",0,function(a){return a.semantic??[]},"packsRoot",0,A,"parsePackIdentity",0,B,"parsePackPolicy",0,E,"parsePackSemanticPolicy",0,I,"readInstalledPacks",0,function(){let a,d=C();if(!(0,c.existsSync)(d))return{packs:[],errors:[]};try{a=JSON.parse((0,c.readFileSync)(d,"utf8"))}catch(a){return{packs:[],errors:[{id:null,reason:`unreadable pack manifest: ${J(a)}`}]}}if(!a||"object"!=typeof a)return{packs:[],errors:[{id:null,reason:"pack manifest is not an object"}]};let e=a;if(!r.includes(e.schemaVersion))return{packs:[],errors:[{id:null,reason:`unsupported pack manifest schema ${String(e.schemaVersion)} (supported: ${r.join(", ")})`}]};if(!Array.isArray(e.packs))return{packs:[],errors:[{id:null,reason:"pack manifest packs is not an array"}]};let f=A(),g=[],h=[],i=[],j=new Set;for(let a of e.packs){let d=a&&"object"==typeof a&&"string"==typeof a.id?a.id:null,e=[];try{let d=function(a,d,e){if(!d||"object"!=typeof d)throw Error("pack entry is not an object");let f=B(d);if("string"!=typeof d.source||0===d.source.length)throw Error(`pack ${d.id} has no source`);if("string"!=typeof d.sha256||!s.test(d.sha256))throw Error(`invalid SHA-256 for pack ${d.id}`);let g=f.effect,h=F(f.id,d.minCliVersion);if("too-old"===h.kind)throw Error(h.reason);"unreadable"===h.kind&&e.push(h.reason);let i=k(a,d.entry),j=(0,b.createHash)("sha256").update((0,c.readFileSync)(i)).digest("hex");if(j!==d.sha256)throw Error(`pack ${d.id} failed integrity verification: expected ${d.sha256}, got ${j}`);if(!Array.isArray(d.policies))throw Error(`pack ${d.id} policies is not an array`);let l=d.policies.map((a,b)=>E(d.id,a,b,e)),m=new Set;for(let a of l){if(m.has(a.name))throw Error(`pack ${d.id} declares ${a.name} twice`);m.add(a.name)}let n=null;if(void 0!==d.enabled){if(!Array.isArray(d.enabled)||d.enabled.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} enabled is not an array of names`);n=d.enabled.filter(a=>m.has(a))}let o=null;if(void 0!==d.clis){if(!Array.isArray(d.clis)||d.clis.some(a=>"string"!=typeof a))throw Error(`pack ${d.id} clis is not an array of agent names`);o=d.clis}return{clis:o,id:f.id,version:f.version,source:d.source,path:i,sha256:d.sha256,effect:g,policies:l,semantic:function(a,b,c){if(void 0===b)return[];if(!Array.isArray(b))return c.push(`pack ${a} semantic is not an array, so none of it was loaded`),[];let d=[],e=new Set;for(let[f,g]of b.entries()){if(d.length>=24){c.push(`pack ${a} declares more than 24 semantic policies; the ${b.length-24} past that cap were dropped`);break}try{let b=I(a,g,f);if(e.has(b.name))throw Error(`pack ${a} declares semantic policy ${b.name} twice`);e.add(b.name),d.push(b)}catch(a){c.push(J(a))}}return d}(f.id,d.semantic,e),..."satisfied"===h.kind&&h.declared?{minCliVersion:h.declared}:{},enabled:n}}(f,a,e);if(j.has(d.id))throw Error(`duplicate pack id ${d.id}`);j.add(d.id),g.push(d),i.push(...e)}catch(c){let b=a&&("observe"===a.effect||"enforce"===a.effect)?a.effect:"enforce";h.push({id:d,reason:J(c),effect:b,...Array.isArray(a?.policies)?{declared:function(a){let b=[];for(let c of a)c&&"object"==typeof c&&"string"==typeof c.name&&c.match&&"object"==typeof c.match&&b.push(c);return b}(a.policies)}:{},...Array.isArray(a?.clis)&&a.clis.every(a=>"string"==typeof a)?{clis:a.clis}:{}})}}return{packs:g,errors:h,...i.length>0?{warnings:i}:{}}}],9909)},65917,a=>{"use strict";a.s(["POLICY_CATALOG",0,[{name:"sanitize-jwt",description:"Stop Claude from reading JWTs in tool responses",displayTitle:"Redacted JWT tokens from tool output",impact:"Stops the agent from echoing auth tokens it saw in command output.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-api-keys",description:"Stop Claude from reading API keys (OpenAI, Anthropic, GitHub, AWS, Stripe, Google) in tool responses",displayTitle:"Redacted API keys from tool output",impact:"Catches OpenAI / Anthropic / GitHub / AWS / Stripe / Google keys before the model sees them.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize",params:{additionalPatterns:{type:"pattern[]",description:"Additional API key patterns to scrub, each with { regex, label }",default:[]}}},{name:"sanitize-connection-strings",description:"Stop Claude from reading database connection strings with embedded credentials in tool responses",displayTitle:"Redacted database connection strings from tool output",impact:"Strips embedded DB credentials before they reach the model context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-private-key-content",description:"Stop Claude from reading PEM private key content in tool responses",displayTitle:"Redacted PEM private keys from tool output",impact:"Prevents private key bodies from being echoed into chat context.",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"sanitize-bearer-tokens",displayTitle:"Redacted bearer tokens from tool output",impact:"Strips Authorization: Bearer values before they hit the model.",description:"Stop Claude from reading Authorization Bearer tokens in tool responses",match:{events:["PostToolUse"]},authority:"hard",defaultEnabled:!0,category:"Sanitize"},{name:"protect-env-vars",displayTitle:"Tried to dump environment variables to chat",impact:"Env vars often contain secrets; blocking `env` / `printenv` keeps them out of the model context.",description:"Prevent commands that read environment variables",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["env-secrets-dump","secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-env-files",displayTitle:"Tried to read or write a .env file",impact:"`.env` files routinely contain API keys and DB credentials.",description:"Block reading/writing .env files",match:{events:["PreToolUse"]},authority:"reviewable",reviewedBy:["secret-exposure"],defaultEnabled:!0,category:"Environment"},{name:"block-read-outside-cwd",displayTitle:"Tried to read files outside your project directory",impact:"Stops the agent from peeking at neighboring repos or your home directory.",description:"Block file reads outside the session working directory",match:{events:["PreToolUse"],toolNames:["Read","Glob","Grep","Bash"]},authority:"reviewable",reviewedBy:["read-outside-workspace"],defaultEnabled:!1,category:"Environment",params:{allowPaths:{type:"string[]",description:"Absolute paths outside cwd that are allowed to be read",default:[]}}},{name:"block-sudo",displayTitle:"Tried to run a command with sudo",impact:"Sudo gives the agent root — blocked unless explicitly allow-listed.",description:"Block sudo commands",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands",params:{allowPatterns:{type:"string[]",description:"Sudo command patterns to allow, matched token-by-token (e.g. 'sudo systemctl status')",default:[]}}},{name:"block-curl-pipe-sh",displayTitle:"Tried to pipe a downloaded script straight to a shell",impact:"`curl ... | sh` runs unverified remote code on your machine.",description:"Block piping downloads to shell",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Dangerous Commands"},{name:"block-rm-rf",displayTitle:"Tried to recursively delete a system path",impact:"Catches catastrophic `rm -rf /` and Windows equivalents.",description:"Prevent catastrophic deletions",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["destructive-deletion"],defaultEnabled:!1,category:"Dangerous Commands",params:{allowPaths:{type:"string[]",description:"Paths that are allowed to be recursively deleted",default:[]}}},{name:"block-failproofai-commands",displayTitle:"Tried to disable, pause or modify failproofai itself",impact:"An agent that can pause or remove enforcement can switch off every other policy.",description:"Block failproofai CLI commands, self-pause and uninstallation",match:{events:["PreToolUse","PermissionRequest"],toolNames:["Bash","Write","Edit","NotebookEdit"]},defaultEnabled:!0,alwaysOn:!0,authority:"hard",category:"Dangerous Commands"},{name:"block-kubectl",displayTitle:"Tried to run a Kubernetes command",impact:"kubectl can change live cluster state — gated unless allow-listed.",description:"Block kubectl commands (Kubernetes cluster mutations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"kubectl command patterns to allow, matched token-by-token (e.g. 'kubectl get *', 'kubectl describe *')",default:[]}}},{name:"block-terraform",displayTitle:"Tried to run a Terraform/OpenTofu command",impact:"Terraform mutates real infrastructure — gated unless allow-listed.",description:"Block terraform and tofu (OpenTofu) commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"terraform/tofu command patterns to allow (e.g. 'terraform plan', 'terraform validate')",default:[]}}},{name:"block-aws-cli",displayTitle:"Tried to run an AWS CLI command",impact:"AWS CLI can spend money or break prod — gated.",description:"Block aws CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"aws CLI command patterns to allow (e.g. 'aws s3 ls *', 'aws sts get-caller-identity')",default:[]}}},{name:"block-gcloud",displayTitle:"Tried to run a Google Cloud command",impact:"gcloud can spend money or break prod — gated.",description:"Block gcloud (Google Cloud) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gcloud command patterns to allow (e.g. 'gcloud auth list', 'gcloud config list')",default:[]}}},{name:"block-az-cli",displayTitle:"Tried to run an Azure CLI command",impact:"az can spend money or break prod — gated.",description:"Block az (Azure) CLI commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"az CLI command patterns to allow (e.g. 'az account show', 'az group list')",default:[]}}},{name:"block-helm",displayTitle:"Tried to run a Helm command",impact:"Helm releases mutate cluster state — gated.",description:"Block helm commands",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["production-infra-change"],defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"helm command patterns to allow (e.g. 'helm list', 'helm status *')",default:[]}}},{name:"block-gh-pipeline",displayTitle:"Tried to run a privileged GitHub CLI pipeline command",impact:"Catches `gh workflow run`, `gh pr merge`, `gh secret set`, etc.",description:"Block gh CLI pipeline-trigger subcommands (workflow run, run rerun/cancel, pr merge, release create/delete, cache delete, secret set/delete)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Infra Commands",params:{allowPatterns:{type:"string[]",description:"gh pipeline command patterns to allow (e.g. specific scripted invocations); read-only gh subcommands like 'gh pr view' and 'gh run list' are not matched by this policy",default:[]}}},{name:"block-secrets-write",displayTitle:"Tried to write a secret-key file",impact:"Stops the agent from creating `.pem`, `id_rsa`, `credentials.json`, etc.",description:"Block writing secret key files",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"reviewable",reviewedBy:["secret-exposure"],defaultEnabled:!1,category:"Dangerous Commands",params:{additionalPatterns:{type:"string[]",description:"Additional filename patterns (substrings) to block",default:[]}}},{name:"block-push-master",displayTitle:"Tried to push directly to main/master",impact:"Direct pushes to a protected branch bypass review.",description:"Block pushing to main/master",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!0,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names to protect from direct pushes",default:["main","master"]}}},{name:"block-force-push",displayTitle:"Tried to force-push",impact:"Force-pushes rewrite history and can clobber teammates' work.",description:"Prevent force-pushing to any branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["git-history-rewrite"],defaultEnabled:!1,category:"Git"},{name:"block-work-on-main",displayTitle:"Tried to commit or merge on main/master",impact:"Work should land via PR — direct commits skip review.",description:"Block git commits and merges on main/master branch",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git",params:{protectedBranches:{type:"string[]",description:"Branch names where commits/merges are blocked",default:["main","master"]}}},{name:"warn-git-amend",displayTitle:"Used git commit --amend",impact:"Amending after a push rewrites history that others may have pulled.",description:"Warns before amending git commits, which rewrites history",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["git-history-rewrite"],defaultEnabled:!1,category:"Git"},{name:"warn-git-stash-drop",displayTitle:"Tried to drop or clear git stash",impact:"Stash deletions are permanent and silent.",description:"Warns before permanently deleting stashed changes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-git-clean",displayTitle:"Tried to delete untracked or ignored files with git clean",impact:"`git clean -fdx` takes `.env`, local config and unstaged work — git never had a copy of any of it.",description:"Warns before git clean deletes untracked directories (-d) or ignored files (-x / -X)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git",params:{destructiveFlags:{type:"string[]",description:"git clean flag letters that make it worth warning about, checked alongside --force. Narrow to ['x','X'] to allow `git clean -fd`, or widen with 'f' to warn on a bare `git clean -f`.",default:["d","x","X"]}}},{name:"warn-all-files-staged",displayTitle:"Staged all files with git add -A / .",impact:"Wide stages routinely catch generated files or secrets you didn't intend to commit.",description:"Warns before staging all working tree files with git add -A / . / --all",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Git"},{name:"warn-destructive-sql",displayTitle:"Ran destructive SQL (DROP / TRUNCATE / DELETE without WHERE)",impact:"Easy way to wipe a table by accident.",description:"Warn before executing destructive SQL (DROP/TRUNCATE/DELETE without WHERE) via database clients",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["database-destruction"],defaultEnabled:!1,category:"Database"},{name:"warn-schema-alteration",displayTitle:"Altered a database schema column",impact:"ALTER TABLE operations can lock tables and break readers.",description:"Warns before SQL schema changes (ALTER TABLE with column or rename operations)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Database"},{name:"warn-package-publish",displayTitle:"Tried to publish a package",impact:"Publishes are irreversible — `npm publish` / `cargo publish` shouldn't happen without intent.",description:"Warn before publishing packages to public registries (npm, PyPI, crates.io, RubyGems, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-global-package-install",displayTitle:"Installed a package globally",impact:"`npm i -g`, `cargo install`, `pip --user` pollute your machine outside the project.",description:"Warns before installing packages globally (npm -g, cargo install, etc.)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"reviewable",reviewedBy:["system-modification"],defaultEnabled:!1,category:"Packages & System"},{name:"prefer-package-manager",displayTitle:"Used a non-preferred package manager",impact:"Mixing package managers creates lockfile churn for your team.",description:"Blocks non-preferred package managers and tells Claude to use an allowed one (e.g., uv instead of pip)",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{allowed:{type:"string[]",description:"Allowed package manager names (e.g. ['uv', 'bun']). Any detected manager not in this list is blocked.",default:[]},blocked:{type:"string[]",description:"Additional manager names to block beyond the built-in list (e.g. ['pdm', 'pipx']).",default:[]}}},{name:"warn-large-file-write",displayTitle:"Wrote a file larger than the configured threshold",impact:"Catches accidentally large file writes (logs, binaries, model dumps).",description:"Warn before writing files larger than 1MB (configurable via thresholdKb param)",match:{events:["PreToolUse"],toolNames:["Write"]},authority:"hard",defaultEnabled:!1,category:"Packages & System",params:{thresholdKb:{type:"number",description:"File size threshold in KB above which a warning is issued",default:1024}}},{name:"warn-background-process",displayTitle:"Started a long-lived background process",impact:"Catches `nohup` / `&` / `screen` / `tmux` / `disown` patterns that the agent often forgets to clean up.",description:"Warns before starting detached or background processes",match:{events:["PreToolUse"],toolNames:["Bash"]},authority:"hard",defaultEnabled:!1,category:"Packages & System"},{name:"warn-repeated-tool-calls",displayTitle:"Called the same tool 3+ times with identical arguments",impact:"Usually a sign of a stuck loop burning tokens.",description:"Warn when the same tool is called 3+ times with identical parameters",match:{events:["PreToolUse"]},authority:"hard",defaultEnabled:!1,category:"AI Behavior"},{name:"require-commit-before-stop",displayTitle:"Stopped with uncommitted changes",impact:"Work not in a commit is invisible to teammates and easy to lose.",description:"Require all changes to be committed before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"},{name:"require-push-before-stop",displayTitle:"Stopped with unpushed commits",impact:"Local-only commits won't trigger CI or be reviewable.",description:"Require all commits to be pushed to remote before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{remote:{type:"string",description:"Remote name to push to (default: origin)",default:"origin"},baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-pr-before-stop",displayTitle:"Stopped without a PR for the branch",impact:"Branches without PRs don't get reviewed.",description:"Require a pull request to exist for the current branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to compare against (default: main)",default:"main"}}},{name:"require-no-conflicts-before-stop",displayTitle:"Stopped with a branch that conflicts with main",impact:"Conflicting branches can't merge — surface them early.",description:"Require the current branch to merge cleanly with the base branch before Claude stops",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow",params:{baseBranch:{type:"string",description:"Base branch to check for conflicts against (default: main)",default:"main"}}},{name:"require-ci-green-before-stop",displayTitle:"Stopped with failing CI",impact:"Failing CI blocks deploy.",description:"Require CI checks to pass on the current HEAD commit before Claude stops (ignores stale runs on prior commits)",match:{events:["Stop"]},authority:"hard",defaultEnabled:!1,category:"Workflow"}]])},75534,a=>{"use strict";a.i(9909),a.i(91609),a.s(["normalizePolicyName",0,function(a){return a.includes("/")?a:`failproofai/${a}`}],75534)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_hooks_1fm2w5z._.js.map
|