@cursor/july 0.1.107 → 0.1.109
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/AGENTS.md +2 -6
- package/README.md +13 -11
- package/dist/bin/agent-serve.js +30 -8
- package/dist/channels/bitbucket/api.d.ts +41 -0
- package/dist/channels/bitbucket/api.d.ts.map +1 -1
- package/dist/channels/bitbucket/api.js +260 -0
- package/dist/channels/bitbucket/binding.d.ts +4 -0
- package/dist/channels/bitbucket/binding.d.ts.map +1 -1
- package/dist/channels/bitbucket/binding.js +16 -0
- package/dist/channels/bitbucket/index.d.ts +1 -1
- package/dist/channels/bitbucket/index.d.ts.map +1 -1
- package/dist/channels/bitbucket/index.js +1 -1
- package/dist/channels/github/github-channel.js +8 -5
- package/dist/channels/github/types.d.ts +5 -1
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/gitlab/api.d.ts +27 -0
- package/dist/channels/gitlab/api.d.ts.map +1 -1
- package/dist/channels/gitlab/api.js +88 -0
- package/dist/channels/gitlab/binding.d.ts +5 -0
- package/dist/channels/gitlab/binding.d.ts.map +1 -1
- package/dist/channels/gitlab/binding.js +10 -0
- package/dist/channels/gitlab/index.d.ts +1 -1
- package/dist/channels/gitlab/index.d.ts.map +1 -1
- package/dist/channels/gitlab/index.js +1 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +27 -13
- package/dist/channels/origin/types.d.ts +5 -1
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.d.ts +10 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +20 -3
- package/dist/channels/slack/slack-channel.d.ts +12 -5
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +59 -8
- package/dist/channels.d.ts +45 -0
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +106 -7
- package/dist/connections.d.ts +2 -1
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +2 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.CtuckIiL.js → app.Cr-wVbnB.js} +1 -1
- package/dist/docs/assets/{building-with-agents.md.CUSWxlP_.js → building-with-agents.md.D0KbSkJn.js} +2 -2
- package/dist/docs/assets/{building-with-agents.md.CUSWxlP_.lean.js → building-with-agents.md.D0KbSkJn.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CFVQ4S17.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Bkkhnu8K.js → VPLocalSearchBox.CVQERt56.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DhpIe0Pa.js → theme.Dnsd3XOn.js} +2 -2
- package/dist/docs/assets/concepts.md.B4o63Gul.js +1 -0
- package/dist/docs/assets/{deployment.md.MFPKqsqI.js → deployment.md.JenwuCCB.js} +4 -4
- package/dist/docs/assets/{deployment.md.MFPKqsqI.lean.js → deployment.md.JenwuCCB.lean.js} +1 -1
- package/dist/docs/assets/evals.md.C7JLjoEP.js +211 -0
- package/dist/docs/assets/evals.md.C7JLjoEP.lean.js +1 -0
- package/dist/docs/assets/guides_bitbucket.md.DZPzmUjU.js +10 -0
- package/dist/docs/assets/guides_bitbucket.md.DZPzmUjU.lean.js +1 -0
- package/dist/docs/assets/guides_cloud-agents.md.BsloyHdY.js +9 -0
- package/dist/docs/assets/{guides_cloud-agents.md.DS8RIjwx.lean.js → guides_cloud-agents.md.BsloyHdY.lean.js} +1 -1
- package/dist/docs/assets/{guides_github.md.c0gdGJ-D.js → guides_github.md.TZaTZlfz.js} +13 -3
- package/dist/docs/assets/{guides_github.md.c0gdGJ-D.lean.js → guides_github.md.TZaTZlfz.lean.js} +1 -1
- package/dist/docs/assets/guides_gitlab.md.BmqwQfdG.js +14 -0
- package/dist/docs/assets/guides_gitlab.md.BmqwQfdG.lean.js +1 -0
- package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.js → guides_grokbot-agents.md.DyV-WArv.js} +1 -1
- package/dist/docs/assets/guides_improve.md.BGVk32bK.js +14 -0
- package/dist/docs/assets/guides_improve.md.BGVk32bK.lean.js +1 -0
- package/dist/docs/assets/{guides_slack.md.9oHPye9o.js → guides_slack.md.D4RVMM4G.js} +3 -3
- package/dist/docs/assets/{guides_slack.md.9oHPye9o.lean.js → guides_slack.md.D4RVMM4G.lean.js} +1 -1
- package/dist/docs/assets/{guides_webhooks.md.DKdA43Qm.js → guides_webhooks.md.CJK484ex.js} +2 -2
- package/dist/docs/assets/{hillclimbing.md.CpTGTCle.js → hillclimbing.md.BOiVo1tf.js} +1 -1
- package/dist/docs/assets/index.md.DD9Q2XuJ.js +5 -0
- package/dist/docs/assets/{index.md.BW_6tOgR.lean.js → index.md.DD9Q2XuJ.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.js → reference_agent-config.md.CvoL6pof.js} +1 -1
- package/dist/docs/assets/{reference_channels.md.D-qTqwcq.js → reference_channels.md.CAo-iK4j.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.D-qTqwcq.lean.js → reference_channels.md.CAo-iK4j.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.Dm67hd2D.js → reference_cli.md.Deg7849l.js} +7 -7
- package/dist/docs/assets/{reference_cli.md.Dm67hd2D.lean.js → reference_cli.md.Deg7849l.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.Di6jJAXF.js → reference_connections.md.BojkC6c5.js} +1 -1
- package/dist/docs/assets/{reference_extensions.md.CGmMLblt.js → reference_extensions.md.ZAVUyuEX.js} +3 -3
- package/dist/docs/assets/{reference_hooks.md.Ddt5DdgJ.js → reference_hooks.md.BlM_bOg6.js} +3 -3
- package/dist/docs/assets/{reference_hooks.md.Ddt5DdgJ.lean.js → reference_hooks.md.BlM_bOg6.lean.js} +1 -1
- package/dist/docs/assets/{reference_http-api.md.oySXBO8o.js → reference_http-api.md.BwaCo-VO.js} +1 -1
- package/dist/docs/assets/{reference_playground.md.4myJPxrf.js → reference_playground.md.DLnoaczX.js} +1 -1
- package/dist/docs/assets/{reference_playground.md.4myJPxrf.lean.js → reference_playground.md.DLnoaczX.lean.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md.DuBu9a96.js → reference_project-layout.md.BEU8MtQV.js} +3 -3
- package/dist/docs/assets/{reference_project-layout.md.DuBu9a96.lean.js → reference_project-layout.md.BEU8MtQV.lean.js} +1 -1
- package/dist/docs/assets/reference_sessions.md.CyXV1MUw.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.js → scaffolding-agents.md.Kctn3OVb.js} +1 -1
- package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.js → skills_create-agent.md.Q3h6Je-e.js} +1 -1
- package/dist/docs/assets/{skills_debug.md.CDbPhHfg.js → skills_debug.md.CVjCXMFF.js} +1 -1
- package/dist/docs/assets/{skills_debug.md.CDbPhHfg.lean.js → skills_debug.md.CVjCXMFF.lean.js} +1 -1
- package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.js +35 -0
- package/dist/docs/assets/skills_deploy.md.CWqi_ZxW.lean.js +1 -0
- package/dist/docs/assets/skills_evals.md.DFxYPErF.js +25 -0
- package/dist/docs/assets/skills_evals.md.DFxYPErF.lean.js +1 -0
- package/dist/docs/assets/skills_framework-map.md.BxLSOhSY.js +1 -0
- package/dist/docs/assets/{skills_framework-map.md.haibFyoB.lean.js → skills_framework-map.md.BxLSOhSY.lean.js} +1 -1
- package/dist/docs/assets/{skills_github.md.D0JahM8c.js → skills_github.md.hgFX_oKY.js} +1 -1
- package/dist/docs/assets/skills_index.md.DL7EHaQ-.js +1 -0
- package/dist/docs/assets/skills_index.md.DL7EHaQ-.lean.js +1 -0
- package/dist/docs/assets/{storage.md.BOHeqk2M.js → storage.md.BUrhJ-Zz.js} +4 -4
- package/dist/docs/assets/{storage.md.BOHeqk2M.lean.js → storage.md.BUrhJ-Zz.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.CYEAO9bM.js +1 -0
- package/dist/docs/building-with-agents.html +5 -5
- package/dist/docs/building-with-agents.md +3 -2
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/concepts.md +2 -4
- package/dist/docs/deployment.html +7 -7
- package/dist/docs/deployment.md +7 -2
- package/dist/docs/evals.html +161 -35
- package/dist/docs/evals.md +612 -296
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/bitbucket.html +36 -0
- package/dist/docs/guides/bitbucket.md +84 -0
- package/dist/docs/guides/cloud-agents.html +6 -6
- package/dist/docs/guides/cloud-agents.md +4 -3
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +17 -7
- package/dist/docs/guides/github.md +33 -1
- package/dist/docs/guides/gitlab.html +40 -0
- package/dist/docs/guides/gitlab.md +92 -0
- package/dist/docs/guides/grokbot-agents.html +6 -6
- package/dist/docs/guides/grokbot-agents.md +2 -2
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/improve.html +40 -0
- package/dist/docs/guides/improve.md +91 -0
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +5 -5
- package/dist/docs/guides/slack.html +7 -7
- package/dist/docs/guides/slack.md +2 -1
- package/dist/docs/guides/webhooks.html +6 -6
- package/dist/docs/guides/webhooks.md +4 -2
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +6 -6
- package/dist/docs/hillclimbing.md +2 -2
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +14 -6
- package/dist/docs/llms-full.txt +1274 -814
- package/dist/docs/llms.txt +7 -5
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +6 -6
- package/dist/docs/reference/agent-config.md +5 -2
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/channels.md +16 -3
- package/dist/docs/reference/cli.html +11 -11
- package/dist/docs/reference/cli.md +24 -15
- package/dist/docs/reference/connections.html +6 -6
- package/dist/docs/reference/connections.md +2 -1
- package/dist/docs/reference/extensions.html +8 -8
- package/dist/docs/reference/extensions.md +2 -3
- package/dist/docs/reference/hooks.html +7 -7
- package/dist/docs/reference/hooks.md +9 -12
- package/dist/docs/reference/http-api.html +6 -6
- package/dist/docs/reference/http-api.md +2 -3
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +5 -5
- package/dist/docs/reference/playground.md +0 -4
- package/dist/docs/reference/project-layout.html +7 -7
- package/dist/docs/reference/project-layout.md +1 -8
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/result.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +5 -5
- package/dist/docs/reference/sessions.md +1 -2
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/scaffolding-agents.md +2 -1
- package/dist/docs/skills/create-agent.html +6 -6
- package/dist/docs/skills/create-agent.md +1 -1
- package/dist/docs/skills/debug.html +5 -5
- package/dist/docs/skills/debug.md +1 -1
- package/dist/docs/skills/deploy.html +61 -0
- package/dist/docs/skills/deploy.md +161 -0
- package/dist/docs/skills/evals.html +8 -8
- package/dist/docs/skills/evals.md +44 -6
- package/dist/docs/skills/framework-map.html +5 -5
- package/dist/docs/skills/framework-map.md +5 -4
- package/dist/docs/skills/github.html +6 -6
- package/dist/docs/skills/github.md +1 -1
- package/dist/docs/skills/hillclimb.html +4 -4
- package/dist/docs/skills/index.html +6 -6
- package/dist/docs/skills/index.md +1 -1
- package/dist/docs/skills/mcp-auth.html +4 -4
- package/dist/docs/skills/otel.html +4 -4
- package/dist/docs/skills/setup-slack.html +4 -4
- package/dist/docs/storage.html +8 -8
- package/dist/docs/storage.md +15 -24
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/agents-md.html +4 -4
- package/dist/docs/templates/code-wiki.html +4 -4
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/grokbot-agents.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +4 -4
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +1 -1
- package/dist/extensions/improve/extension.d.ts +46 -0
- package/dist/extensions/improve/extension.d.ts.map +1 -0
- package/dist/extensions/improve/extension.js +41 -0
- package/dist/extensions/improve/skills/yourself.d.ts +4 -0
- package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
- package/dist/extensions/improve/skills/yourself.js +43 -0
- package/dist/extensions.d.ts +2 -3
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +2 -5
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/internal/authored-alias-hooks.d.ts +5 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +17 -0
- package/dist/internal/authored-loaders.d.ts +4 -0
- package/dist/internal/authored-loaders.d.ts.map +1 -1
- package/dist/internal/authored-loaders.js +21 -2
- package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -1
- package/dist/internal/builtin-tools/artifacts.js +2 -3
- package/dist/internal/channel-route-dispatch.d.ts +13 -0
- package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-route-dispatch.js +62 -0
- package/dist/internal/channel-state.d.ts +17 -0
- package/dist/internal/channel-state.d.ts.map +1 -0
- package/dist/internal/channel-state.js +78 -0
- package/dist/internal/cli-ax.d.ts +8 -2
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +100 -3
- package/dist/internal/cli-cursor.d.ts.map +1 -1
- package/dist/internal/cli-cursor.js +2 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +38 -14
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +15 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -1
- package/dist/internal/cli-mcp.js +12 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +8 -2
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +2 -2
- package/dist/internal/continuation-identity.js +8 -3
- package/dist/internal/cursor/credentials.d.ts +8 -2
- package/dist/internal/cursor/credentials.d.ts.map +1 -1
- package/dist/internal/cursor/credentials.js +27 -5
- package/dist/internal/deploy-client.d.ts +27 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +32 -0
- package/dist/internal/deploy-manifest.d.ts +23 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +84 -1
- package/dist/internal/describe-error.d.ts +1 -0
- package/dist/internal/describe-error.d.ts.map +1 -1
- package/dist/internal/describe-error.js +25 -0
- package/dist/internal/discovery/agent.d.ts +1 -1
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +0 -5
- package/dist/internal/discovery/extension-overlay.d.ts +1 -2
- package/dist/internal/discovery/extension-overlay.d.ts.map +1 -1
- package/dist/internal/discovery/extension-overlay.js +0 -14
- package/dist/internal/discovery/extensions.d.ts +1 -2
- package/dist/internal/discovery/extensions.d.ts.map +1 -1
- package/dist/internal/discovery/extensions.js +4 -22
- package/dist/internal/discovery/info.d.ts.map +1 -1
- package/dist/internal/discovery/info.js +42 -24
- package/dist/internal/discovery/modules.js +0 -1
- package/dist/internal/discovery/project.d.ts.map +1 -1
- package/dist/internal/discovery/project.js +0 -16
- package/dist/internal/eval-runner.js +0 -1
- package/dist/internal/framework-file-storage.d.ts +4 -5
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +4 -5
- package/dist/internal/framework-storage-selection.d.ts +2 -2
- package/dist/internal/framework-storage-selection.js +2 -2
- package/dist/internal/guest-network.d.ts +4 -10
- package/dist/internal/guest-network.d.ts.map +1 -1
- package/dist/internal/guest-network.js +42 -26
- package/dist/internal/hosted-admission-adapter.d.ts +2 -0
- package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
- package/dist/internal/hosted-catch-protocol.d.ts +51 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-catch-protocol.js +103 -0
- package/dist/internal/hosted-catch.d.ts +40 -0
- package/dist/internal/hosted-catch.d.ts.map +1 -0
- package/dist/internal/hosted-catch.js +149 -0
- package/dist/internal/hosted-delivery-protocol.d.ts +41 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +249 -0
- package/dist/internal/hosted-delivery.d.ts +10 -1
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +100 -22
- package/dist/internal/hosted-execution-diag.d.ts +4 -1
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
- package/dist/internal/hosted-execution-diag.js +13 -4
- package/dist/internal/hosted-execution-flush.d.ts +3 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
- package/dist/internal/hosted-execution-flush.js +2 -4
- package/dist/internal/http-control-plane-session.d.ts +30 -0
- package/dist/internal/http-control-plane-session.d.ts.map +1 -0
- package/dist/internal/http-control-plane-session.js +83 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -1
- package/dist/internal/init-scaffold.js +1 -2
- package/dist/internal/install-cursor-skills.d.ts +5 -2
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +25 -5
- package/dist/internal/legacy-command-guard.d.ts +22 -0
- package/dist/internal/legacy-command-guard.d.ts.map +1 -0
- package/dist/internal/legacy-command-guard.js +51 -0
- package/dist/internal/platform-timers.d.ts +7 -0
- package/dist/internal/platform-timers.d.ts.map +1 -1
- package/dist/internal/platform-timers.js +139 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts +2 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
- package/dist/internal/reminder-control-plane-protocol.js +9 -2
- package/dist/internal/reminder-runner.d.ts +8 -0
- package/dist/internal/reminder-runner.d.ts.map +1 -1
- package/dist/internal/reminder-runner.js +36 -9
- package/dist/internal/resolve-prod-target.d.ts +2 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +13 -0
- package/dist/internal/run-client.d.ts +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +5 -4
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +57 -70
- package/dist/internal/session-engine.d.ts +7 -41
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +110 -227
- package/dist/internal/storage-coordinator.d.ts +5 -19
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +3 -62
- package/dist/internal/storage-roles.d.ts +4 -9
- package/dist/internal/storage-roles.d.ts.map +1 -1
- package/dist/internal/storage-roles.js +2 -2
- package/dist/playground/assets/index-Bhxzrcf6.css +1 -0
- package/dist/playground/assets/index-CqLX5uF3.js +67 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted-v2.d.ts +4 -5
- package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted-v2.js +4 -5
- package/dist/storage-backends/cursor-hosted.d.ts +7 -2
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +29 -31
- package/dist/storage-backends/file-kv.d.ts +9 -12
- package/dist/storage-backends/file-kv.d.ts.map +1 -1
- package/dist/storage-backends/file-kv.js +11 -47
- package/dist/storage-protocol.d.ts +3 -11
- package/dist/storage-protocol.d.ts.map +1 -1
- package/dist/storage-protocol.js +3 -11
- package/dist/storage.d.ts +8 -36
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +8 -44
- package/dist/types.d.ts +53 -62
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +14 -6
- package/docs/building-with-agents.md +3 -2
- package/docs/concepts.md +2 -4
- package/docs/deployment.md +7 -2
- package/docs/evals.md +613 -297
- package/docs/guides/bitbucket.md +89 -0
- package/docs/guides/cloud-agents.md +4 -3
- package/docs/guides/github.md +33 -1
- package/docs/guides/gitlab.md +97 -0
- package/docs/guides/grokbot-agents.md +2 -2
- package/docs/guides/improve.md +96 -0
- package/docs/guides/slack.md +2 -1
- package/docs/guides/webhooks.md +4 -2
- package/docs/hillclimbing.md +2 -2
- package/docs/reference/agent-config.md +5 -2
- package/docs/reference/channels.md +16 -3
- package/docs/reference/cli.md +24 -15
- package/docs/reference/connections.md +2 -1
- package/docs/reference/extensions.md +2 -3
- package/docs/reference/hooks.md +9 -12
- package/docs/reference/http-api.md +2 -3
- package/docs/reference/playground.md +0 -4
- package/docs/reference/project-layout.md +1 -8
- package/docs/reference/sessions.md +1 -2
- package/docs/scaffolding-agents.md +2 -1
- package/docs/skills/index.md +2 -2
- package/docs/storage.md +15 -24
- package/docs/troubleshooting.md +1 -1
- package/package.json +8 -7
- package/skills/create-agent/SKILL.md +1 -1
- package/skills/debug/SKILL.md +1 -1
- package/skills/deploy/SKILL.md +169 -0
- package/skills/evals/SKILL.md +45 -8
- package/skills/framework-map/SKILL.md +5 -4
- package/skills/github/SKILL.md +1 -1
- package/src/bin/agent-serve.ts +27 -2
- package/src/channels/bitbucket/api.ts +341 -0
- package/src/channels/bitbucket/binding.ts +25 -0
- package/src/channels/bitbucket/index.ts +2 -0
- package/src/channels/github/github-channel.ts +8 -8
- package/src/channels/github/types.ts +5 -0
- package/src/channels/gitlab/api.ts +123 -0
- package/src/channels/gitlab/binding.ts +12 -0
- package/src/channels/gitlab/index.ts +1 -0
- package/src/channels/origin/origin-channel.ts +29 -13
- package/src/channels/origin/types.ts +5 -0
- package/src/channels/slack/dispatch.ts +30 -0
- package/src/channels/slack/slack-channel.ts +69 -7
- package/src/channels.ts +157 -10
- package/src/connections.ts +2 -1
- package/src/extensions/improve/extension.ts +70 -0
- package/src/extensions/improve/skills/yourself.ts +50 -0
- package/src/extensions.ts +2 -6
- package/src/index.ts +0 -3
- package/src/internal/authored-alias-hooks.ts +32 -0
- package/src/internal/authored-loaders.ts +26 -2
- package/src/internal/builtin-tools/artifacts.ts +2 -3
- package/src/internal/channel-route-dispatch.ts +66 -0
- package/src/internal/channel-state.ts +96 -0
- package/src/internal/cli-ax.ts +111 -3
- package/src/internal/cli-cursor.ts +4 -1
- package/src/internal/cli-deploy.ts +50 -10
- package/src/internal/cli-mcp-oauth.ts +18 -0
- package/src/internal/cli-mcp.ts +11 -0
- package/src/internal/cli-slack.ts +15 -2
- package/src/internal/continuation-channel.ts +2 -1
- package/src/internal/continuation-identity.ts +10 -2
- package/src/internal/cursor/credentials.ts +35 -7
- package/src/internal/deploy-client.ts +54 -0
- package/src/internal/deploy-manifest.ts +115 -1
- package/src/internal/describe-error.ts +28 -0
- package/src/internal/discovery/agent.ts +1 -7
- package/src/internal/discovery/extension-overlay.ts +0 -18
- package/src/internal/discovery/extensions.ts +2 -26
- package/src/internal/discovery/info.ts +3 -13
- package/src/internal/discovery/modules.ts +0 -1
- package/src/internal/discovery/project.ts +0 -16
- package/src/internal/eval-runner.ts +0 -1
- package/src/internal/framework-file-storage.ts +4 -5
- package/src/internal/framework-storage-selection.ts +2 -2
- package/src/internal/guest-network.ts +43 -29
- package/src/internal/hosted-admission-adapter.ts +2 -0
- package/src/internal/hosted-catch-protocol.ts +130 -0
- package/src/internal/hosted-catch.ts +192 -0
- package/src/internal/hosted-delivery-protocol.ts +387 -0
- package/src/internal/hosted-delivery.ts +155 -22
- package/src/internal/hosted-execution-diag.ts +21 -3
- package/src/internal/hosted-execution-flush.ts +6 -3
- package/src/internal/http-control-plane-session.ts +104 -0
- package/src/internal/init-scaffold.ts +1 -2
- package/src/internal/install-cursor-skills.ts +38 -5
- package/src/internal/legacy-command-guard.ts +59 -0
- package/src/internal/platform-timers.ts +191 -0
- package/src/internal/reminder-control-plane-protocol.ts +15 -2
- package/src/internal/reminder-runner.ts +60 -9
- package/src/internal/resolve-prod-target.ts +15 -0
- package/src/internal/run-client.ts +1 -1
- package/src/internal/sdk-runner.ts +3 -2
- package/src/internal/server.ts +89 -95
- package/src/internal/session-engine.ts +155 -285
- package/src/internal/storage-coordinator.ts +5 -76
- package/src/internal/storage-roles.ts +4 -9
- package/src/storage-backends/cursor-hosted-v2.ts +4 -7
- package/src/storage-backends/cursor-hosted.ts +40 -38
- package/src/storage-backends/file-kv.ts +10 -51
- package/src/storage-protocol.ts +3 -17
- package/src/storage.ts +10 -101
- package/src/types.ts +58 -62
- package/templates/demo/README.md +10 -6
- package/templates/demo/agent/channels/github.ts +2 -0
- package/templates/demo/agent/channels/queue.ts +6 -2
- package/templates/demo/agent/lib/repos.ts +5 -0
- package/templates/demo/init.json +25 -0
- package/dist/ab.d.ts +0 -209
- package/dist/ab.d.ts.map +0 -1
- package/dist/ab.js +0 -246
- package/dist/docs/ab.html +0 -80
- package/dist/docs/ab.md +0 -332
- package/dist/docs/assets/ab.md.mlVgqvSk.js +0 -54
- package/dist/docs/assets/ab.md.mlVgqvSk.lean.js +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DXXZxiMv.js +0 -1
- package/dist/docs/assets/concepts.md.DgEcZOfT.js +0 -1
- package/dist/docs/assets/evals.md.CbMoebP1.js +0 -85
- package/dist/docs/assets/evals.md.CbMoebP1.lean.js +0 -1
- package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +0 -9
- package/dist/docs/assets/index.md.BW_6tOgR.js +0 -5
- package/dist/docs/assets/reference_sessions.md.CueyOHSL.js +0 -1
- package/dist/docs/assets/skills_ab.md.CsFNatVx.js +0 -26
- package/dist/docs/assets/skills_ab.md.CsFNatVx.lean.js +0 -1
- package/dist/docs/assets/skills_evals.md.723kpUmA.js +0 -25
- package/dist/docs/assets/skills_evals.md.723kpUmA.lean.js +0 -1
- package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +0 -1
- package/dist/docs/assets/skills_index.md.DKwIxzGg.js +0 -1
- package/dist/docs/assets/skills_index.md.DKwIxzGg.lean.js +0 -1
- package/dist/docs/assets/troubleshooting.md.Cus_YZga.js +0 -1
- package/dist/docs/skills/ab.html +0 -52
- package/dist/docs/skills/ab.md +0 -50
- package/dist/internal/ab-collector.d.ts +0 -44
- package/dist/internal/ab-collector.d.ts.map +0 -1
- package/dist/internal/ab-collector.js +0 -142
- package/dist/internal/ab-fold.d.ts +0 -36
- package/dist/internal/ab-fold.d.ts.map +0 -1
- package/dist/internal/ab-fold.js +0 -175
- package/dist/internal/ab-snapshot.d.ts +0 -68
- package/dist/internal/ab-snapshot.d.ts.map +0 -1
- package/dist/internal/ab-snapshot.js +0 -208
- package/dist/internal/discovery/ab.d.ts +0 -9
- package/dist/internal/discovery/ab.d.ts.map +0 -1
- package/dist/internal/discovery/ab.js +0 -113
- package/dist/playground/assets/index-Bq2HpEQB.js +0 -67
- package/dist/playground/assets/index-CZKKNlmb.css +0 -1
- package/docs/ab.md +0 -337
- package/skills/ab/SKILL.md +0 -58
- package/src/ab.ts +0 -430
- package/src/internal/ab-collector.ts +0 -200
- package/src/internal/ab-fold.ts +0 -232
- package/src/internal/ab-snapshot.ts +0 -331
- package/src/internal/discovery/ab.ts +0 -131
- /package/dist/docs/assets/{concepts.md.DgEcZOfT.lean.js → concepts.md.B4o63Gul.lean.js} +0 -0
- /package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.lean.js → guides_grokbot-agents.md.DyV-WArv.lean.js} +0 -0
- /package/dist/docs/assets/{guides_webhooks.md.DKdA43Qm.lean.js → guides_webhooks.md.CJK484ex.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.CpTGTCle.lean.js → hillclimbing.md.BOiVo1tf.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.lean.js → reference_agent-config.md.CvoL6pof.lean.js} +0 -0
- /package/dist/docs/assets/{reference_connections.md.Di6jJAXF.lean.js → reference_connections.md.BojkC6c5.lean.js} +0 -0
- /package/dist/docs/assets/{reference_extensions.md.CGmMLblt.lean.js → reference_extensions.md.ZAVUyuEX.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.oySXBO8o.lean.js → reference_http-api.md.BwaCo-VO.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.CueyOHSL.lean.js → reference_sessions.md.CyXV1MUw.lean.js} +0 -0
- /package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.lean.js → scaffolding-agents.md.Kctn3OVb.lean.js} +0 -0
- /package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.lean.js → skills_create-agent.md.Q3h6Je-e.lean.js} +0 -0
- /package/dist/docs/assets/{skills_github.md.D0JahM8c.lean.js → skills_github.md.hgFX_oKY.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.Cus_YZga.lean.js → troubleshooting.md.CYEAO9bM.lean.js} +0 -0
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
* `continuation` go to the framework file store (file-shaped; the store
|
|
22
22
|
* accepts values up to 64 MiB per
|
|
23
23
|
* object without chunking, versus the KV proxy's 1 MiB row cap), while
|
|
24
|
-
* author `kv`, eval runs,
|
|
25
|
-
*
|
|
26
|
-
* database).
|
|
24
|
+
* author `kv`, eval runs, and conditional writes stay on the control-plane
|
|
25
|
+
* KV proxy (the dashboard reads them there, and CAS needs a database).
|
|
27
26
|
*
|
|
28
27
|
* v2 only, by construction: the composite is selected in
|
|
29
28
|
* framework-storage-selection.ts, which v1 never reaches with a
|
|
@@ -188,8 +187,8 @@ function decodeDocument(key, bytes) {
|
|
|
188
187
|
/**
|
|
189
188
|
* Split one storage core by key kind: framework session state to `files`,
|
|
190
189
|
* everything else to `kv`. Spread over the KV backend when building the
|
|
191
|
-
* full definition so its `evals`
|
|
192
|
-
*
|
|
190
|
+
* full definition so its `evals` group (and the cursor-hosted marker)
|
|
191
|
+
* rides along untouched; wrap the KV `cas` group with
|
|
193
192
|
* {@link frameworkGuardedCas} rather than spreading it as-is.
|
|
194
193
|
*/
|
|
195
194
|
export function composeFrameworkStorage(input) {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`, bound at task time) holds
|
|
25
25
|
* session records, event transcripts, and the continuation index —
|
|
26
26
|
* file-shaped state on file storage, apart from the author-facing user
|
|
27
|
-
* store. Author `host.kv`, eval runs,
|
|
28
|
-
*
|
|
27
|
+
* store. Author `host.kv`, eval runs, and conditional writes ride the
|
|
28
|
+
* AgentSDK v2 KV proxy (cursor-hosted-v2.ts), which resolves the
|
|
29
29
|
* pod service account to the factorydb deployment row (the v1 Bugbot
|
|
30
30
|
* proxy cannot resolve v2 pods at all). Framework session state never
|
|
31
31
|
* routes to the KV proxy — the composite splits by key kind — so
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`, bound at task time) holds
|
|
25
25
|
* session records, event transcripts, and the continuation index —
|
|
26
26
|
* file-shaped state on file storage, apart from the author-facing user
|
|
27
|
-
* store. Author `host.kv`, eval runs,
|
|
28
|
-
*
|
|
27
|
+
* store. Author `host.kv`, eval runs, and conditional writes ride the
|
|
28
|
+
* AgentSDK v2 KV proxy (cursor-hosted-v2.ts), which resolves the
|
|
29
29
|
* pod service account to the factorydb deployment row (the v1 Bugbot
|
|
30
30
|
* proxy cannot resolve v2 pods at all). Framework session state never
|
|
31
31
|
* routes to the KV proxy — the composite splits by key kind — so
|
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
* so leftover races still return 503 `guest_network_unavailable` instead of
|
|
13
13
|
* a redacted 500.
|
|
14
14
|
*
|
|
15
|
-
* Quiet guest Connect
|
|
16
|
-
* `
|
|
17
|
-
*
|
|
18
|
-
* retries the same pod — including when `waitForCompletion` resolves
|
|
19
|
-
* with that message instead of throwing.
|
|
15
|
+
* Quiet guest Connect failures with a typed Connect/undici code are stalls,
|
|
16
|
+
* not dead NICs. Those become `guest_connect_stalled` so TAS retries the same
|
|
17
|
+
* pod. Untyped errors stay unknown rather than being classified from prose.
|
|
20
18
|
*/
|
|
21
19
|
export declare const GUEST_NETWORK_UNAVAILABLE = "guest_network_unavailable";
|
|
22
20
|
export declare const GUEST_CONNECT_STALLED = "guest_connect_stalled";
|
|
@@ -39,9 +37,7 @@ export declare class GuestNetworkUnavailableError extends Error {
|
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* True when the error (or anything on its `cause` chain, or inside an
|
|
42
|
-
* `AggregateError`)
|
|
43
|
-
* undici's `TypeError: fetch failed` as `ConnectError` and keeps the
|
|
44
|
-
* original on `cause`.
|
|
40
|
+
* `AggregateError`) carries a known network-level code.
|
|
45
41
|
*/
|
|
46
42
|
export declare function isTransientGuestNetworkError(error: unknown): boolean;
|
|
47
43
|
export declare function hasGuestNetworkErrno(error: unknown): boolean;
|
|
@@ -52,8 +48,6 @@ export declare function hasGuestNetworkErrno(error: unknown): boolean;
|
|
|
52
48
|
* mapper can return `guest_connect_stalled` instead of a mystery 503.
|
|
53
49
|
*/
|
|
54
50
|
export declare function isQuietGuestConnectStall(error: unknown): boolean;
|
|
55
|
-
/** Message-only form for `waitForCompletion` outcomes that do not throw. */
|
|
56
|
-
export declare function isQuietGuestConnectStallMessage(message: string): boolean;
|
|
57
51
|
/** Last-line wait inside an already-open hosted POST. */
|
|
58
52
|
export declare const DEFAULT_WAIT_TIMEOUT_MS = 8000;
|
|
59
53
|
export type GuestNetworkWaitOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guest-network.d.ts","sourceRoot":"","sources":["../../src/internal/guest-network.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"guest-network.d.ts","sourceRoot":"","sources":["../../src/internal/guest-network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,QAAS,CAAC;AAuB1D,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,EAAE,OAAO,yBAAyB,CAA6B;IAC5E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,YACE,OAAO,SAAsD,EAC7D,MAAM,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,EAMzD;CACF;AASD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpE;AAeD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQhE;AA4FD,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAG7C,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,CAAC;AA+CF,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAE1E,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,uBAAuB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,qBAAqB,GAC3B,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAkDjC;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAuCnB"}
|
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
* so leftover races still return 503 `guest_network_unavailable` instead of
|
|
13
13
|
* a redacted 500.
|
|
14
14
|
*
|
|
15
|
-
* Quiet guest Connect
|
|
16
|
-
* `
|
|
17
|
-
*
|
|
18
|
-
* retries the same pod — including when `waitForCompletion` resolves
|
|
19
|
-
* with that message instead of throwing.
|
|
15
|
+
* Quiet guest Connect failures with a typed Connect/undici code are stalls,
|
|
16
|
+
* not dead NICs. Those become `guest_connect_stalled` so TAS retries the same
|
|
17
|
+
* pod. Untyped errors stay unknown rather than being classified from prose.
|
|
20
18
|
*/
|
|
21
19
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
20
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -67,11 +65,15 @@ export class GuestNetworkUnavailableError extends Error {
|
|
|
67
65
|
this.probeAttempts = (_b = extras.probeAttempts) !== null && _b !== void 0 ? _b : 0;
|
|
68
66
|
}
|
|
69
67
|
}
|
|
68
|
+
class GuestNetworkProbeFailedError extends Error {
|
|
69
|
+
constructor(cause) {
|
|
70
|
+
super("Guest network probe failed", { cause });
|
|
71
|
+
this.name = "GuestNetworkProbeFailedError";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
70
74
|
/**
|
|
71
75
|
* True when the error (or anything on its `cause` chain, or inside an
|
|
72
|
-
* `AggregateError`)
|
|
73
|
-
* undici's `TypeError: fetch failed` as `ConnectError` and keeps the
|
|
74
|
-
* original on `cause`.
|
|
76
|
+
* `AggregateError`) carries a known network-level code.
|
|
75
77
|
*/
|
|
76
78
|
export function isTransientGuestNetworkError(error) {
|
|
77
79
|
return isTransientAtDepth(error, 0);
|
|
@@ -86,7 +88,8 @@ const QUIET_CONNECT_ERROR_CODES = new Set([
|
|
|
86
88
|
"UND_ERR_BODY_TIMEOUT",
|
|
87
89
|
"UND_ERR_HEADERS_TIMEOUT",
|
|
88
90
|
]);
|
|
89
|
-
|
|
91
|
+
// gRPC Canceled, Unknown, and Unavailable.
|
|
92
|
+
const QUIET_CONNECT_CODES = new Set([1, 2, 14]);
|
|
90
93
|
export function hasGuestNetworkErrno(error) {
|
|
91
94
|
return hasCodeAtDepth(error, 0, TRANSIENT_NETWORK_ERROR_CODES);
|
|
92
95
|
}
|
|
@@ -105,14 +108,14 @@ export function isQuietGuestConnectStall(error) {
|
|
|
105
108
|
}
|
|
106
109
|
return isQuietSignatureAtDepth(error, 0);
|
|
107
110
|
}
|
|
108
|
-
/** Message-only form for `waitForCompletion` outcomes that do not throw. */
|
|
109
|
-
export function isQuietGuestConnectStallMessage(message) {
|
|
110
|
-
return QUIET_CONNECT_MESSAGE.test(message);
|
|
111
|
-
}
|
|
112
111
|
function errorCode(error) {
|
|
113
112
|
const code = error.code;
|
|
114
113
|
return typeof code === "string" && code.length > 0 ? code : undefined;
|
|
115
114
|
}
|
|
115
|
+
function numericErrorCode(error) {
|
|
116
|
+
const code = error.code;
|
|
117
|
+
return typeof code === "number" ? code : undefined;
|
|
118
|
+
}
|
|
116
119
|
function hasCodeAtDepth(error, depth, codes) {
|
|
117
120
|
if (depth >= MAX_CAUSE_DEPTH || !(error instanceof Error)) {
|
|
118
121
|
return false;
|
|
@@ -131,14 +134,15 @@ function isQuietSignatureAtDepth(error, depth) {
|
|
|
131
134
|
if (depth >= MAX_CAUSE_DEPTH || !(error instanceof Error)) {
|
|
132
135
|
return false;
|
|
133
136
|
}
|
|
134
|
-
if (error
|
|
137
|
+
if (error.name === "AbortError") {
|
|
135
138
|
return true;
|
|
136
139
|
}
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
140
|
+
const numericCode = numericErrorCode(error);
|
|
141
|
+
if (numericCode !== undefined && QUIET_CONNECT_CODES.has(numericCode)) {
|
|
139
142
|
return true;
|
|
140
143
|
}
|
|
141
|
-
|
|
144
|
+
const code = errorCode(error);
|
|
145
|
+
if (code !== undefined && QUIET_CONNECT_ERROR_CODES.has(code)) {
|
|
142
146
|
return true;
|
|
143
147
|
}
|
|
144
148
|
if (error instanceof AggregateError &&
|
|
@@ -151,10 +155,17 @@ function isTransientAtDepth(error, depth) {
|
|
|
151
155
|
if (depth >= MAX_CAUSE_DEPTH || !(error instanceof Error)) {
|
|
152
156
|
return false;
|
|
153
157
|
}
|
|
154
|
-
if (error instanceof
|
|
158
|
+
if (error instanceof GuestNetworkUnavailableError) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
if (error instanceof GuestNetworkProbeFailedError) {
|
|
155
162
|
return true;
|
|
156
163
|
}
|
|
157
|
-
if (error
|
|
164
|
+
if (error.name === "AbortError") {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
const numericCode = numericErrorCode(error);
|
|
168
|
+
if (numericCode !== undefined && QUIET_CONNECT_CODES.has(numericCode)) {
|
|
158
169
|
return true;
|
|
159
170
|
}
|
|
160
171
|
const code = errorCode(error);
|
|
@@ -199,13 +210,18 @@ function waitEnabled(options) {
|
|
|
199
210
|
function defaultProbe(probeUrl, probeTimeoutMs) {
|
|
200
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
212
|
var _a;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
try {
|
|
214
|
+
// Any HTTP response means egress and DNS work. 401/404 are ready.
|
|
215
|
+
const response = yield fetch(probeUrl, {
|
|
216
|
+
method: "GET",
|
|
217
|
+
redirect: "manual",
|
|
218
|
+
signal: AbortSignal.timeout(probeTimeoutMs),
|
|
219
|
+
});
|
|
220
|
+
void ((_a = response.body) === null || _a === void 0 ? void 0 : _a.cancel());
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
throw new GuestNetworkProbeFailedError(error);
|
|
224
|
+
}
|
|
209
225
|
});
|
|
210
226
|
}
|
|
211
227
|
/**
|
|
@@ -18,6 +18,8 @@ export type HostedAdmissionAdapter = {
|
|
|
18
18
|
*/
|
|
19
19
|
prepareArgs?(args: ChannelHandlerArgs): ChannelHandlerArgs;
|
|
20
20
|
dispatch(input: {
|
|
21
|
+
/** Mounted channel id the delivery addressed (always set by hosted delivery). */
|
|
22
|
+
channelId?: string;
|
|
21
23
|
eventType: string;
|
|
22
24
|
payload: unknown;
|
|
23
25
|
deliveryId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-admission-adapter.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-admission-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,kBAAkB,CAAC;KAC1B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvB,CAAC;AAIF,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAEN;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GACjB,sBAAsB,GAAG,SAAS,CAEpC"}
|
|
1
|
+
{"version":3,"file":"hosted-admission-adapter.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-admission-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE;QACd,iFAAiF;QACjF,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,kBAAkB,CAAC;KAC1B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvB,CAAC;AAIF,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAEN;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GACjB,sBAAsB,GAAG,SAAS,CAEpC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catch ingress wire contract, July copy. The control plane keeps a
|
|
3
|
+
* byte-identical copy of these constants in
|
|
4
|
+
* `backend/packages/server-shared/src/agentServe/agentSdkCatch.ts`; a
|
|
5
|
+
* backend drift test compares the two as text. Neither package imports the
|
|
6
|
+
* other.
|
|
7
|
+
*
|
|
8
|
+
* A caught request is one hosted admission whose `eventType` is
|
|
9
|
+
* {@link AGENT_SDK_CATCH_EVENT_TYPE} and whose `payload` is a
|
|
10
|
+
* {@link CatchRequestEnvelope}: the HTTP request the control plane
|
|
11
|
+
* accepted on a manifest-declared route after verifying the deployment's
|
|
12
|
+
* secret. July replays it into the authored route handler; the control
|
|
13
|
+
* plane never runs channel code.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AGENT_SDK_CATCH_ENVELOPE_VERSION = 1;
|
|
16
|
+
export declare const AGENT_SDK_CATCH_EVENT_TYPE = "http.request";
|
|
17
|
+
export declare const AGENT_SDK_CUSTOM_CHANNEL_KIND = "custom";
|
|
18
|
+
export declare const AGENT_SDK_SESSION_EVENT_TYPE = "agentsdk.session";
|
|
19
|
+
export declare const AGENT_SDK_HTTP_CHANNEL_ID = "http";
|
|
20
|
+
export declare const AGENT_SDK_HTTP_CHANNEL_KIND = "http";
|
|
21
|
+
export declare const AGENT_SDK_SESSION_RESUME_KEY_PREFIX = "cont:session:";
|
|
22
|
+
export declare const AGENT_SDK_CATCH_MAX_BODY_BYTES: number;
|
|
23
|
+
export declare const AGENT_SDK_CATCH_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
24
|
+
export type CatchRouteMethod = (typeof AGENT_SDK_CATCH_ROUTE_METHODS)[number];
|
|
25
|
+
export type CatchRequestEnvelope = {
|
|
26
|
+
v: 1;
|
|
27
|
+
method: CatchRouteMethod;
|
|
28
|
+
/** Channel-relative path, e.g. `/webhook`. */
|
|
29
|
+
path: string;
|
|
30
|
+
/** Raw query string without the leading `?`; empty when absent. */
|
|
31
|
+
query: string;
|
|
32
|
+
/** Lowercased header names. */
|
|
33
|
+
headers: Record<string, string>;
|
|
34
|
+
body: {
|
|
35
|
+
encoding: "utf8" | "base64";
|
|
36
|
+
data: string;
|
|
37
|
+
} | null;
|
|
38
|
+
receivedAt: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Mailbox key the control plane stamps on an explicit `ses_…` resume. The
|
|
42
|
+
* suffix is the CP session id the hosted execution also names, so the
|
|
43
|
+
* engine can recognise the key as "this existing session" rather than a
|
|
44
|
+
* new continuation identity.
|
|
45
|
+
*/
|
|
46
|
+
export declare function hostedSessionResumeKey(sessionPublicId: string): string;
|
|
47
|
+
/** Strict parse of a claim-checked catch envelope; anything else is undefined. */
|
|
48
|
+
export declare function parseCatchRequestEnvelope(value: unknown): CatchRequestEnvelope | undefined;
|
|
49
|
+
/** Raw request bytes from an envelope body; empty for a null body. */
|
|
50
|
+
export declare function decodeCatchBody(body: CatchRequestEnvelope["body"]): Buffer;
|
|
51
|
+
//# sourceMappingURL=hosted-catch-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-catch-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AACzD,eAAO,MAAM,6BAA6B,WAAW,CAAC;AACtD,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAClD,eAAO,MAAM,mCAAmC,kBAAkB,CAAC;AACnE,eAAO,MAAM,8BAA8B,EAAE,MAAmB,CAAC;AAEjE,eAAO,MAAM,6BAA6B,YACxC,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,QAAQ,CACA,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,EAAE,CAAC,CAAC;IACL,MAAM,EAAE,gBAAgB,CAAC;IACzB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAEtE;AAqBD,kFAAkF;AAClF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,GACb,oBAAoB,GAAG,SAAS,CA2ClC;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,MAAM,CAK1E"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catch ingress wire contract, July copy. The control plane keeps a
|
|
3
|
+
* byte-identical copy of these constants in
|
|
4
|
+
* `backend/packages/server-shared/src/agentServe/agentSdkCatch.ts`; a
|
|
5
|
+
* backend drift test compares the two as text. Neither package imports the
|
|
6
|
+
* other.
|
|
7
|
+
*
|
|
8
|
+
* A caught request is one hosted admission whose `eventType` is
|
|
9
|
+
* {@link AGENT_SDK_CATCH_EVENT_TYPE} and whose `payload` is a
|
|
10
|
+
* {@link CatchRequestEnvelope}: the HTTP request the control plane
|
|
11
|
+
* accepted on a manifest-declared route after verifying the deployment's
|
|
12
|
+
* secret. July replays it into the authored route handler; the control
|
|
13
|
+
* plane never runs channel code.
|
|
14
|
+
*/
|
|
15
|
+
export const AGENT_SDK_CATCH_ENVELOPE_VERSION = 1;
|
|
16
|
+
export const AGENT_SDK_CATCH_EVENT_TYPE = "http.request";
|
|
17
|
+
export const AGENT_SDK_CUSTOM_CHANNEL_KIND = "custom";
|
|
18
|
+
export const AGENT_SDK_SESSION_EVENT_TYPE = "agentsdk.session";
|
|
19
|
+
export const AGENT_SDK_HTTP_CHANNEL_ID = "http";
|
|
20
|
+
export const AGENT_SDK_HTTP_CHANNEL_KIND = "http";
|
|
21
|
+
export const AGENT_SDK_SESSION_RESUME_KEY_PREFIX = "cont:session:";
|
|
22
|
+
export const AGENT_SDK_CATCH_MAX_BODY_BYTES = 256 * 1024;
|
|
23
|
+
export const AGENT_SDK_CATCH_ROUTE_METHODS = [
|
|
24
|
+
"GET",
|
|
25
|
+
"POST",
|
|
26
|
+
"PUT",
|
|
27
|
+
"PATCH",
|
|
28
|
+
"DELETE",
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Mailbox key the control plane stamps on an explicit `ses_…` resume. The
|
|
32
|
+
* suffix is the CP session id the hosted execution also names, so the
|
|
33
|
+
* engine can recognise the key as "this existing session" rather than a
|
|
34
|
+
* new continuation identity.
|
|
35
|
+
*/
|
|
36
|
+
export function hostedSessionResumeKey(sessionPublicId) {
|
|
37
|
+
return `${AGENT_SDK_SESSION_RESUME_KEY_PREFIX}${sessionPublicId}`;
|
|
38
|
+
}
|
|
39
|
+
const ENVELOPE_KEYS = new Set([
|
|
40
|
+
"v",
|
|
41
|
+
"method",
|
|
42
|
+
"path",
|
|
43
|
+
"query",
|
|
44
|
+
"headers",
|
|
45
|
+
"body",
|
|
46
|
+
"receivedAt",
|
|
47
|
+
]);
|
|
48
|
+
const METHODS = new Set(AGENT_SDK_CATCH_ROUTE_METHODS);
|
|
49
|
+
const MAX_PATH_CHARS = 1024;
|
|
50
|
+
const MAX_QUERY_CHARS = 4096;
|
|
51
|
+
const MAX_HEADER_COUNT = 64;
|
|
52
|
+
const MAX_HEADER_BYTES = 16 * 1024;
|
|
53
|
+
function isRecord(value) {
|
|
54
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55
|
+
}
|
|
56
|
+
/** Strict parse of a claim-checked catch envelope; anything else is undefined. */
|
|
57
|
+
export function parseCatchRequestEnvelope(value) {
|
|
58
|
+
if (!isRecord(value)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
if (Object.keys(value).some((key) => !ENVELOPE_KEYS.has(key)) ||
|
|
62
|
+
value.v !== AGENT_SDK_CATCH_ENVELOPE_VERSION ||
|
|
63
|
+
typeof value.method !== "string" ||
|
|
64
|
+
!METHODS.has(value.method) ||
|
|
65
|
+
typeof value.path !== "string" ||
|
|
66
|
+
!value.path.startsWith("/") ||
|
|
67
|
+
value.path.length > MAX_PATH_CHARS ||
|
|
68
|
+
typeof value.query !== "string" ||
|
|
69
|
+
value.query.length > MAX_QUERY_CHARS ||
|
|
70
|
+
typeof value.receivedAt !== "string" ||
|
|
71
|
+
!isRecord(value.headers)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const entries = Object.entries(value.headers);
|
|
75
|
+
if (entries.length > MAX_HEADER_COUNT) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
let headerBytes = 0;
|
|
79
|
+
for (const [name, headerValue] of entries) {
|
|
80
|
+
if (typeof headerValue !== "string" || name !== name.toLowerCase()) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
headerBytes += name.length + headerValue.length;
|
|
84
|
+
}
|
|
85
|
+
if (headerBytes > MAX_HEADER_BYTES) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
if (value.body !== null) {
|
|
89
|
+
if (!isRecord(value.body) ||
|
|
90
|
+
(value.body.encoding !== "utf8" && value.body.encoding !== "base64") ||
|
|
91
|
+
typeof value.body.data !== "string") {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
/** Raw request bytes from an envelope body; empty for a null body. */
|
|
98
|
+
export function decodeCatchBody(body) {
|
|
99
|
+
if (body === null) {
|
|
100
|
+
return Buffer.alloc(0);
|
|
101
|
+
}
|
|
102
|
+
return Buffer.from(body.data, body.encoding);
|
|
103
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted admission for caught HTTP requests.
|
|
3
|
+
*
|
|
4
|
+
* The control plane accepted a request on one of this channel's declared
|
|
5
|
+
* routes, verified the deployment's secret, and claim-checked the request
|
|
6
|
+
* as a {@link CatchRequestEnvelope}. Admission replays that request into
|
|
7
|
+
* the authored route handler exactly as the local router would have
|
|
8
|
+
* (same route table, same Zod schema gate), with the control plane as the
|
|
9
|
+
* authenticated principal. A captured `send()` becomes the pending send;
|
|
10
|
+
* a handler that answers without sending is a `skip`.
|
|
11
|
+
*/
|
|
12
|
+
import type { AuthContext, ChannelDefinition, ChannelHandlerArgs, ChannelRoute } from "../types.js";
|
|
13
|
+
import { type CatchRequestEnvelope } from "./hosted-catch-protocol.js";
|
|
14
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
15
|
+
export declare const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
16
|
+
/**
|
|
17
|
+
* Principal for a replayed request. The deployment secret was checked by
|
|
18
|
+
* the control plane before compute existed; the channel's own auth chain
|
|
19
|
+
* does not run again in the VM.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CATCH_AUTH_CONTEXT: AuthContext;
|
|
22
|
+
export declare function catchRequestFromEnvelope(input: {
|
|
23
|
+
channelId: string;
|
|
24
|
+
deliveryId: string;
|
|
25
|
+
envelope: CatchRequestEnvelope;
|
|
26
|
+
}): Request;
|
|
27
|
+
export declare function replayCatchRequest(input: {
|
|
28
|
+
channelId: string;
|
|
29
|
+
deliveryId: string;
|
|
30
|
+
routes: readonly ChannelRoute[];
|
|
31
|
+
payload: unknown;
|
|
32
|
+
args: ChannelHandlerArgs;
|
|
33
|
+
}): Promise<Response>;
|
|
34
|
+
/**
|
|
35
|
+
* Attach catch admission to an authored channel. Provider packs attach
|
|
36
|
+
* their own adapter afterwards and replace this one; the control plane
|
|
37
|
+
* never sends `http.request` to a pack kind in any case.
|
|
38
|
+
*/
|
|
39
|
+
export declare function attachCatchAdmission(definition: ChannelDefinition<unknown>, routes: readonly ChannelRoute[]): void;
|
|
40
|
+
//# sourceMappingURL=hosted-catch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-catch.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACb,MAAM,aAAa,CAAC;AAUrB,OAAO,EAGL,KAAK,oBAAoB,EAG1B,MAAM,4BAA4B,CAAC;AAIpC,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAIlE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAIhC,CAAC;AAIF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAgBV;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkFpB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,iBAAiB,CAAC,OAAO,CAAC,EACtC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,IAAI,CAgBN"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted admission for caught HTTP requests.
|
|
3
|
+
*
|
|
4
|
+
* The control plane accepted a request on one of this channel's declared
|
|
5
|
+
* routes, verified the deployment's secret, and claim-checked the request
|
|
6
|
+
* as a {@link CatchRequestEnvelope}. Admission replays that request into
|
|
7
|
+
* the authored route handler exactly as the local router would have
|
|
8
|
+
* (same route table, same Zod schema gate), with the control plane as the
|
|
9
|
+
* authenticated principal. A captured `send()` becomes the pending send;
|
|
10
|
+
* a handler that answers without sending is a `skip`.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { acknowledgeTurn, dispatchOutcome, skipped, tagOutcome, } from "./channel-dispatch.js";
|
|
22
|
+
import { invokeChannelRoute } from "./channel-route-dispatch.js";
|
|
23
|
+
import { DeferredChannelSessionError } from "./deferred-channel-session.js";
|
|
24
|
+
import { attachHostedAdmissionAdapter } from "./hosted-admission-adapter.js";
|
|
25
|
+
import { AGENT_SDK_CATCH_EVENT_TYPE, AGENT_SDK_CUSTOM_CHANNEL_KIND, decodeCatchBody, parseCatchRequestEnvelope, } from "./hosted-catch-protocol.js";
|
|
26
|
+
import { errorResponse } from "./http-channel.js";
|
|
27
|
+
import { Router } from "./router.js";
|
|
28
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
29
|
+
export const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
30
|
+
/** Placeholder origin for replayed requests; handlers see a well-formed URL. */
|
|
31
|
+
const CATCH_REQUEST_ORIGIN = "http://agent-sdk.hosted";
|
|
32
|
+
/**
|
|
33
|
+
* Principal for a replayed request. The deployment secret was checked by
|
|
34
|
+
* the control plane before compute existed; the channel's own auth chain
|
|
35
|
+
* does not run again in the VM.
|
|
36
|
+
*/
|
|
37
|
+
export const CATCH_AUTH_CONTEXT = {
|
|
38
|
+
authenticator: "control-plane-catch",
|
|
39
|
+
principalId: "agent-sdk:catch",
|
|
40
|
+
principalType: "runtime",
|
|
41
|
+
};
|
|
42
|
+
const BODYLESS_METHODS = new Set(["GET", "HEAD"]);
|
|
43
|
+
export function catchRequestFromEnvelope(input) {
|
|
44
|
+
const { envelope } = input;
|
|
45
|
+
const url = `${CATCH_REQUEST_ORIGIN}/v1/channels/${input.channelId}${envelope.path}${envelope.query === "" ? "" : `?${envelope.query}`}`;
|
|
46
|
+
const headers = new Headers(envelope.headers);
|
|
47
|
+
headers.set(CATCH_DELIVERY_ID_HEADER, input.deliveryId);
|
|
48
|
+
const body = decodeCatchBody(envelope.body);
|
|
49
|
+
return new Request(url, {
|
|
50
|
+
method: envelope.method,
|
|
51
|
+
headers,
|
|
52
|
+
body: body.length === 0 || BODYLESS_METHODS.has(envelope.method)
|
|
53
|
+
? undefined
|
|
54
|
+
: new Uint8Array(body),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function replayCatchRequest(input) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const envelope = parseCatchRequestEnvelope(input.payload);
|
|
60
|
+
if (envelope === undefined) {
|
|
61
|
+
return errorResponse(400, "invalid_catch_envelope", "Expected a supported Agent SDK catch request envelope.");
|
|
62
|
+
}
|
|
63
|
+
const router = new Router();
|
|
64
|
+
for (const route of input.routes) {
|
|
65
|
+
router.add({
|
|
66
|
+
method: route.method,
|
|
67
|
+
pattern: route.path,
|
|
68
|
+
auth: "none",
|
|
69
|
+
handler: () => errorResponse(500, "unreachable", "unreachable"),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const matched = router.match(envelope.method, envelope.path);
|
|
73
|
+
const route = input.routes.find((candidate) => candidate.method === (matched === null || matched === void 0 ? void 0 : matched.route.method) &&
|
|
74
|
+
candidate.path === matched.route.pattern);
|
|
75
|
+
if (matched === undefined || route === undefined) {
|
|
76
|
+
// The control plane routes from the same pinned manifest this VM was
|
|
77
|
+
// frozen from; a miss here is drift, not a caller error.
|
|
78
|
+
return errorResponse(404, "route_not_declared", `No ${envelope.method} ${envelope.path} route is mounted on channel "${input.channelId}".`);
|
|
79
|
+
}
|
|
80
|
+
const request = catchRequestFromEnvelope({
|
|
81
|
+
channelId: input.channelId,
|
|
82
|
+
deliveryId: input.deliveryId,
|
|
83
|
+
envelope,
|
|
84
|
+
});
|
|
85
|
+
let response;
|
|
86
|
+
try {
|
|
87
|
+
response = yield invokeChannelRoute({
|
|
88
|
+
route,
|
|
89
|
+
request,
|
|
90
|
+
handlerArgs: Object.assign(Object.assign({}, input.args), { params: matched.params, auth: CATCH_AUTH_CONTEXT }),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
// `return Response.json({ sessionId: session.id })` after `send()` is
|
|
95
|
+
// the ordinary local webhook shape. Hosted, `send()` is captured and the
|
|
96
|
+
// handle is deferred, so reading `.id` throws — but nobody reads this
|
|
97
|
+
// handler's HTTP reply hosted; the captured send is the outcome.
|
|
98
|
+
if (error instanceof DeferredChannelSessionError) {
|
|
99
|
+
return acknowledgeTurn();
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
// A 2xx the handler did not tag and in which nothing was captured means
|
|
104
|
+
// it handled the request itself (acknowledged, ignored, replied). There is
|
|
105
|
+
// nothing to execute: report skip instead of failing the delivery.
|
|
106
|
+
if (response.ok && dispatchOutcome(response) === undefined) {
|
|
107
|
+
return tagOutcome(response, "skip");
|
|
108
|
+
}
|
|
109
|
+
// A 4xx is the handler rejecting the sender (bad signature on a
|
|
110
|
+
// handler-verified `publicEndpoint()` route, schema mismatch, unknown
|
|
111
|
+
// event). The sender already has its 202; retrying the delivery cannot
|
|
112
|
+
// change the verdict, so report a cheap skip that lets the control plane
|
|
113
|
+
// discard the compute instead of failing and retrying the activity.
|
|
114
|
+
if (response.status >= 400 && response.status < 500) {
|
|
115
|
+
// Logged so a probed public route or a misconfigured provider secret is
|
|
116
|
+
// distinguishable from a benign "nothing to do" skip in the guest logs;
|
|
117
|
+
// the wire outcome to the control plane is still `skip`.
|
|
118
|
+
console.info(`[agent-sdk] catch replay rejected by handler deliveryId=${input.deliveryId} channelId=${input.channelId} route=${envelope.method} ${route.path} status=${String(response.status)}`);
|
|
119
|
+
return skipped(`handler rejected the request (${response.status})`, {
|
|
120
|
+
status: response.status,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return response;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Attach catch admission to an authored channel. Provider packs attach
|
|
128
|
+
* their own adapter afterwards and replace this one; the control plane
|
|
129
|
+
* never sends `http.request` to a pack kind in any case.
|
|
130
|
+
*/
|
|
131
|
+
export function attachCatchAdmission(definition, routes) {
|
|
132
|
+
var _a;
|
|
133
|
+
var _b;
|
|
134
|
+
attachHostedAdmissionAdapter(definition, {
|
|
135
|
+
kind: (_b = (_a = definition.meta) === null || _a === void 0 ? void 0 : _a.kind) !== null && _b !== void 0 ? _b : AGENT_SDK_CUSTOM_CHANNEL_KIND,
|
|
136
|
+
dispatch: ({ channelId, eventType, payload, deliveryId, args }) => {
|
|
137
|
+
if (eventType !== AGENT_SDK_CATCH_EVENT_TYPE) {
|
|
138
|
+
return Promise.resolve(skipped("not a caught http request"));
|
|
139
|
+
}
|
|
140
|
+
return replayCatchRequest({
|
|
141
|
+
channelId: channelId !== null && channelId !== void 0 ? channelId : "channel",
|
|
142
|
+
deliveryId,
|
|
143
|
+
routes,
|
|
144
|
+
payload,
|
|
145
|
+
args,
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|