@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
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
|
|
13
|
+
import type {
|
|
14
|
+
AuthContext,
|
|
15
|
+
ChannelDefinition,
|
|
16
|
+
ChannelHandlerArgs,
|
|
17
|
+
ChannelRoute,
|
|
18
|
+
} from "../types.js";
|
|
19
|
+
import {
|
|
20
|
+
acknowledgeTurn,
|
|
21
|
+
dispatchOutcome,
|
|
22
|
+
skipped,
|
|
23
|
+
tagOutcome,
|
|
24
|
+
} from "./channel-dispatch.js";
|
|
25
|
+
import { invokeChannelRoute } from "./channel-route-dispatch.js";
|
|
26
|
+
import { DeferredChannelSessionError } from "./deferred-channel-session.js";
|
|
27
|
+
import { attachHostedAdmissionAdapter } from "./hosted-admission-adapter.js";
|
|
28
|
+
import {
|
|
29
|
+
AGENT_SDK_CATCH_EVENT_TYPE,
|
|
30
|
+
AGENT_SDK_CUSTOM_CHANNEL_KIND,
|
|
31
|
+
type CatchRequestEnvelope,
|
|
32
|
+
decodeCatchBody,
|
|
33
|
+
parseCatchRequestEnvelope,
|
|
34
|
+
} from "./hosted-catch-protocol.js";
|
|
35
|
+
import { errorResponse } from "./http-channel.js";
|
|
36
|
+
import { Router } from "./router.js";
|
|
37
|
+
|
|
38
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
39
|
+
export const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
40
|
+
/** Placeholder origin for replayed requests; handlers see a well-formed URL. */
|
|
41
|
+
const CATCH_REQUEST_ORIGIN = "http://agent-sdk.hosted";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Principal for a replayed request. The deployment secret was checked by
|
|
45
|
+
* the control plane before compute existed; the channel's own auth chain
|
|
46
|
+
* does not run again in the VM.
|
|
47
|
+
*/
|
|
48
|
+
export const CATCH_AUTH_CONTEXT: AuthContext = {
|
|
49
|
+
authenticator: "control-plane-catch",
|
|
50
|
+
principalId: "agent-sdk:catch",
|
|
51
|
+
principalType: "runtime",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const BODYLESS_METHODS = new Set(["GET", "HEAD"]);
|
|
55
|
+
|
|
56
|
+
export function catchRequestFromEnvelope(input: {
|
|
57
|
+
channelId: string;
|
|
58
|
+
deliveryId: string;
|
|
59
|
+
envelope: CatchRequestEnvelope;
|
|
60
|
+
}): Request {
|
|
61
|
+
const { envelope } = input;
|
|
62
|
+
const url = `${CATCH_REQUEST_ORIGIN}/v1/channels/${input.channelId}${envelope.path}${
|
|
63
|
+
envelope.query === "" ? "" : `?${envelope.query}`
|
|
64
|
+
}`;
|
|
65
|
+
const headers = new Headers(envelope.headers);
|
|
66
|
+
headers.set(CATCH_DELIVERY_ID_HEADER, input.deliveryId);
|
|
67
|
+
const body = decodeCatchBody(envelope.body);
|
|
68
|
+
return new Request(url, {
|
|
69
|
+
method: envelope.method,
|
|
70
|
+
headers,
|
|
71
|
+
body:
|
|
72
|
+
body.length === 0 || BODYLESS_METHODS.has(envelope.method)
|
|
73
|
+
? undefined
|
|
74
|
+
: new Uint8Array(body),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function replayCatchRequest(input: {
|
|
79
|
+
channelId: string;
|
|
80
|
+
deliveryId: string;
|
|
81
|
+
routes: readonly ChannelRoute[];
|
|
82
|
+
payload: unknown;
|
|
83
|
+
args: ChannelHandlerArgs;
|
|
84
|
+
}): Promise<Response> {
|
|
85
|
+
const envelope = parseCatchRequestEnvelope(input.payload);
|
|
86
|
+
if (envelope === undefined) {
|
|
87
|
+
return errorResponse(
|
|
88
|
+
400,
|
|
89
|
+
"invalid_catch_envelope",
|
|
90
|
+
"Expected a supported Agent SDK catch request envelope."
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
const router = new Router();
|
|
94
|
+
for (const route of input.routes) {
|
|
95
|
+
router.add({
|
|
96
|
+
method: route.method,
|
|
97
|
+
pattern: route.path,
|
|
98
|
+
auth: "none",
|
|
99
|
+
handler: () => errorResponse(500, "unreachable", "unreachable"),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const matched = router.match(envelope.method, envelope.path);
|
|
103
|
+
const route = input.routes.find(
|
|
104
|
+
(candidate) =>
|
|
105
|
+
candidate.method === matched?.route.method &&
|
|
106
|
+
candidate.path === matched.route.pattern
|
|
107
|
+
);
|
|
108
|
+
if (matched === undefined || route === undefined) {
|
|
109
|
+
// The control plane routes from the same pinned manifest this VM was
|
|
110
|
+
// frozen from; a miss here is drift, not a caller error.
|
|
111
|
+
return errorResponse(
|
|
112
|
+
404,
|
|
113
|
+
"route_not_declared",
|
|
114
|
+
`No ${envelope.method} ${envelope.path} route is mounted on channel "${input.channelId}".`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
const request = catchRequestFromEnvelope({
|
|
118
|
+
channelId: input.channelId,
|
|
119
|
+
deliveryId: input.deliveryId,
|
|
120
|
+
envelope,
|
|
121
|
+
});
|
|
122
|
+
let response: Response;
|
|
123
|
+
try {
|
|
124
|
+
response = await invokeChannelRoute({
|
|
125
|
+
route,
|
|
126
|
+
request,
|
|
127
|
+
handlerArgs: {
|
|
128
|
+
...input.args,
|
|
129
|
+
params: matched.params,
|
|
130
|
+
auth: CATCH_AUTH_CONTEXT,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
} catch (error) {
|
|
134
|
+
// `return Response.json({ sessionId: session.id })` after `send()` is
|
|
135
|
+
// the ordinary local webhook shape. Hosted, `send()` is captured and the
|
|
136
|
+
// handle is deferred, so reading `.id` throws — but nobody reads this
|
|
137
|
+
// handler's HTTP reply hosted; the captured send is the outcome.
|
|
138
|
+
if (error instanceof DeferredChannelSessionError) {
|
|
139
|
+
return acknowledgeTurn();
|
|
140
|
+
}
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
// A 2xx the handler did not tag and in which nothing was captured means
|
|
144
|
+
// it handled the request itself (acknowledged, ignored, replied). There is
|
|
145
|
+
// nothing to execute: report skip instead of failing the delivery.
|
|
146
|
+
if (response.ok && dispatchOutcome(response) === undefined) {
|
|
147
|
+
return tagOutcome(response, "skip");
|
|
148
|
+
}
|
|
149
|
+
// A 4xx is the handler rejecting the sender (bad signature on a
|
|
150
|
+
// handler-verified `publicEndpoint()` route, schema mismatch, unknown
|
|
151
|
+
// event). The sender already has its 202; retrying the delivery cannot
|
|
152
|
+
// change the verdict, so report a cheap skip that lets the control plane
|
|
153
|
+
// discard the compute instead of failing and retrying the activity.
|
|
154
|
+
if (response.status >= 400 && response.status < 500) {
|
|
155
|
+
// Logged so a probed public route or a misconfigured provider secret is
|
|
156
|
+
// distinguishable from a benign "nothing to do" skip in the guest logs;
|
|
157
|
+
// the wire outcome to the control plane is still `skip`.
|
|
158
|
+
console.info(
|
|
159
|
+
`[agent-sdk] catch replay rejected by handler deliveryId=${input.deliveryId} channelId=${input.channelId} route=${envelope.method} ${route.path} status=${String(response.status)}`
|
|
160
|
+
);
|
|
161
|
+
return skipped(`handler rejected the request (${response.status})`, {
|
|
162
|
+
status: response.status,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return response;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Attach catch admission to an authored channel. Provider packs attach
|
|
170
|
+
* their own adapter afterwards and replace this one; the control plane
|
|
171
|
+
* never sends `http.request` to a pack kind in any case.
|
|
172
|
+
*/
|
|
173
|
+
export function attachCatchAdmission(
|
|
174
|
+
definition: ChannelDefinition<unknown>,
|
|
175
|
+
routes: readonly ChannelRoute[]
|
|
176
|
+
): void {
|
|
177
|
+
attachHostedAdmissionAdapter(definition, {
|
|
178
|
+
kind: definition.meta?.kind ?? AGENT_SDK_CUSTOM_CHANNEL_KIND,
|
|
179
|
+
dispatch: ({ channelId, eventType, payload, deliveryId, args }) => {
|
|
180
|
+
if (eventType !== AGENT_SDK_CATCH_EVENT_TYPE) {
|
|
181
|
+
return Promise.resolve(skipped("not a caught http request"));
|
|
182
|
+
}
|
|
183
|
+
return replayCatchRequest({
|
|
184
|
+
channelId: channelId ?? "channel",
|
|
185
|
+
deliveryId,
|
|
186
|
+
routes,
|
|
187
|
+
payload,
|
|
188
|
+
args,
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
@@ -9,10 +9,144 @@ export type HostedGuestRetryDisposition =
|
|
|
9
9
|
| typeof HOSTED_GUEST_RETRY_TRANSIENT
|
|
10
10
|
| typeof HOSTED_GUEST_RETRY_TERMINAL;
|
|
11
11
|
|
|
12
|
+
export const HOSTED_FAILURE_CLASSIFICATION_VERSION = 1;
|
|
13
|
+
|
|
14
|
+
export type HostedFailureDomain =
|
|
15
|
+
| "configuration"
|
|
16
|
+
| "protocol"
|
|
17
|
+
| "platform"
|
|
18
|
+
| "agent"
|
|
19
|
+
| "dependency"
|
|
20
|
+
| "cancellation"
|
|
21
|
+
| "unknown";
|
|
22
|
+
|
|
23
|
+
export type HostedFailureSource =
|
|
24
|
+
| "tas"
|
|
25
|
+
| "factory"
|
|
26
|
+
| "anyrun"
|
|
27
|
+
| "engine"
|
|
28
|
+
| "agent";
|
|
29
|
+
|
|
30
|
+
export type HostedFailureClassification = {
|
|
31
|
+
v: typeof HOSTED_FAILURE_CLASSIFICATION_VERSION;
|
|
32
|
+
domain: HostedFailureDomain;
|
|
33
|
+
source: HostedFailureSource;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const HOSTED_FAILURE_DOMAINS = new Set<HostedFailureDomain>([
|
|
37
|
+
"configuration",
|
|
38
|
+
"protocol",
|
|
39
|
+
"platform",
|
|
40
|
+
"agent",
|
|
41
|
+
"dependency",
|
|
42
|
+
"cancellation",
|
|
43
|
+
"unknown",
|
|
44
|
+
]);
|
|
45
|
+
const HOSTED_FAILURE_SOURCES = new Set<HostedFailureSource>([
|
|
46
|
+
"tas",
|
|
47
|
+
"factory",
|
|
48
|
+
"anyrun",
|
|
49
|
+
"engine",
|
|
50
|
+
"agent",
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
export type HostedFailureCode =
|
|
54
|
+
| "agent_admission_threw"
|
|
55
|
+
| "agent_dependency_failed"
|
|
56
|
+
| "background_dispatch_failed"
|
|
57
|
+
| "bound_secrets_not_consumed"
|
|
58
|
+
| "channel_dispatch_failed"
|
|
59
|
+
| "channel_kind_mismatch"
|
|
60
|
+
| "channel_not_found"
|
|
61
|
+
| "channel_outcome_missing"
|
|
62
|
+
| "forbidden"
|
|
63
|
+
| "guest_connect_stalled"
|
|
64
|
+
| "guest_network_unavailable"
|
|
65
|
+
| "hosted_admission_session_mismatch"
|
|
66
|
+
| "hosted_admission_unavailable"
|
|
67
|
+
| "hosted_deferred_session_unusable"
|
|
68
|
+
| "hosted_local_send_rejected"
|
|
69
|
+
| "hosted_send_limit_exceeded"
|
|
70
|
+
| "internal_error"
|
|
71
|
+
| "invalid_hosted_admission"
|
|
72
|
+
| "invalid_hosted_execution"
|
|
73
|
+
| "invalid_request"
|
|
74
|
+
| "method_not_allowed"
|
|
75
|
+
| "not_found"
|
|
76
|
+
| "session_busy"
|
|
77
|
+
| "turn_cancelled"
|
|
78
|
+
| "turn_failed"
|
|
79
|
+
| "unauthorized"
|
|
80
|
+
| "v2_identity_conflict";
|
|
81
|
+
|
|
82
|
+
export const HOSTED_FAILURE_CLASSIFICATIONS: Record<
|
|
83
|
+
HostedFailureCode,
|
|
84
|
+
Omit<HostedFailureClassification, "v">
|
|
85
|
+
> = {
|
|
86
|
+
agent_admission_threw: { domain: "agent", source: "agent" },
|
|
87
|
+
agent_dependency_failed: { domain: "dependency", source: "factory" },
|
|
88
|
+
background_dispatch_failed: { domain: "agent", source: "agent" },
|
|
89
|
+
bound_secrets_not_consumed: { domain: "platform", source: "engine" },
|
|
90
|
+
channel_dispatch_failed: { domain: "agent", source: "agent" },
|
|
91
|
+
channel_kind_mismatch: { domain: "configuration", source: "engine" },
|
|
92
|
+
channel_not_found: { domain: "configuration", source: "engine" },
|
|
93
|
+
channel_outcome_missing: { domain: "protocol", source: "agent" },
|
|
94
|
+
forbidden: { domain: "configuration", source: "engine" },
|
|
95
|
+
guest_connect_stalled: { domain: "platform", source: "engine" },
|
|
96
|
+
guest_network_unavailable: { domain: "platform", source: "anyrun" },
|
|
97
|
+
hosted_admission_session_mismatch: { domain: "protocol", source: "engine" },
|
|
98
|
+
hosted_admission_unavailable: { domain: "platform", source: "engine" },
|
|
99
|
+
hosted_deferred_session_unusable: { domain: "agent", source: "agent" },
|
|
100
|
+
hosted_local_send_rejected: { domain: "agent", source: "agent" },
|
|
101
|
+
hosted_send_limit_exceeded: { domain: "agent", source: "agent" },
|
|
102
|
+
internal_error: { domain: "unknown", source: "engine" },
|
|
103
|
+
invalid_hosted_admission: { domain: "protocol", source: "engine" },
|
|
104
|
+
invalid_hosted_execution: { domain: "protocol", source: "engine" },
|
|
105
|
+
invalid_request: { domain: "protocol", source: "engine" },
|
|
106
|
+
method_not_allowed: { domain: "protocol", source: "engine" },
|
|
107
|
+
not_found: { domain: "protocol", source: "engine" },
|
|
108
|
+
session_busy: { domain: "platform", source: "engine" },
|
|
109
|
+
turn_cancelled: { domain: "cancellation", source: "agent" },
|
|
110
|
+
turn_failed: { domain: "agent", source: "agent" },
|
|
111
|
+
unauthorized: { domain: "configuration", source: "engine" },
|
|
112
|
+
v2_identity_conflict: { domain: "protocol", source: "engine" },
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export function hostedFailureClassification(
|
|
116
|
+
code: string
|
|
117
|
+
): HostedFailureClassification {
|
|
118
|
+
const known = HOSTED_FAILURE_CLASSIFICATIONS[code as HostedFailureCode];
|
|
119
|
+
return {
|
|
120
|
+
v: HOSTED_FAILURE_CLASSIFICATION_VERSION,
|
|
121
|
+
domain: known?.domain ?? "unknown",
|
|
122
|
+
source: known?.source ?? "engine",
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function parseHostedFailureClassification(
|
|
127
|
+
value: unknown
|
|
128
|
+
): HostedFailureClassification | undefined {
|
|
129
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const body = value as Record<string, unknown>;
|
|
133
|
+
if (
|
|
134
|
+
body.v !== HOSTED_FAILURE_CLASSIFICATION_VERSION ||
|
|
135
|
+
typeof body.domain !== "string" ||
|
|
136
|
+
!HOSTED_FAILURE_DOMAINS.has(body.domain as HostedFailureDomain) ||
|
|
137
|
+
typeof body.source !== "string" ||
|
|
138
|
+
!HOSTED_FAILURE_SOURCES.has(body.source as HostedFailureSource)
|
|
139
|
+
) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
return body as HostedFailureClassification;
|
|
143
|
+
}
|
|
144
|
+
|
|
12
145
|
export type HostedGuestError = {
|
|
13
146
|
ok: false;
|
|
14
147
|
error: string;
|
|
15
148
|
retry: HostedGuestRetryDisposition;
|
|
149
|
+
classification: HostedFailureClassification;
|
|
16
150
|
message?: string;
|
|
17
151
|
turnStatus?: string;
|
|
18
152
|
};
|
|
@@ -33,6 +167,7 @@ export function hostedGuestErrorResponse(input: {
|
|
|
33
167
|
ok: false,
|
|
34
168
|
error: input.error,
|
|
35
169
|
retry: input.retry,
|
|
170
|
+
classification: hostedFailureClassification(input.error),
|
|
36
171
|
message: input.message,
|
|
37
172
|
turnStatus: input.turnStatus,
|
|
38
173
|
};
|
|
@@ -66,6 +201,30 @@ export type HostedReminderFirePayload = {
|
|
|
66
201
|
fireCount: number;
|
|
67
202
|
};
|
|
68
203
|
|
|
204
|
+
/** Protocol v1 immutable fire descriptor (architecture v2 CP path). */
|
|
205
|
+
export type HostedReminderFireDescriptorPayload = {
|
|
206
|
+
protocolVersion: 1;
|
|
207
|
+
id: string;
|
|
208
|
+
fireCount: number;
|
|
209
|
+
generation: number;
|
|
210
|
+
purpose: string;
|
|
211
|
+
channelId: string;
|
|
212
|
+
continuationToken: string;
|
|
213
|
+
target?: Record<string, unknown>;
|
|
214
|
+
scheduleKind: "every" | "cron" | "delay" | "at";
|
|
215
|
+
scheduleValue: string;
|
|
216
|
+
intervalMs?: number;
|
|
217
|
+
prompt?: string;
|
|
218
|
+
handler?: string;
|
|
219
|
+
args?: Record<string, unknown>;
|
|
220
|
+
hasRunHandler: boolean;
|
|
221
|
+
hasUntilFn: boolean;
|
|
222
|
+
untilPrompt?: string;
|
|
223
|
+
busyPolicy: "skipIfBusy" | "queueBehindTurn";
|
|
224
|
+
nextFireAtMs: number;
|
|
225
|
+
claimedAtMs: number;
|
|
226
|
+
};
|
|
227
|
+
|
|
69
228
|
export type HostedAdmissionManagedAutomation = {
|
|
70
229
|
automationUuid: string;
|
|
71
230
|
mcpServerNames: string[];
|
|
@@ -267,6 +426,234 @@ export function parseHostedReminderFirePayload(
|
|
|
267
426
|
};
|
|
268
427
|
}
|
|
269
428
|
|
|
429
|
+
const HOSTED_REMINDER_FIRE_DESCRIPTOR_KEYS = new Set([
|
|
430
|
+
"protocolVersion",
|
|
431
|
+
"id",
|
|
432
|
+
"fireCount",
|
|
433
|
+
"generation",
|
|
434
|
+
"purpose",
|
|
435
|
+
"channelId",
|
|
436
|
+
"continuationToken",
|
|
437
|
+
"target",
|
|
438
|
+
"scheduleKind",
|
|
439
|
+
"scheduleValue",
|
|
440
|
+
"intervalMs",
|
|
441
|
+
"prompt",
|
|
442
|
+
"handler",
|
|
443
|
+
"args",
|
|
444
|
+
"hasRunHandler",
|
|
445
|
+
"hasUntilFn",
|
|
446
|
+
"untilPrompt",
|
|
447
|
+
"busyPolicy",
|
|
448
|
+
"nextFireAtMs",
|
|
449
|
+
"claimedAtMs",
|
|
450
|
+
]);
|
|
451
|
+
|
|
452
|
+
const HOSTED_REMINDER_SCHEDULE_KINDS = new Set([
|
|
453
|
+
"every",
|
|
454
|
+
"cron",
|
|
455
|
+
"delay",
|
|
456
|
+
"at",
|
|
457
|
+
]);
|
|
458
|
+
const HOSTED_REMINDER_BUSY_POLICIES = new Set([
|
|
459
|
+
"skipIfBusy",
|
|
460
|
+
"queueBehindTurn",
|
|
461
|
+
]);
|
|
462
|
+
|
|
463
|
+
const HOSTED_REMINDER_JSON_MAX_DEPTH = 8;
|
|
464
|
+
|
|
465
|
+
/** Reject non-JSON values (NaN/Infinity/undefined/bigint/function/symbol). */
|
|
466
|
+
function isJsonSafeValue(value: unknown, depth: number): boolean {
|
|
467
|
+
if (depth > HOSTED_REMINDER_JSON_MAX_DEPTH) {
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
if (value === null) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
const type = typeof value;
|
|
474
|
+
if (type === "string" || type === "boolean") {
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
if (type === "number") {
|
|
478
|
+
return Number.isFinite(value);
|
|
479
|
+
}
|
|
480
|
+
if (type !== "object") {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
if (Array.isArray(value)) {
|
|
484
|
+
return value.every((entry) => isJsonSafeValue(entry, depth + 1));
|
|
485
|
+
}
|
|
486
|
+
const proto = Object.getPrototypeOf(value);
|
|
487
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
for (const entry of Object.values(value as Record<string, unknown>)) {
|
|
491
|
+
if (!isJsonSafeValue(entry, depth + 1)) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function parseOptionalJsonObjectField(
|
|
499
|
+
value: unknown,
|
|
500
|
+
maxBytes: number
|
|
501
|
+
): Record<string, unknown> | undefined {
|
|
502
|
+
if (value === undefined) {
|
|
503
|
+
return undefined;
|
|
504
|
+
}
|
|
505
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
506
|
+
return undefined;
|
|
507
|
+
}
|
|
508
|
+
if (!isJsonSafeValue(value, 0)) {
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
try {
|
|
512
|
+
const encoded = JSON.stringify(value);
|
|
513
|
+
if (
|
|
514
|
+
encoded === undefined ||
|
|
515
|
+
Buffer.byteLength(encoded, "utf8") > maxBytes
|
|
516
|
+
) {
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
const roundTrip = JSON.parse(encoded) as unknown;
|
|
520
|
+
if (
|
|
521
|
+
typeof roundTrip !== "object" ||
|
|
522
|
+
roundTrip === null ||
|
|
523
|
+
Array.isArray(roundTrip)
|
|
524
|
+
) {
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
return roundTrip as Record<string, unknown>;
|
|
528
|
+
} catch {
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Parse the immutable CP fire descriptor. Rejects unknown keys, non-enum
|
|
535
|
+
* schedule/busy values, and non-JSON-safe optional object fields.
|
|
536
|
+
*/
|
|
537
|
+
export function parseHostedReminderFireDescriptorPayload(
|
|
538
|
+
value: unknown
|
|
539
|
+
): HostedReminderFireDescriptorPayload | undefined {
|
|
540
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
const body = value as Record<string, unknown>;
|
|
544
|
+
if (
|
|
545
|
+
Object.keys(body).some(
|
|
546
|
+
(key) => !HOSTED_REMINDER_FIRE_DESCRIPTOR_KEYS.has(key)
|
|
547
|
+
)
|
|
548
|
+
) {
|
|
549
|
+
return undefined;
|
|
550
|
+
}
|
|
551
|
+
if (
|
|
552
|
+
body.protocolVersion !== 1 ||
|
|
553
|
+
typeof body.id !== "string" ||
|
|
554
|
+
body.id.length === 0 ||
|
|
555
|
+
body.id.length > 128 ||
|
|
556
|
+
typeof body.fireCount !== "number" ||
|
|
557
|
+
!Number.isInteger(body.fireCount) ||
|
|
558
|
+
body.fireCount < 0 ||
|
|
559
|
+
typeof body.generation !== "number" ||
|
|
560
|
+
!Number.isInteger(body.generation) ||
|
|
561
|
+
body.generation < 0 ||
|
|
562
|
+
typeof body.purpose !== "string" ||
|
|
563
|
+
body.purpose.length === 0 ||
|
|
564
|
+
body.purpose.length > 512 ||
|
|
565
|
+
typeof body.channelId !== "string" ||
|
|
566
|
+
body.channelId.length === 0 ||
|
|
567
|
+
body.channelId.length > 128 ||
|
|
568
|
+
typeof body.continuationToken !== "string" ||
|
|
569
|
+
body.continuationToken.length === 0 ||
|
|
570
|
+
body.continuationToken.length > 512 ||
|
|
571
|
+
typeof body.scheduleKind !== "string" ||
|
|
572
|
+
!HOSTED_REMINDER_SCHEDULE_KINDS.has(body.scheduleKind) ||
|
|
573
|
+
typeof body.scheduleValue !== "string" ||
|
|
574
|
+
body.scheduleValue.length === 0 ||
|
|
575
|
+
body.scheduleValue.length > 512 ||
|
|
576
|
+
typeof body.hasRunHandler !== "boolean" ||
|
|
577
|
+
typeof body.hasUntilFn !== "boolean" ||
|
|
578
|
+
typeof body.busyPolicy !== "string" ||
|
|
579
|
+
!HOSTED_REMINDER_BUSY_POLICIES.has(body.busyPolicy) ||
|
|
580
|
+
typeof body.nextFireAtMs !== "number" ||
|
|
581
|
+
!Number.isFinite(body.nextFireAtMs) ||
|
|
582
|
+
typeof body.claimedAtMs !== "number" ||
|
|
583
|
+
!Number.isFinite(body.claimedAtMs) ||
|
|
584
|
+
!Number.isInteger(body.claimedAtMs) ||
|
|
585
|
+
body.claimedAtMs < 0
|
|
586
|
+
) {
|
|
587
|
+
return undefined;
|
|
588
|
+
}
|
|
589
|
+
if (body.intervalMs !== undefined) {
|
|
590
|
+
if (
|
|
591
|
+
typeof body.intervalMs !== "number" ||
|
|
592
|
+
!Number.isFinite(body.intervalMs) ||
|
|
593
|
+
!Number.isInteger(body.intervalMs) ||
|
|
594
|
+
body.intervalMs <= 0
|
|
595
|
+
) {
|
|
596
|
+
return undefined;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (body.prompt !== undefined) {
|
|
600
|
+
if (typeof body.prompt !== "string" || body.prompt.length > 8192) {
|
|
601
|
+
return undefined;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (body.handler !== undefined) {
|
|
605
|
+
if (
|
|
606
|
+
typeof body.handler !== "string" ||
|
|
607
|
+
body.handler.length === 0 ||
|
|
608
|
+
body.handler.length > 128
|
|
609
|
+
) {
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
if (body.untilPrompt !== undefined) {
|
|
614
|
+
if (
|
|
615
|
+
typeof body.untilPrompt !== "string" ||
|
|
616
|
+
body.untilPrompt.length > 8192
|
|
617
|
+
) {
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const target = parseOptionalJsonObjectField(body.target, 16 * 1024);
|
|
622
|
+
if (body.target !== undefined && target === undefined) {
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
const args = parseOptionalJsonObjectField(body.args, 32 * 1024);
|
|
626
|
+
if (body.args !== undefined && args === undefined) {
|
|
627
|
+
return undefined;
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
protocolVersion: 1,
|
|
631
|
+
id: body.id,
|
|
632
|
+
fireCount: body.fireCount,
|
|
633
|
+
generation: body.generation,
|
|
634
|
+
purpose: body.purpose,
|
|
635
|
+
channelId: body.channelId,
|
|
636
|
+
continuationToken: body.continuationToken,
|
|
637
|
+
...(target === undefined ? {} : { target }),
|
|
638
|
+
scheduleKind:
|
|
639
|
+
body.scheduleKind as HostedReminderFireDescriptorPayload["scheduleKind"],
|
|
640
|
+
scheduleValue: body.scheduleValue,
|
|
641
|
+
...(body.intervalMs === undefined ? {} : { intervalMs: body.intervalMs }),
|
|
642
|
+
...(body.prompt === undefined ? {} : { prompt: body.prompt }),
|
|
643
|
+
...(body.handler === undefined ? {} : { handler: body.handler }),
|
|
644
|
+
...(args === undefined ? {} : { args }),
|
|
645
|
+
hasRunHandler: body.hasRunHandler,
|
|
646
|
+
hasUntilFn: body.hasUntilFn,
|
|
647
|
+
...(body.untilPrompt === undefined
|
|
648
|
+
? {}
|
|
649
|
+
: { untilPrompt: body.untilPrompt }),
|
|
650
|
+
busyPolicy:
|
|
651
|
+
body.busyPolicy as HostedReminderFireDescriptorPayload["busyPolicy"],
|
|
652
|
+
nextFireAtMs: body.nextFireAtMs,
|
|
653
|
+
claimedAtMs: body.claimedAtMs,
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
|
|
270
657
|
export function parseHostedAdmissionOutcome(
|
|
271
658
|
value: unknown
|
|
272
659
|
): HostedAdmissionOutcome | undefined {
|