agenttwin 0.3.21 → 0.3.23
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/dist/api.js +2113 -609
- package/dist/dashboard/assets/dashboard/agent-home.css +7 -7
- package/dist/dashboard/assets/dashboard/bay-morning.webp +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-afternoon.webp +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-portrait.webp +0 -0
- package/dist/dashboard/assets/dashboard/moonlit-coast.webp +0 -0
- package/dist/dashboard/assets/next/static/chunks/{1250-7571b1a697f6bb4a.js → 1250-a3c859fd20517500.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{2743-a0efd6f4aeb11cc5.js → 2743-72610a5d5a3f8462.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/5663-403316746afad10e.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/{page-9c11295678539a5f.js → page-0e0392368e0a891e.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-4981ea4966b19e3e.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-dd4ac0f5f36e6bfa.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/{page-34574448d210c775.js → page-de0fe6d84be21e6a.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-360cbffc57981f6b.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-fc4df4912ce3af44.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{webpack-40324749d289e4a5.js → webpack-9e40ef55e5f2fb53.js} +1 -1
- package/dist/dashboard/assets/next/static/css/{42045de5f39b50ca.css → 37d81e1d2804cc5f.css} +1 -1
- package/dist/dashboard/assets/next/static/css/69ec1bae997c3bb0.css +1 -0
- package/dist/dashboard/assets/next/static/css/ad85402a1595e56e.css +1 -0
- package/dist/dashboard/assets/next/static/css/{4bbe78c2fe206b92.css → da981fb878a02b8c.css} +1 -1
- package/dist/dashboard/assets/next/static/media/bay-morning.82669113.webp +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.0aa49492.webp +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-portrait.89fc667a.webp +0 -0
- package/dist/dashboard/assets/next/static/media/moonlit-coast.09739ef4.webp +0 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/engine.js +6386 -4974
- package/dist/gateway.js +2194 -604
- package/dist/twins/catalog.json +6020 -0
- package/dist/twins/engine/v2/THIRD-PARTY.txt +25 -0
- package/dist/twins/engine/v2/chunks/2CHBP57N.mjs +8 -0
- package/dist/twins/engine/v2/chunks/4CPL6MPF.mjs +30 -0
- package/dist/twins/engine/v2/chunks/OYLYKZGD.mjs +2 -0
- package/dist/twins/engine/v2/chunks/SQSP35HM.mjs +38 -0
- package/dist/twins/engine/v2/chunks/YSJQQVUM.mjs +2 -0
- package/dist/twins/engine/v2/react-dom_client.mjs +272 -0
- package/dist/twins/engine/v2/react-dom_server.mjs +263 -0
- package/dist/twins/engine/v2/react.mjs +2 -0
- package/dist/twins/engine/v2/react_jsx-runtime.mjs +31 -0
- package/dist/twins/engine/v2/volter_world-core.mjs +195 -0
- package/dist/twins/engine/v2/volter_world-core_app-route.mjs +2 -0
- package/dist/twins/engine/v2/volter_world-core_network-policy.mjs +2 -0
- package/dist/twins/engine/v3/THIRD-PARTY.txt +65 -0
- package/dist/twins/engine/v3/chunks/2CHBP57N.mjs +8 -0
- package/dist/twins/engine/v3/chunks/2YSSPA5O.mjs +65 -0
- package/dist/twins/engine/v3/chunks/5PWRY4UK.mjs +154 -0
- package/dist/twins/engine/v3/chunks/7XRKSFFJ.mjs +2 -0
- package/dist/twins/engine/v3/chunks/AWOWH2H5.mjs +2 -0
- package/dist/twins/engine/v3/chunks/C46M5U3Q.mjs +2 -0
- package/dist/twins/engine/v3/chunks/MFH2VZPP.mjs +2 -0
- package/dist/twins/engine/v3/chunks/MWCO5UV3.mjs +2 -0
- package/dist/twins/engine/v3/chunks/N5BL5RDF.mjs +313 -0
- package/dist/twins/engine/v3/chunks/O7HGPMXG.mjs +2 -0
- package/dist/twins/engine/v3/chunks/OYLYKZGD.mjs +2 -0
- package/dist/twins/engine/v3/chunks/PLB7HTON.mjs +8 -0
- package/dist/twins/engine/v3/chunks/TY4LDBVH.mjs +7 -0
- package/dist/twins/engine/v3/chunks/VDIRUSCM.mjs +2 -0
- package/dist/twins/engine/v3/chunks/WGUCFQK6.mjs +2 -0
- package/dist/twins/engine/v3/chunks/WPATONSC.mjs +2 -0
- package/dist/twins/engine/v3/react_jsx-runtime.mjs +2 -0
- package/dist/twins/engine/v3/volter_world-core.mjs +2 -0
- package/dist/twins/engine/v3/volter_world-ui.mjs +559 -0
- package/dist/twins/packs/ahrefs/LICENSE +202 -0
- package/dist/twins/packs/ahrefs/NOTICE +7 -0
- package/dist/twins/packs/ahrefs/index.mjs +2 -0
- package/dist/twins/packs/ai-gateway/LICENSE +202 -0
- package/dist/twins/packs/ai-gateway/NOTICE +7 -0
- package/dist/twins/packs/ai-gateway/index.mjs +14 -0
- package/dist/twins/packs/airtable/LICENSE +202 -0
- package/dist/twins/packs/airtable/NOTICE +7 -0
- package/dist/twins/packs/airtable/index.mjs +2 -0
- package/dist/twins/packs/algolia/LICENSE +202 -0
- package/dist/twins/packs/algolia/NOTICE +7 -0
- package/dist/twins/packs/algolia/index.mjs +2 -0
- package/dist/twins/packs/ambientcg/LICENSE +202 -0
- package/dist/twins/packs/ambientcg/NOTICE +7 -0
- package/dist/twins/packs/ambientcg/index.mjs +2 -0
- package/dist/twins/packs/anthropic/LICENSE +202 -0
- package/dist/twins/packs/anthropic/NOTICE +7 -0
- package/dist/twins/packs/anthropic/index.mjs +18 -0
- package/dist/twins/packs/assemblyai/LICENSE +202 -0
- package/dist/twins/packs/assemblyai/NOTICE +7 -0
- package/dist/twins/packs/assemblyai/index.mjs +11 -0
- package/dist/twins/packs/aws/LICENSE +202 -0
- package/dist/twins/packs/aws/NOTICE +7 -0
- package/dist/twins/packs/aws/index.mjs +2 -0
- package/dist/twins/packs/azure/LICENSE +202 -0
- package/dist/twins/packs/azure/NOTICE +7 -0
- package/dist/twins/packs/azure/index.mjs +38 -0
- package/dist/twins/packs/azureformrecognizer/LICENSE +202 -0
- package/dist/twins/packs/azureformrecognizer/NOTICE +7 -0
- package/dist/twins/packs/azureformrecognizer/index.mjs +3 -0
- package/dist/twins/packs/bitly/LICENSE +202 -0
- package/dist/twins/packs/bitly/NOTICE +7 -0
- package/dist/twins/packs/bitly/index.mjs +2 -0
- package/dist/twins/packs/bluesky/LICENSE +202 -0
- package/dist/twins/packs/bluesky/NOTICE +7 -0
- package/dist/twins/packs/bluesky/index.mjs +30 -0
- package/dist/twins/packs/calcom/LICENSE +202 -0
- package/dist/twins/packs/calcom/NOTICE +7 -0
- package/dist/twins/packs/calcom/index.mjs +2 -0
- package/dist/twins/packs/clerk/LICENSE +202 -0
- package/dist/twins/packs/clerk/NOTICE +7 -0
- package/dist/twins/packs/clerk/index.mjs +5 -0
- package/dist/twins/packs/cloudflare/LICENSE +202 -0
- package/dist/twins/packs/cloudflare/NOTICE +7 -0
- package/dist/twins/packs/cloudflare/index.mjs +79 -0
- package/dist/twins/packs/cohere/LICENSE +202 -0
- package/dist/twins/packs/cohere/NOTICE +7 -0
- package/dist/twins/packs/cohere/index.mjs +2 -0
- package/dist/twins/packs/datadog/LICENSE +202 -0
- package/dist/twins/packs/datadog/NOTICE +7 -0
- package/dist/twins/packs/datadog/index.mjs +3 -0
- package/dist/twins/packs/deepinfra/LICENSE +202 -0
- package/dist/twins/packs/deepinfra/NOTICE +7 -0
- package/dist/twins/packs/deepinfra/index.mjs +13 -0
- package/dist/twins/packs/deepseek/LICENSE +202 -0
- package/dist/twins/packs/deepseek/NOTICE +7 -0
- package/dist/twins/packs/deepseek/index.mjs +12 -0
- package/dist/twins/packs/discord/LICENSE +202 -0
- package/dist/twins/packs/discord/NOTICE +7 -0
- package/dist/twins/packs/discord/index.mjs +2 -0
- package/dist/twins/packs/duckduckgo/LICENSE +202 -0
- package/dist/twins/packs/duckduckgo/NOTICE +7 -0
- package/dist/twins/packs/duckduckgo/index.mjs +532 -0
- package/dist/twins/packs/dynadot/LICENSE +202 -0
- package/dist/twins/packs/dynadot/NOTICE +7 -0
- package/dist/twins/packs/dynadot/index.mjs +2 -0
- package/dist/twins/packs/e2b/LICENSE +202 -0
- package/dist/twins/packs/e2b/NOTICE +7 -0
- package/dist/twins/packs/e2b/index.mjs +2 -0
- package/dist/twins/packs/elevenlabs/LICENSE +202 -0
- package/dist/twins/packs/elevenlabs/NOTICE +7 -0
- package/dist/twins/packs/elevenlabs/index.mjs +4 -0
- package/dist/twins/packs/expo/LICENSE +202 -0
- package/dist/twins/packs/expo/NOTICE +7 -0
- package/dist/twins/packs/expo/index.mjs +2 -0
- package/dist/twins/packs/fal/LICENSE +202 -0
- package/dist/twins/packs/fal/NOTICE +7 -0
- package/dist/twins/packs/fal/index.mjs +2 -0
- package/dist/twins/packs/figma/LICENSE +202 -0
- package/dist/twins/packs/figma/NOTICE +7 -0
- package/dist/twins/packs/figma/index.mjs +2 -0
- package/dist/twins/packs/firecrawl/LICENSE +202 -0
- package/dist/twins/packs/firecrawl/NOTICE +7 -0
- package/dist/twins/packs/firecrawl/index.mjs +9 -0
- package/dist/twins/packs/fireworks/LICENSE +202 -0
- package/dist/twins/packs/fireworks/NOTICE +7 -0
- package/dist/twins/packs/fireworks/index.mjs +13 -0
- package/dist/twins/packs/fly/LICENSE +202 -0
- package/dist/twins/packs/fly/NOTICE +7 -0
- package/dist/twins/packs/fly/index.mjs +2 -0
- package/dist/twins/packs/gcs/LICENSE +202 -0
- package/dist/twins/packs/gcs/NOTICE +7 -0
- package/dist/twins/packs/gcs/index.mjs +8 -0
- package/dist/twins/packs/gemini/LICENSE +202 -0
- package/dist/twins/packs/gemini/NOTICE +7 -0
- package/dist/twins/packs/gemini/index.mjs +7 -0
- package/dist/twins/packs/github/LICENSE +202 -0
- package/dist/twins/packs/github/NOTICE +7 -0
- package/dist/twins/packs/github/index.mjs +75153 -0
- package/dist/twins/packs/googleads/LICENSE +202 -0
- package/dist/twins/packs/googleads/NOTICE +7 -0
- package/dist/twins/packs/googleads/index.mjs +3 -0
- package/dist/twins/packs/googlemaps/LICENSE +202 -0
- package/dist/twins/packs/googlemaps/NOTICE +7 -0
- package/dist/twins/packs/googlemaps/index.mjs +2 -0
- package/dist/twins/packs/googleoauth/LICENSE +202 -0
- package/dist/twins/packs/googleoauth/NOTICE +7 -0
- package/dist/twins/packs/googleoauth/index.mjs +2 -0
- package/dist/twins/packs/hackernews/LICENSE +202 -0
- package/dist/twins/packs/hackernews/NOTICE +7 -0
- package/dist/twins/packs/hackernews/index.mjs +35 -0
- package/dist/twins/packs/huggingface/LICENSE +202 -0
- package/dist/twins/packs/huggingface/NOTICE +7 -0
- package/dist/twins/packs/huggingface/index.mjs +9 -0
- package/dist/twins/packs/inngest/LICENSE +202 -0
- package/dist/twins/packs/inngest/NOTICE +7 -0
- package/dist/twins/packs/inngest/index.mjs +2 -0
- package/dist/twins/packs/instagram/LICENSE +202 -0
- package/dist/twins/packs/instagram/NOTICE +7 -0
- package/dist/twins/packs/instagram/index.mjs +2 -0
- package/dist/twins/packs/jira/LICENSE +202 -0
- package/dist/twins/packs/jira/NOTICE +7 -0
- package/dist/twins/packs/jira/index.mjs +2 -0
- package/dist/twins/packs/langfuse/LICENSE +202 -0
- package/dist/twins/packs/langfuse/NOTICE +7 -0
- package/dist/twins/packs/langfuse/index.mjs +2 -0
- package/dist/twins/packs/linear/LICENSE +202 -0
- package/dist/twins/packs/linear/NOTICE +7 -0
- package/dist/twins/packs/linear/index.mjs +52866 -0
- package/dist/twins/packs/linkedin/LICENSE +202 -0
- package/dist/twins/packs/linkedin/NOTICE +7 -0
- package/dist/twins/packs/linkedin/index.mjs +78 -0
- package/dist/twins/packs/livekit/LICENSE +202 -0
- package/dist/twins/packs/livekit/NOTICE +7 -0
- package/dist/twins/packs/livekit/index.mjs +2 -0
- package/dist/twins/packs/mailgun/LICENSE +202 -0
- package/dist/twins/packs/mailgun/NOTICE +7 -0
- package/dist/twins/packs/mailgun/index.mjs +13 -0
- package/dist/twins/packs/mapbox/LICENSE +202 -0
- package/dist/twins/packs/mapbox/NOTICE +7 -0
- package/dist/twins/packs/mapbox/index.mjs +2 -0
- package/dist/twins/packs/merge/LICENSE +202 -0
- package/dist/twins/packs/merge/NOTICE +7 -0
- package/dist/twins/packs/merge/index.mjs +4 -0
- package/dist/twins/packs/mistral/LICENSE +202 -0
- package/dist/twins/packs/mistral/NOTICE +7 -0
- package/dist/twins/packs/mistral/index.mjs +6 -0
- package/dist/twins/packs/mixpanel/LICENSE +202 -0
- package/dist/twins/packs/mixpanel/NOTICE +8 -0
- package/dist/twins/packs/mixpanel/index.mjs +2 -0
- package/dist/twins/packs/mongodb/LICENSE +202 -0
- package/dist/twins/packs/mongodb/NOTICE +7 -0
- package/dist/twins/packs/mongodb/index.mjs +8 -0
- package/dist/twins/packs/moonshot/LICENSE +202 -0
- package/dist/twins/packs/moonshot/NOTICE +7 -0
- package/dist/twins/packs/moonshot/index.mjs +18 -0
- package/dist/twins/packs/notion/LICENSE +202 -0
- package/dist/twins/packs/notion/NOTICE +7 -0
- package/dist/twins/packs/notion/index.mjs +2 -0
- package/dist/twins/packs/npm-registry/LICENSE +202 -0
- package/dist/twins/packs/npm-registry/NOTICE +7 -0
- package/dist/twins/packs/npm-registry/index.mjs +2 -0
- package/dist/twins/packs/oa-treasury/LICENSE +202 -0
- package/dist/twins/packs/oa-treasury/NOTICE +8 -0
- package/dist/twins/packs/oa-treasury/index.mjs +16 -0
- package/dist/twins/packs/openai/LICENSE +202 -0
- package/dist/twins/packs/openai/NOTICE +7 -0
- package/dist/twins/packs/openai/index.mjs +3473 -0
- package/dist/twins/packs/openrouter/LICENSE +202 -0
- package/dist/twins/packs/openrouter/NOTICE +7 -0
- package/dist/twins/packs/openrouter/index.mjs +2 -0
- package/dist/twins/packs/openweather/LICENSE +202 -0
- package/dist/twins/packs/openweather/NOTICE +7 -0
- package/dist/twins/packs/openweather/index.mjs +2 -0
- package/dist/twins/packs/paypal/LICENSE +202 -0
- package/dist/twins/packs/paypal/NOTICE +7 -0
- package/dist/twins/packs/paypal/index.mjs +51 -0
- package/dist/twins/packs/pinecone/LICENSE +202 -0
- package/dist/twins/packs/pinecone/NOTICE +7 -0
- package/dist/twins/packs/pinecone/index.mjs +2 -0
- package/dist/twins/packs/plain/LICENSE +202 -0
- package/dist/twins/packs/plain/NOTICE +8 -0
- package/dist/twins/packs/plain/index.mjs +18426 -0
- package/dist/twins/packs/planetscale/LICENSE +202 -0
- package/dist/twins/packs/planetscale/NOTICE +7 -0
- package/dist/twins/packs/planetscale/index.mjs +18 -0
- package/dist/twins/packs/polar/LICENSE +202 -0
- package/dist/twins/packs/polar/NOTICE +7 -0
- package/dist/twins/packs/polar/index.mjs +2 -0
- package/dist/twins/packs/polyhaven/LICENSE +202 -0
- package/dist/twins/packs/polyhaven/NOTICE +7 -0
- package/dist/twins/packs/polyhaven/index.mjs +3 -0
- package/dist/twins/packs/postmark/LICENSE +202 -0
- package/dist/twins/packs/postmark/NOTICE +7 -0
- package/dist/twins/packs/postmark/index.mjs +12 -0
- package/dist/twins/packs/reddit/LICENSE +202 -0
- package/dist/twins/packs/reddit/NOTICE +7 -0
- package/dist/twins/packs/reddit/index.mjs +324 -0
- package/dist/twins/packs/redis/LICENSE +202 -0
- package/dist/twins/packs/redis/NOTICE +7 -0
- package/dist/twins/packs/redis/index.mjs +2 -0
- package/dist/twins/packs/replicate/LICENSE +202 -0
- package/dist/twins/packs/replicate/NOTICE +7 -0
- package/dist/twins/packs/replicate/index.mjs +2 -0
- package/dist/twins/packs/resend/LICENSE +202 -0
- package/dist/twins/packs/resend/NOTICE +7 -0
- package/dist/twins/packs/resend/index.mjs +139 -0
- package/dist/twins/packs/runhuman/LICENSE +202 -0
- package/dist/twins/packs/runhuman/NOTICE +7 -0
- package/dist/twins/packs/runhuman/index.mjs +3 -0
- package/dist/twins/packs/scrapecreators/LICENSE +202 -0
- package/dist/twins/packs/scrapecreators/NOTICE +7 -0
- package/dist/twins/packs/scrapecreators/index.mjs +2 -0
- package/dist/twins/packs/segment/LICENSE +202 -0
- package/dist/twins/packs/segment/NOTICE +8 -0
- package/dist/twins/packs/segment/index.mjs +2 -0
- package/dist/twins/packs/sendblue/LICENSE +202 -0
- package/dist/twins/packs/sendblue/NOTICE +7 -0
- package/dist/twins/packs/sendblue/index.mjs +2 -0
- package/dist/twins/packs/sendgrid/LICENSE +202 -0
- package/dist/twins/packs/sendgrid/NOTICE +8 -0
- package/dist/twins/packs/sendgrid/index.mjs +4 -0
- package/dist/twins/packs/sentry/LICENSE +202 -0
- package/dist/twins/packs/sentry/NOTICE +7 -0
- package/dist/twins/packs/sentry/index.mjs +5 -0
- package/dist/twins/packs/sigstore/LICENSE +202 -0
- package/dist/twins/packs/sigstore/NOTICE +7 -0
- package/dist/twins/packs/sigstore/index.mjs +12 -0
- package/dist/twins/packs/slack/LICENSE +202 -0
- package/dist/twins/packs/slack/NOTICE +7 -0
- package/dist/twins/packs/slack/index.mjs +66 -0
- package/dist/twins/packs/smtp/LICENSE +202 -0
- package/dist/twins/packs/smtp/NOTICE +7 -0
- package/dist/twins/packs/smtp/index.mjs +3 -0
- package/dist/twins/packs/snowflake/LICENSE +202 -0
- package/dist/twins/packs/snowflake/NOTICE +8 -0
- package/dist/twins/packs/snowflake/index.mjs +30 -0
- package/dist/twins/packs/stigg/LICENSE +202 -0
- package/dist/twins/packs/stigg/NOTICE +8 -0
- package/dist/twins/packs/stigg/index.mjs +22194 -0
- package/dist/twins/packs/stream/LICENSE +202 -0
- package/dist/twins/packs/stream/NOTICE +7 -0
- package/dist/twins/packs/stream/index.mjs +2 -0
- package/dist/twins/packs/stripe/LICENSE +202 -0
- package/dist/twins/packs/stripe/NOTICE +7 -0
- package/dist/twins/packs/stripe/index.mjs +211 -0
- package/dist/twins/packs/supabase/LICENSE +202 -0
- package/dist/twins/packs/supabase/NOTICE +7 -0
- package/dist/twins/packs/supabase/index.mjs +2 -0
- package/dist/twins/packs/supermemory/LICENSE +202 -0
- package/dist/twins/packs/supermemory/NOTICE +7 -0
- package/dist/twins/packs/supermemory/index.mjs +2 -0
- package/dist/twins/packs/svix/LICENSE +202 -0
- package/dist/twins/packs/svix/NOTICE +7 -0
- package/dist/twins/packs/svix/index.mjs +2 -0
- package/dist/twins/packs/tavily/LICENSE +202 -0
- package/dist/twins/packs/tavily/NOTICE +7 -0
- package/dist/twins/packs/tavily/index.mjs +2 -0
- package/dist/twins/packs/telegram/LICENSE +202 -0
- package/dist/twins/packs/telegram/NOTICE +7 -0
- package/dist/twins/packs/telegram/index.mjs +11 -0
- package/dist/twins/packs/temporal/LICENSE +202 -0
- package/dist/twins/packs/temporal/NOTICE +7 -0
- package/dist/twins/packs/temporal/index.mjs +44 -0
- package/dist/twins/packs/tiktok/LICENSE +202 -0
- package/dist/twins/packs/tiktok/NOTICE +7 -0
- package/dist/twins/packs/tiktok/index.mjs +2 -0
- package/dist/twins/packs/tinybird/LICENSE +202 -0
- package/dist/twins/packs/tinybird/NOTICE +7 -0
- package/dist/twins/packs/tinybird/index.mjs +50 -0
- package/dist/twins/packs/togetherai/LICENSE +202 -0
- package/dist/twins/packs/togetherai/NOTICE +7 -0
- package/dist/twins/packs/togetherai/index.mjs +11 -0
- package/dist/twins/packs/tremendous/LICENSE +202 -0
- package/dist/twins/packs/tremendous/NOTICE +7 -0
- package/dist/twins/packs/tremendous/index.mjs +2 -0
- package/dist/twins/packs/tripo/LICENSE +202 -0
- package/dist/twins/packs/tripo/NOTICE +7 -0
- package/dist/twins/packs/tripo/index.mjs +9 -0
- package/dist/twins/packs/tunnel/LICENSE +202 -0
- package/dist/twins/packs/tunnel/NOTICE +7 -0
- package/dist/twins/packs/tunnel/index.mjs +2 -0
- package/dist/twins/packs/twelvelabs/LICENSE +202 -0
- package/dist/twins/packs/twelvelabs/NOTICE +7 -0
- package/dist/twins/packs/twelvelabs/index.mjs +5 -0
- package/dist/twins/packs/twilio/LICENSE +202 -0
- package/dist/twins/packs/twilio/NOTICE +7 -0
- package/dist/twins/packs/twilio/index.mjs +2 -0
- package/dist/twins/packs/twitch/LICENSE +202 -0
- package/dist/twins/packs/twitch/NOTICE +7 -0
- package/dist/twins/packs/twitch/index.mjs +68 -0
- package/dist/twins/packs/upstash/LICENSE +202 -0
- package/dist/twins/packs/upstash/NOTICE +7 -0
- package/dist/twins/packs/upstash/index.mjs +14 -0
- package/dist/twins/packs/upstashvector/LICENSE +202 -0
- package/dist/twins/packs/upstashvector/NOTICE +7 -0
- package/dist/twins/packs/upstashvector/index.mjs +3 -0
- package/dist/twins/packs/vercel/LICENSE +202 -0
- package/dist/twins/packs/vercel/NOTICE +7 -0
- package/dist/twins/packs/vercel/index.mjs +10 -0
- package/dist/twins/packs/veriff/LICENSE +202 -0
- package/dist/twins/packs/veriff/NOTICE +7 -0
- package/dist/twins/packs/veriff/index.mjs +2 -0
- package/dist/twins/packs/vgauth/LICENSE +202 -0
- package/dist/twins/packs/vgauth/NOTICE +7 -0
- package/dist/twins/packs/vgauth/index.mjs +2 -0
- package/dist/twins/packs/vital/LICENSE +202 -0
- package/dist/twins/packs/vital/NOTICE +7 -0
- package/dist/twins/packs/vital/index.mjs +2 -0
- package/dist/twins/packs/volteridentity/LICENSE +202 -0
- package/dist/twins/packs/volteridentity/NOTICE +7 -0
- package/dist/twins/packs/volteridentity/index.mjs +2 -0
- package/dist/twins/packs/webrisk/LICENSE +202 -0
- package/dist/twins/packs/webrisk/NOTICE +7 -0
- package/dist/twins/packs/webrisk/index.mjs +2 -0
- package/dist/twins/packs/worldlabs/LICENSE +202 -0
- package/dist/twins/packs/worldlabs/NOTICE +7 -0
- package/dist/twins/packs/worldlabs/index.mjs +2 -0
- package/dist/twins/packs/x/LICENSE +202 -0
- package/dist/twins/packs/x/NOTICE +7 -0
- package/dist/twins/packs/x/index.mjs +63 -0
- package/dist/twins/packs/xai/LICENSE +202 -0
- package/dist/twins/packs/xai/NOTICE +7 -0
- package/dist/twins/packs/xai/index.mjs +4 -0
- package/dist/twins/packs/xidentity/LICENSE +202 -0
- package/dist/twins/packs/xidentity/NOTICE +8 -0
- package/dist/twins/packs/xidentity/index.mjs +209 -0
- package/dist/twins/packs/youtube/LICENSE +202 -0
- package/dist/twins/packs/youtube/NOTICE +7 -0
- package/dist/twins/packs/youtube/index.mjs +5 -0
- package/dist/worker.js +442 -18
- package/dist/world-host.js +928 -91
- package/package.json +6 -5
- package/dist/dashboard/assets/dashboard/bay-morning.png +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-afternoon.png +0 -0
- package/dist/dashboard/assets/dashboard/golden-gate-portrait.png +0 -0
- package/dist/dashboard/assets/dashboard/moonlit-coast.png +0 -0
- package/dist/dashboard/assets/next/static/chunks/2868-424d32cfc8ae81c9.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-f9fca2c08f779fa0.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-bc480c9258e5cc4d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-f04c0b236abaead3.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-07c8054d57c9089b.js +0 -1
- package/dist/dashboard/assets/next/static/css/4af3c8ca0da0f48b.css +0 -1
- package/dist/dashboard/assets/next/static/css/6b8edde77e493a51.css +0 -1
- package/dist/dashboard/assets/next/static/media/bay-morning.1a9f358c.png +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.3e7cea58.png +0 -0
- package/dist/dashboard/assets/next/static/media/golden-gate-portrait.7941528f.png +0 -0
- package/dist/dashboard/assets/next/static/media/moonlit-coast.bbe901a1.png +0 -0
- /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_buildManifest.js +0 -0
- /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_ssgManifest.js +0 -0
package/dist/worker.js
CHANGED
|
@@ -191,7 +191,7 @@ function stripeOperation(method, path, params, data, sequence) {
|
|
|
191
191
|
|
|
192
192
|
// src/runtime/llm-adapter.ts
|
|
193
193
|
function hasToolResult(messages) {
|
|
194
|
-
return Array.isArray(messages) && messages.some((m) => !!m && typeof m === "object" && (m.role === "tool" || Array.isArray(m.content) && m.content.some((part) => !!part && typeof part === "object" && part.type === "tool_result")));
|
|
194
|
+
return Array.isArray(messages) && messages.some((m) => !!m && typeof m === "object" && (m.role === "tool" || m.type === "function_call_output" || Array.isArray(m.content) && m.content.some((part) => !!part && typeof part === "object" && part.type === "tool_result")));
|
|
195
195
|
}
|
|
196
196
|
function lastUserText(messages) {
|
|
197
197
|
if (typeof messages === "string") return messages;
|
|
@@ -229,12 +229,76 @@ function parsedInput(value) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
var arg = (value) => typeof value === "string" ? value : JSON.stringify(value ?? {});
|
|
232
|
+
var SSE = { "content-type": "text/event-stream; charset=utf-8", "cache-control": "no-cache" };
|
|
233
|
+
var pieces = (text) => {
|
|
234
|
+
const out = [];
|
|
235
|
+
const size = Math.max(1, Math.ceil(text.length / 3));
|
|
236
|
+
for (let i = 0; i < text.length; i += size) out.push(text.slice(i, i + size));
|
|
237
|
+
return out.length ? out : [""];
|
|
238
|
+
};
|
|
239
|
+
var frame = (data, event) => `${event ? `event: ${event}
|
|
240
|
+
` : ""}data: ${typeof data === "string" ? data : JSON.stringify(data)}
|
|
241
|
+
|
|
242
|
+
`;
|
|
243
|
+
function streamed(result, events) {
|
|
244
|
+
return { ...result, body: events, headers: { ...result.headers ?? {}, ...SSE } };
|
|
245
|
+
}
|
|
246
|
+
function chatStream(body) {
|
|
247
|
+
const base = { id: body.id, object: "chat.completion.chunk", created: body.created, model: body.model, system_fingerprint: null };
|
|
248
|
+
const message = body.choices[0].message, chunk = (delta, finish = null) => frame({ ...base, choices: [{ index: 0, delta, logprobs: null, finish_reason: finish }] });
|
|
249
|
+
let out = chunk({ role: "assistant", content: "", refusal: null });
|
|
250
|
+
if (typeof message.content === "string") for (const part of pieces(message.content)) out += chunk({ content: part });
|
|
251
|
+
(message.tool_calls ?? []).forEach((call, index) => {
|
|
252
|
+
out += chunk({ tool_calls: [{ index, id: call.id, type: "function", function: { name: call.function.name, arguments: "" } }] });
|
|
253
|
+
for (const part of pieces(call.function.arguments)) out += chunk({ tool_calls: [{ index, function: { arguments: part } }] });
|
|
254
|
+
});
|
|
255
|
+
out += chunk({}, body.choices[0].finish_reason);
|
|
256
|
+
return out + frame("[DONE]");
|
|
257
|
+
}
|
|
258
|
+
function responsesStream(body) {
|
|
259
|
+
let n = 0;
|
|
260
|
+
const ev = (type, data) => frame({ type, sequence_number: n++, ...data }, type);
|
|
261
|
+
const pending = { ...body, status: "in_progress", output: [], usage: null };
|
|
262
|
+
let out = ev("response.created", { response: pending }) + ev("response.in_progress", { response: pending });
|
|
263
|
+
body.output.forEach((item, output_index) => {
|
|
264
|
+
if (item.type === "message") {
|
|
265
|
+
const text = item.content[0]?.text ?? "";
|
|
266
|
+
out += ev("response.output_item.added", { output_index, item: { ...item, status: "in_progress", content: [] } });
|
|
267
|
+
out += ev("response.content_part.added", { item_id: item.id, output_index, content_index: 0, part: { type: "output_text", text: "", annotations: [] } });
|
|
268
|
+
for (const delta of pieces(text)) out += ev("response.output_text.delta", { item_id: item.id, output_index, content_index: 0, delta, logprobs: [] });
|
|
269
|
+
out += ev("response.output_text.done", { item_id: item.id, output_index, content_index: 0, text, logprobs: [] });
|
|
270
|
+
out += ev("response.content_part.done", { item_id: item.id, output_index, content_index: 0, part: item.content[0] });
|
|
271
|
+
} else {
|
|
272
|
+
out += ev("response.output_item.added", { output_index, item: { ...item, arguments: "", status: "in_progress" } });
|
|
273
|
+
for (const delta of pieces(item.arguments)) out += ev("response.function_call_arguments.delta", { item_id: item.id, output_index, delta });
|
|
274
|
+
out += ev("response.function_call_arguments.done", { item_id: item.id, output_index, arguments: item.arguments });
|
|
275
|
+
}
|
|
276
|
+
out += ev("response.output_item.done", { output_index, item });
|
|
277
|
+
});
|
|
278
|
+
return out + ev("response.completed", { response: body });
|
|
279
|
+
}
|
|
280
|
+
function anthropicStream(body) {
|
|
281
|
+
const ev = (type, data) => frame({ type, ...data }, type);
|
|
282
|
+
let out = ev("message_start", { message: { ...body, content: [], stop_reason: null, stop_sequence: null, usage: { input_tokens: 0, output_tokens: 0 } } });
|
|
283
|
+
body.content.forEach((block, index) => {
|
|
284
|
+
if (block.type === "text") {
|
|
285
|
+
out += ev("content_block_start", { index, content_block: { type: "text", text: "" } });
|
|
286
|
+
for (const text of pieces(block.text)) out += ev("content_block_delta", { index, delta: { type: "text_delta", text } });
|
|
287
|
+
} else {
|
|
288
|
+
out += ev("content_block_start", { index, content_block: { type: "tool_use", id: block.id, name: block.name, input: {} } });
|
|
289
|
+
for (const partial_json of pieces(JSON.stringify(block.input ?? {}))) out += ev("content_block_delta", { index, delta: { type: "input_json_delta", partial_json } });
|
|
290
|
+
}
|
|
291
|
+
out += ev("content_block_stop", { index });
|
|
292
|
+
});
|
|
293
|
+
out += ev("message_delta", { delta: { stop_reason: body.stop_reason, stop_sequence: null }, usage: { output_tokens: 0 } });
|
|
294
|
+
return out + ev("message_stop", {});
|
|
295
|
+
}
|
|
232
296
|
function openaiOperation(method, path, params, _headers, data, sequence) {
|
|
233
297
|
const collection = "/requests";
|
|
234
298
|
if (path === "/v1/requests" || path === "/requests") return method === "GET" ? { status: 200, body: { object: "list", data: data[collection] }, collection, operation: "read" } : void 0;
|
|
235
299
|
if (method === "POST" && ["/v1/responses", "/responses"].includes(path)) return openaiResponsesOperation(params, data, sequence);
|
|
236
300
|
if (method !== "POST" || !["/v1/chat/completions", "/chat/completions"].includes(path)) return void 0;
|
|
237
|
-
if (
|
|
301
|
+
if (!Array.isArray(params.messages)) return void 0;
|
|
238
302
|
const prompt = lastUserText(params.messages);
|
|
239
303
|
const script = nextScripted(data, prompt, hasToolResult(params.messages));
|
|
240
304
|
if (!script) return void 0;
|
|
@@ -250,13 +314,14 @@ function openaiOperation(method, path, params, _headers, data, sequence) {
|
|
|
250
314
|
choices: [{ index: 0, message: { role: "assistant", content: script.content, refusal: null, ...toolCalls.length ? { tool_calls: toolCalls } : {} }, logprobs: null, finish_reason: toolCalls.length ? "tool_calls" : "stop" }],
|
|
251
315
|
usage: { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 }
|
|
252
316
|
};
|
|
253
|
-
|
|
317
|
+
const result = { status: 200, body, collection, record: entry, operation: "write" };
|
|
318
|
+
return params.stream === true ? streamed(result, chatStream(body)) : result;
|
|
254
319
|
}
|
|
255
320
|
function openaiResponsesOperation(params, data, sequence) {
|
|
256
321
|
const collection = "/requests";
|
|
257
|
-
if (
|
|
322
|
+
if (typeof params.input !== "string" && !Array.isArray(params.input)) return void 0;
|
|
258
323
|
const prompt = lastUserText(params.input);
|
|
259
|
-
const script = nextScripted(data, prompt);
|
|
324
|
+
const script = nextScripted(data, prompt, hasToolResult(params.input));
|
|
260
325
|
if (!script) return void 0;
|
|
261
326
|
const id = `resp_at_${sequence}`;
|
|
262
327
|
const calls = script.calls.map((call, index) => ({ type: "function_call", id: `fc_at_${sequence}_${index}`, call_id: `call_at_${sequence}_${index}`, name: String(call.name), arguments: arg(call.arguments), status: "completed" }));
|
|
@@ -277,13 +342,14 @@ function openaiResponsesOperation(params, data, sequence) {
|
|
|
277
342
|
tools: Array.isArray(params.tools) ? params.tools : [],
|
|
278
343
|
usage: { input_tokens: 0, output_tokens: 0, total_tokens: 0, input_tokens_details: { cached_tokens: 0 }, output_tokens_details: { reasoning_tokens: 0 } }
|
|
279
344
|
};
|
|
280
|
-
|
|
345
|
+
const result = { status: 200, body, collection, record: entry, operation: "write" };
|
|
346
|
+
return params.stream === true ? streamed(result, responsesStream(body)) : result;
|
|
281
347
|
}
|
|
282
348
|
function anthropicOperation(method, path, params, _headers, data, sequence) {
|
|
283
349
|
const collection = "/requests";
|
|
284
350
|
if (path === "/v1/requests" || path === "/requests") return method === "GET" ? { status: 200, body: { data: data[collection] }, collection, operation: "read" } : void 0;
|
|
285
351
|
if (method !== "POST" || !["/v1/messages", "/messages"].includes(path)) return void 0;
|
|
286
|
-
if (
|
|
352
|
+
if (!Array.isArray(params.messages)) return void 0;
|
|
287
353
|
const prompt = lastUserText(params.messages);
|
|
288
354
|
const script = nextScripted(data, prompt, hasToolResult(params.messages));
|
|
289
355
|
if (!script) return void 0;
|
|
@@ -301,7 +367,8 @@ function anthropicOperation(method, path, params, _headers, data, sequence) {
|
|
|
301
367
|
stop_sequence: null,
|
|
302
368
|
usage: { input_tokens: 0, output_tokens: 0 }
|
|
303
369
|
};
|
|
304
|
-
|
|
370
|
+
const result = { status: 200, body, collection, record: entry, operation: "write" };
|
|
371
|
+
return params.stream === true ? streamed(result, anthropicStream(body)) : result;
|
|
305
372
|
}
|
|
306
373
|
|
|
307
374
|
// src/runtime/composio-twin.ts
|
|
@@ -1862,6 +1929,44 @@ function generatedAdapter(adapter) {
|
|
|
1862
1929
|
};
|
|
1863
1930
|
}
|
|
1864
1931
|
|
|
1932
|
+
// src/runtime/packs.ts
|
|
1933
|
+
import { existsSync, readFileSync } from "fs";
|
|
1934
|
+
import { dirname, join as join2, resolve as resolve2 } from "path";
|
|
1935
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
1936
|
+
function packsDir() {
|
|
1937
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
1938
|
+
const candidates = [process.env.AGENTTWIN_TWINS_DIR, join2(here, "twins"), join2(here, "../twins"), resolve2(here, "../../../twins/dist")];
|
|
1939
|
+
return candidates.find((dir) => !!dir && existsSync(join2(dir, "catalog.json")));
|
|
1940
|
+
}
|
|
1941
|
+
var cached;
|
|
1942
|
+
function packCatalog() {
|
|
1943
|
+
if (cached !== void 0) return cached;
|
|
1944
|
+
const dir = packsDir();
|
|
1945
|
+
cached = dir ? JSON.parse(readFileSync(join2(dir, "catalog.json"), "utf8")) : null;
|
|
1946
|
+
return cached;
|
|
1947
|
+
}
|
|
1948
|
+
var PACK_PREFIX = "pack:";
|
|
1949
|
+
var isPackAdapter = (adapter) => typeof adapter === "string" && adapter.startsWith(PACK_PREFIX) && !!packRecord(adapter.slice(PACK_PREFIX.length));
|
|
1950
|
+
var packRecord = (name) => {
|
|
1951
|
+
const c = packCatalog();
|
|
1952
|
+
return c && Object.hasOwn(c.packs, name) ? c.packs[name] : void 0;
|
|
1953
|
+
};
|
|
1954
|
+
var loaded = /* @__PURE__ */ new Map();
|
|
1955
|
+
function loadPack(name) {
|
|
1956
|
+
const record2 = packRecord(name);
|
|
1957
|
+
if (!record2) throw new Error(`No twin pack named ${name}`);
|
|
1958
|
+
let factory = loaded.get(name);
|
|
1959
|
+
if (!factory) {
|
|
1960
|
+
const file = join2(packsDir(), "packs", name, "index.mjs");
|
|
1961
|
+
factory = import(pathToFileURL(file).href).then((mod) => {
|
|
1962
|
+
if (typeof mod.createTwinFetch !== "function") throw new Error(`Twin pack ${name} exports no createTwinFetch`);
|
|
1963
|
+
return mod.createTwinFetch;
|
|
1964
|
+
});
|
|
1965
|
+
loaded.set(name, factory);
|
|
1966
|
+
}
|
|
1967
|
+
return factory;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1865
1970
|
// src/runtime/enterprise-twins.ts
|
|
1866
1971
|
import { createHash as createHash4 } from "crypto";
|
|
1867
1972
|
var ENTERPRISE_ADAPTERS = ["salesforce", "servicenow", "workday", "sap", "microsoft-teams", "outlook", "entra-id", "okta", "confluence", "sharepoint", "snowflake", "netsuite", "pagerduty"];
|
|
@@ -2834,6 +2939,7 @@ var ENTERPRISE_CONTRACTS = {
|
|
|
2834
2939
|
};
|
|
2835
2940
|
|
|
2836
2941
|
// src/runtime/spec.ts
|
|
2942
|
+
var RUNTIMES = /^(?:\/[\w./-]+\/)?(?:node|python[0-9.]*|uv|poetry|pipenv|go|ruby|bundle|deno|bun|curl)$/;
|
|
2837
2943
|
var ADAPTER_OPTIONAL_COLLECTIONS = {
|
|
2838
2944
|
stripe: ["/v1/charges", "/v1/refunds", "/v1/events"],
|
|
2839
2945
|
...ENTERPRISE_OPTIONAL_COLLECTIONS
|
|
@@ -2875,7 +2981,7 @@ function parseWorld(value) {
|
|
|
2875
2981
|
if (typeof v.name !== "string" || !namePattern.test(v.name)) invalid("name must be lowercase letters, digits or underscores");
|
|
2876
2982
|
if (!Array.isArray(v.files) || !v.files.length || v.files.length > 100 || !v.files.every((f) => typeof f === "string" && f.length > 0)) invalid("files must explicitly list 1\u2013100 application files");
|
|
2877
2983
|
if (new Set(v.files).size !== v.files.length) invalid("files must be unique");
|
|
2878
|
-
if (!Array.isArray(v.command) || !v.command.length || !v.command.every((c) => typeof c === "string" && c.length > 0) || v.command[0]
|
|
2984
|
+
if (!Array.isArray(v.command) || !v.command.length || !v.command.every((c) => typeof c === "string" && c.length > 0) || !RUNTIMES.test(v.command[0])) invalid("command must be an argv array starting with node, python, python3, uv, poetry, go, ruby, bundle, deno, bun or curl");
|
|
2879
2985
|
if (!Number.isInteger(v.timeoutSeconds) || Number(v.timeoutSeconds) < 1 || Number(v.timeoutSeconds) > 300) invalid("timeoutSeconds must be 1\u2013300");
|
|
2880
2986
|
if (v.workflowId !== void 0 && (typeof v.workflowId !== "string" || !v.workflowId)) invalid("workflowId must be a nonempty string");
|
|
2881
2987
|
if (v.sourceBuild !== void 0 && (typeof v.sourceBuild !== "string" || !/^[a-f0-9]{64}$/.test(v.sourceBuild))) invalid("sourceBuild must be a SHA-256 build-record digest");
|
|
@@ -2886,7 +2992,7 @@ function parseWorld(value) {
|
|
|
2886
2992
|
if (!object2(service) || typeof service.name !== "string" || !namePattern.test(service.name) || services.has(service.name)) invalid("service names must be unique lowercase identifiers");
|
|
2887
2993
|
const item = service;
|
|
2888
2994
|
if (!Array.isArray(item.collections) || !item.collections.length || item.collections.length > 20) invalid("each service needs 1\u201320 collections");
|
|
2889
|
-
if (item.adapter !== void 0 && !["json-collection", "slack", "stripe", "openai", "anthropic", "github", "linear", "notion", "hubspot", "shopify", "datadog", "gmail", "google-calendar", "gitlab", "jira", "discord", "twilio", "zendesk", "google-oauth", "composio", ...ENTERPRISE_ADAPTERS].includes(String(item.adapter)) && !isGeneratedAdapter(item.adapter)) invalid("unsupported service adapter");
|
|
2995
|
+
if (item.adapter !== void 0 && !["json-collection", "slack", "stripe", "openai", "anthropic", "github", "linear", "notion", "hubspot", "shopify", "datadog", "gmail", "google-calendar", "gitlab", "jira", "discord", "twilio", "zendesk", "google-oauth", "composio", ...ENTERPRISE_ADAPTERS].includes(String(item.adapter)) && !isGeneratedAdapter(item.adapter) && !isPackAdapter(item.adapter)) invalid("unsupported service adapter");
|
|
2890
2996
|
const paths = /* @__PURE__ */ new Set();
|
|
2891
2997
|
for (const entry of item.collections) {
|
|
2892
2998
|
if (!object2(entry) || typeof entry.path !== "string" || !/^\/[a-zA-Z0-9_/-]+$/.test(entry.path) || entry.path.includes("//") || paths.has(entry.path)) invalid("collection paths must be unique absolute HTTP paths");
|
|
@@ -2897,6 +3003,7 @@ function parseWorld(value) {
|
|
|
2897
3003
|
const required = ADAPTER_COLLECTIONS[item.adapter];
|
|
2898
3004
|
const optional = ADAPTER_OPTIONAL_COLLECTIONS[item.adapter] ?? [];
|
|
2899
3005
|
if (required && (!required.every((p) => paths.has(p)) || [...paths].some((p) => !required.includes(p) && !optional.includes(p)))) invalid(`${item.adapter} adapter requires exactly ${required.join(", ")} collections${optional.length ? ` (optionally ${optional.join(", ")})` : ""}`);
|
|
3006
|
+
if (item.account !== void 0 && (!isPackAdapter(item.adapter) || !object2(item.account) || Object.keys(item.account).length > 10 || !Object.entries(item.account).every(([k, val]) => /^_?[a-z][a-z0-9_]{0,40}$/.test(k) && ["string", "number", "boolean"].includes(typeof val) && String(val).length <= 200))) invalid("account is for twin packs only: up to 10 simple fields with string, number or boolean values");
|
|
2900
3007
|
services.set(item.name, /* @__PURE__ */ new Set([...paths, ...optional]));
|
|
2901
3008
|
}
|
|
2902
3009
|
const known2 = (entry) => typeof entry.service === "string" && typeof entry.path === "string" && services.get(entry.service)?.has(entry.path);
|
|
@@ -3036,7 +3143,77 @@ function parseWorld(value) {
|
|
|
3036
3143
|
return v;
|
|
3037
3144
|
}
|
|
3038
3145
|
|
|
3146
|
+
// src/runtime/pack-log.ts
|
|
3147
|
+
import { closeSync, existsSync as existsSync2, openSync, readdirSync, readSync, statSync } from "fs";
|
|
3148
|
+
import { join as join3 } from "path";
|
|
3149
|
+
var PackActionTail = class {
|
|
3150
|
+
constructor(root) {
|
|
3151
|
+
this.root = root;
|
|
3152
|
+
}
|
|
3153
|
+
root;
|
|
3154
|
+
offsets = /* @__PURE__ */ new Map();
|
|
3155
|
+
partial = /* @__PURE__ */ new Map();
|
|
3156
|
+
files() {
|
|
3157
|
+
if (!existsSync2(this.root)) return [];
|
|
3158
|
+
return readdirSync(this.root, { recursive: true, encoding: "utf8" }).filter((f) => f.endsWith("actions.jsonl")).map((f) => join3(this.root, f)).sort();
|
|
3159
|
+
}
|
|
3160
|
+
drain() {
|
|
3161
|
+
const out = [];
|
|
3162
|
+
for (const file of this.files()) {
|
|
3163
|
+
const size = statSync(file).size, from = this.offsets.get(file) ?? 0;
|
|
3164
|
+
if (size <= from) continue;
|
|
3165
|
+
const buffer = Buffer.alloc(size - from), fd = openSync(file, "r");
|
|
3166
|
+
try {
|
|
3167
|
+
readSync(fd, buffer, 0, buffer.length, from);
|
|
3168
|
+
} finally {
|
|
3169
|
+
closeSync(fd);
|
|
3170
|
+
}
|
|
3171
|
+
this.offsets.set(file, size);
|
|
3172
|
+
const text = (this.partial.get(file) ?? "") + buffer.toString("utf8");
|
|
3173
|
+
const lines = text.split("\n");
|
|
3174
|
+
this.partial.set(file, lines.pop() ?? "");
|
|
3175
|
+
for (const line of lines) if (line.trim()) try {
|
|
3176
|
+
out.push(JSON.parse(line));
|
|
3177
|
+
} catch {
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
return out;
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3183
|
+
var singular2 = (s) => s.endsWith("ies") ? s.slice(0, -3) + "y" : s.endsWith("ses") ? s.slice(0, -2) : s.endsWith("s") ? s.slice(0, -1) : s;
|
|
3184
|
+
var plural = (s) => /[^aeiou]y$/.test(s) ? s.slice(0, -1) + "ies" : /(s|x|ch|sh)$/.test(s) ? s + "es" : s + "s";
|
|
3185
|
+
function packCollection(type, requestPath) {
|
|
3186
|
+
const segments = requestPath.split("/").filter(Boolean);
|
|
3187
|
+
const at = segments.findIndex((s) => s === type || singular2(s) === type || s.replace(/-/g, "_") === type || singular2(s.replace(/-/g, "_")) === type);
|
|
3188
|
+
if (at >= 0) return "/" + segments.slice(0, at + 1).join("/");
|
|
3189
|
+
const prefix = segments[0] && /^v\d+(?:\.\d+)?$/i.test(segments[0]) ? `/${segments[0]}` : "";
|
|
3190
|
+
return `${prefix}/${plural(type)}`;
|
|
3191
|
+
}
|
|
3192
|
+
var isCredential = (a) => /^_.*(key|token|credential)/i.test(a.subject?.type ?? "") && !!a.fields;
|
|
3193
|
+
function credentialAction(actions) {
|
|
3194
|
+
return actions.find(isCredential);
|
|
3195
|
+
}
|
|
3196
|
+
function tenantFields(actions) {
|
|
3197
|
+
const owner = actions.find(isCredential);
|
|
3198
|
+
return Object.fromEntries(Object.entries(owner?.fields ?? {}).filter(([k, v]) => /^_(team|account|tenant|org|organization|workspace|project|platform)(_id)?$/.test(k) && (typeof v === "string" || typeof v === "number")));
|
|
3199
|
+
}
|
|
3200
|
+
function seedActions(service, collections, at, tenant = {}) {
|
|
3201
|
+
const lines = [];
|
|
3202
|
+
for (const c of collections) {
|
|
3203
|
+
const last = c.path.split("/").filter(Boolean).pop() ?? "record", type = singular2(last.replace(/-/g, "_"));
|
|
3204
|
+
c.seed.forEach((row, i) => {
|
|
3205
|
+
const id = typeof row.id === "string" && row.id ? row.id : `${type}_seed_${i + 1}`;
|
|
3206
|
+
const fields = { ...tenant, ...Object.fromEntries(Object.entries(row).filter(([k]) => k !== "id")) };
|
|
3207
|
+
lines.push(JSON.stringify({ id: `twin:${service}:${type}.create:${id}:${at}:seed${i + 1}`, service, op: "set", operation: `${type}.create`, subject: { type, id }, occurredAt: at, actor: { kind: "system" }, fields }));
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
return lines.length ? lines.join("\n") + "\n" : "";
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3039
3213
|
// src/runtime/http-world.ts
|
|
3214
|
+
import { mkdir, mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile2 } from "fs/promises";
|
|
3215
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
3216
|
+
import { join as join4 } from "path";
|
|
3040
3217
|
var idempotencyKeyDigest = (key) => typeof key === "string" && key ? `sha256:${createHash5("sha256").update(key).digest("hex").slice(0, 16)}` : void 0;
|
|
3041
3218
|
var HttpWorld = class {
|
|
3042
3219
|
/** The one-command flow runs apps that hard-code their own model key: the model twins then accept any credential. */
|
|
@@ -3101,6 +3278,12 @@ var HttpWorld = class {
|
|
|
3101
3278
|
this.replayKeys.set(service.name, keys);
|
|
3102
3279
|
const latency = this.spec.latency && (this.spec.latency.maxMs > this.spec.latency.minMs || this.spec.latency.minMs > 0) ? new SeedStream(this.seed, `latency:${service.name}`) : null;
|
|
3103
3280
|
const latencyMs = () => latency && this.spec.latency ? this.spec.latency.minMs + latency.nextInt(this.spec.latency.maxMs - this.spec.latency.minMs + 1) : 0;
|
|
3281
|
+
if (isPackAdapter(service.adapter)) {
|
|
3282
|
+
const server2 = await this.startPack(service, token, faultOrdinalsFor, faultKey, data, latencyMs);
|
|
3283
|
+
this.servers.push(server2);
|
|
3284
|
+
this.credentials[service.name] = { endpoint: `http://127.0.0.1:${server2.address().port}`, token };
|
|
3285
|
+
continue;
|
|
3286
|
+
}
|
|
3104
3287
|
const server = createServer((req, res) => this.sourceContext.run(parseRequestSource(req.headers["x-agenttwin-source"], this.spec), async () => {
|
|
3105
3288
|
const epoch = this.epoch;
|
|
3106
3289
|
const send = (code, body, headers = {}) => {
|
|
@@ -3421,15 +3604,251 @@ var HttpWorld = class {
|
|
|
3421
3604
|
}
|
|
3422
3605
|
}));
|
|
3423
3606
|
server.requestTimeout = 1e4;
|
|
3424
|
-
await new Promise((
|
|
3607
|
+
await new Promise((resolve3, reject) => {
|
|
3425
3608
|
server.once("error", reject);
|
|
3426
|
-
server.listen(0, "127.0.0.1",
|
|
3609
|
+
server.listen(0, "127.0.0.1", resolve3);
|
|
3427
3610
|
});
|
|
3428
3611
|
this.servers.push(server);
|
|
3429
3612
|
this.credentials[service.name] = { endpoint: `http://127.0.0.1:${server.address().port}`, token };
|
|
3430
3613
|
}
|
|
3431
3614
|
return this.credentials;
|
|
3432
3615
|
}
|
|
3616
|
+
/** Environment each pack service's credential door issued (STRIPE_SECRET_KEY…), for the application's process. */
|
|
3617
|
+
packEnv = /* @__PURE__ */ Object.create(null);
|
|
3618
|
+
packRoots = [];
|
|
3619
|
+
/**
|
|
3620
|
+
* A twin pack served behind this world: the run token is checked and swapped for the credential the pack issued,
|
|
3621
|
+
* seeded fault schedules apply around the pack's own handler, and every action the pack logs becomes evidence — writes
|
|
3622
|
+
* caused by the application's request, the twin's own records (events), webhook deliveries and modelled gaps.
|
|
3623
|
+
*/
|
|
3624
|
+
async startPack(service, token, faultOrdinalsFor, faultKey, data, latencyMs) {
|
|
3625
|
+
const name = service.adapter.slice(PACK_PREFIX.length), meta = packRecord(name);
|
|
3626
|
+
const root = await mkdtemp2(join4(tmpdir2(), `agenttwin-pack-${name}-`));
|
|
3627
|
+
this.packRoots.push(root);
|
|
3628
|
+
const worldSeed = meta.logService ? JSON.stringify({ id: `twin:${meta.logService}:world_seed.record:seed:agenttwin`, service: meta.logService, op: "set", operation: "world_seed.record", subject: { type: "_world_seed", id: "seed" }, occurredAt: (/* @__PURE__ */ new Date()).toISOString(), actor: { kind: "system" }, fields: { value: new SeedStream(this.seed, `pack-world:${service.name}`).nextHex(64) } }) + "\n" : "";
|
|
3629
|
+
const writeSeedLog = async (dir, text) => {
|
|
3630
|
+
if (!text) return;
|
|
3631
|
+
await mkdir(join4(dir, ".volter/world", meta.logService), { recursive: true });
|
|
3632
|
+
await writeFile2(join4(dir, ".volter/world", meta.logService, "actions.jsonl"), text);
|
|
3633
|
+
};
|
|
3634
|
+
let tenant = {}, credential;
|
|
3635
|
+
if (meta.logService && meta.credentialDoor && (service.collections.some((c) => c.seed.length) || service.account)) {
|
|
3636
|
+
const probe = await mkdtemp2(join4(tmpdir2(), `agenttwin-pack-${name}-probe-`));
|
|
3637
|
+
try {
|
|
3638
|
+
await writeSeedLog(probe, worldSeed);
|
|
3639
|
+
const scratch = await (await loadPack(name))({ root: probe });
|
|
3640
|
+
await (await scratch(new Request(`https://${meta.hosts[0]?.host ?? `${name}.twin.test`}${meta.credentialDoor.path}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(meta.credentialDoor.body ?? {}) }))).arrayBuffer();
|
|
3641
|
+
const probed = new PackActionTail(join4(probe, ".volter")).drain().filter((a) => a.subject?.type !== "_world_seed");
|
|
3642
|
+
tenant = tenantFields(probed);
|
|
3643
|
+
credential = credentialAction(probed);
|
|
3644
|
+
} finally {
|
|
3645
|
+
await rm2(probe, { recursive: true, force: true });
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
const account = credential && service.account ? JSON.stringify({ ...credential, id: `${credential.id ?? "credential"}:preset`, fields: { ...credential.fields, ...service.account } }) + "\n" : "";
|
|
3649
|
+
const seeded = meta.logService ? worldSeed + account + seedActions(meta.logService, service.collections, (/* @__PURE__ */ new Date()).toISOString(), tenant) : "";
|
|
3650
|
+
await writeSeedLog(root, seeded);
|
|
3651
|
+
const twin = await (await loadPack(name))({ root });
|
|
3652
|
+
const baseHost = meta.hosts[0]?.host ?? `${name}.twin.test`;
|
|
3653
|
+
const log = new PackActionTail(join4(root, ".volter"));
|
|
3654
|
+
let issued = {};
|
|
3655
|
+
if (meta.credentialDoor) {
|
|
3656
|
+
const r = await twin(new Request(`https://${baseHost}${meta.credentialDoor.path}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(meta.credentialDoor.body ?? {}) }));
|
|
3657
|
+
if (r.ok) issued = await r.json();
|
|
3658
|
+
else await r.arrayBuffer();
|
|
3659
|
+
}
|
|
3660
|
+
const env = {};
|
|
3661
|
+
for (const [envName, field] of Object.entries(meta.credentialDoor?.fill ?? {})) if (typeof issued[field] === "string") env[envName] = issued[field];
|
|
3662
|
+
this.packEnv[service.name] = env;
|
|
3663
|
+
const primaryEnv = Object.keys(env).find((k) => /(SECRET|API|PRIVATE|ACCESS)_?(KEY|TOKEN)$|_TOKEN$|_KEY$/.test(k) && !/PUBLISHABLE|PUBLIC|WEBHOOK|SIGNING|ENDPOINT/.test(k));
|
|
3664
|
+
const primary = primaryEnv ? env[primaryEnv] : void 0;
|
|
3665
|
+
const authHeaders = () => primary ? { authorization: `Bearer ${primary}` } : {};
|
|
3666
|
+
const fault = this.spec.fault;
|
|
3667
|
+
const matchesFault = (target) => !!fault && (target === fault.path || target.startsWith(`${fault.path}/`) || target.endsWith(fault.path));
|
|
3668
|
+
const apply = (actions, method, path, evidence) => {
|
|
3669
|
+
const wrote = [];
|
|
3670
|
+
for (const a of actions) {
|
|
3671
|
+
const type = a.subject?.type, id = a.subject?.id;
|
|
3672
|
+
if (!type || !id) continue;
|
|
3673
|
+
if (type === "_world_event_delivery") {
|
|
3674
|
+
if (evidence) this.record(service.name, "webhook", String(a.fields?.url ?? ""), `delivered ${typeof a.fields?.body === "string" ? /"type":"([^"]+)"/.exec(a.fields.body)?.[1] ?? "event" : "event"} to ${a.fields?.url ?? "endpoint"}`);
|
|
3675
|
+
continue;
|
|
3676
|
+
}
|
|
3677
|
+
if (type.startsWith("_")) continue;
|
|
3678
|
+
const collection = packCollection(type, path);
|
|
3679
|
+
const rows2 = data[collection] ??= [];
|
|
3680
|
+
const at = rows2.findIndex((r) => r.id === id);
|
|
3681
|
+
const removed = /^(del|delete|remove)$/i.test(a.op ?? "") || /\.(delete|del)$/.test(a.operation ?? "");
|
|
3682
|
+
const row = { id, ...a.fields ?? {} };
|
|
3683
|
+
if (removed) {
|
|
3684
|
+
if (at >= 0) rows2.splice(at, 1);
|
|
3685
|
+
} else if (at >= 0) rows2[at] = row;
|
|
3686
|
+
else rows2.push(row);
|
|
3687
|
+
if (!evidence) continue;
|
|
3688
|
+
const byApp = a.actor?.kind === "agent";
|
|
3689
|
+
this.record(service.name, byApp ? "write" : "twin", collection, `${method} ${path} \u2192 ${a.operation ?? type} ${id}${byApp ? "" : " (by the twin)"}`, row);
|
|
3690
|
+
if (byApp) wrote.push(collection);
|
|
3691
|
+
}
|
|
3692
|
+
return [...new Set(wrote)].sort((x, y) => Number(path.startsWith(y)) - Number(path.startsWith(x)));
|
|
3693
|
+
};
|
|
3694
|
+
for (const path of Object.keys(data)) data[path] = [];
|
|
3695
|
+
for (const a of log.drain()) if (a.actor?.kind === "system" && /:seed\d+$/.test(String(a.id ?? ""))) apply([a], "POST", service.collections.find((c) => packCollection(a.subject?.type ?? "", c.path) === c.path)?.path ?? "/", false);
|
|
3696
|
+
if (!seeded) for (const collection of service.collections) for (const seedRow of collection.seed) {
|
|
3697
|
+
const body = meta.acceptsProvidedIds ? seedRow : Object.fromEntries(Object.entries(seedRow).filter(([k]) => k !== "id"));
|
|
3698
|
+
const encoded = meta.bodyMode === "form" ? new URLSearchParams(Object.entries(body).filter(([, v]) => v !== null && typeof v !== "object").map(([k, v]) => [k, String(v)])).toString() : JSON.stringify(body);
|
|
3699
|
+
const r = await twin(new Request(`https://${baseHost}${collection.path}`, { method: "POST", headers: { ...authHeaders(), "content-type": meta.bodyMode === "form" ? "application/x-www-form-urlencoded" : "application/json" }, body: encoded }));
|
|
3700
|
+
await r.arrayBuffer();
|
|
3701
|
+
apply(log.drain(), "POST", collection.path, false);
|
|
3702
|
+
}
|
|
3703
|
+
for (const collection of service.collections) data[collection.path] ??= [];
|
|
3704
|
+
let chain = Promise.resolve();
|
|
3705
|
+
const serialized = (fn) => {
|
|
3706
|
+
const run = chain.then(fn, fn);
|
|
3707
|
+
chain = run.then(() => void 0, () => void 0);
|
|
3708
|
+
return run;
|
|
3709
|
+
};
|
|
3710
|
+
const server = createServer((req, res) => this.sourceContext.run(parseRequestSource(req.headers["x-agenttwin-source"], this.spec), async () => {
|
|
3711
|
+
const epoch = this.epoch;
|
|
3712
|
+
const send = (status, headers, body) => {
|
|
3713
|
+
if (!res.destroyed) {
|
|
3714
|
+
res.writeHead(status, headers);
|
|
3715
|
+
res.end(body);
|
|
3716
|
+
}
|
|
3717
|
+
};
|
|
3718
|
+
const later = (ms, fn) => {
|
|
3719
|
+
const timer = setTimeout(() => {
|
|
3720
|
+
this.timers.delete(timer);
|
|
3721
|
+
if (epoch === this.epoch) fn();
|
|
3722
|
+
}, ms);
|
|
3723
|
+
this.timers.add(timer);
|
|
3724
|
+
};
|
|
3725
|
+
const respond = (status, headers, body) => {
|
|
3726
|
+
const ms = latencyMs();
|
|
3727
|
+
if (ms <= 0) send(status, headers, body);
|
|
3728
|
+
else later(ms, () => send(status, headers, body));
|
|
3729
|
+
};
|
|
3730
|
+
const json = (status, value) => respond(status, { "content-type": "application/json" }, Buffer.from(JSON.stringify(value)));
|
|
3731
|
+
try {
|
|
3732
|
+
const ours = req.headers.authorization === `Bearer ${token}` || req.headers["x-api-key"] === token || req.headers["x-agenttwin-token"] === token;
|
|
3733
|
+
if (!ours) {
|
|
3734
|
+
this.record(service.name, "auth-denied", req.url ?? "", "invalid test credential");
|
|
3735
|
+
json(401, { error: "invalid_test_credential" });
|
|
3736
|
+
return;
|
|
3737
|
+
}
|
|
3738
|
+
if (this.events.length >= 5e4 || this.unsupported.length >= 1e3) {
|
|
3739
|
+
json(429, { error: "world_capacity" });
|
|
3740
|
+
return;
|
|
3741
|
+
}
|
|
3742
|
+
const url = new URL(req.url ?? "/", "http://localhost"), method = req.method ?? "GET", path = url.pathname;
|
|
3743
|
+
const requestKey = req.headers["idempotency-key"];
|
|
3744
|
+
if (fault && faultOrdinalsFor && (fault.type === "blackhole" || fault.type === "server-error") && matchesFault(path) && faultOrdinalsFor.includes(this.candidateIndex(faultKey))) {
|
|
3745
|
+
this.faultActions++;
|
|
3746
|
+
if (fault.type === "blackhole") {
|
|
3747
|
+
this.record(service.name, "fault", fault.path, `blackhole: request dropped; nothing committed (${method})`);
|
|
3748
|
+
this.keyed(requestKey);
|
|
3749
|
+
return;
|
|
3750
|
+
}
|
|
3751
|
+
const windowMs = fault.windowMs ?? 0;
|
|
3752
|
+
const delay = windowMs <= 0 ? 0 : new SeedStream(this.seed, `server-error:${service.name}:${fault.path}`).nextInt(windowMs + 1);
|
|
3753
|
+
this.record(service.name, "fault", fault.path, `server-error fault: responding 500 after ${delay}ms; nothing committed (${method})`);
|
|
3754
|
+
this.keyed(requestKey);
|
|
3755
|
+
const fail = () => json(500, { error: { type: "api_error", message: "server_error fault" } });
|
|
3756
|
+
if (delay <= 0) fail();
|
|
3757
|
+
else later(delay, fail);
|
|
3758
|
+
return;
|
|
3759
|
+
}
|
|
3760
|
+
const chunks = [];
|
|
3761
|
+
let bytes = 0;
|
|
3762
|
+
for await (const chunk of req) {
|
|
3763
|
+
bytes += chunk.length;
|
|
3764
|
+
if (bytes > 5 * 1024 * 1024) {
|
|
3765
|
+
json(413, { error: "body_too_large" });
|
|
3766
|
+
return;
|
|
3767
|
+
}
|
|
3768
|
+
chunks.push(Buffer.from(chunk));
|
|
3769
|
+
}
|
|
3770
|
+
const body = ["GET", "HEAD"].includes(method) ? void 0 : Buffer.concat(chunks);
|
|
3771
|
+
if (epoch !== this.epoch) {
|
|
3772
|
+
json(409, { error: "world_reset" });
|
|
3773
|
+
return;
|
|
3774
|
+
}
|
|
3775
|
+
let host = String(req.headers["x-agenttwin-original-host"] ?? baseHost);
|
|
3776
|
+
if (name === "pinecone") {
|
|
3777
|
+
const m = /^([a-z0-9-]+?)-[a-z0-9]+\.svc\.[a-z0-9.-]*pinecone\.io$/.exec(host);
|
|
3778
|
+
const index = m && (data["/indexes"] ?? []).find((r) => r.name === m[1] && typeof r.host === "string");
|
|
3779
|
+
if (index && index.host !== host) host = String(index.host);
|
|
3780
|
+
}
|
|
3781
|
+
const headers = new Headers();
|
|
3782
|
+
for (const [k, v] of Object.entries(req.headers)) if (v !== void 0 && !/^(host|connection|keep-alive|content-length|transfer-encoding|x-agenttwin-.*)$/i.test(k)) headers.set(k, Array.isArray(v) ? v.join(", ") : v);
|
|
3783
|
+
if (headers.get("authorization") === `Bearer ${token}`) {
|
|
3784
|
+
if (primary) headers.set("authorization", `Bearer ${primary}`);
|
|
3785
|
+
else headers.delete("authorization");
|
|
3786
|
+
}
|
|
3787
|
+
if (headers.get("x-api-key") === token) {
|
|
3788
|
+
if (primary) headers.set("x-api-key", primary);
|
|
3789
|
+
else headers.delete("x-api-key");
|
|
3790
|
+
}
|
|
3791
|
+
const call = async () => {
|
|
3792
|
+
const r = await twin(new Request(`https://${host}${req.url ?? "/"}`, { method, headers, ...body ? { body } : {} }));
|
|
3793
|
+
return { status: r.status, headers: r.headers, bytes: Buffer.from(await r.arrayBuffer()), actions: log.drain() };
|
|
3794
|
+
};
|
|
3795
|
+
const first = await serialized(call);
|
|
3796
|
+
if (epoch !== this.epoch) return;
|
|
3797
|
+
const wrote = apply(first.actions, method, path, true);
|
|
3798
|
+
let okFalse;
|
|
3799
|
+
if (first.status < 300 && /json/.test(first.headers.get("content-type") ?? "")) try {
|
|
3800
|
+
const parsed = JSON.parse(first.bytes.toString("utf8"));
|
|
3801
|
+
if (parsed.ok === false) okFalse = [parsed.error, ...parsed.response_metadata?.messages ?? []].filter(Boolean).join(": ").slice(0, 240) || "ok: false";
|
|
3802
|
+
} catch {
|
|
3803
|
+
}
|
|
3804
|
+
if (wrote.length) this.keyed(requestKey);
|
|
3805
|
+
else if (meta.gapMessage && (first.status >= 400 || okFalse) && first.bytes.toString("utf8").includes(meta.gapMessage)) this.rejectUnsupported(service.name, method, path, `${name} twin does not model ${method} ${path}`);
|
|
3806
|
+
else if (okFalse) this.record(service.name, "rejected", path, `${method} ${path} \u2192 ${first.status} ok:false: ${okFalse}`);
|
|
3807
|
+
else if (first.status >= 400) {
|
|
3808
|
+
let reason = "";
|
|
3809
|
+
try {
|
|
3810
|
+
const parsed = JSON.parse(first.bytes.toString("utf8"));
|
|
3811
|
+
const e = parsed.error ?? parsed;
|
|
3812
|
+
reason = String(e.message ?? e.error_description ?? e.code ?? "").slice(0, 240);
|
|
3813
|
+
} catch {
|
|
3814
|
+
reason = first.bytes.toString("utf8").slice(0, 120);
|
|
3815
|
+
}
|
|
3816
|
+
this.record(service.name, "rejected", path, `${method} ${path} \u2192 ${first.status}${reason ? `: ${reason}` : ""}`);
|
|
3817
|
+
} else if (method === "GET") this.record(service.name, "read", path, `${first.status}`);
|
|
3818
|
+
const target = wrote[0];
|
|
3819
|
+
if (target && fault?.type === "duplicate-write" && fault.service === service.name && !requestKey && matchesFault(target) && faultOrdinalsFor?.includes(this.candidateIndex(faultKey))) {
|
|
3820
|
+
const second = await serialized(call);
|
|
3821
|
+
apply(second.actions, method, path, true);
|
|
3822
|
+
this.faultActions++;
|
|
3823
|
+
this.record(service.name, "fault", fault.path, `duplicate-write: a single write was delivered twice (${target})`);
|
|
3824
|
+
}
|
|
3825
|
+
const out = {};
|
|
3826
|
+
first.headers.forEach((v, k) => {
|
|
3827
|
+
if (!/^(content-length|transfer-encoding|connection)$/i.test(k)) out[k] = v;
|
|
3828
|
+
});
|
|
3829
|
+
if (target && !this.fired && fault?.type === "timeout-after-write" && fault.service === service.name && matchesFault(target)) {
|
|
3830
|
+
this.fired = true;
|
|
3831
|
+
this.faultActions++;
|
|
3832
|
+
this.record(service.name, "fault", target, `write committed; response delayed ${fault.delayMs}ms`);
|
|
3833
|
+
this.keyed(requestKey);
|
|
3834
|
+
later(fault.delayMs, () => send(first.status, out, first.bytes));
|
|
3835
|
+
} else if (fault?.type === "slow-response" && faultOrdinalsFor && matchesFault(target ?? path) && faultOrdinalsFor.includes(this.candidateIndex(faultKey))) {
|
|
3836
|
+
this.faultActions++;
|
|
3837
|
+
this.record(service.name, "fault", target ?? path, `slow-response: ${target ? "write" : "request"} applied; response delayed ${fault.delayMs}ms`);
|
|
3838
|
+
this.keyed(requestKey);
|
|
3839
|
+
later(fault.delayMs, () => respond(first.status, out, first.bytes));
|
|
3840
|
+
} else respond(first.status, out, first.bytes);
|
|
3841
|
+
} catch {
|
|
3842
|
+
json(500, { error: "world_request_error" });
|
|
3843
|
+
}
|
|
3844
|
+
}));
|
|
3845
|
+
server.requestTimeout = 1e4;
|
|
3846
|
+
await new Promise((resolve3, reject) => {
|
|
3847
|
+
server.once("error", reject);
|
|
3848
|
+
server.listen(0, "127.0.0.1", resolve3);
|
|
3849
|
+
});
|
|
3850
|
+
return server;
|
|
3851
|
+
}
|
|
3433
3852
|
assertions() {
|
|
3434
3853
|
return this.spec.assertions.map((a) => {
|
|
3435
3854
|
const rows2 = this.state[a.service][a.path].filter((row) => !a.where || Object.entries(a.where).every(([k, v]) => isDeepStrictEqual(row[k], v)));
|
|
@@ -3466,11 +3885,12 @@ var HttpWorld = class {
|
|
|
3466
3885
|
this.epoch++;
|
|
3467
3886
|
for (const timer of this.timers) clearTimeout(timer);
|
|
3468
3887
|
this.timers.clear();
|
|
3469
|
-
await Promise.all(this.servers.map((server) => new Promise((
|
|
3470
|
-
server.close(() =>
|
|
3888
|
+
await Promise.all(this.servers.map((server) => new Promise((resolve3) => {
|
|
3889
|
+
server.close(() => resolve3());
|
|
3471
3890
|
server.closeAllConnections();
|
|
3472
3891
|
})));
|
|
3473
3892
|
this.servers.length = 0;
|
|
3893
|
+
await Promise.all(this.packRoots.splice(0).map((root) => rm2(root, { recursive: true, force: true })));
|
|
3474
3894
|
}
|
|
3475
3895
|
};
|
|
3476
3896
|
|
|
@@ -3843,14 +4263,17 @@ function operationMatrix(spec) {
|
|
|
3843
4263
|
schema: "agenttwin/contracts-v1",
|
|
3844
4264
|
unsupported: { status: 501, marker: "X-AgentTwin-Unsupported", coverage: "incomplete", forwardedToProduction: false },
|
|
3845
4265
|
adapters: CONTRACTS,
|
|
3846
|
-
services: spec?.services.map((s) => ({
|
|
4266
|
+
services: spec?.services.map((s) => typeof s.adapter === "string" && s.adapter.startsWith("pack:") ? packContract(s.name, s.adapter) : {
|
|
3847
4267
|
name: s.name,
|
|
3848
4268
|
adapter: s.adapter ?? "json-collection",
|
|
3849
4269
|
version: CONTRACTS[s.adapter ?? "json-collection"].version,
|
|
3850
4270
|
operations: s.adapter === "slack" ? CONTRACTS.slack.operations : s.adapter === "stripe" ? CONTRACTS.stripe.operations : s.adapter && s.adapter !== "json-collection" ? CONTRACTS[s.adapter].operations : s.collections.flatMap((c) => CONTRACTS["json-collection"].operations.map((op2) => ({ ...op2, endpoint: c.path })))
|
|
3851
|
-
})
|
|
4271
|
+
}) ?? []
|
|
3852
4272
|
};
|
|
3853
4273
|
}
|
|
4274
|
+
function packContract(name, adapter) {
|
|
4275
|
+
return { name, adapter, version: "twin-pack", operations: [], pack: adapter.slice("pack:".length) };
|
|
4276
|
+
}
|
|
3854
4277
|
|
|
3855
4278
|
// src/runtime/worker.ts
|
|
3856
4279
|
var secrets = [];
|
|
@@ -3877,6 +4300,7 @@ async function main() {
|
|
|
3877
4300
|
env[`AGENTTWIN_${name.toUpperCase()}_URL`] = credential.endpoint;
|
|
3878
4301
|
env[`AGENTTWIN_${name.toUpperCase()}_TOKEN`] = credential.token;
|
|
3879
4302
|
}
|
|
4303
|
+
if (spec.command[0] !== "node") throw new Error(`The isolated runner runs Node applications; run ${spec.command[0]} workflows locally with npx agenttwin (they use the twin proxy).`);
|
|
3880
4304
|
let stdout = "", stderr = "", timedOut = false;
|
|
3881
4305
|
const child = spawn(spec.command[0], spec.command.slice(1), { cwd: "/input/app", env, stdio: ["ignore", "pipe", "pipe"], detached: true, uid: 1e3, gid: 1e3 });
|
|
3882
4306
|
child.stdout.on("data", (b) => {
|
|
@@ -3897,9 +4321,9 @@ async function main() {
|
|
|
3897
4321
|
timedOut = true;
|
|
3898
4322
|
kill();
|
|
3899
4323
|
}, spec.timeoutSeconds * 1e3);
|
|
3900
|
-
const exitCode = await new Promise((
|
|
4324
|
+
const exitCode = await new Promise((resolve3, reject) => {
|
|
3901
4325
|
child.once("error", reject);
|
|
3902
|
-
child.once("exit",
|
|
4326
|
+
child.once("exit", resolve3);
|
|
3903
4327
|
}).finally(() => {
|
|
3904
4328
|
clearTimeout(timer);
|
|
3905
4329
|
kill();
|