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,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic credential scrubbing for SDK spool files.
|
|
3
|
+
*
|
|
4
|
+
* This mirrors the daemon's minimal redaction boundary — and, line for line,
|
|
5
|
+
* `failproofai_sdk/_redact.py`. The SDK applies it before bytes reach disk; the
|
|
6
|
+
* daemon applies it again before upload so batches written by older SDKs
|
|
7
|
+
* receive the same protection.
|
|
8
|
+
*
|
|
9
|
+
* The scan is index-based rather than regex-based on purpose: several of the
|
|
10
|
+
* rules (the JWT segment walk, the assignment's backwards name scan, the bearer
|
|
11
|
+
* token's byte budget) are not regular, and a half-regex/half-manual
|
|
12
|
+
* implementation is exactly how the two sides of a redactor drift apart.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { readFileSync } from "node:fs";
|
|
16
|
+
import { homedir } from "node:os";
|
|
17
|
+
import { basename, dirname, join } from "node:path";
|
|
18
|
+
|
|
19
|
+
const PREFIX_RULES: ReadonlyArray<readonly [string, number, string]> = [
|
|
20
|
+
["sk-ant-api", 16, "anthropic-key"],
|
|
21
|
+
["sk-ant-", 16, "anthropic-key"],
|
|
22
|
+
["sk-proj-", 16, "openai-key"],
|
|
23
|
+
["sk-", 16, "api-key"],
|
|
24
|
+
["ghp_", 20, "github-token"],
|
|
25
|
+
["gho_", 20, "github-token"],
|
|
26
|
+
["ghu_", 20, "github-token"],
|
|
27
|
+
["ghs_", 20, "github-token"],
|
|
28
|
+
["ghr_", 20, "github-token"],
|
|
29
|
+
["github_pat_", 20, "github-token"],
|
|
30
|
+
["sb_secret_", 16, "supabase-key"],
|
|
31
|
+
["sbp_", 20, "supabase-key"],
|
|
32
|
+
["xoxb-", 16, "slack-token"],
|
|
33
|
+
["xoxp-", 16, "slack-token"],
|
|
34
|
+
["AKIA", 16, "aws-access-key-id"],
|
|
35
|
+
["ASIA", 16, "aws-access-key-id"],
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const STRONG_SECRET_NAMES = ["secret", "password", "passwd", "credential"] as const;
|
|
39
|
+
const WEAK_SECRET_NAMES = ["key", "token"] as const;
|
|
40
|
+
const MIN_ASSIGNMENT_VALUE = 12;
|
|
41
|
+
|
|
42
|
+
type Match = readonly [length: number, label: string];
|
|
43
|
+
|
|
44
|
+
function isAsciiAlnum(code: number): boolean {
|
|
45
|
+
return (
|
|
46
|
+
(code >= 48 && code <= 57) || (code >= 65 && code <= 90) || (code >= 97 && code <= 122)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isTokenChar(value: string, index: number): boolean {
|
|
51
|
+
const code = value.charCodeAt(index);
|
|
52
|
+
return isAsciiAlnum(code) || code === 0x5f /* _ */ || code === 0x2d /* - */;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* UTF-8 byte length of the code unit at `index`.
|
|
57
|
+
*
|
|
58
|
+
* Summed across a string this is the exact UTF-8 byte count, including for
|
|
59
|
+
* astral characters: each half of a surrogate pair reports 2, and 2 + 2 is the
|
|
60
|
+
* 4 bytes such a code point actually occupies. That is what lets the byte
|
|
61
|
+
* budgets below scan by code unit without ever decoding the string.
|
|
62
|
+
*/
|
|
63
|
+
function utf8LenAt(value: string, index: number): number {
|
|
64
|
+
const code = value.charCodeAt(index);
|
|
65
|
+
if (code < 0x80) return 1;
|
|
66
|
+
if (code < 0x800) return 2;
|
|
67
|
+
return code >= 0xd800 && code <= 0xdfff ? 2 : 3;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function utf8Length(value: string): number {
|
|
71
|
+
let total = 0;
|
|
72
|
+
for (let i = 0; i < value.length; i += 1) total += utf8LenAt(value, i);
|
|
73
|
+
return total;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Python's `str.isspace()`: the ASCII whitespace set plus the file/group/record/
|
|
77
|
+
// unit separators, plus Unicode separators. `\s` covers the Unicode half; the
|
|
78
|
+
// C1 separators are spelled out because `\s` does not include them.
|
|
79
|
+
function isSpaceChar(char: string): boolean {
|
|
80
|
+
return /\s/.test(char) || (char >= "\u001c" && char <= "\u001f");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function isUpperChar(char: string): boolean {
|
|
84
|
+
return char.toLowerCase() !== char && char.toUpperCase() === char;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function atBoundary(value: string, start: number): boolean {
|
|
88
|
+
return start === 0 || !isTokenChar(value, start - 1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function matchPrefix(value: string, start: number): Match | null {
|
|
92
|
+
if (!atBoundary(value, start)) return null;
|
|
93
|
+
for (const [prefix, minimum, label] of PREFIX_RULES) {
|
|
94
|
+
if (!value.startsWith(prefix, start)) continue;
|
|
95
|
+
let end = start + prefix.length;
|
|
96
|
+
while (end < value.length && isTokenChar(value, end)) end += 1;
|
|
97
|
+
if (end - start - prefix.length >= minimum) return [end - start, label];
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function matchJwt(value: string, start: number): Match | null {
|
|
103
|
+
if (!atBoundary(value, start) || !value.startsWith("eyJ", start)) return null;
|
|
104
|
+
let end = start;
|
|
105
|
+
let segments = 0;
|
|
106
|
+
while (segments < 3) {
|
|
107
|
+
const segmentStart = end;
|
|
108
|
+
while (end < value.length) {
|
|
109
|
+
const code = value.charCodeAt(end);
|
|
110
|
+
if (
|
|
111
|
+
!(
|
|
112
|
+
isAsciiAlnum(code) ||
|
|
113
|
+
code === 0x2d /* - */ ||
|
|
114
|
+
code === 0x5f /* _ */ ||
|
|
115
|
+
code === 0x3d /* = */
|
|
116
|
+
)
|
|
117
|
+
) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
end += 1;
|
|
121
|
+
}
|
|
122
|
+
if (end === segmentStart) break;
|
|
123
|
+
segments += 1;
|
|
124
|
+
if (segments < 3 && end < value.length && value[end] === ".") {
|
|
125
|
+
end += 1;
|
|
126
|
+
} else if (segments < 3) {
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const length = end - start;
|
|
131
|
+
return segments === 3 && length >= 40 ? [length, "jwt"] : null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function matchBearer(value: string, start: number): Match | null {
|
|
135
|
+
if (value.slice(start, start + 7).toLowerCase() !== "bearer ") return null;
|
|
136
|
+
let end = start + 7;
|
|
137
|
+
let tokenBytes = 0;
|
|
138
|
+
while (end < value.length) {
|
|
139
|
+
const char = value[end]!;
|
|
140
|
+
if (isSpaceChar(char) || char === '"' || char === "'") break;
|
|
141
|
+
tokenBytes += utf8LenAt(value, end);
|
|
142
|
+
end += 1;
|
|
143
|
+
}
|
|
144
|
+
return tokenBytes >= 8 ? [end - start, "bearer-token"] : null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isSecretName(name: string): boolean {
|
|
148
|
+
const raw = name.replace(/^-+/, "").replace(/-+$/, "");
|
|
149
|
+
const lowered = raw.toLowerCase();
|
|
150
|
+
const compound =
|
|
151
|
+
raw.includes("_") ||
|
|
152
|
+
raw.includes("-") ||
|
|
153
|
+
Array.from(raw.slice(1)).some((char) => isUpperChar(char));
|
|
154
|
+
return (
|
|
155
|
+
STRONG_SECRET_NAMES.some((part) => lowered.endsWith(part)) ||
|
|
156
|
+
(compound && WEAK_SECRET_NAMES.some((part) => lowered.endsWith(part)))
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const OPAQUE_VALUE_PREFIXES = ["{", "$", "<", "(", "`", "[redacted:"] as const;
|
|
161
|
+
|
|
162
|
+
function isLiteralSecret(value: string): boolean {
|
|
163
|
+
return (
|
|
164
|
+
utf8Length(value) >= MIN_ASSIGNMENT_VALUE &&
|
|
165
|
+
!OPAQUE_VALUE_PREFIXES.some((prefix) => value.startsWith(prefix))
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function matchAssignment(value: string, start: number): Match | null {
|
|
170
|
+
if (start === 0) return null;
|
|
171
|
+
if (value[start - 1] === "=" && (value[start] === '"' || value[start] === "'")) return null;
|
|
172
|
+
|
|
173
|
+
const previous = value[start - 1]!;
|
|
174
|
+
const quote = previous === '"' || previous === "'" ? previous : null;
|
|
175
|
+
const equals = quote ? start - 2 : start - 1;
|
|
176
|
+
if (equals < 0 || value[equals] !== "=") return null;
|
|
177
|
+
|
|
178
|
+
let nameStart = equals;
|
|
179
|
+
while (nameStart > 0) {
|
|
180
|
+
if (!isTokenChar(value, nameStart - 1)) break;
|
|
181
|
+
nameStart -= 1;
|
|
182
|
+
}
|
|
183
|
+
if (nameStart === equals) return null;
|
|
184
|
+
if (
|
|
185
|
+
!isSecretName(value.slice(nameStart, equals)) ||
|
|
186
|
+
["{", "$", "<", "(", "`"].some((prefix) => value.startsWith(prefix, start))
|
|
187
|
+
) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let end = start;
|
|
192
|
+
let valueBytes = 0;
|
|
193
|
+
while (end < value.length) {
|
|
194
|
+
const char = value[end]!;
|
|
195
|
+
if (
|
|
196
|
+
(quote && char === quote) ||
|
|
197
|
+
(!quote && (isSpaceChar(char) || char === ";" || char === "&" || char === '"' || char === "'"))
|
|
198
|
+
) {
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
valueBytes += utf8LenAt(value, end);
|
|
202
|
+
end += 1;
|
|
203
|
+
}
|
|
204
|
+
return valueBytes >= MIN_ASSIGNMENT_VALUE ? [end - start, "secret-assignment"] : null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** The minimally redacted string and the replacement count. */
|
|
208
|
+
export function scrubString(value: string): [string, number] {
|
|
209
|
+
const out: string[] = [];
|
|
210
|
+
let cursor = 0;
|
|
211
|
+
let copiedThrough = 0;
|
|
212
|
+
let hits = 0;
|
|
213
|
+
while (cursor < value.length) {
|
|
214
|
+
const match =
|
|
215
|
+
matchPrefix(value, cursor) ??
|
|
216
|
+
matchJwt(value, cursor) ??
|
|
217
|
+
matchBearer(value, cursor) ??
|
|
218
|
+
matchAssignment(value, cursor);
|
|
219
|
+
if (match === null) {
|
|
220
|
+
cursor += 1;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const [length, label] = match;
|
|
224
|
+
out.push(value.slice(copiedThrough, cursor));
|
|
225
|
+
out.push(`[redacted:${label}]`);
|
|
226
|
+
cursor += length;
|
|
227
|
+
copiedThrough = cursor;
|
|
228
|
+
hits += 1;
|
|
229
|
+
}
|
|
230
|
+
if (hits === 0) return [value, 0];
|
|
231
|
+
out.push(value.slice(copiedThrough));
|
|
232
|
+
return [out.join(""), hits];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Read the daemon's redaction switch, defaulting safely to minimal. */
|
|
236
|
+
export function redactionEnabled(baseDir: string): boolean {
|
|
237
|
+
const configuredHome = process.env.FAILPROOFAI_HOME;
|
|
238
|
+
let configPath: string;
|
|
239
|
+
if (basename(baseDir) === "custom-agents") {
|
|
240
|
+
configPath = join(dirname(baseDir), "config.json");
|
|
241
|
+
} else if (configuredHome) {
|
|
242
|
+
configPath = join(configuredHome, "config.json");
|
|
243
|
+
} else {
|
|
244
|
+
configPath = join(homedir(), ".failproofai", "config.json");
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const config: unknown = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
248
|
+
if (typeof config !== "object" || config === null || Array.isArray(config)) return true;
|
|
249
|
+
const collector = (config as Record<string, unknown>).collector;
|
|
250
|
+
if (typeof collector !== "object" || collector === null || Array.isArray(collector)) {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
return (collector as Record<string, unknown>).redact !== "off";
|
|
254
|
+
} catch {
|
|
255
|
+
// A missing, unreadable or malformed config means we do not know the
|
|
256
|
+
// operator's intent — so redact. Failing open here would mean one typo in
|
|
257
|
+
// `config.json` silently ships credentials.
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Redact credential-shaped keys and string values in a valid JSON event line. */
|
|
263
|
+
export function redactJsonLine(encoded: string): string {
|
|
264
|
+
const event: unknown = JSON.parse(encoded);
|
|
265
|
+
let hits = 0;
|
|
266
|
+
|
|
267
|
+
const scrub = (value: unknown, fieldName?: string): unknown => {
|
|
268
|
+
if (typeof value === "string") {
|
|
269
|
+
const [scrubbed, count] = scrubString(value);
|
|
270
|
+
hits += count;
|
|
271
|
+
if (count === 0 && typeof fieldName === "string" && isSecretName(fieldName)) {
|
|
272
|
+
if (isLiteralSecret(scrubbed)) {
|
|
273
|
+
hits += 1;
|
|
274
|
+
return "[redacted:secret-assignment]";
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return scrubbed;
|
|
278
|
+
}
|
|
279
|
+
if (Array.isArray(value)) {
|
|
280
|
+
// Elements are more values for the same field, so its name still applies.
|
|
281
|
+
return value.map((item) => scrub(item, fieldName));
|
|
282
|
+
}
|
|
283
|
+
if (typeof value === "object" && value !== null) {
|
|
284
|
+
const result: Record<string, unknown> = {};
|
|
285
|
+
for (const [key, item] of Object.entries(value as Record<string, unknown>)) {
|
|
286
|
+
const [redactedKey, count] = scrubString(key);
|
|
287
|
+
hits += count;
|
|
288
|
+
let uniqueKey = redactedKey;
|
|
289
|
+
let suffix = 2;
|
|
290
|
+
while (Object.prototype.hasOwnProperty.call(result, uniqueKey)) {
|
|
291
|
+
uniqueKey = `${redactedKey}#${suffix}`;
|
|
292
|
+
suffix += 1;
|
|
293
|
+
}
|
|
294
|
+
result[uniqueKey] = scrub(item, key);
|
|
295
|
+
}
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
return value;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const redacted = scrub(event);
|
|
302
|
+
return hits ? JSON.stringify(redacted) : encoded;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export { isSecretName, isLiteralSecret };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { isAbsolute, join, resolve, sep } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { shared } from "./shared.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where this SDK writes its event spool.
|
|
8
|
+
*
|
|
9
|
+
* Resolution order, most explicit first:
|
|
10
|
+
*
|
|
11
|
+
* 1. `setBaseDir()` — a caller said so outright
|
|
12
|
+
* 2. `~/.failproofai/custom-agents` — always
|
|
13
|
+
*
|
|
14
|
+
* There is no environment variable that redirects the spool off the umbrella,
|
|
15
|
+
* and that is the point. `FAILPROOFAI_HOME` (honoured by
|
|
16
|
+
* `failproofaiCustomAgentsDir()` below) MOVES the umbrella; it cannot take you
|
|
17
|
+
* outside it, because the `custom-agents` segment is appended unconditionally.
|
|
18
|
+
* Wherever the home is, the spool is inside it.
|
|
19
|
+
*
|
|
20
|
+
* ## Why `$AGENTEYE_HOME` does not resolve here
|
|
21
|
+
*
|
|
22
|
+
* In the Python SDK it used to sit at step 2 and win over the default, which
|
|
23
|
+
* made it possible to aim the SDK at `~/.agenteye` — or anywhere else — from
|
|
24
|
+
* the environment. That is a redirect with no confirmation and no error:
|
|
25
|
+
* batches land in a directory, something may or may not read it, and an unread
|
|
26
|
+
* spool is indistinguishable from an idle one. An operator who exports it for
|
|
27
|
+
* the OTHER component that reads it (the older `agenteye-collector`) moved the
|
|
28
|
+
* SDK's spool as a side effect they never asked for. This SDK never had it.
|
|
29
|
+
*
|
|
30
|
+
* ## Nothing is stranded by this
|
|
31
|
+
*
|
|
32
|
+
* `failproofaid`, the daemon this SDK ships beside, watches BOTH
|
|
33
|
+
* `~/.failproofai/custom-agents/events` AND `~/.agenteye/events`
|
|
34
|
+
* (`crates/fpai-collect/src/config.rs`, `spool_dirs`). Batches sitting under
|
|
35
|
+
* the legacy root still drain.
|
|
36
|
+
*
|
|
37
|
+
* ## The one case that needs a deliberate choice
|
|
38
|
+
*
|
|
39
|
+
* A host running the older `agenteye-collector` and nothing else. That
|
|
40
|
+
* collector never learned the umbrella, so it does not watch where this SDK
|
|
41
|
+
* writes. The supported bridges, in order of preference:
|
|
42
|
+
*
|
|
43
|
+
* * run `failproofaid` instead — it watches both roots; or
|
|
44
|
+
* * point the collector AT the SDK with
|
|
45
|
+
* `AGENTEYE_HOME=~/.failproofai/custom-agents`; or
|
|
46
|
+
* * `configure({ baseDir: "~/.agenteye" })` in the application, which is
|
|
47
|
+
* explicit, visible at the call site, and cannot happen by inheriting
|
|
48
|
+
* somebody else's environment.
|
|
49
|
+
*
|
|
50
|
+
* `test/spool-contract.test.ts` reads the Rust, the TypeScript in `src/hooks/`
|
|
51
|
+
* and the Python resolver and fails if any of them drifts from this.
|
|
52
|
+
*/
|
|
53
|
+
export function getBaseDir(): string {
|
|
54
|
+
const baseDir = shared().baseDir;
|
|
55
|
+
if (baseDir !== null) return baseDir;
|
|
56
|
+
return failproofaiCustomAgentsDir();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `~/.failproofai/custom-agents`, honouring `$FAILPROOFAI_HOME`.
|
|
61
|
+
*
|
|
62
|
+
* Mirrors `customAgentsDir()` in `src/hooks/fp-home.ts`,
|
|
63
|
+
* `custom_agents_events_dir()` in `crates/fpai-collect/src/config.rs` and
|
|
64
|
+
* `failproofai_custom_agents_dir()` in the Python SDK. All four must agree; a
|
|
65
|
+
* divergence would mean this SDK writes somewhere the daemon never reads, with
|
|
66
|
+
* NO error on either side.
|
|
67
|
+
*
|
|
68
|
+
* Returns a path unconditionally and never checks whether it exists. The caller
|
|
69
|
+
* creates it: `writer`'s file write already does a recursive `mkdir` on the
|
|
70
|
+
* directory it is about to write into. An existence check here is what made an
|
|
71
|
+
* earlier opt-in dead — a spool root that must pre-exist can never be the place
|
|
72
|
+
* a first batch is written.
|
|
73
|
+
*/
|
|
74
|
+
export function failproofaiCustomAgentsDir(): string {
|
|
75
|
+
const fpHome = process.env.FAILPROOFAI_HOME;
|
|
76
|
+
const base = fpHome ? expandUser(fpHome) : join(homedir(), ".failproofai");
|
|
77
|
+
return join(base, "custom-agents");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* `~/.agenteye` — the root the SDK family wrote to before the default moved.
|
|
82
|
+
*
|
|
83
|
+
* Not part of resolution, and no environment variable can put it back — see
|
|
84
|
+
* `getBaseDir`. Kept as a named constant because the migration notes and the
|
|
85
|
+
* tests still refer to it, and because `failproofaid` goes on watching
|
|
86
|
+
* `~/.agenteye/events`. Spelling it in four places is how the sides drift apart.
|
|
87
|
+
*/
|
|
88
|
+
export function legacyAgenteyeDir(): string {
|
|
89
|
+
return join(homedir(), ".agenteye");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Expand a leading `~` against the current user's home.
|
|
94
|
+
*
|
|
95
|
+
* Load-bearing, not a nicety: the migration bridge this module itself
|
|
96
|
+
* prescribes — `configure({ baseDir: "~/.agenteye" })`, listed in `getBaseDir`'s
|
|
97
|
+
* docs and in the README as the explicit, visible-at-the-call-site option — is
|
|
98
|
+
* a RELATIVE path whose first segment is the literal character `~`. Without
|
|
99
|
+
* this, the writer's recursive `mkdir` cheerfully creates a `~` directory under
|
|
100
|
+
* the process's cwd and spools into it: nothing on the machine watches that
|
|
101
|
+
* path, so 100% of the telemetry is lost, which is the precise "an unread spool
|
|
102
|
+
* is indistinguishable from an idle one" failure the prose above is written to
|
|
103
|
+
* prevent.
|
|
104
|
+
*/
|
|
105
|
+
export function expandUser(path: string): string {
|
|
106
|
+
if (path === "~") return homedir();
|
|
107
|
+
if (path.startsWith(`~${sep}`) || path.startsWith("~/")) {
|
|
108
|
+
return join(homedir(), path.slice(2));
|
|
109
|
+
}
|
|
110
|
+
return path;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function setBaseDir(path: string | null | undefined): void {
|
|
114
|
+
if (path === null || path === undefined) {
|
|
115
|
+
shared().baseDir = null;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const expanded = expandUser(path);
|
|
119
|
+
shared().baseDir = isAbsolute(expanded) ? expanded : resolve(expanded);
|
|
120
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The process-wide writer and event namespace.
|
|
3
|
+
*
|
|
4
|
+
* These live in a leaf module so that `scopes.ts` and the framework adapters
|
|
5
|
+
* can reach the namespace without importing the package index, which would be
|
|
6
|
+
* a circular import.
|
|
7
|
+
*
|
|
8
|
+
* Constructing `EventWriter` starts the flush interval and registers the
|
|
9
|
+
* module-level exit flush, and that happens at `import "@failproofai/sdk"`
|
|
10
|
+
* time — the index imports this module, so the timing matches the Python SDK's.
|
|
11
|
+
* The interval is `unref`'d, so importing this package never keeps a process
|
|
12
|
+
* alive on its own.
|
|
13
|
+
*
|
|
14
|
+
* Reach the namespace through the `runtime` object rather than a direct named
|
|
15
|
+
* import, so a test can swap in a recording namespace and the scopes and
|
|
16
|
+
* adapters pick it up. A `let` export would work under ESM live bindings and
|
|
17
|
+
* silently not under the CJS build, which is exactly the kind of difference
|
|
18
|
+
* that shows up only in somebody else's project.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { EventNamespace } from "./events.js";
|
|
22
|
+
import { EventWriter } from "./writer.js";
|
|
23
|
+
|
|
24
|
+
const writer = new EventWriter();
|
|
25
|
+
|
|
26
|
+
export const runtime: { writer: EventWriter; event: EventNamespace } = {
|
|
27
|
+
writer,
|
|
28
|
+
event: new EventNamespace(writer),
|
|
29
|
+
};
|