failproofai 1.0.7-beta.1 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js +4 -4
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +4 -4
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +7 -8
- 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 +5 -7
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js +6 -6
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +11 -13
- 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 +7 -8
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +7 -7
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +6 -7
- 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 +8 -41
- package/.next/standalone/.next/server/app/settings/page.js +9 -12
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1j-zsg5._.js → [externals]__1_bftcl._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__19_pzeq._.js → [externals]__1msfs-h._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1bf34x4._.js → [root-of-the-server]__1_r2rbg._.js} +7 -5
- package/.next/standalone/.next/server/chunks/_09dz7xv._.js +21 -21
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/{_1q5i8mb._.js → _1c3k-8x._.js} +2 -2
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +16 -16
- 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_0iu54mz._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3._.js +2 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-_ki57._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0yxwl6j._.js → [root-of-the-server]__0bd3mje._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cg-bgc._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cpu_mj._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1mf3zp6._.js → [root-of-the-server]__0cxe_2_._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0u3w0ll._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__17d_ffl._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__19d9tgz._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1jiwfsj._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1phc187._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_06imw3p._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1w_5l7t._.js → _0h_douw._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_214wgrp._.js → _1-i_gzc._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0bn2oo8._.js → _166t73i._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_1q46vxx._.js → _1_qswah._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_1gb0ifp._.js → _1es2j7i._.js} +5 -5
- package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +3 -0
- 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_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_18_d8l1._.js → node_modules_next_dist_0drixxt._.js} +4 -4
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +10 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +23 -56
- package/.next/standalone/.next/static/chunks/094xgi4owxaqf.js +1 -0
- package/.next/standalone/.next/static/chunks/0__8a7m868fvf.js +1 -0
- package/.next/standalone/.next/static/chunks/{12tvm75t5ffui.js → 0o6qlkgubtoex.js} +1 -1
- package/.next/standalone/.next/static/chunks/13i7-9is-vhys.js +1 -0
- package/.next/standalone/.next/static/chunks/1rz20_pz828f3.js +6 -0
- package/.next/standalone/.next/static/chunks/2k9f4tyv04809.css +1 -0
- package/.next/standalone/.next/static/chunks/{0vmd180qfntfb.js → 2klitrtzpaoe0.js} +1 -1
- package/.next/standalone/.next/static/chunks/{258668t68du6b.js → 2mdh397ghgnvv.js} +1 -1
- package/.next/standalone/.next/static/chunks/2rshywgeqsyzk.css +2 -0
- package/.next/standalone/.next/static/chunks/3pzx4chkhko9k.js +1 -0
- package/.next/standalone/.next/static/chunks/{0qrbdkv9qmvli.js → 3rh5o7e16irrm.js} +1 -1
- package/.next/standalone/.next/static/chunks/{29fql3nbnfc9q.js → 43ufqrz8qo3h-.js} +1 -1
- package/.next/standalone/SECURITY.md +53 -0
- package/.next/standalone/app/actions/pack-actions.ts +0 -12
- package/.next/standalone/app/policies/hooks-client.tsx +0 -9
- package/.next/standalone/app/settings/page.tsx +1 -20
- package/.next/standalone/app/settings/settings-client.tsx +1 -27
- package/.next/standalone/app/settings/settings.css +0 -79
- package/.next/standalone/package.json +9 -9
- 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 +133 -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 +261 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package.json +16 -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 +156 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package.json +16 -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 +344 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package.json +19 -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 +441 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package.json +19 -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 +6797 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package.json +24 -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/bin/failproofai.mjs +2 -115
- package/dist/cli.mjs +6538 -13686
- package/dist/index.js +1 -19
- package/dist/worker.mjs +2085 -8012
- package/package.json +9 -9
- package/pi-extension/index.ts +0 -11
- package/scripts/build-policy-pack.mjs +2 -39
- package/src/hooks/builtin-policies.ts +3 -21
- package/src/hooks/cloud-enrollment-cli.ts +1 -1
- package/src/hooks/cloud-managed-policies.ts +0 -22
- package/src/hooks/custom-hooks-loader.ts +7 -45
- package/src/hooks/custom-hooks-registry.ts +1 -45
- package/src/hooks/first-run-gate.ts +0 -5
- package/src/hooks/fp-home.ts +0 -23
- package/src/hooks/handler.ts +6 -265
- package/src/hooks/hook-activity-store.ts +1 -105
- package/src/hooks/hook-telemetry.ts +0 -41
- package/src/hooks/loader-utils.ts +0 -6
- package/src/hooks/pack-cli.ts +17 -278
- package/src/hooks/pack-manifest.ts +7 -479
- package/src/hooks/pack-store.ts +10 -156
- package/src/hooks/policy-catalog.ts +0 -65
- package/src/hooks/policy-evaluator.ts +796 -940
- package/src/hooks/policy-registry.ts +0 -25
- package/src/hooks/policy-types.ts +0 -126
- package/src/hooks/worker-server.ts +26 -119
- package/src/index.ts +0 -6
- package/.next/standalone/.next/server/chunks/src_hooks_01frwmb._.js +0 -5
- package/.next/standalone/.next/server/chunks/src_hooks_18qtd42._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01bmjsj._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +0 -22
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qxnccm._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0soxz2z._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yrsbd_._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1feuvhb._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0w6mzq5._.js +0 -151
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_095a_79._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_18k8rl0._.js +0 -12
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +0 -3
- package/.next/standalone/.next/static/chunks/0cd-_8-c-m1ea.js +0 -6
- package/.next/standalone/.next/static/chunks/0uldbut9y2-e8.js +0 -1
- package/.next/standalone/.next/static/chunks/1u5zsejmgrir_.js +0 -1
- package/.next/standalone/.next/static/chunks/285spx855h_3r.css +0 -2
- package/.next/standalone/.next/static/chunks/2qv4hshejedtx.css +0 -1
- 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/app/actions/get-jev-config.ts +0 -409
- package/.next/standalone/app/actions/update-jev-config.ts +0 -420
- package/.next/standalone/app/components/jev-notices.tsx +0 -96
- package/.next/standalone/app/settings/jev-panel.tsx +0 -469
- package/src/hooks/effective-reviewers.ts +0 -79
- package/src/hooks/jev-activity.ts +0 -385
- package/src/hooks/jev-cli.ts +0 -1193
- package/src/hooks/policy-authority.ts +0 -333
- package/src/hooks/policy-reviewability.ts +0 -229
- package/src/hooks/semantic/combine.ts +0 -541
- package/src/hooks/semantic/compile.ts +0 -176
- package/src/hooks/semantic/decide.ts +0 -392
- package/src/hooks/semantic/envelope.ts +0 -1296
- package/src/hooks/semantic/evaluator.ts +0 -547
- package/src/hooks/semantic/facts.ts +0 -292
- package/src/hooks/semantic/intent.ts +0 -1190
- package/src/hooks/semantic/jev-client.ts +0 -643
- package/src/hooks/semantic/jev-config.ts +0 -594
- package/src/hooks/semantic/jev-review.ts +0 -374
- package/src/hooks/semantic/jev-stats.ts +0 -289
- package/src/hooks/semantic/jev-throttle.ts +0 -421
- package/src/hooks/semantic/pack-policies.ts +0 -251
- package/src/hooks/semantic/policies.ts +0 -596
- package/src/hooks/semantic/precondition-names.ts +0 -60
- package/src/hooks/semantic/preconditions.ts +0 -58
- package/src/hooks/semantic/redact.ts +0 -2910
- package/src/hooks/semantic/types.ts +0 -145
- package/src/hooks/semver-precedence.ts +0 -128
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → PgeWCHmyVbjRznv2VO7KF}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → PgeWCHmyVbjRznv2VO7KF}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → PgeWCHmyVbjRznv2VO7KF}/_ssgManifest.js +0 -0
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Policy authority: who has the last word on a policy's deny or instruct once
|
|
3
|
-
* Jev is configured. See {@link PolicyAuthority} for the two values and
|
|
4
|
-
* `docs/policies/authority.mdx` for the builtin table.
|
|
5
|
-
*
|
|
6
|
-
* Every route a policy arrives by — a builtin, the user's own policy file, an
|
|
7
|
-
* installed pack, a cloud assignment — declares its authority somewhere
|
|
8
|
-
* different. This module is the one place those declarations are read and
|
|
9
|
-
* judged, so the rule cannot drift between them:
|
|
10
|
-
*
|
|
11
|
-
* - `hard` is the default and the answer to anything unclear. Absent, a value
|
|
12
|
-
* that is not one of the two, a `reviewedBy` that is empty or malformed or
|
|
13
|
-
* names a check this build does not have, or an `alwaysOn` policy: all hard.
|
|
14
|
-
* - `reviewable` means Jev may clear the policy's verdict — and only through the
|
|
15
|
-
* semantic policies it names, every one of which must have been asked.
|
|
16
|
-
*
|
|
17
|
-
* Nothing here decides anything at evaluation time. It resolves a declaration
|
|
18
|
-
* once, at registration, and `registerPolicy` stores the result, so what sits in
|
|
19
|
-
* the registry is already the effective authority.
|
|
20
|
-
*/
|
|
21
|
-
import { existsSync } from "node:fs";
|
|
22
|
-
import { jevConfigFile } from "./fp-home";
|
|
23
|
-
import { hookLogWarn } from "./hook-logger";
|
|
24
|
-
import { effectiveAuthority } from "./policy-types";
|
|
25
|
-
import type { CustomHook, PolicyAuthority, PolicyCatalogEntry } from "./policy-types";
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A declaration as it arrives, before anything has vouched for it. Fields are
|
|
29
|
-
* `unknown` because three of the four sources are files on disk written by
|
|
30
|
-
* somebody else.
|
|
31
|
-
*/
|
|
32
|
-
export interface AuthorityDeclaration {
|
|
33
|
-
authority?: unknown;
|
|
34
|
-
reviewedBy?: unknown;
|
|
35
|
-
/** The self-protection guard. Always hard, whatever else it says. */
|
|
36
|
-
alwaysOn?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** The shape-valid authority fields a parsed record (a pack entry, a cloud assignment) carries. */
|
|
40
|
-
export interface AuthorityFields {
|
|
41
|
-
authority?: PolicyAuthority;
|
|
42
|
-
reviewedBy?: string[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** What a registered policy carries: already judged, and honest to its type. */
|
|
46
|
-
export interface ResolvedAuthority {
|
|
47
|
-
authority: PolicyAuthority;
|
|
48
|
-
/** Present exactly when `authority` is `reviewable`. Deduplicated, in declared order. */
|
|
49
|
-
reviewedBy?: string[];
|
|
50
|
-
/**
|
|
51
|
-
* Why a `reviewable` declaration was not honored, for a warning. Absent when
|
|
52
|
-
* nothing asked for `reviewable` — a policy that is simply hard is not news.
|
|
53
|
-
*/
|
|
54
|
-
downgraded?: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The names `reviewedBy` may use: the semantic policies in
|
|
59
|
-
* `src/hooks/semantic/policies.ts`. Not the probes (`INJECTION_PROBE`,
|
|
60
|
-
* `SCOPE_PROBE`, the task probes) — those are inputs to Jev's decision, not
|
|
61
|
-
* checks a regex verdict can be cleared by.
|
|
62
|
-
*
|
|
63
|
-
* Written out rather than read off `SEMANTIC_POLICIES`, and pinned to it by
|
|
64
|
-
* `policy-authority.test.ts`. The registry imports this module, so a runtime
|
|
65
|
-
* import of the semantic policies would load all sixteen of Jev's prompts on
|
|
66
|
-
* every hook event of a machine that never configured Jev, and bundle them into
|
|
67
|
-
* every pack artifact that registers a policy.
|
|
68
|
-
*/
|
|
69
|
-
export const SEMANTIC_POLICY_NAMES = [
|
|
70
|
-
"destructive-deletion",
|
|
71
|
-
"production-infra-change",
|
|
72
|
-
"git-history-rewrite",
|
|
73
|
-
"push-to-protected-branch",
|
|
74
|
-
"commit-on-protected-branch",
|
|
75
|
-
"secret-exposure",
|
|
76
|
-
"credential-exfiltration",
|
|
77
|
-
"remote-code-execution",
|
|
78
|
-
"privilege-escalation",
|
|
79
|
-
"database-destruction",
|
|
80
|
-
"read-outside-workspace",
|
|
81
|
-
"agent-config-tampering",
|
|
82
|
-
"system-modification",
|
|
83
|
-
"env-secrets-dump",
|
|
84
|
-
"external-destructive-action",
|
|
85
|
-
"external-data-egress",
|
|
86
|
-
] as const;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The compiled-in reviewer set, and the DEFAULT rather than the only one.
|
|
90
|
-
*
|
|
91
|
-
* A pack that declares its own `semantic` entries replaces
|
|
92
|
-
* `SEMANTIC_POLICIES` wholesale on the machine that installed it, so the names
|
|
93
|
-
* a `reviewedBy` may use there are the pack's. Callers that know which set is
|
|
94
|
-
* live pass it (`effectiveReviewerNames()` in `pack-manifest.ts`, which reads
|
|
95
|
-
* the manifest and imports nothing from `semantic/`); everyone else gets this
|
|
96
|
-
* one, which is what a machine with no pack runs.
|
|
97
|
-
*/
|
|
98
|
-
export const SEMANTIC_REVIEWER_NAMES: ReadonlySet<string> = new Set(SEMANTIC_POLICY_NAMES);
|
|
99
|
-
|
|
100
|
-
const isName = (n: unknown): n is string => typeof n === "string" && n.length > 0;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Judge one declaration.
|
|
104
|
-
*
|
|
105
|
-
* Stricter than `effectiveAuthority`, which is the §7 contract and needs only
|
|
106
|
-
* one usable name: here EVERY entry must be a semantic policy this build has,
|
|
107
|
-
* and anything else makes the whole declaration hard rather than being dropped.
|
|
108
|
-
* `reviewedBy` is a conjunction, so dropping a name the author wrote — a typo, a
|
|
109
|
-
* stray `7` — would let Jev clear the policy on fewer checks than they asked
|
|
110
|
-
* for. It is also the safe direction for version skew: a pack built against a
|
|
111
|
-
* newer semantic set, installed on an older build, enforces as hard rather than
|
|
112
|
-
* as reviewable-by-less.
|
|
113
|
-
*
|
|
114
|
-
* What this returns is what `registerPolicy` stores, so a registered policy's
|
|
115
|
-
* `reviewedBy` is always clean and the two functions agree on it.
|
|
116
|
-
*
|
|
117
|
-
* @param knownReviewers - the semantic policies that CAN be asked on this
|
|
118
|
-
* machine. Defaults to the compiled-in set, which is what runs until a pack
|
|
119
|
-
* ships its own; see {@link SEMANTIC_REVIEWER_NAMES}. It is a parameter rather
|
|
120
|
-
* than a lookup because this module is imported by the registry, and reading
|
|
121
|
-
* which set is live means reading a file — a cost registration is willing to
|
|
122
|
-
* pay once and this judgement must not pay per call.
|
|
123
|
-
*/
|
|
124
|
-
export function resolvePolicyAuthority(
|
|
125
|
-
decl: AuthorityDeclaration | undefined,
|
|
126
|
-
knownReviewers: ReadonlySet<string> = SEMANTIC_REVIEWER_NAMES,
|
|
127
|
-
): ResolvedAuthority {
|
|
128
|
-
const declaredReviewable = decl?.authority === "reviewable";
|
|
129
|
-
if (!decl || effectiveAuthority(decl) === "hard") {
|
|
130
|
-
if (!declaredReviewable) return { authority: "hard" };
|
|
131
|
-
return { authority: "hard", downgraded: whyHard(decl!) };
|
|
132
|
-
}
|
|
133
|
-
const names = decl.reviewedBy as unknown[];
|
|
134
|
-
if (!names.every(isName)) {
|
|
135
|
-
return { authority: "hard", downgraded: "reviewedBy is not a list of semantic policy names" };
|
|
136
|
-
}
|
|
137
|
-
const unknown = names.filter((n) => !knownReviewers.has(n));
|
|
138
|
-
if (unknown.length > 0) {
|
|
139
|
-
return {
|
|
140
|
-
authority: "hard",
|
|
141
|
-
downgraded:
|
|
142
|
-
`reviewedBy names ${unknown.map((n) => JSON.stringify(n)).join(", ")}, ` +
|
|
143
|
-
`which ${unknown.length === 1 ? "is not a semantic policy" : "are not semantic policies"} in this build`,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
return { authority: "reviewable", reviewedBy: [...new Set(names)] };
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function whyHard(decl: AuthorityDeclaration): string {
|
|
150
|
-
if (decl.alwaysOn === true) return "it is alwaysOn, and the self-protection guard is never reviewable";
|
|
151
|
-
if (!Array.isArray(decl.reviewedBy) || decl.reviewedBy.length === 0) {
|
|
152
|
-
return "reviewedBy does not name any semantic policy";
|
|
153
|
-
}
|
|
154
|
-
return "reviewedBy is not a list of semantic policy names";
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The shape-valid authority fields of a serialized policy entry, for parsers.
|
|
159
|
-
*
|
|
160
|
-
* Invalid fields are DROPPED, never thrown on. A pack or cloud deployment that
|
|
161
|
-
* is refused over a typo in an optional field fails closed and denies every
|
|
162
|
-
* tool call its policies cover; dropping the field makes that one policy hard,
|
|
163
|
-
* which is the default the typo would have produced at registration anyway.
|
|
164
|
-
* Names are not checked against the semantic set here — that is a property of
|
|
165
|
-
* the build reading the entry, not of the entry, and is judged at registration.
|
|
166
|
-
*/
|
|
167
|
-
export function authorityFieldsOf(raw: Record<string, unknown>): AuthorityFields {
|
|
168
|
-
const out: AuthorityFields = {};
|
|
169
|
-
if (raw.authority === "hard" || raw.authority === "reviewable") out.authority = raw.authority;
|
|
170
|
-
const list = raw.reviewedBy;
|
|
171
|
-
if (Array.isArray(list) && list.length > 0 && list.every(isName)) {
|
|
172
|
-
out.reviewedBy = [...(list as string[])];
|
|
173
|
-
}
|
|
174
|
-
return out;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Why a declaration cannot be PUBLISHED as written, or `undefined` when it can.
|
|
179
|
-
*
|
|
180
|
-
* For build steps — `scripts/build-policy-pack.mjs` and `failproofai publish`.
|
|
181
|
-
* The loaders drop a malformed field and registration downgrades a refused
|
|
182
|
-
* `reviewable`, both toward hard and both only as a warning, because by then the
|
|
183
|
-
* pack is installed and refusing it would fail it closed. At build time nothing
|
|
184
|
-
* is installed yet, so refusing costs nobody anything, while shipping the
|
|
185
|
-
* declaration would make the policy silently hard on every machine that
|
|
186
|
-
* installs it — a decision its author made, quietly not taking effect.
|
|
187
|
-
*
|
|
188
|
-
* An empty `reviewedBy` on a hard policy is not a problem: it says nothing.
|
|
189
|
-
*/
|
|
190
|
-
export function authorityProblem(
|
|
191
|
-
decl: AuthorityDeclaration,
|
|
192
|
-
/**
|
|
193
|
-
* The reviewers the pack being built will SHIP WITH — its own `semantic`
|
|
194
|
-
* entries when it declares any, this build's set otherwise. A pack that
|
|
195
|
-
* carries both halves of the two-tier set names its own checks, and refusing
|
|
196
|
-
* that would make the feature unpublishable by the tool that implements it.
|
|
197
|
-
*/
|
|
198
|
-
knownReviewers: ReadonlySet<string> = SEMANTIC_REVIEWER_NAMES,
|
|
199
|
-
): string | undefined {
|
|
200
|
-
if (decl.authority !== undefined && decl.authority !== "hard" && decl.authority !== "reviewable") {
|
|
201
|
-
const t = typeof decl.authority;
|
|
202
|
-
return `authority must be "hard" or "reviewable", and is ${t === "string" ? JSON.stringify(decl.authority) : `${/^[aeiou]/.test(t) ? "an" : "a"} ${t}`}`;
|
|
203
|
-
}
|
|
204
|
-
if (decl.reviewedBy !== undefined && !(Array.isArray(decl.reviewedBy) && decl.reviewedBy.every(isName))) {
|
|
205
|
-
return "reviewedBy must be a list of semantic policy names";
|
|
206
|
-
}
|
|
207
|
-
const { downgraded } = resolvePolicyAuthority(decl, knownReviewers);
|
|
208
|
-
return downgraded ? `authority "reviewable" was refused — ${downgraded}` : undefined;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* The authority fields a pack MANIFEST should carry for one entry: resolved, as
|
|
213
|
-
* the registry will store them, so the manifest says exactly what takes effect.
|
|
214
|
-
* Throws, naming the entry, on anything {@link authorityProblem} refuses.
|
|
215
|
-
*/
|
|
216
|
-
export function manifestAuthority(
|
|
217
|
-
entry: AuthorityDeclaration & { name: string },
|
|
218
|
-
knownReviewers: ReadonlySet<string> = SEMANTIC_REVIEWER_NAMES,
|
|
219
|
-
): {
|
|
220
|
-
authority: PolicyAuthority;
|
|
221
|
-
reviewedBy?: string[];
|
|
222
|
-
} {
|
|
223
|
-
const problem = authorityProblem(entry, knownReviewers);
|
|
224
|
-
if (problem) throw new Error(`${entry.name}: ${problem}`);
|
|
225
|
-
const { authority, reviewedBy } = resolvePolicyAuthority(entry, knownReviewers);
|
|
226
|
-
return reviewedBy ? { authority, reviewedBy } : { authority };
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* One authority for several declarations that land on ONE registration.
|
|
231
|
-
*
|
|
232
|
-
* Artifacts are content-addressed, so two cloud assignments or two packs whose
|
|
233
|
-
* code is byte-identical load as one policy (the collapse in
|
|
234
|
-
* `custom-hooks-loader.ts`). Keeping one of their declarations would let the
|
|
235
|
-
* order of `active.json` or `installed.json` decide — and let one pack's
|
|
236
|
-
* manifest, or one team's assignment, make another's policy reviewable.
|
|
237
|
-
*
|
|
238
|
-
* So it resolves toward HARD, the way the collapse resolves the effect toward
|
|
239
|
-
* enforce: reviewable only when EVERY declaration resolves to reviewable, and
|
|
240
|
-
* then through the UNION of their checks (more checks that must all come back
|
|
241
|
-
* clear is stricter, never weaker). Otherwise it takes the first declaration
|
|
242
|
-
* that is not reviewable, so a refused one is still reported at registration.
|
|
243
|
-
*
|
|
244
|
-
* Returns `record` itself when its own fields already say that, and a copy with
|
|
245
|
-
* only the two authority fields replaced otherwise. `overruled` is true when
|
|
246
|
-
* some declaration asked for reviewable, validly, and did not get it.
|
|
247
|
-
*/
|
|
248
|
-
export function withMergedAuthority<T extends AuthorityFields>(
|
|
249
|
-
record: T,
|
|
250
|
-
declarations: ReadonlyArray<AuthorityFields>,
|
|
251
|
-
): { merged: T; overruled: boolean } {
|
|
252
|
-
const resolved = declarations.map((d) => resolvePolicyAuthority(d));
|
|
253
|
-
const allReviewable = resolved.length > 0 && resolved.every((r) => r.authority === "reviewable");
|
|
254
|
-
const fields: AuthorityFields = allReviewable
|
|
255
|
-
? { authority: "reviewable", reviewedBy: [...new Set(resolved.flatMap((r) => r.reviewedBy ?? []))] }
|
|
256
|
-
: fieldsOf(declarations[resolved.findIndex((r) => r.authority !== "reviewable")] ?? {});
|
|
257
|
-
const overruled = !allReviewable && resolved.some((r) => r.authority === "reviewable");
|
|
258
|
-
const same =
|
|
259
|
-
record.authority === fields.authority &&
|
|
260
|
-
JSON.stringify(record.reviewedBy) === JSON.stringify(fields.reviewedBy);
|
|
261
|
-
if (same) return { merged: record, overruled };
|
|
262
|
-
const { authority: _a, reviewedBy: _r, ...rest } = record;
|
|
263
|
-
return { merged: { ...rest, ...fields } as T, overruled };
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/** The authority fields a record actually carries, and nothing else. */
|
|
267
|
-
function fieldsOf(d: AuthorityFields): AuthorityFields {
|
|
268
|
-
return {
|
|
269
|
-
...(d.authority !== undefined ? { authority: d.authority } : {}),
|
|
270
|
-
...(d.reviewedBy !== undefined ? { reviewedBy: d.reviewedBy } : {}),
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const warnedAuthority = new Set<string>();
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Say that an authority declaration was not honored — once per process, and
|
|
278
|
-
* only once Jev is configured (a global `jev.json` exists).
|
|
279
|
-
*
|
|
280
|
-
* Without Jev, authority decides nothing, so there is nothing to tell anyone —
|
|
281
|
-
* and a warning is not free: it goes to the hook's stderr, which some CLIs show
|
|
282
|
-
* as the deny text itself, on every event, for every machine that installed a
|
|
283
|
-
* pack built against a newer semantic set. Once per process keeps the daemon's
|
|
284
|
-
* warm worker from repeating it for every tool call. Authors are told at build
|
|
285
|
-
* time as well: `failproofai publish` refuses what this would warn about.
|
|
286
|
-
*
|
|
287
|
-
* Presence of the file rather than a validated load: a machine where someone
|
|
288
|
-
* has started configuring Jev is where the answer to "why does Jev never clear
|
|
289
|
-
* this policy" is wanted, and a stat keeps the semantic modules unloaded.
|
|
290
|
-
*/
|
|
291
|
-
export function warnAuthority(message: string): void {
|
|
292
|
-
try {
|
|
293
|
-
if (!existsSync(jevConfigFile())) return;
|
|
294
|
-
} catch {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (warnedAuthority.has(message)) return;
|
|
298
|
-
warnedAuthority.add(message);
|
|
299
|
-
hookLogWarn(message);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Where a loaded hook's authority is declared, by the route it arrived on.
|
|
304
|
-
*
|
|
305
|
-
* - **Cloud-managed:** the artifact record in the active deployment. A cloud
|
|
306
|
-
* policy's authority is a central decision, so code inside the artifact
|
|
307
|
-
* cannot grant itself `reviewable`.
|
|
308
|
-
* - **Pack:** the pack's own manifest entry for that policy, matched by name —
|
|
309
|
-
* the same place its `params` schema is read from. A pack can only ever
|
|
310
|
-
* describe its own policies this way: its names cannot contain `/`, and they
|
|
311
|
-
* register under `pack/<id>@<version>/`, so no manifest can reach a builtin
|
|
312
|
-
* or another pack's policy. A policy the artifact registers but the manifest
|
|
313
|
-
* does not declare has no entry and is hard. When packs share one artifact,
|
|
314
|
-
* the loader has already merged their entries toward hard
|
|
315
|
-
* ({@link withMergedAuthority}), so no one of them decides for the others.
|
|
316
|
-
* - **The user's own file:** the hook itself.
|
|
317
|
-
*/
|
|
318
|
-
export function authorityDeclarationFor(
|
|
319
|
-
hook: Pick<CustomHook, "name" | "authority" | "reviewedBy">,
|
|
320
|
-
source: {
|
|
321
|
-
cloudManaged?: { authority?: unknown; reviewedBy?: unknown };
|
|
322
|
-
pack?: { policies: PolicyCatalogEntry[] };
|
|
323
|
-
},
|
|
324
|
-
): AuthorityDeclaration {
|
|
325
|
-
if (source.cloudManaged) {
|
|
326
|
-
return { authority: source.cloudManaged.authority, reviewedBy: source.cloudManaged.reviewedBy };
|
|
327
|
-
}
|
|
328
|
-
if (source.pack) {
|
|
329
|
-
const entry = source.pack.policies.find((p) => p.name === hook.name);
|
|
330
|
-
return { authority: entry?.authority, reviewedBy: entry?.reviewedBy };
|
|
331
|
-
}
|
|
332
|
-
return { authority: hook.authority, reviewedBy: hook.reviewedBy };
|
|
333
|
-
}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How much of what this machine enforces Jev is allowed to CLEAR — the
|
|
3
|
-
* diagnostic half of `policy-authority.ts`, and nothing else.
|
|
4
|
-
*
|
|
5
|
-
* ## The silence this exists to break
|
|
6
|
-
*
|
|
7
|
-
* Authority decides one thing: whether Jev may clear a regex policy's deny or
|
|
8
|
-
* instruct (`combine.ts`, which returns early unless the authority is
|
|
9
|
-
* `reviewable`). Absent means `hard`, and that default is right — it is what
|
|
10
|
-
* keeps an unknown pack, cloud or custom policy from being weakened by a
|
|
11
|
-
* classifier nobody asked about it.
|
|
12
|
-
*
|
|
13
|
-
* It is also completely silent. `authority` and `reviewedBy` reach a pack
|
|
14
|
-
* through its manifest, and the only thing that writes them there is
|
|
15
|
-
* `scripts/build-policy-pack.mjs`, which ships WITH this release. So a pack
|
|
16
|
-
* published before it declares none, every policy in it resolves to `hard`
|
|
17
|
-
* with nothing downgraded, and `warnAuthority` — which only speaks when a
|
|
18
|
-
* `reviewable` declaration was not honored — has nothing to say. The result a
|
|
19
|
-
* customer gets is the deny half of the two-tier evaluator working exactly as
|
|
20
|
-
* documented, the clear half unable to fire once, and no diagnostic anywhere:
|
|
21
|
-
* `jev status` says `on`, the fallback rate says the calls are being answered,
|
|
22
|
-
* and `cleared` says `nothing` forever.
|
|
23
|
-
*
|
|
24
|
-
* This module counts. It changes no policy's authority and no verdict, it is
|
|
25
|
-
* never imported from the hook path, and a machine with no `jev.json` never
|
|
26
|
-
* reaches a caller of it.
|
|
27
|
-
*
|
|
28
|
-
* ## What "enabled" means here
|
|
29
|
-
*
|
|
30
|
-
* The same thing it means in `handler.ts`, read from the same files, without
|
|
31
|
-
* loading or executing a policy:
|
|
32
|
-
*
|
|
33
|
-
* - **Installed packs** — each pack's manifest entries, narrowed by its
|
|
34
|
-
* `enabled` selection (absent means the whole pack). A pack's `clis`
|
|
35
|
-
* narrowing is NOT applied: there is no agent CLI in a status command, and
|
|
36
|
-
* the honest answer to "what could Jev clear on this machine" spans all of
|
|
37
|
-
* them.
|
|
38
|
-
* - **Builtins** — this build's catalog, under the same migration shim the
|
|
39
|
-
* handler applies: they enforce only while no pack is installed. The
|
|
40
|
-
* `alwaysOn` guard is counted always, because it registers always (and is
|
|
41
|
-
* hard always, so it can only ever lower the ratio).
|
|
42
|
-
* - **Cloud assignments** — the active deployment's records, whose authority is
|
|
43
|
-
* declared by whoever deployed them. One record per assignment; an artifact
|
|
44
|
-
* that registers several hooks is still one central decision.
|
|
45
|
-
*
|
|
46
|
-
* Two things are deliberately NOT counted, and `customFiles` is what says so
|
|
47
|
-
* out loud when it matters:
|
|
48
|
-
*
|
|
49
|
-
* - **Policies from the user's own files.** A custom hook declares its
|
|
50
|
-
* authority inside the module, so counting one means importing and running
|
|
51
|
-
* somebody's JavaScript — from a settings page, on every read. The count of
|
|
52
|
-
* configured custom policy PATHS is reported instead, and the summary says
|
|
53
|
-
* in words that those policies were not counted.
|
|
54
|
-
* - **A session pause.** It suspends local policy for minutes, and a warning
|
|
55
|
-
* about a policy set that is coming back shortly would be noise.
|
|
56
|
-
*/
|
|
57
|
-
import { readActiveCloudManagedPolicies } from "./cloud-managed-policies";
|
|
58
|
-
import { configuredCustomPolicyPaths, readMergedHooksConfig } from "./hooks-config";
|
|
59
|
-
import { hasInstalledPacks, packSemantic, readInstalledPacks } from "./pack-manifest";
|
|
60
|
-
import { resolvePolicyAuthority } from "./policy-authority";
|
|
61
|
-
import { POLICY_CATALOG } from "./policy-catalog";
|
|
62
|
-
import { normalizePolicyName } from "./policy-registry";
|
|
63
|
-
import type { HooksConfig } from "./policy-types";
|
|
64
|
-
|
|
65
|
-
/** Anything that carries an authority declaration: a catalog entry, a pack entry, a cloud record. */
|
|
66
|
-
export interface AuthorityRecord {
|
|
67
|
-
authority?: unknown;
|
|
68
|
-
reviewedBy?: unknown;
|
|
69
|
-
alwaysOn?: boolean;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface ReviewableCoverage {
|
|
73
|
-
/** Enabled policies whose authority could be read without running code. */
|
|
74
|
-
enabled: number;
|
|
75
|
-
/** Of those, the ones Jev may clear a deny or an instruct from. */
|
|
76
|
-
reviewable: number;
|
|
77
|
-
/** Configured custom policy paths, whose policies are not in the counts above. */
|
|
78
|
-
customFiles: number;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** The command that replaces a pack with one built by this release. */
|
|
82
|
-
export const RETAKE_PACK_COMMAND = "failproofai policies add FailproofAI/policies";
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Count a policy set by the authority it would REGISTER with —
|
|
86
|
-
* `resolvePolicyAuthority`, the rule `registerPolicy` applies — so this cannot
|
|
87
|
-
* report a clear that would not happen or hide one that would.
|
|
88
|
-
*
|
|
89
|
-
* Deliberately not `effectiveAuthority`, the looser §7 contract `jev-review.ts`
|
|
90
|
-
* asks at evaluation time. That one needs a single non-empty name and is right
|
|
91
|
-
* where it is asked, because by then the registry holds a `reviewedBy` that
|
|
92
|
-
* registration already cleaned, and on cleaned records the two rules agree.
|
|
93
|
-
* Nothing counted HERE has been through registration: these records are read
|
|
94
|
-
* straight off a pack manifest, this build's catalog and the cloud deployment.
|
|
95
|
-
* So a declaration naming a check this build does not have — `reviewedBy:
|
|
96
|
-
* ["future-check"]`, which is what a pack built against a NEWER semantic set
|
|
97
|
-
* looks like here — is reviewable to the loose rule and hard in the registry,
|
|
98
|
-
* and counting it would report a clear that can never happen while
|
|
99
|
-
* `reviewableProblem` stayed silent about the machine it exists to warn.
|
|
100
|
-
*/
|
|
101
|
-
export function countReviewable(
|
|
102
|
-
policies: Iterable<AuthorityRecord>,
|
|
103
|
-
/**
|
|
104
|
-
* The semantic checks that can be asked on this machine. Defaults to the
|
|
105
|
-
* compiled-in set; `surveyReviewableCoverage` passes the pack's when one
|
|
106
|
-
* declares its own, because otherwise this diagnostic reports "0 of 11
|
|
107
|
-
* reviewable" on exactly the machines the feature was built for — the ones
|
|
108
|
-
* running a pack that carries both tiers.
|
|
109
|
-
*/
|
|
110
|
-
knownReviewers?: ReadonlySet<string>,
|
|
111
|
-
): {
|
|
112
|
-
enabled: number;
|
|
113
|
-
reviewable: number;
|
|
114
|
-
} {
|
|
115
|
-
let enabled = 0;
|
|
116
|
-
let reviewable = 0;
|
|
117
|
-
for (const p of policies) {
|
|
118
|
-
enabled += 1;
|
|
119
|
-
if (resolvePolicyAuthority(p, knownReviewers).authority === "reviewable") reviewable += 1;
|
|
120
|
-
}
|
|
121
|
-
return { enabled, reviewable };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* What this machine's enabled policy set looks like to Jev. Reads three files
|
|
126
|
-
* and no policy: see the header for what is in the counts and what is not.
|
|
127
|
-
*
|
|
128
|
-
* Every source is wrapped, and an unreadable one contributes nothing rather
|
|
129
|
-
* than throwing — the same fail-open posture `handler.ts` takes for packs and
|
|
130
|
-
* cloud policies, for the same reason: this is a diagnostic, and one corrupt
|
|
131
|
-
* byte must not replace a settings page with an error boundary.
|
|
132
|
-
*/
|
|
133
|
-
export function surveyReviewableCoverage(cwd?: string): ReviewableCoverage {
|
|
134
|
-
const records: AuthorityRecord[] = [];
|
|
135
|
-
|
|
136
|
-
let packsInstalled = false;
|
|
137
|
-
/**
|
|
138
|
-
* The reviewers a pack brought with it. Collected from the SAME read as the
|
|
139
|
-
* policies rather than through `effectiveReviewerNames()`, which would re-read
|
|
140
|
-
* and re-verify every artifact for an answer already in hand — and would, for
|
|
141
|
-
* one read of a manifest being rewritten underneath, be able to disagree with
|
|
142
|
-
* the records counted here.
|
|
143
|
-
*
|
|
144
|
-
* A pack's `enabled` selection is deliberately not applied: it narrows which
|
|
145
|
-
* of its REGEX policies register, and its semantic set is not selectable.
|
|
146
|
-
*/
|
|
147
|
-
const packReviewers = new Set<string>();
|
|
148
|
-
try {
|
|
149
|
-
packsInstalled = hasInstalledPacks();
|
|
150
|
-
for (const pack of readInstalledPacks().packs) {
|
|
151
|
-
const selected = pack.enabled;
|
|
152
|
-
records.push(...(selected ? pack.policies.filter((p) => selected.includes(p.name)) : pack.policies));
|
|
153
|
-
for (const entry of packSemantic(pack)) packReviewers.add(entry.name);
|
|
154
|
-
}
|
|
155
|
-
} catch {
|
|
156
|
-
// An unreadable manifest enforces nothing; `readInstalledPacks` already
|
|
157
|
-
// reports that to the hook log on the path that cares.
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
let config: HooksConfig;
|
|
161
|
-
try {
|
|
162
|
-
config = readMergedHooksConfig(cwd);
|
|
163
|
-
} catch {
|
|
164
|
-
config = { enabledPolicies: [] };
|
|
165
|
-
}
|
|
166
|
-
// The migration shim, exactly as `handler.ts` applies it: this build's
|
|
167
|
-
// builtins enforce only until a pack is installed.
|
|
168
|
-
const legacyEnabled = new Set(packsInstalled ? [] : config.enabledPolicies.map(normalizePolicyName));
|
|
169
|
-
for (const policy of POLICY_CATALOG) {
|
|
170
|
-
if (policy.alwaysOn || legacyEnabled.has(normalizePolicyName(policy.name))) records.push(policy);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
try {
|
|
174
|
-
for (const assignment of readActiveCloudManagedPolicies()) {
|
|
175
|
-
records.push({ authority: assignment.authority, reviewedBy: assignment.reviewedBy });
|
|
176
|
-
}
|
|
177
|
-
} catch {
|
|
178
|
-
// Same fail-open as the handler's own read of this file.
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
let customFiles = 0;
|
|
182
|
-
try {
|
|
183
|
-
customFiles = configuredCustomPolicyPaths(config).length;
|
|
184
|
-
} catch {
|
|
185
|
-
customFiles = 0;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return { ...countReviewable(records, packReviewers.size > 0 ? packReviewers : undefined), customFiles };
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* The one line both surfaces show: the count, in the words `jev status` and the
|
|
193
|
-
* dashboard panel must agree on. A non-zero count is worth saying too — it is
|
|
194
|
-
* how someone learns how much of their policy set Jev can act on at all.
|
|
195
|
-
*/
|
|
196
|
-
export function reviewableSummary(coverage: ReviewableCoverage): string {
|
|
197
|
-
const { enabled, reviewable } = coverage;
|
|
198
|
-
// Said out loud rather than folded into the number, because a custom policy
|
|
199
|
-
// CAN be reviewable and this count would not know: reading that declaration
|
|
200
|
-
// means importing and running the file it lives in.
|
|
201
|
-
const tail = coverage.customFiles > 0 ? " (policies from your own files are not counted)" : "";
|
|
202
|
-
if (enabled === 0) return `No policies are enabled here, so there is nothing for Jev to clear${tail}.`;
|
|
203
|
-
const noun = enabled === 1 ? "1 enabled policy is" : `${enabled} enabled policies are`;
|
|
204
|
-
if (reviewable === 0) return `0 of ${noun} reviewable${tail}.`;
|
|
205
|
-
return `${reviewable} of ${noun} reviewable: Jev may clear a deny or an instruction from those, and from no others${tail}.`;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Why Jev can never clear anything here, and what fixes it — or null when it
|
|
210
|
-
* can clear something, which needs no explanation.
|
|
211
|
-
*
|
|
212
|
-
* It states the observation before naming the usual cause, because the cause is
|
|
213
|
-
* the usual one and not the only one: a machine can also reach zero by enabling
|
|
214
|
-
* only hard policies, or by having nothing but the self-protection guard. The
|
|
215
|
-
* remedy is the same in each case, and it is one command.
|
|
216
|
-
*
|
|
217
|
-
* Nothing is diagnosed for an empty policy set: there is no clear to lose, and
|
|
218
|
-
* an authority warning to someone who enforces nothing answers a question they
|
|
219
|
-
* did not ask.
|
|
220
|
-
*/
|
|
221
|
-
export function reviewableProblem(coverage: ReviewableCoverage): string | null {
|
|
222
|
-
if (coverage.enabled === 0 || coverage.reviewable > 0) return null;
|
|
223
|
-
return (
|
|
224
|
-
"Jev can add a deny or an instruction on this machine, but it can never clear one. " +
|
|
225
|
-
"No enabled policy is marked reviewable — a policy pack published before this release carries no such marks — " +
|
|
226
|
-
`so re-take the pack (\`${RETAKE_PACK_COMMAND}\`) to get a marked copy, ` +
|
|
227
|
-
"or enforce this build's builtin policies, which carry them."
|
|
228
|
-
);
|
|
229
|
-
}
|