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
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import {
|
|
3
|
+
existsSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
mkdtempSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
readdirSync,
|
|
8
|
+
rmSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
} from "node:fs";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { dirname, join, resolve } from "node:path";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
|
|
15
|
+
import ts from "typescript";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The real-framework harness.
|
|
19
|
+
*
|
|
20
|
+
* Everything under `test/` runs against `src/` with no framework installed, so
|
|
21
|
+
* it can prove an adapter's logic and nothing about whether that logic ever
|
|
22
|
+
* reaches the framework. The failures this directory exists for are invisible
|
|
23
|
+
* from there and total from outside it:
|
|
24
|
+
*
|
|
25
|
+
* * an adapter that patches the CommonJS copy of a dual-published framework
|
|
26
|
+
* while an ES-module app runs the ESM copy — `instrument()` reports
|
|
27
|
+
* success, every event is lost, nothing warns;
|
|
28
|
+
* * a framework major that moved the extension point — the adapter still
|
|
29
|
+
* installs, the callbacks never fire;
|
|
30
|
+
* * type declarations that resolve in the SDK's own `nodenext` tsconfig and
|
|
31
|
+
* in no CommonJS project's.
|
|
32
|
+
*
|
|
33
|
+
* So each fixture is a real consumer project: its own `package.json`, its own
|
|
34
|
+
* lockfile pinning a real framework release, the PACKED tarball extracted into
|
|
35
|
+
* its `node_modules` exactly as `npm install @failproofai/sdk` would lay it out,
|
|
36
|
+
* and one `agent.ts` run twice — once transpiled to an ES module and once to
|
|
37
|
+
* CommonJS — because the two module systems load different copies of the
|
|
38
|
+
* framework and both are what customers run.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
42
|
+
export const FIXTURES = join(ROOT, "integration", "fixtures");
|
|
43
|
+
|
|
44
|
+
export type Format = "esm" | "cjs" | "bun-esm" | "bun-cjs" | "deno-esm" | "deno-cjs";
|
|
45
|
+
/** The two module systems, under Node. What every framework file runs. */
|
|
46
|
+
export const FORMATS: readonly Format[] = ["esm", "cjs"];
|
|
47
|
+
/**
|
|
48
|
+
* The same two transpiled agents, under Bun. A framework test file opts in with
|
|
49
|
+
* `describe.each([...FORMATS, ...BUN_FORMATS])`; `runtimes.bun.test.ts` runs
|
|
50
|
+
* every scenario of every fixture this way against its Node twin.
|
|
51
|
+
*/
|
|
52
|
+
export const BUN_FORMATS: readonly Format[] = ["bun-esm", "bun-cjs"];
|
|
53
|
+
/** The same two transpiled agents, under Deno (`deno run -A`). */
|
|
54
|
+
export const DENO_FORMATS: readonly Format[] = ["deno-esm", "deno-cjs"];
|
|
55
|
+
|
|
56
|
+
export type Runtime = "node" | "bun" | "deno";
|
|
57
|
+
|
|
58
|
+
/** Which runtime a format runs under, and which transpiled agent it runs. */
|
|
59
|
+
export function splitFormat(format: Format): { runtime: Runtime; module: "esm" | "cjs" } {
|
|
60
|
+
const [head, tail] = format.split("-") as [string, string | undefined];
|
|
61
|
+
if (tail === undefined) return { runtime: "node", module: head as "esm" | "cjs" };
|
|
62
|
+
return { runtime: head as Runtime, module: tail as "esm" | "cjs" };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The command line that starts `runtime`, before the script and its arguments.
|
|
67
|
+
*
|
|
68
|
+
* Bun and Deno come from the `runtimes` fixture — pinned in its lockfile and
|
|
69
|
+
* installed with `--ignore-scripts`, so each is its platform package's own
|
|
70
|
+
* binary rather than whatever a developer or a CI image happens to have on
|
|
71
|
+
* PATH. `FAILPROOFAI_IT_BUN` / `FAILPROOFAI_IT_DENO` override that with an
|
|
72
|
+
* explicit binary. There is no fall-back to PATH and no skip: a runtime that
|
|
73
|
+
* cannot be found fails the test that needed it.
|
|
74
|
+
*/
|
|
75
|
+
export function runtimeCommand(runtime: Runtime): string[] {
|
|
76
|
+
if (runtime === "node") return [process.execPath];
|
|
77
|
+
const override = process.env[runtime === "bun" ? "FAILPROOFAI_IT_BUN" : "FAILPROOFAI_IT_DENO"];
|
|
78
|
+
const binary = override || runtimeBinary(runtime);
|
|
79
|
+
return runtime === "deno" ? [binary, "run", "--allow-all", "--no-lock"] : [binary];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function runtimeBinary(runtime: "bun" | "deno"): string {
|
|
83
|
+
const modules = join(FIXTURES, "runtimes", "node_modules");
|
|
84
|
+
const scope = join(modules, runtime === "bun" ? "@oven" : "@deno");
|
|
85
|
+
const candidates = existsSync(scope)
|
|
86
|
+
? readdirSync(scope).map((dir) =>
|
|
87
|
+
runtime === "bun" ? join(scope, dir, "bin", "bun") : join(scope, dir, "deno"),
|
|
88
|
+
)
|
|
89
|
+
: [];
|
|
90
|
+
// npm installs every platform package whose os/cpu match; on a glibc Linux
|
|
91
|
+
// that can include a musl build that will not start. Take the first that runs.
|
|
92
|
+
for (const candidate of candidates) {
|
|
93
|
+
if (!existsSync(candidate)) continue;
|
|
94
|
+
const probe = spawnSync(candidate, ["--version"], { encoding: "utf8" });
|
|
95
|
+
if (probe.status === 0) return candidate;
|
|
96
|
+
}
|
|
97
|
+
throw new Error(
|
|
98
|
+
`no runnable ${runtime} binary under ${scope}. The runtimes fixture installs it; ` +
|
|
99
|
+
`run the suite with FAILPROOFAI_IT_FIXTURES including "runtimes", or set ` +
|
|
100
|
+
`FAILPROOFAI_IT_${runtime.toUpperCase()} to a binary.`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Every scenario a fixture's agent accepts: the `case "…":` labels of its
|
|
106
|
+
* dispatch `switch`. Lets a runtime-parity test cover a fixture completely
|
|
107
|
+
* without restating what each framework test already asserts.
|
|
108
|
+
*/
|
|
109
|
+
export function scenarios(fixture: string): string[] {
|
|
110
|
+
const source = readFileSync(join(FIXTURES, fixture, "agent.ts"), "utf8");
|
|
111
|
+
return [...new Set([...source.matchAll(/^\s*case "([a-z0-9-]+)":/gm)].map((match) => match[1]!))];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type Event = Record<string, unknown> & {
|
|
115
|
+
type: string;
|
|
116
|
+
session_id: string;
|
|
117
|
+
agent_id: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export interface RunResult {
|
|
121
|
+
events: Event[];
|
|
122
|
+
stdout: string;
|
|
123
|
+
stderr: string;
|
|
124
|
+
status: number | null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Pack `dist/` exactly as `npm publish` would, once per process. */
|
|
128
|
+
let tarball: string | null = null;
|
|
129
|
+
export function packedTarball(): string {
|
|
130
|
+
if (tarball !== null) return tarball;
|
|
131
|
+
if (!existsSync(join(ROOT, "dist", "esm", "index.js"))) {
|
|
132
|
+
throw new Error("dist/ is not built. Run `npm run build` first (`npm run test:integration` does).");
|
|
133
|
+
}
|
|
134
|
+
const out = mkdtempSync(join(tmpdir(), "failproofai-sdk-pack-"));
|
|
135
|
+
const name = execFileSync("npm", ["pack", "--silent", "--ignore-scripts", "--pack-destination", out], {
|
|
136
|
+
cwd: ROOT,
|
|
137
|
+
encoding: "utf8",
|
|
138
|
+
})
|
|
139
|
+
.trim()
|
|
140
|
+
.split("\n")
|
|
141
|
+
.pop()!;
|
|
142
|
+
tarball = join(out, name);
|
|
143
|
+
return tarball;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Install one fixture: `npm ci` against its lockfile, then the packed SDK.
|
|
148
|
+
*
|
|
149
|
+
* The SDK is extracted rather than `npm install`ed. It has no dependencies to
|
|
150
|
+
* resolve, and an install would rewrite the fixture's lockfile — which is the
|
|
151
|
+
* one file that pins the framework release this fixture exists to test.
|
|
152
|
+
*
|
|
153
|
+
* `npm ci` is skipped when `node_modules` was already built from this exact
|
|
154
|
+
* lockfile, so a local re-run costs seconds rather than minutes.
|
|
155
|
+
*/
|
|
156
|
+
export async function installFixture(fixture: string, pack: string): Promise<void> {
|
|
157
|
+
const dir = join(FIXTURES, fixture);
|
|
158
|
+
const lock = join(dir, "package-lock.json");
|
|
159
|
+
if (!existsSync(lock)) throw new Error(`${fixture} has no package-lock.json`);
|
|
160
|
+
const stamp = join(dir, "node_modules", ".failproofai-lock");
|
|
161
|
+
const lockText = readFileSync(lock, "utf8");
|
|
162
|
+
if (!existsSync(stamp) || readFileSync(stamp, "utf8") !== lockText) {
|
|
163
|
+
await run("npm", ["ci", "--no-audit", "--no-fund", "--ignore-scripts"], dir, `npm ci in ${fixture}`);
|
|
164
|
+
writeFileSync(stamp, lockText);
|
|
165
|
+
}
|
|
166
|
+
const target = join(dir, "node_modules", "@failproofai", "sdk");
|
|
167
|
+
rmSync(target, { recursive: true, force: true });
|
|
168
|
+
mkdirSync(target, { recursive: true });
|
|
169
|
+
execFileSync("tar", ["-xzf", pack, "-C", target, "--strip-components=1"]);
|
|
170
|
+
// Runtime fixtures (`nextjs`, `runtimes`, `workers`) are not one-agent
|
|
171
|
+
// projects; they build or run their own sources.
|
|
172
|
+
if (existsSync(join(dir, "agent.ts"))) transpile(fixture);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function run(command: string, args: string[], cwd: string, label: string): Promise<void> {
|
|
176
|
+
return new Promise((resolvePromise, reject) => {
|
|
177
|
+
const child = spawn(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
178
|
+
let output = "";
|
|
179
|
+
child.stdout.on("data", (chunk: Buffer) => (output += chunk.toString()));
|
|
180
|
+
child.stderr.on("data", (chunk: Buffer) => (output += chunk.toString()));
|
|
181
|
+
child.on("error", reject);
|
|
182
|
+
child.on("close", (code) =>
|
|
183
|
+
code === 0 ? resolvePromise() : reject(new Error(`${label} failed (exit ${String(code)}):\n${output}`)),
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Every fixture directory, i.e. every framework release under test. */
|
|
189
|
+
export function fixtures(): string[] {
|
|
190
|
+
return readdirSync(FIXTURES, { withFileTypes: true })
|
|
191
|
+
.filter((entry) => entry.isDirectory() && existsSync(join(FIXTURES, entry.name, "package.json")))
|
|
192
|
+
.map((entry) => entry.name)
|
|
193
|
+
.sort();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Transpile `agent.ts` into both module systems, beside the fixture's
|
|
198
|
+
* `node_modules` so resolution is exactly the fixture's.
|
|
199
|
+
*
|
|
200
|
+
* `transpileModule` rather than `tsc`: this step is about RUNTIME resolution and
|
|
201
|
+
* must not fail because of a type error — type correctness is checked
|
|
202
|
+
* separately, by `typecheck()`, where a failure names itself.
|
|
203
|
+
*/
|
|
204
|
+
export function transpile(fixture: string): void {
|
|
205
|
+
const dir = join(FIXTURES, fixture);
|
|
206
|
+
const out = join(dir, ".run");
|
|
207
|
+
mkdirSync(out, { recursive: true });
|
|
208
|
+
// `agent.ts`, plus any other top-level `agent-*.ts` program a fixture carries
|
|
209
|
+
// for APIs only its own framework release has, and the named EXTRA_PROGRAMS
|
|
210
|
+
// (the ai fixtures' `surfaces.ts`) — all run through `runAgent`'s `program`.
|
|
211
|
+
// Each is standalone: programs never import one another.
|
|
212
|
+
const programs = readdirSync(dir).filter(
|
|
213
|
+
(name) => /^agent(-[\w-]+)?\.ts$/.test(name) || EXTRA_PROGRAMS.some((extra) => name === `${extra}.ts`),
|
|
214
|
+
);
|
|
215
|
+
for (const name of programs) {
|
|
216
|
+
const base = name.slice(0, -".ts".length);
|
|
217
|
+
const source = readFileSync(join(dir, name), "utf8");
|
|
218
|
+
const emit = (module: ts.ModuleKind, file: string): void => {
|
|
219
|
+
const { outputText } = ts.transpileModule(source, {
|
|
220
|
+
compilerOptions: { module, target: ts.ScriptTarget.ES2022, esModuleInterop: true },
|
|
221
|
+
fileName: join(dir, name),
|
|
222
|
+
});
|
|
223
|
+
writeFileSync(join(out, file), outputText);
|
|
224
|
+
};
|
|
225
|
+
emit(ts.ModuleKind.ESNext, `${base}.mjs`);
|
|
226
|
+
emit(ts.ModuleKind.CommonJS, `${base}.cjs`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Entry programs besides `agent.ts` that a fixture may ship, run with `runAgent(..., program)`. */
|
|
231
|
+
const EXTRA_PROGRAMS = ["surfaces"];
|
|
232
|
+
|
|
233
|
+
/** Run one case of a fixture's agent in one module system. */
|
|
234
|
+
export function runAgent(
|
|
235
|
+
fixture: string,
|
|
236
|
+
format: Format,
|
|
237
|
+
scenario: string,
|
|
238
|
+
env: Record<string, string> = {},
|
|
239
|
+
/** Which `agent*.ts` program of the fixture to run; `agent` unless it carries more. */
|
|
240
|
+
program = "agent",
|
|
241
|
+
): RunResult {
|
|
242
|
+
const dir = join(FIXTURES, fixture);
|
|
243
|
+
const home = mkdtempSync(join(tmpdir(), `failproofai-it-${fixture}-`));
|
|
244
|
+
try {
|
|
245
|
+
const { runtime, module } = splitFormat(format);
|
|
246
|
+
const entry = join(dir, ".run", `${program}.${module === "esm" ? "mjs" : "cjs"}`);
|
|
247
|
+
const [command, ...prefix] = runtimeCommand(runtime);
|
|
248
|
+
const result = spawnSync(command!, [...prefix, entry, scenario], {
|
|
249
|
+
cwd: dir,
|
|
250
|
+
encoding: "utf8",
|
|
251
|
+
timeout: 90_000,
|
|
252
|
+
env: {
|
|
253
|
+
...process.env,
|
|
254
|
+
// Never the developer's real spool: a running daemon would collect it.
|
|
255
|
+
FAILPROOFAI_HOME: home,
|
|
256
|
+
FAILPROOFAI_SDK_STRICT: "1",
|
|
257
|
+
NODE_OPTIONS: "",
|
|
258
|
+
...env,
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
return {
|
|
262
|
+
events: readSpool(join(home, "custom-agents", "events")),
|
|
263
|
+
stdout: result.stdout,
|
|
264
|
+
stderr: result.stderr,
|
|
265
|
+
status: result.status,
|
|
266
|
+
};
|
|
267
|
+
} finally {
|
|
268
|
+
rmSync(home, { recursive: true, force: true });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* `runAgent`, without blocking the test worker — so a file that runs hundreds
|
|
274
|
+
* of cases (the runtime-parity suites) can run them `concurrent`ly.
|
|
275
|
+
*/
|
|
276
|
+
export async function runAgentAsync(
|
|
277
|
+
fixture: string,
|
|
278
|
+
format: Format,
|
|
279
|
+
scenario: string,
|
|
280
|
+
env: Record<string, string> = {},
|
|
281
|
+
): Promise<RunResult> {
|
|
282
|
+
const dir = join(FIXTURES, fixture);
|
|
283
|
+
const { runtime, module } = splitFormat(format);
|
|
284
|
+
const entry = join(dir, ".run", module === "esm" ? "agent.mjs" : "agent.cjs");
|
|
285
|
+
const [command, ...prefix] = runtimeCommand(runtime);
|
|
286
|
+
return await runProcess([command!, ...prefix, entry, scenario], { cwd: dir, env, label: fixture });
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Run any command against a fresh scratch spool and collect what it wrote.
|
|
291
|
+
* The building block of `runAgentAsync`, and of the runtime suites whose
|
|
292
|
+
* programs are not a fixture's `agent.ts`.
|
|
293
|
+
*/
|
|
294
|
+
export async function runProcess(
|
|
295
|
+
argv: string[],
|
|
296
|
+
options: { cwd: string; env?: Record<string, string>; label?: string; timeout?: number; home?: string },
|
|
297
|
+
): Promise<RunResult> {
|
|
298
|
+
const home = options.home ?? mkdtempSync(join(tmpdir(), `failproofai-it-${options.label ?? "run"}-`));
|
|
299
|
+
try {
|
|
300
|
+
const { stdout, stderr, status } = await new Promise<{ stdout: string; stderr: string; status: number | null }>(
|
|
301
|
+
(resolvePromise) => {
|
|
302
|
+
const child = spawn(argv[0]!, argv.slice(1), {
|
|
303
|
+
cwd: options.cwd,
|
|
304
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
305
|
+
env: {
|
|
306
|
+
...process.env,
|
|
307
|
+
FAILPROOFAI_HOME: home,
|
|
308
|
+
FAILPROOFAI_SDK_STRICT: "1",
|
|
309
|
+
NODE_OPTIONS: "",
|
|
310
|
+
...options.env,
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
let out = "";
|
|
314
|
+
let err = "";
|
|
315
|
+
child.stdout.on("data", (chunk: Buffer) => (out += chunk.toString()));
|
|
316
|
+
child.stderr.on("data", (chunk: Buffer) => (err += chunk.toString()));
|
|
317
|
+
const timer = setTimeout(() => child.kill("SIGKILL"), options.timeout ?? 90_000);
|
|
318
|
+
child.on("error", (error) => {
|
|
319
|
+
clearTimeout(timer);
|
|
320
|
+
resolvePromise({ stdout: out, stderr: `${err}\n${String(error)}`, status: null });
|
|
321
|
+
});
|
|
322
|
+
child.on("close", (code) => {
|
|
323
|
+
clearTimeout(timer);
|
|
324
|
+
resolvePromise({ stdout: out, stderr: err, status: code });
|
|
325
|
+
});
|
|
326
|
+
},
|
|
327
|
+
);
|
|
328
|
+
return { events: readSpool(join(home, "custom-agents", "events")), stdout, stderr, status };
|
|
329
|
+
} finally {
|
|
330
|
+
if (options.home === undefined) rmSync(home, { recursive: true, force: true });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Every event in a spool directory, in the order the run produced them. */
|
|
335
|
+
export function readSpool(dir: string): Event[] {
|
|
336
|
+
if (!existsSync(dir)) return [];
|
|
337
|
+
const events: Event[] = [];
|
|
338
|
+
for (const name of readdirSync(dir).filter((n) => n.endsWith(".jsonl")).sort()) {
|
|
339
|
+
for (const line of readFileSync(join(dir, name), "utf8").split("\n")) {
|
|
340
|
+
if (line.trim()) events.push(JSON.parse(line) as Event);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// Batches are named by time, then pid, then sequence; order within the run
|
|
344
|
+
// is the order the timestamps say, with the file order breaking ties.
|
|
345
|
+
return events
|
|
346
|
+
.map((event, index) => ({ event, index }))
|
|
347
|
+
.sort((a, b) => String(a.event.timestamp).localeCompare(String(b.event.timestamp)) || a.index - b.index)
|
|
348
|
+
.map(({ event }) => event);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** `tsc --noEmit` over a fixture with a given tsconfig; returns diagnostics. */
|
|
352
|
+
export function typecheck(fixture: string, tsconfig = "tsconfig.json"): string {
|
|
353
|
+
const dir = join(FIXTURES, fixture);
|
|
354
|
+
const tsc = join(ROOT, "node_modules", "typescript", "bin", "tsc");
|
|
355
|
+
const result = spawnSync(process.execPath, [tsc, "-p", join(dir, tsconfig), "--noEmit"], {
|
|
356
|
+
cwd: dir,
|
|
357
|
+
encoding: "utf8",
|
|
358
|
+
});
|
|
359
|
+
return (result.stdout + result.stderr).trim();
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export const count = (events: Event[], type: string): number =>
|
|
363
|
+
events.filter((event) => event.type === type).length;
|
|
364
|
+
|
|
365
|
+
export const ofType = (events: Event[], type: string): Event[] =>
|
|
366
|
+
events.filter((event) => event.type === type);
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The four checks every adapter must pass, from the Python SDK's
|
|
370
|
+
* `skill/references/frameworks.md` ("Verifying an adapter"), plus the two that
|
|
371
|
+
* make them meaningful: something was recorded, and nothing was recorded twice.
|
|
372
|
+
* Returns the list of violations so a failure names every problem at once.
|
|
373
|
+
*/
|
|
374
|
+
export function traceViolations(events: Event[]): string[] {
|
|
375
|
+
const problems: string[] = [];
|
|
376
|
+
if (events.length === 0) return ["no events were recorded"];
|
|
377
|
+
|
|
378
|
+
const bySession = new Map<string, Event[]>();
|
|
379
|
+
for (const event of events) {
|
|
380
|
+
const list = bySession.get(event.session_id) ?? [];
|
|
381
|
+
list.push(event);
|
|
382
|
+
bySession.set(event.session_id, list);
|
|
383
|
+
}
|
|
384
|
+
const UUID = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i;
|
|
385
|
+
|
|
386
|
+
for (const [session, list] of bySession) {
|
|
387
|
+
// 1. The first event of each session is the root agent_start.
|
|
388
|
+
if (list[0]!.type !== "agent_start") {
|
|
389
|
+
problems.push(`session ${session} starts with ${list[0]!.type}, not agent_start`);
|
|
390
|
+
}
|
|
391
|
+
// 2. agent_id values are names, not UUIDs.
|
|
392
|
+
for (const id of new Set(list.map((e) => e.agent_id))) {
|
|
393
|
+
if (UUID.test(id)) problems.push(`session ${session} has a UUID agent_id ${id}`);
|
|
394
|
+
}
|
|
395
|
+
// 3. model_request/model_response pair on request_id, response has duration.
|
|
396
|
+
const requests = new Set(ofType(list, "model_request").map((e) => e.request_id));
|
|
397
|
+
for (const response of ofType(list, "model_response")) {
|
|
398
|
+
if (!requests.has(response.request_id)) {
|
|
399
|
+
problems.push(`model_response ${String(response.request_id)} has no matching model_request`);
|
|
400
|
+
}
|
|
401
|
+
if (typeof response.duration_ms !== "number") {
|
|
402
|
+
problems.push(`model_response ${String(response.request_id)} has no duration_ms`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (count(list, "model_request") !== count(list, "model_response")) {
|
|
406
|
+
problems.push(
|
|
407
|
+
`session ${session}: ${count(list, "model_request")} model_request vs ` +
|
|
408
|
+
`${count(list, "model_response")} model_response`,
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
// 4. Nothing left open.
|
|
412
|
+
const pairs: Array<[string, string, string]> = [
|
|
413
|
+
["tool_use", "tool_result", "tool_call_id"],
|
|
414
|
+
["hook_triggered", "hook_completed", "hook_id"],
|
|
415
|
+
];
|
|
416
|
+
for (const [open, close, key] of pairs) {
|
|
417
|
+
const opened = ofType(list, open).map((e) => String(e[key]));
|
|
418
|
+
const closed = new Set(ofType(list, close).map((e) => String(e[key])));
|
|
419
|
+
for (const id of opened) if (!closed.has(id)) problems.push(`${open} ${id} never closed`);
|
|
420
|
+
const dupes = opened.filter((id, i) => opened.indexOf(id) !== i);
|
|
421
|
+
for (const id of new Set(dupes)) problems.push(`${open} ${id} emitted more than once`);
|
|
422
|
+
}
|
|
423
|
+
const depth = new Map<string, number>();
|
|
424
|
+
for (const event of list) {
|
|
425
|
+
if (event.type === "agent_start") depth.set(event.agent_id, (depth.get(event.agent_id) ?? 0) + 1);
|
|
426
|
+
if (event.type === "agent_end") depth.set(event.agent_id, (depth.get(event.agent_id) ?? 0) - 1);
|
|
427
|
+
}
|
|
428
|
+
for (const [agent, open] of depth) {
|
|
429
|
+
if (open !== 0) problems.push(`session ${session}: agent ${agent} start/end imbalance ${open}`);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return problems;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** Shorthand for a failure message that shows the trace it is about. */
|
|
436
|
+
export function describeTrace(result: RunResult): string {
|
|
437
|
+
const lines = result.events.map(
|
|
438
|
+
(e) =>
|
|
439
|
+
` ${e.session_id.slice(0, 12)} ${e.agent_id} ${e.type}` +
|
|
440
|
+
(e.tool_name ? ` tool=${JSON.stringify(e.tool_name)}` : "") +
|
|
441
|
+
(e.hook_name ? ` hook=${JSON.stringify(e.hook_name)}` : "") +
|
|
442
|
+
(e.input_tokens !== undefined ? ` tokens=${JSON.stringify([e.input_tokens, e.output_tokens])}` : ""),
|
|
443
|
+
);
|
|
444
|
+
return [
|
|
445
|
+
`exit=${String(result.status)}`,
|
|
446
|
+
`trace (${result.events.length}):`,
|
|
447
|
+
...lines,
|
|
448
|
+
`stdout: ${result.stdout.slice(-1500)}`,
|
|
449
|
+
`stderr: ${result.stderr.slice(-3000)}`,
|
|
450
|
+
].join("\n");
|
|
451
|
+
}
|