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,180 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
describeTrace,
|
|
5
|
+
runAgentAsync,
|
|
6
|
+
scenarios,
|
|
7
|
+
traceViolations,
|
|
8
|
+
type Event,
|
|
9
|
+
type Format,
|
|
10
|
+
type RunResult,
|
|
11
|
+
} from "./harness.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Runtime parity: every scenario of every framework fixture, run under another
|
|
15
|
+
* runtime and under Node, must record the same trace.
|
|
16
|
+
*
|
|
17
|
+
* The framework files (`ai.test.ts`, …) say what a correct trace IS; this says
|
|
18
|
+
* only that Bun or Deno produce the one Node does. That keeps a runtime suite
|
|
19
|
+
* from restating — and drifting from — a hundred and eighty expectations, and
|
|
20
|
+
* it still catches every way a runtime differs that matters here: the adapter
|
|
21
|
+
* patched a copy the app does not run (no events), a hook never fired (a
|
|
22
|
+
* missing pair), the exit flush never ran (a short trace), a warning Node does
|
|
23
|
+
* not print.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const FRAMEWORK_FIXTURES = [
|
|
27
|
+
"ai-4",
|
|
28
|
+
"ai-5",
|
|
29
|
+
"ai-6",
|
|
30
|
+
"ai-7",
|
|
31
|
+
"langchain-0.3",
|
|
32
|
+
"langchain-1",
|
|
33
|
+
"mastra-0",
|
|
34
|
+
"mastra-1",
|
|
35
|
+
"llamaindex-0.11",
|
|
36
|
+
"llamaindex-0.12",
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The fields of an event that are a property of the RUN, not of the moment:
|
|
41
|
+
* no timestamps, durations, generated ids or session ids.
|
|
42
|
+
*/
|
|
43
|
+
const STABLE = [
|
|
44
|
+
"type",
|
|
45
|
+
"agent_id",
|
|
46
|
+
"parent_id",
|
|
47
|
+
"tool_name",
|
|
48
|
+
"hook_name",
|
|
49
|
+
"trigger_event",
|
|
50
|
+
"model",
|
|
51
|
+
"input_tokens",
|
|
52
|
+
"output_tokens",
|
|
53
|
+
"stop_reason",
|
|
54
|
+
"tool_call_id",
|
|
55
|
+
"outcome",
|
|
56
|
+
"framework",
|
|
57
|
+
] as const;
|
|
58
|
+
|
|
59
|
+
/** A generated id (a tool call with no model-assigned id gets a UUID). */
|
|
60
|
+
const GENERATED = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Each session's events in order, sessions sorted. Two sessions run
|
|
64
|
+
* concurrently (`shared-query`) interleave by scheduling, which is a property
|
|
65
|
+
* of the event loop and not of the SDK; the order WITHIN a session is not.
|
|
66
|
+
*/
|
|
67
|
+
export const digest = (events: Event[], unordered = false): string[][] => {
|
|
68
|
+
const sessions = new Map<string, Event[]>();
|
|
69
|
+
for (const event of events) sessions.set(event.session_id, [...(sessions.get(event.session_id) ?? []), event]);
|
|
70
|
+
return [...sessions.values()]
|
|
71
|
+
.map((session) => (unordered ? digestSession(session).sort() : digestSession(session)))
|
|
72
|
+
.sort((a, b) => a.join().localeCompare(b.join()));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Scenarios that run several agents at once INSIDE ONE session (ten
|
|
77
|
+
* `generate`s on one agent, say). Their events interleave by scheduling within
|
|
78
|
+
* the session too, so for these the comparison is the same MULTISET of events
|
|
79
|
+
* per session rather than the same sequence — still exact about what was
|
|
80
|
+
* recorded, silent only about an order no runtime (Node included) repeats.
|
|
81
|
+
*/
|
|
82
|
+
const UNORDERED = /^concurrent/;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Scenarios not compared at all, with the reason. Each is one its own
|
|
86
|
+
* framework suite already skips as a documented limit, where the trace is not
|
|
87
|
+
* a stable property of the run on any runtime.
|
|
88
|
+
*/
|
|
89
|
+
const SKIPPED: Record<string, string> = {
|
|
90
|
+
"mastra-0:tripwire-output":
|
|
91
|
+
"Mastra 0.24 gives no end signal for an output-processor tripwire on a stream, so the run is left open (skipped in mastra-coverage.test.ts)",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const digestSession = (events: Event[]): string[] =>
|
|
95
|
+
events.map((event) =>
|
|
96
|
+
JSON.stringify(
|
|
97
|
+
Object.fromEntries(
|
|
98
|
+
STABLE.filter((key) => key in event).map((key) => {
|
|
99
|
+
const value = event[key];
|
|
100
|
+
return [key, typeof value === "string" && GENERATED.test(value) ? "<generated>" : value];
|
|
101
|
+
}),
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
/** The SDK's own diagnostics, without the parts that name paths or numbers. */
|
|
107
|
+
export const sdkLines = (stderr: string): string[] =>
|
|
108
|
+
stderr
|
|
109
|
+
.split("\n")
|
|
110
|
+
.filter((line) => line.includes("[failproofai-sdk]"))
|
|
111
|
+
.map((line) => line.replace(/\/[^\s"')]+/g, "<path>").replace(/\d+/g, "N"));
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Labels in an agent's `switch` that are not scenarios: each is one half of a
|
|
115
|
+
* scenario that spawns it with arguments of its own, and is exercised through
|
|
116
|
+
* that scenario — under the runtime being tested, since the parent re-executes
|
|
117
|
+
* `process.execPath`. Run bare, they only exercise argument handling (and Deno,
|
|
118
|
+
* whose `writeFileSync(undefined)` does not throw, writes a file named
|
|
119
|
+
* `undefined` into the fixture).
|
|
120
|
+
*/
|
|
121
|
+
const HELPERS: Record<string, string> = {
|
|
122
|
+
"remote-resume-pause": "the pausing process of remote-resume, which passes it a checkpoint path",
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export interface Divergence {
|
|
126
|
+
/** Why this scenario is allowed to differ, stated as the observed behaviour. */
|
|
127
|
+
reason: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* One `describe` per fixture and module system; one concurrent case per
|
|
132
|
+
* scenario. `known` lists scenarios whose difference is understood and is NOT
|
|
133
|
+
* the SDK's (each is asserted to still differ, so a fix upstream shows up),
|
|
134
|
+
* keyed `fixture:format:scenario` with `*` for either of the first two.
|
|
135
|
+
*/
|
|
136
|
+
export function parity(
|
|
137
|
+
label: string,
|
|
138
|
+
pairs: ReadonlyArray<readonly [node: Format, other: Format]>,
|
|
139
|
+
known: Record<string, Divergence> = {},
|
|
140
|
+
): void {
|
|
141
|
+
describe.each(FRAMEWORK_FIXTURES)(`%s under ${label}`, (fixture) => {
|
|
142
|
+
describe.each(pairs)("%s vs %s", (nodeFormat, otherFormat) => {
|
|
143
|
+
it.concurrent.each(
|
|
144
|
+
scenarios(fixture).filter((name) => !(name in HELPERS) && !(`${fixture}:${name}` in SKIPPED)),
|
|
145
|
+
)("%s", async (scenario) => {
|
|
146
|
+
const [node, other] = await Promise.all([
|
|
147
|
+
runAgentAsync(fixture, nodeFormat, scenario),
|
|
148
|
+
runAgentAsync(fixture, otherFormat, scenario),
|
|
149
|
+
]);
|
|
150
|
+
const key = `${fixture}:${otherFormat}:${scenario}`;
|
|
151
|
+
const unordered = UNORDERED.test(scenario);
|
|
152
|
+
const matches = same(node, other, unordered);
|
|
153
|
+
const divergence =
|
|
154
|
+
known[key] ??
|
|
155
|
+
known[`${fixture}:*:${scenario}`] ??
|
|
156
|
+
known[`*:${otherFormat}:${scenario}`] ??
|
|
157
|
+
known[`*:*:${scenario}`];
|
|
158
|
+
if (divergence !== undefined) {
|
|
159
|
+
expect(matches, `${key} is listed as a known divergence (${divergence.reason}) but now matches Node`).toBe(
|
|
160
|
+
false,
|
|
161
|
+
);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const context = `NODE ${nodeFormat}\n${describeTrace(node)}\n\n${otherFormat.toUpperCase()}\n${describeTrace(other)}`;
|
|
165
|
+
expect(other.status, context).toBe(node.status);
|
|
166
|
+
expect(digest(other.events, unordered), context).toEqual(digest(node.events, unordered));
|
|
167
|
+
expect(traceViolations(other.events), context).toEqual(traceViolations(node.events));
|
|
168
|
+
expect(sdkLines(other.stderr), context).toEqual(sdkLines(node.stderr));
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function same(a: RunResult, b: RunResult, unordered: boolean): boolean {
|
|
175
|
+
return (
|
|
176
|
+
a.status === b.status &&
|
|
177
|
+
JSON.stringify(digest(a.events, unordered)) === JSON.stringify(digest(b.events, unordered)) &&
|
|
178
|
+
JSON.stringify(sdkLines(a.stderr)) === JSON.stringify(sdkLines(b.stderr))
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { parity } from "./runtime-parity.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bun: every scenario of every framework fixture, as an ES module and as
|
|
5
|
+
* CommonJS, against Node's trace for the same agent.
|
|
6
|
+
*
|
|
7
|
+
* Bun implements `node:module`'s `createRequire`, `require.cache`,
|
|
8
|
+
* `require.main`, `AsyncLocalStorage` and `process.on("exit")`, which is
|
|
9
|
+
* everything the SDK's copy resolution and exit flush rely on — this proves it
|
|
10
|
+
* on real frameworks instead of assuming it.
|
|
11
|
+
*/
|
|
12
|
+
parity("bun", [
|
|
13
|
+
["esm", "bun-esm"],
|
|
14
|
+
["cjs", "bun-cjs"],
|
|
15
|
+
]);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
BUN_FORMATS,
|
|
7
|
+
DENO_FORMATS,
|
|
8
|
+
FIXTURES,
|
|
9
|
+
FORMATS,
|
|
10
|
+
count,
|
|
11
|
+
describeTrace,
|
|
12
|
+
runAgentAsync,
|
|
13
|
+
runProcess,
|
|
14
|
+
runtimeCommand,
|
|
15
|
+
traceViolations,
|
|
16
|
+
type Event,
|
|
17
|
+
} from "./harness.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The SDK with no framework, under every runtime it can be imported in with a
|
|
21
|
+
* filesystem — Node, Bun, Deno — as an ES module and as CommonJS.
|
|
22
|
+
*
|
|
23
|
+
* Agent: `fixtures/runtimes/agent.ts`.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const ALL = [...FORMATS, ...BUN_FORMATS, ...DENO_FORMATS];
|
|
27
|
+
|
|
28
|
+
/** All 15 event types, each exactly as often as `core()` emits it. */
|
|
29
|
+
const CORE_COUNTS: Record<string, number> = {
|
|
30
|
+
agent_start: 2,
|
|
31
|
+
agent_end: 2,
|
|
32
|
+
model_request: 2,
|
|
33
|
+
model_response: 2,
|
|
34
|
+
tool_use: 2,
|
|
35
|
+
tool_result: 2,
|
|
36
|
+
hook_triggered: 1,
|
|
37
|
+
hook_completed: 1,
|
|
38
|
+
agent_pause: 1,
|
|
39
|
+
agent_resume: 1,
|
|
40
|
+
human_wait: 1,
|
|
41
|
+
human_input: 1,
|
|
42
|
+
human_pause: 1,
|
|
43
|
+
human_interrupt: 1,
|
|
44
|
+
error: 1,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const shape = (events: Event[]) => events.map((e) => `${e.agent_id} ${e.type}`);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `traceViolations`, less the one rule this program breaks by design: a
|
|
51
|
+
* hand-emitted `model_response` carries no `duration_ms` (the SDK measures only
|
|
52
|
+
* the pairs it can see open — tools, hooks, pauses, human input — exactly like
|
|
53
|
+
* the Python SDK). The adapters are what supply model timings.
|
|
54
|
+
*/
|
|
55
|
+
const violations = (events: Event[]) =>
|
|
56
|
+
traceViolations(events).filter((problem) => !problem.endsWith("has no duration_ms"));
|
|
57
|
+
|
|
58
|
+
describe.each(ALL)("as %s", (format) => {
|
|
59
|
+
const run = (scenario: string) => runAgentAsync("runtimes", format, scenario);
|
|
60
|
+
|
|
61
|
+
it("records every scope and all 15 event methods, and flush() writes them", async () => {
|
|
62
|
+
const result = await run("core");
|
|
63
|
+
expect(result.status, describeTrace(result)).toBe(0);
|
|
64
|
+
expect(violations(result.events), describeTrace(result)).toEqual([]);
|
|
65
|
+
const counts = Object.fromEntries(Object.keys(CORE_COUNTS).map((type) => [type, count(result.events, type)]));
|
|
66
|
+
expect(counts, describeTrace(result)).toEqual(CORE_COUNTS);
|
|
67
|
+
expect(result.events).toHaveLength(21);
|
|
68
|
+
for (const event of result.events) expect(event.session_id).toBe("core-session");
|
|
69
|
+
const helper = result.events.find((e) => e.type === "agent_start" && e.agent_id === "helper")!;
|
|
70
|
+
expect(helper.parent_id).toBe("planner");
|
|
71
|
+
expect(result.stderr, describeTrace(result)).not.toContain("[failproofai-sdk]");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("Deno with npm: specifiers", () => {
|
|
76
|
+
const GEN = [
|
|
77
|
+
"weather-agent agent_start",
|
|
78
|
+
"weather-agent model_request",
|
|
79
|
+
"weather-agent model_response",
|
|
80
|
+
"weather-agent tool_use",
|
|
81
|
+
"weather-agent tool_result",
|
|
82
|
+
"weather-agent model_request",
|
|
83
|
+
"weather-agent model_response",
|
|
84
|
+
"weather-agent agent_end",
|
|
85
|
+
];
|
|
86
|
+
const run = (scenario: string) =>
|
|
87
|
+
runProcess([...runtimeCommand("deno"), "deno-npm.ts", scenario], {
|
|
88
|
+
cwd: join(FIXTURES, "runtimes"),
|
|
89
|
+
label: "deno-npm",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// wrapModel() sees model calls only — the tools run outside the model — so
|
|
93
|
+
// its trace is GEN without the tool pair, exactly as `ai.test.ts` expects.
|
|
94
|
+
const WRAPPED = GEN.filter((line) => !line.includes(" tool_"));
|
|
95
|
+
|
|
96
|
+
it.each([
|
|
97
|
+
["telemetry", GEN],
|
|
98
|
+
["wrap", WRAPPED],
|
|
99
|
+
])("records an ai tool loop through %s()", async (scenario, expected) => {
|
|
100
|
+
const result = await run(scenario);
|
|
101
|
+
expect(result.status, describeTrace(result)).toBe(0);
|
|
102
|
+
expect(result.stdout).toContain("It is 20C in Paris.");
|
|
103
|
+
expect(shape(result.events), describeTrace(result)).toEqual(expected);
|
|
104
|
+
expect(traceViolations(result.events), describeTrace(result)).toEqual([]);
|
|
105
|
+
expect(
|
|
106
|
+
result.events.filter((e) => e.type === "model_response").map((e) => [e.input_tokens, e.output_tokens]),
|
|
107
|
+
).toEqual([
|
|
108
|
+
[11, 7],
|
|
109
|
+
[23, 9],
|
|
110
|
+
]);
|
|
111
|
+
expect(result.stderr, describeTrace(result)).not.toContain("[failproofai-sdk]");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { parity } from "./runtime-parity.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deno (`deno run --allow-all`), running each fixture's transpiled agent
|
|
5
|
+
* straight out of the fixture's `node_modules` — Deno 2's npm compatibility,
|
|
6
|
+
* with the frameworks resolved exactly as Node resolves them.
|
|
7
|
+
*
|
|
8
|
+
* This file found the SDK's one Deno bug: Deno answers `require.main === null`
|
|
9
|
+
* (not `undefined`) for an ES-module entry, which the SDK read as "CommonJS",
|
|
10
|
+
* so `instrument()` patched the CommonJS copy of LangChain, Mastra and
|
|
11
|
+
* LlamaIndex while the app ran the ES-module copy — success reported, nothing
|
|
12
|
+
* recorded. See `isCommonJsMain` in `src/node-require.ts`.
|
|
13
|
+
*
|
|
14
|
+
* `npm:` specifiers and the core SDK under Deno are in `runtimes.core.test.ts`.
|
|
15
|
+
*/
|
|
16
|
+
parity("deno", [
|
|
17
|
+
["esm", "deno-esm"],
|
|
18
|
+
["cjs", "deno-cjs"],
|
|
19
|
+
]);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { closeSync, copyFileSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
import { describe, expect, inject, it } from "vitest";
|
|
6
|
+
|
|
7
|
+
import { FIXTURES } from "./harness.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The packed tarball's type declarations, as every kind of TypeScript project
|
|
11
|
+
* sees them.
|
|
12
|
+
*
|
|
13
|
+
* The SDK's own tsconfig is `nodenext` ESM, the one setup in which a dual
|
|
14
|
+
* package whose `exports` hand ESM declarations to `require` looks fine. Every
|
|
15
|
+
* other setup a customer can carry was broken by exactly that, and silently
|
|
16
|
+
* from here:
|
|
17
|
+
*
|
|
18
|
+
* * a CommonJS project on `module: node16` (or `nodenext` before TS 5.8) got
|
|
19
|
+
* TS1479 — "the referenced file is an ECMAScript module" — on every import;
|
|
20
|
+
* * `moduleResolution: node` (node10, still what `module: commonjs` implies,
|
|
21
|
+
* e.g. every NestJS project) resolved the root and no subpath at all.
|
|
22
|
+
*
|
|
23
|
+
* So `agent.ts` — importing the root and every public subpath, using the names
|
|
24
|
+
* in ways a wrong or `any` type would fail — is compiled under each consumer
|
|
25
|
+
* mode, on the newest TypeScript and on the oldest one this package supports,
|
|
26
|
+
* with `skipLibCheck: false` so the declarations themselves are checked too.
|
|
27
|
+
* `@arethetypeswrong/cli` then runs over the same tarball: it checks JavaScript
|
|
28
|
+
* and declarations AGREE on module format, which no compile of ours can see.
|
|
29
|
+
*
|
|
30
|
+
* Minimum TypeScript: 5.4. It is the oldest release in which every mode below
|
|
31
|
+
* exists (`module: preserve` arrived in 5.4). The declarations themselves need
|
|
32
|
+
* only a type for `Symbol.dispose` (the `using` scopes), which `@types/node`
|
|
33
|
+
* supplies, as does `lib: esnext.disposable` from TS 5.2 — measured: 5.2
|
|
34
|
+
* passes every mode it has; 5.0 passes them only with `skipLibCheck`, because
|
|
35
|
+
* `@types/node` 22 itself no longer compiles there.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
const FIXTURE = "types";
|
|
39
|
+
const DIR = join(FIXTURES, FIXTURE);
|
|
40
|
+
|
|
41
|
+
interface Mode {
|
|
42
|
+
/** The consumer file's extension, which fixes its module format under node16/nodenext. */
|
|
43
|
+
ext: "ts" | "mts" | "cts";
|
|
44
|
+
module: string;
|
|
45
|
+
moduleResolution: string;
|
|
46
|
+
/** Written as the mode directory's package.json `type`; absent = CommonJS. */
|
|
47
|
+
type?: "module";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const MODES: Record<string, Mode> = {
|
|
51
|
+
"ESM nodenext": { ext: "ts", module: "nodenext", moduleResolution: "nodenext", type: "module" },
|
|
52
|
+
"CJS .cts nodenext": { ext: "cts", module: "nodenext", moduleResolution: "nodenext" },
|
|
53
|
+
"CJS node16": { ext: "ts", module: "node16", moduleResolution: "node16" },
|
|
54
|
+
"CJS commonjs + node10": { ext: "ts", module: "commonjs", moduleResolution: "node" },
|
|
55
|
+
"esnext + bundler": { ext: "ts", module: "esnext", moduleResolution: "bundler" },
|
|
56
|
+
"preserve + bundler": { ext: "ts", module: "preserve", moduleResolution: "bundler" },
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** The installed compiler packages, and the release each must be. */
|
|
60
|
+
const COMPILERS = { typescript: "5.9.3", "typescript-min": "5.4.5" } as const;
|
|
61
|
+
|
|
62
|
+
const ENTRYPOINTS = [".", "./ai", "./mastra", "./langchain", "./llamaindex", "./next", "./evaluator", "./sandbox-worker"];
|
|
63
|
+
|
|
64
|
+
function writeMode(name: string, mode: Mode): string {
|
|
65
|
+
const dir = join(DIR, ".run", "types", name.replace(/[^a-z0-9]+/gi, "-").toLowerCase());
|
|
66
|
+
rmSync(dir, { recursive: true, force: true });
|
|
67
|
+
mkdirSync(dir, { recursive: true });
|
|
68
|
+
const file = `agent.${mode.ext}`;
|
|
69
|
+
copyFileSync(join(DIR, "agent.ts"), join(dir, file));
|
|
70
|
+
// Every mode gets a package.json, so the fixture's own cannot decide the
|
|
71
|
+
// format of a mode that expects the other one.
|
|
72
|
+
writeFileSync(join(dir, "package.json"), JSON.stringify(mode.type ? { type: mode.type } : {}));
|
|
73
|
+
writeFileSync(
|
|
74
|
+
join(dir, "tsconfig.json"),
|
|
75
|
+
JSON.stringify({
|
|
76
|
+
compilerOptions: {
|
|
77
|
+
target: "ES2022",
|
|
78
|
+
module: mode.module,
|
|
79
|
+
moduleResolution: mode.moduleResolution,
|
|
80
|
+
strict: true,
|
|
81
|
+
noEmit: true,
|
|
82
|
+
skipLibCheck: false,
|
|
83
|
+
types: ["node"],
|
|
84
|
+
},
|
|
85
|
+
files: [file],
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
return dir;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function tsc(compiler: string, project: string): string {
|
|
92
|
+
const bin = join(DIR, "node_modules", compiler, "bin", "tsc");
|
|
93
|
+
const result = spawnSync(process.execPath, [bin, "-p", project], { cwd: project, encoding: "utf8" });
|
|
94
|
+
return (result.stdout + result.stderr).trim();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
describe.each(Object.entries(COMPILERS))("TypeScript %s", (compiler, release) => {
|
|
98
|
+
it(`is ${release}`, () => {
|
|
99
|
+
const manifest = JSON.parse(readFileSync(join(DIR, "node_modules", compiler, "package.json"), "utf8"));
|
|
100
|
+
expect(manifest.version).toBe(release);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it.each(Object.entries(MODES))("typechecks every entry point as a %s project", (name, mode) => {
|
|
104
|
+
expect(tsc(compiler, writeMode(`${compiler}-${name}`, mode))).toBe("");
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe("@arethetypeswrong/cli", () => {
|
|
109
|
+
it("finds no problem in any entry point under any resolution mode", () => {
|
|
110
|
+
const attw = join(DIR, "node_modules", "@arethetypeswrong", "cli", "dist", "index.js");
|
|
111
|
+
// Into a file, not a pipe: attw calls process.exit() straight after
|
|
112
|
+
// writing, which truncates a large report written to a pipe.
|
|
113
|
+
const out = join(DIR, ".run", "attw.json");
|
|
114
|
+
mkdirSync(dirname(out), { recursive: true });
|
|
115
|
+
const fd = openSync(out, "w");
|
|
116
|
+
let result;
|
|
117
|
+
try {
|
|
118
|
+
result = spawnSync(process.execPath, [attw, inject("tarball"), "--format", "json"], {
|
|
119
|
+
cwd: DIR,
|
|
120
|
+
encoding: "utf8",
|
|
121
|
+
stdio: ["ignore", fd, "pipe"],
|
|
122
|
+
});
|
|
123
|
+
} finally {
|
|
124
|
+
closeSync(fd);
|
|
125
|
+
}
|
|
126
|
+
const report = JSON.parse(readFileSync(out, "utf8")) as {
|
|
127
|
+
analysis: {
|
|
128
|
+
entrypoints: Record<string, { resolutions: Record<string, unknown> }>;
|
|
129
|
+
problems: unknown[];
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
expect(Object.keys(report.analysis.entrypoints).filter((e) => e !== "./package.json").sort()).toEqual(
|
|
133
|
+
[...ENTRYPOINTS].sort(),
|
|
134
|
+
);
|
|
135
|
+
for (const [entry, { resolutions }] of Object.entries(report.analysis.entrypoints)) {
|
|
136
|
+
expect(Object.keys(resolutions).sort(), entry).toEqual(["bundler", "node10", "node16-cjs", "node16-esm"]);
|
|
137
|
+
}
|
|
138
|
+
expect(report.analysis.problems).toEqual([]);
|
|
139
|
+
expect(result.status, result.stderr).toBe(0);
|
|
140
|
+
});
|
|
141
|
+
});
|