failproofai 1.0.7-beta.1 → 1.0.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +7 -7
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l3yhx4._.js +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_18qtd42._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0yxwl6j._.js → [root-of-the-server]__0l44ual._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s_yomn._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_214wgrp._.js → _1mel6y1._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0bn2oo8._.js → _1v-jvrv._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_15t8kqj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1fm2w5z._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1j0zy3v._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_builtin-policies_ts_09j2ndl._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +22 -22
- package/.next/standalone/.next/static/chunks/043j99m8ykg__.css +2 -0
- package/.next/standalone/.next/static/chunks/0fqd7m_u81mi5.js +1 -0
- package/.next/standalone/.next/static/chunks/129ag2bw93bdh.js +1 -0
- package/.next/standalone/.next/static/chunks/{29fql3nbnfc9q.js → 1qd741hzlmjbo.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0vmd180qfntfb.js → 2_pltstd8-xgs.js} +1 -1
- package/.next/standalone/.next/static/chunks/{1u5zsejmgrir_.js → 2c8j9l6j_b1ci.js} +1 -1
- package/.next/standalone/.next/static/chunks/3-k569wzcli8q.js +1 -0
- package/.next/standalone/.next/static/chunks/{258668t68du6b.js → 3brze37td_wnc.js} +1 -1
- package/.next/standalone/.next/static/chunks/3otmypm6j_xfo.js +6 -0
- package/.next/standalone/.next/static/chunks/{12tvm75t5ffui.js → 3ugmd_7dyn0id.js} +1 -1
- package/.next/standalone/.next/static/chunks/3yxro_r2_o9ad.js +69 -0
- package/.next/standalone/PROBE-FOLLOWUP.md +186 -0
- package/.next/standalone/app/actions/get-jev-config.ts +38 -23
- package/.next/standalone/app/actions/update-jev-config.ts +1 -1
- package/.next/standalone/app/settings/jev-panel.tsx +33 -29
- package/.next/standalone/package.json +10 -10
- package/.next/standalone/sdk/python/skill/SKILL.md +60 -14
- package/.next/standalone/sdk/python/skill/agents/openai.yaml +2 -1
- package/.next/standalone/sdk/python/skill/references/evaluator.md +255 -0
- package/.next/standalone/sdk/python/skill/references/events.md +17 -8
- package/.next/standalone/sdk/python/skill/references/frameworks.md +3 -0
- package/.next/standalone/sdk/python/skill/references/install.md +3 -0
- package/.next/standalone/sdk/python/skill/references/integration.md +6 -2
- package/.next/standalone/sdk/python/skill/references/typescript.md +568 -0
- package/.next/standalone/sdk/typescript/CHANGELOG.md +119 -0
- package/.next/standalone/sdk/typescript/LICENSE +42 -0
- package/.next/standalone/sdk/typescript/README.md +552 -0
- package/.next/standalone/sdk/typescript/eslint.config.mjs +59 -0
- package/.next/standalone/sdk/typescript/examples/research-agent.ts +197 -0
- package/.next/standalone/sdk/typescript/integration/ai.test.ts +920 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/agent.ts +337 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package-lock.json +281 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/surfaces.ts +605 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-4/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/agent.ts +342 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package-lock.json +168 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/surfaces.ts +628 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-5/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/agent.ts +346 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/package-lock.json +156 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/surfaces.ts +651 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-6/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/agent.ts +350 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/package-lock.json +153 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/package.json +13 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/surfaces.ts +651 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/ai-7/tsconfig.surfaces.json +4 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/agent.ts +623 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package-lock.json +463 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-0.3/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/agent-v1.ts +99 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/agent.ts +623 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/package-lock.json +336 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-1/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/agent.ts +96 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package-lock.json +579 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/index.cjs +53 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/index.mjs +55 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/langchain-dup-core/vendor/lc-weather-provider/package.json +18 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/agent.ts +659 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/package-lock.json +635 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.11/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/agent.ts +659 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/package-lock.json +553 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/llamaindex-0.12/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/agent.ts +877 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/mcp-server.mjs +66 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package-lock.json +6417 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-0/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/agent.ts +872 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/mcp-server.mjs +66 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package-lock.json +2540 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/actions.ts +18 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/ai/route.ts +42 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/edge/route.ts +29 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/langgraph/route.ts +21 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/llamaindex/route.ts +11 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/mastra/route.ts +19 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/api/status/route.ts +7 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/layout.tsx +9 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/app/page.tsx +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/instrumentation.ts +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/ai.ts +61 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/langgraph.ts +68 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/llamaindex.ts +98 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/lib/mastra.ts +90 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/next.config.ts +52 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package-lock.json +4343 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/nextjs/package.json +28 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/agent.ts +51 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/deno-npm.ts +76 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/package-lock.json +484 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/runtimes/package.json +15 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/types/agent.ts +79 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/types/package-lock.json +740 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/types/package.json +11 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/agent.ts +197 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/package-lock.json +70 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/package.json +12 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/vanilla/tsconfig.json +12 -0
- package/.next/standalone/sdk/typescript/integration/global-setup.ts +29 -0
- package/.next/standalone/sdk/typescript/integration/harness.ts +451 -0
- package/.next/standalone/sdk/typescript/integration/langchain.test.ts +682 -0
- package/.next/standalone/sdk/typescript/integration/llamaindex.test.ts +709 -0
- package/.next/standalone/sdk/typescript/integration/mastra-coverage.test.ts +386 -0
- package/.next/standalone/sdk/typescript/integration/mastra.test.ts +311 -0
- package/.next/standalone/sdk/typescript/integration/nextjs.test.ts +341 -0
- package/.next/standalone/sdk/typescript/integration/runtime-parity.ts +180 -0
- package/.next/standalone/sdk/typescript/integration/runtimes.bun.test.ts +15 -0
- package/.next/standalone/sdk/typescript/integration/runtimes.core.test.ts +113 -0
- package/.next/standalone/sdk/typescript/integration/runtimes.deno.test.ts +19 -0
- package/.next/standalone/sdk/typescript/integration/types.test.ts +141 -0
- package/.next/standalone/sdk/typescript/integration/vanilla.test.ts +255 -0
- package/.next/standalone/sdk/typescript/package-lock.json +2640 -0
- package/.next/standalone/sdk/typescript/package.json +401 -0
- package/.next/standalone/sdk/typescript/scripts/finalize-build.mjs +123 -0
- package/.next/standalone/sdk/typescript/scripts/release.mjs +177 -0
- package/.next/standalone/sdk/typescript/src/clock.ts +58 -0
- package/.next/standalone/sdk/typescript/src/context.ts +214 -0
- package/.next/standalone/sdk/typescript/src/edge/adapter.ts +18 -0
- package/.next/standalone/sdk/typescript/src/edge/ai.ts +116 -0
- package/.next/standalone/sdk/typescript/src/edge/index.ts +238 -0
- package/.next/standalone/sdk/typescript/src/edge/langchain.ts +18 -0
- package/.next/standalone/sdk/typescript/src/edge/llamaindex.ts +12 -0
- package/.next/standalone/sdk/typescript/src/edge/mastra.ts +17 -0
- package/.next/standalone/sdk/typescript/src/edge/notice.ts +33 -0
- package/.next/standalone/sdk/typescript/src/environment.ts +75 -0
- package/.next/standalone/sdk/typescript/src/evaluator/authoring.ts +480 -0
- package/.next/standalone/sdk/typescript/src/evaluator/cli.ts +96 -0
- package/.next/standalone/sdk/typescript/src/evaluator/client.ts +421 -0
- package/.next/standalone/sdk/typescript/src/evaluator/expression.ts +1292 -0
- package/.next/standalone/sdk/typescript/src/evaluator/index.ts +144 -0
- package/.next/standalone/sdk/typescript/src/evaluator/protocol.ts +747 -0
- package/.next/standalone/sdk/typescript/src/evaluator/runtime.ts +930 -0
- package/.next/standalone/sdk/typescript/src/evaluator/sandbox-worker.ts +171 -0
- package/.next/standalone/sdk/typescript/src/evaluator/source-limits.ts +27 -0
- package/.next/standalone/sdk/typescript/src/evaluator/source.ts +509 -0
- package/.next/standalone/sdk/typescript/src/events.ts +879 -0
- package/.next/standalone/sdk/typescript/src/exit.ts +117 -0
- package/.next/standalone/sdk/typescript/src/index.ts +186 -0
- package/.next/standalone/sdk/typescript/src/integrations/ai.ts +1566 -0
- package/.next/standalone/sdk/typescript/src/integrations/compat.ts +322 -0
- package/.next/standalone/sdk/typescript/src/integrations/core.ts +1321 -0
- package/.next/standalone/sdk/typescript/src/integrations/index.ts +355 -0
- package/.next/standalone/sdk/typescript/src/integrations/langchain.ts +2340 -0
- package/.next/standalone/sdk/typescript/src/integrations/llamaindex.ts +2111 -0
- package/.next/standalone/sdk/typescript/src/integrations/mastra.ts +1802 -0
- package/.next/standalone/sdk/typescript/src/logger.ts +98 -0
- package/.next/standalone/sdk/typescript/src/next.ts +115 -0
- package/.next/standalone/sdk/typescript/src/node-require.ts +446 -0
- package/.next/standalone/sdk/typescript/src/redact.ts +305 -0
- package/.next/standalone/sdk/typescript/src/resolver.ts +120 -0
- package/.next/standalone/sdk/typescript/src/runtime.ts +29 -0
- package/.next/standalone/sdk/typescript/src/schema.ts +410 -0
- package/.next/standalone/sdk/typescript/src/scopes.ts +701 -0
- package/.next/standalone/sdk/typescript/src/shared.ts +33 -0
- package/.next/standalone/sdk/typescript/src/version.ts +5 -0
- package/.next/standalone/sdk/typescript/src/writer.ts +934 -0
- package/.next/standalone/sdk/typescript/test/adapters.test.ts +397 -0
- package/.next/standalone/sdk/typescript/test/ai.test.ts +1076 -0
- package/.next/standalone/sdk/typescript/test/copies.test.ts +204 -0
- package/.next/standalone/sdk/typescript/test/edge.test.ts +183 -0
- package/.next/standalone/sdk/typescript/test/evaluator-client.test.ts +234 -0
- package/.next/standalone/sdk/typescript/test/evaluator-protocol.test.ts +225 -0
- package/.next/standalone/sdk/typescript/test/events.test.ts +193 -0
- package/.next/standalone/sdk/typescript/test/expression.test.ts +181 -0
- package/.next/standalone/sdk/typescript/test/global-setup.ts +26 -0
- package/.next/standalone/sdk/typescript/test/helpers.ts +130 -0
- package/.next/standalone/sdk/typescript/test/integrations.test.ts +369 -0
- package/.next/standalone/sdk/typescript/test/langchain-copies.test.ts +204 -0
- package/.next/standalone/sdk/typescript/test/langchain.test.ts +999 -0
- package/.next/standalone/sdk/typescript/test/llamaindex.test.ts +1760 -0
- package/.next/standalone/sdk/typescript/test/mastra-coverage.test.ts +501 -0
- package/.next/standalone/sdk/typescript/test/mastra-lifecycle.test.ts +479 -0
- package/.next/standalone/sdk/typescript/test/mastra.test.ts +285 -0
- package/.next/standalone/sdk/typescript/test/next.test.ts +109 -0
- package/.next/standalone/sdk/typescript/test/packaging.test.ts +312 -0
- package/.next/standalone/sdk/typescript/test/redaction.test.ts +171 -0
- package/.next/standalone/sdk/typescript/test/runtimes.test.ts +101 -0
- package/.next/standalone/sdk/typescript/test/sandbox.test.ts +189 -0
- package/.next/standalone/sdk/typescript/test/scopes.test.ts +271 -0
- package/.next/standalone/sdk/typescript/test/setup.ts +19 -0
- package/.next/standalone/sdk/typescript/test/skill-snippets.test.ts +73 -0
- package/.next/standalone/sdk/typescript/test/spool-contract.test.ts +124 -0
- package/.next/standalone/sdk/typescript/test/tracker-bounds.test.ts +191 -0
- package/.next/standalone/sdk/typescript/test/wire-format.test.ts +214 -0
- package/.next/standalone/sdk/typescript/test/writer.test.ts +407 -0
- package/.next/standalone/sdk/typescript/tsconfig.build.json +15 -0
- package/.next/standalone/sdk/typescript/tsconfig.cjs.json +19 -0
- package/.next/standalone/sdk/typescript/tsconfig.json +28 -0
- package/.next/standalone/sdk/typescript/vitest.config.ts +33 -0
- package/.next/standalone/sdk/typescript/vitest.integration.config.ts +23 -0
- package/.next/standalone/server.js +1 -1
- package/README.md +2 -2
- package/dist/cli.mjs +208 -27
- package/dist/worker.mjs +120 -14
- package/package.json +10 -10
- package/scripts/build-policy-pack.mjs +14 -0
- package/src/audit/features.ts +3 -2
- package/src/hooks/builtin-policies.ts +156 -5
- package/src/hooks/jev-cli.ts +57 -1
- package/src/hooks/manager.ts +1 -1
- package/src/hooks/pack-cli.ts +150 -18
- package/src/hooks/pack-store.ts +1 -1
- package/src/hooks/policy-catalog.ts +148 -9
- package/src/hooks/types.ts +1 -1
- package/.next/standalone/.next/static/chunks/0cd-_8-c-m1ea.js +0 -6
- package/.next/standalone/.next/static/chunks/0qrbdkv9qmvli.js +0 -69
- package/.next/standalone/.next/static/chunks/0uldbut9y2-e8.js +0 -1
- package/.next/standalone/.next/static/chunks/285spx855h_3r.css +0 -2
- package/.next/standalone/.next/static/chunks/2vkvu9-opa_1z.js +0 -1
- package/.next/standalone/.next/static/chunks/37lhv7wa3ywt6.js +0 -1
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → gbEOjBgZAxF2UIUwZVHNu}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → gbEOjBgZAxF2UIUwZVHNu}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{T8YAYM9h_64fKv705vug7 → gbEOjBgZAxF2UIUwZVHNu}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework adapters: the registry behind `failproofai.instrument()`.
|
|
3
|
+
*
|
|
4
|
+
* import * as failproofai from "@failproofai/sdk";
|
|
5
|
+
* await failproofai.instrument(); // every framework we can find
|
|
6
|
+
* await failproofai.instrument("langchain"); // exactly one
|
|
7
|
+
* failproofai.uninstrument(); // put everything back
|
|
8
|
+
*
|
|
9
|
+
* **This module imports no adapter until asked.** The registry maps a name to a
|
|
10
|
+
* dynamic `import()` thunk, so `import "@failproofai/sdk"` never pulls in
|
|
11
|
+
* LangChain.
|
|
12
|
+
*
|
|
13
|
+
* ## Detection is by RESOLVABILITY, and that is a real difference from Python
|
|
14
|
+
*
|
|
15
|
+
* The Python SDK detects by reading `sys.modules` — "is this framework already
|
|
16
|
+
* imported in this process" — precisely so that auto-detection never imports a
|
|
17
|
+
* framework the user is not using. Node exposes no equivalent for ESM: there is
|
|
18
|
+
* no public view of the module registry, and `require.cache` only covers the
|
|
19
|
+
* CommonJS half. So detection here asks whether the package **resolves**, which
|
|
20
|
+
* is a weaker question: a framework that is installed but unused will be
|
|
21
|
+
* imported and patched by a bare `instrument()`.
|
|
22
|
+
*
|
|
23
|
+
* That is cheap and side-effect-free for all four adapters (each patches a
|
|
24
|
+
* class prototype or subscribes to a callback registry; none of them changes
|
|
25
|
+
* behaviour on its own), but it is not free. A process that cares names its
|
|
26
|
+
* framework: `instrument("langchain")` imports exactly one thing.
|
|
27
|
+
*
|
|
28
|
+
* ## Writing an adapter
|
|
29
|
+
*
|
|
30
|
+
* A module registered here must export a const named `adapter` implementing
|
|
31
|
+
* `Adapter` from `./core.js`:
|
|
32
|
+
*
|
|
33
|
+
* name: string
|
|
34
|
+
* install(options): Promise<void> | void
|
|
35
|
+
* uninstall(): void
|
|
36
|
+
*
|
|
37
|
+
* `install()` must save the **original attribute object** it replaces — use
|
|
38
|
+
* `core.Patcher`, which also does the "somebody patched on top of us" check —
|
|
39
|
+
* and `uninstall()` must restore that saved object. Never re-import to restore:
|
|
40
|
+
* that hands back whatever the current value happens to be, which is how two
|
|
41
|
+
* instrumentation libraries silently un-patch each other.
|
|
42
|
+
*
|
|
43
|
+
* Every callback an adapter hands to the framework goes through `core.safe`,
|
|
44
|
+
* and every event goes through a `core.RunTracker`. Adapters own the
|
|
45
|
+
* translation table and nothing else.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
import { logException, logger } from "../logger.js";
|
|
49
|
+
import { NEXT_EXTERNALS_ENV } from "../next.js";
|
|
50
|
+
import { isNextServer, loadedModulePaths, resolveFrom } from "../node-require.js";
|
|
51
|
+
import * as compat from "./compat.js";
|
|
52
|
+
import type { Adapter } from "./core.js";
|
|
53
|
+
import * as core from "./core.js";
|
|
54
|
+
|
|
55
|
+
export type FrameworkName = "langchain" | "ai" | "mastra" | "llamaindex";
|
|
56
|
+
|
|
57
|
+
const REGISTRY: Record<FrameworkName, () => Promise<{ adapter: Adapter }>> = {
|
|
58
|
+
langchain: () => import("./langchain.js"),
|
|
59
|
+
ai: () => import("./ai.js"),
|
|
60
|
+
mastra: () => import("./mastra.js"),
|
|
61
|
+
llamaindex: () => import("./llamaindex.js"),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Spellings people actually type. LangGraph is served by the LangChain adapter
|
|
66
|
+
* because LangGraph.js runs on `@langchain/core`'s callback manager.
|
|
67
|
+
*/
|
|
68
|
+
const ALIASES: Record<string, FrameworkName> = {
|
|
69
|
+
langgraph: "langchain",
|
|
70
|
+
"@langchain/core": "langchain",
|
|
71
|
+
langchainjs: "langchain",
|
|
72
|
+
"aisdk": "ai",
|
|
73
|
+
"ai-sdk": "ai",
|
|
74
|
+
vercel: "ai",
|
|
75
|
+
"vercelai": "ai",
|
|
76
|
+
"@ai-sdk/provider": "ai",
|
|
77
|
+
"@mastra/core": "mastra",
|
|
78
|
+
"llama_index": "llamaindex",
|
|
79
|
+
"llama-index": "llamaindex",
|
|
80
|
+
"llamaindexts": "llamaindex",
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* name -> the packages whose presence means "this framework is in use". Kept
|
|
85
|
+
* here rather than read off the adapter so that detection imports nothing at
|
|
86
|
+
* all, not even our own adapter module.
|
|
87
|
+
*/
|
|
88
|
+
const DETECT: Record<FrameworkName, readonly string[]> = {
|
|
89
|
+
langchain: ["@langchain/core", "langchain", "@langchain/langgraph"],
|
|
90
|
+
ai: ["ai"],
|
|
91
|
+
mastra: ["@mastra/core"],
|
|
92
|
+
llamaindex: ["llamaindex", "@llamaindex/core"],
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const active = new Map<FrameworkName, Adapter>();
|
|
96
|
+
|
|
97
|
+
/** Every registry name that can be instrumented, aliases excluded. */
|
|
98
|
+
export function available(): FrameworkName[] {
|
|
99
|
+
return (Object.keys(REGISTRY) as FrameworkName[]).sort();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Names currently instrumented. */
|
|
103
|
+
export function activeFrameworks(): FrameworkName[] {
|
|
104
|
+
return [...active.keys()].sort();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function canonical(name: string): FrameworkName {
|
|
108
|
+
const key = name.trim().toLowerCase().replaceAll(" ", "");
|
|
109
|
+
const resolved = (ALIASES[key] ?? key) as FrameworkName;
|
|
110
|
+
if (!(resolved in REGISTRY)) {
|
|
111
|
+
const valid = [...new Set([...Object.keys(REGISTRY), ...Object.keys(ALIASES)])].sort().join(", ");
|
|
112
|
+
throw new Error(
|
|
113
|
+
`unknown framework ${JSON.stringify(name)}. Valid names are: ${valid}. ` +
|
|
114
|
+
"(Call instrument() with no argument to auto-detect.)",
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return resolved;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function resolvable(pkg: string): boolean {
|
|
121
|
+
if (resolveFrom(pkg) !== null) return true;
|
|
122
|
+
// `require.cache` is the one authoritative "already loaded" signal Node gives
|
|
123
|
+
// us, and it only covers CommonJS. Checking it costs nothing and turns a
|
|
124
|
+
// false negative above — a package whose `exports` map hides its root — into
|
|
125
|
+
// a true positive for CommonJS consumers.
|
|
126
|
+
const marker = `node_modules/${pkg}/`;
|
|
127
|
+
return loadedModulePaths().some((path) => path.replaceAll("\\", "/").includes(marker));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function detected(): FrameworkName[] {
|
|
131
|
+
return available().filter((name) => DETECT[name].some((pkg) => resolvable(pkg)));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function load(name: FrameworkName): Promise<Adapter> {
|
|
135
|
+
const module = await REGISTRY[name]();
|
|
136
|
+
const adapter = module.adapter;
|
|
137
|
+
for (const method of ["install", "uninstall"] as const) {
|
|
138
|
+
if (typeof adapter?.[method] !== "function") {
|
|
139
|
+
throw new TypeError(
|
|
140
|
+
`adapter ${JSON.stringify(name)} does not implement ${method}() — see ` +
|
|
141
|
+
"integrations/core.ts's Adapter interface.",
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return adapter;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface InstrumentOptions {
|
|
149
|
+
/** Per-field truncation ceiling for this adapter's events. */
|
|
150
|
+
captureLimit?: number;
|
|
151
|
+
[option: string]: unknown;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Install the adapters. Returns the names newly instrumented.
|
|
156
|
+
*
|
|
157
|
+
* With no argument, instruments every framework this process can resolve.
|
|
158
|
+
* Instrumenting something already active is a no-op that returns `[]`, so
|
|
159
|
+
* calling this from two code paths (or from a reloading dev server) cannot
|
|
160
|
+
* double-record.
|
|
161
|
+
*
|
|
162
|
+
* An unknown name throws, listing the valid ones — a typo that silently records
|
|
163
|
+
* nothing is the worst outcome available. An adapter whose `install()` throws
|
|
164
|
+
* is logged and skipped; the others still install, because a broken LlamaIndex
|
|
165
|
+
* should not cost you LangGraph. `FAILPROOFAI_SDK_STRICT=1` turns that skip
|
|
166
|
+
* back into a throw.
|
|
167
|
+
*/
|
|
168
|
+
export async function instrument(
|
|
169
|
+
framework?: string | null,
|
|
170
|
+
options: InstrumentOptions = {},
|
|
171
|
+
): Promise<FrameworkName[]> {
|
|
172
|
+
let names: FrameworkName[];
|
|
173
|
+
if (framework === undefined || framework === null) {
|
|
174
|
+
names = detected();
|
|
175
|
+
if (names.length === 0) {
|
|
176
|
+
// WARN, not debug. This fires only when somebody explicitly asked for
|
|
177
|
+
// instrumentation and got none, and the result is a process that records
|
|
178
|
+
// nothing at all with the adapter "installed" and the docs followed.
|
|
179
|
+
logger.warn(
|
|
180
|
+
"instrument() found no supported framework, so NOTHING was instrumented. " +
|
|
181
|
+
"Install the framework you are using, or name one explicitly: " +
|
|
182
|
+
available()
|
|
183
|
+
.map((name) => `instrument(${JSON.stringify(name)})`)
|
|
184
|
+
.join(", ") +
|
|
185
|
+
".",
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
names = [canonical(framework)];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const installed: FrameworkName[] = [];
|
|
193
|
+
for (const name of names) {
|
|
194
|
+
if (active.has(name)) continue;
|
|
195
|
+
let adapter: Adapter | null = null;
|
|
196
|
+
try {
|
|
197
|
+
adapter = await load(name);
|
|
198
|
+
await adapter.install(options);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
// An install is NOT atomic, so a failure part-way through leaves global
|
|
201
|
+
// state behind — a patched prototype, a registered listener. Catching
|
|
202
|
+
// without rolling back would leave the adapter fully patched and never
|
|
203
|
+
// recorded in `active`, so `activeFrameworks()` would deny it existed and
|
|
204
|
+
// `uninstrument()` — which iterates `active` — could never undo it. It
|
|
205
|
+
// would record for the life of the process and could not be removed.
|
|
206
|
+
if (adapter !== null) {
|
|
207
|
+
try {
|
|
208
|
+
adapter.uninstall();
|
|
209
|
+
} catch (rollbackError) {
|
|
210
|
+
logger.debug(
|
|
211
|
+
`rollback of a failed ${name} install did not complete cleanly: ${String(rollbackError)}`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (core.strict()) throw error;
|
|
216
|
+
// `FAILPROOFAI_SDK_STRICT_INTEGRATIONS=1` is documented as the supported
|
|
217
|
+
// way to make a compat problem loud. Swallowing it here would give the
|
|
218
|
+
// operator neither behaviour — not the throw the flag promises, and not
|
|
219
|
+
// the best-effort instrumentation the warning text promises.
|
|
220
|
+
if (error instanceof compat.FailproofAICompatError && compat.strictIntegrations()) {
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
logException(
|
|
224
|
+
`could not instrument ${JSON.stringify(name)}; the rest of your process is ` +
|
|
225
|
+
"unaffected and other adapters still installed. Set FAILPROOFAI_SDK_STRICT=1 to " +
|
|
226
|
+
"throw instead.",
|
|
227
|
+
error,
|
|
228
|
+
);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
active.set(name, adapter);
|
|
232
|
+
installed.push(name);
|
|
233
|
+
warnIfNextBundles(name);
|
|
234
|
+
}
|
|
235
|
+
return installed;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* What a framework's adapter needs a Next.js server to load from
|
|
240
|
+
* `node_modules`. The Vercel AI SDK needs nothing: ai 7 reads its telemetry
|
|
241
|
+
* integrations from a global and `telemetry()` is passed at the call site, so
|
|
242
|
+
* both reach a bundled copy.
|
|
243
|
+
*/
|
|
244
|
+
const NEXT_REQUIRES: Partial<Record<FrameworkName, readonly string[]>> = {
|
|
245
|
+
langchain: ["@failproofai/sdk", "@langchain/core"],
|
|
246
|
+
mastra: ["@failproofai/sdk", "@mastra/core"],
|
|
247
|
+
llamaindex: ["@failproofai/sdk", "@llamaindex/core", "@llamaindex/workflow"],
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const nextWarned = new Set<FrameworkName>();
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The packages `name` needs externalized that this Next.js server does not
|
|
254
|
+
* externalize — empty when configured, `null` when that cannot be determined.
|
|
255
|
+
*
|
|
256
|
+
* Sources, most direct first: the list `withFailproofai` records when Next
|
|
257
|
+
* evaluates the config (`next start` / `next dev`); the resolved config a
|
|
258
|
+
* standalone server stores in `__NEXT_PRIVATE_STANDALONE_CONFIG`; and a
|
|
259
|
+
* hand-set `FAILPROOFAI_NEXT_EXTERNALS=1`, which trusts the app.
|
|
260
|
+
*
|
|
261
|
+
* @internal Exported for tests.
|
|
262
|
+
*/
|
|
263
|
+
export function nextExternalsGap(name: FrameworkName): string[] | null {
|
|
264
|
+
const required = NEXT_REQUIRES[name];
|
|
265
|
+
if (required === undefined) return [];
|
|
266
|
+
const marker = process.env[NEXT_EXTERNALS_ENV];
|
|
267
|
+
if (marker !== undefined && marker.trim() !== "") {
|
|
268
|
+
if (["1", "true", "yes"].includes(marker.trim().toLowerCase())) return [];
|
|
269
|
+
const listed = new Set(marker.split(",").map((entry) => entry.trim()));
|
|
270
|
+
return required.filter((pkg) => !listed.has(pkg));
|
|
271
|
+
}
|
|
272
|
+
const standalone = process.env.__NEXT_PRIVATE_STANDALONE_CONFIG;
|
|
273
|
+
if (standalone) {
|
|
274
|
+
try {
|
|
275
|
+
const config = JSON.parse(standalone) as { serverExternalPackages?: unknown };
|
|
276
|
+
const listed = new Set(Array.isArray(config.serverExternalPackages) ? config.serverExternalPackages : []);
|
|
277
|
+
return required.filter((pkg) => !listed.has(pkg));
|
|
278
|
+
} catch {
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Warn, once per framework, when a Next.js server bundles what `instrument()`
|
|
287
|
+
* attaches to — the one arrangement where it reports success and records
|
|
288
|
+
* nothing. Node runtime only: an Edge route gets the SDK's no-op build.
|
|
289
|
+
*/
|
|
290
|
+
function warnIfNextBundles(name: FrameworkName): void {
|
|
291
|
+
if (!isNextServer() || process.env.NEXT_RUNTIME !== "nodejs" || nextWarned.has(name)) return;
|
|
292
|
+
const gap = nextExternalsGap(name);
|
|
293
|
+
if (gap !== null && gap.length === 0) return;
|
|
294
|
+
nextWarned.add(name);
|
|
295
|
+
const missing = gap === null ? NEXT_REQUIRES[name]! : gap;
|
|
296
|
+
logger.warn(
|
|
297
|
+
`instrument(${JSON.stringify(name)}) is running under Next.js, which bundles ` +
|
|
298
|
+
`${missing.join(", ")} into its server output unless told not to — and then this adapter ` +
|
|
299
|
+
"records NOTHING while reporting success. Wrap your next.config: " +
|
|
300
|
+
'`import { withFailproofai } from "@failproofai/sdk/next"; export default withFailproofai(config)`, ' +
|
|
301
|
+
`or add ${missing.join(", ")} to serverExternalPackages yourself and set ` +
|
|
302
|
+
`${NEXT_EXTERNALS_ENV}=1 to silence this.`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** @internal Tests only: forget which Next.js warnings have fired. */
|
|
307
|
+
export function resetNextWarnings(): void {
|
|
308
|
+
nextWarned.clear();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Reverse `instrument()`. Returns the names removed. Never throws.
|
|
313
|
+
*
|
|
314
|
+
* With no argument, removes everything. An unknown name, or a name that was
|
|
315
|
+
* never instrumented, is a no-op — teardown that can fail is teardown people
|
|
316
|
+
* stop calling.
|
|
317
|
+
*/
|
|
318
|
+
export function uninstrument(framework?: string | null): FrameworkName[] {
|
|
319
|
+
let names: FrameworkName[];
|
|
320
|
+
if (framework === undefined || framework === null) {
|
|
321
|
+
names = [...active.keys()];
|
|
322
|
+
} else {
|
|
323
|
+
try {
|
|
324
|
+
names = [canonical(framework)];
|
|
325
|
+
} catch (error) {
|
|
326
|
+
logger.warn(error instanceof Error ? error.message : String(error));
|
|
327
|
+
return [];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const removed: FrameworkName[] = [];
|
|
332
|
+
for (const name of names) {
|
|
333
|
+
const adapter = active.get(name);
|
|
334
|
+
if (adapter === undefined) continue;
|
|
335
|
+
active.delete(name);
|
|
336
|
+
try {
|
|
337
|
+
adapter.uninstall();
|
|
338
|
+
} catch (error) {
|
|
339
|
+
logException(
|
|
340
|
+
`${JSON.stringify(name)} did not uninstall cleanly; it is no longer registered, ` +
|
|
341
|
+
"but some patches may remain.",
|
|
342
|
+
error,
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
removed.push(name);
|
|
346
|
+
}
|
|
347
|
+
if (active.size === 0) {
|
|
348
|
+
// Nothing is instrumented any more, so a later instrument() starts from a
|
|
349
|
+
// clean slate rather than inheriting a degraded call site or a warning that
|
|
350
|
+
// has "already been shown".
|
|
351
|
+
core.resetFailures();
|
|
352
|
+
compat.resetWarnings();
|
|
353
|
+
}
|
|
354
|
+
return removed;
|
|
355
|
+
}
|