@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
package/src/bin/agent-serve.ts
CHANGED
|
@@ -99,6 +99,7 @@ Usage:
|
|
|
99
99
|
${CLI} session <sessionId> [--url <baseUrl> | --prod]
|
|
100
100
|
[--json | --text | --events] [--out <file.ndjson>]
|
|
101
101
|
[--slug <slug>] [--team <id>] [--dir <path>]
|
|
102
|
+
or: --prod [<sessionId>] --slug <slug> --message "…" [--dry-run] [--as-of <instant>]
|
|
102
103
|
${CLI} cost [sessionId] [--url <baseUrl> | --prod] [--json]
|
|
103
104
|
[--slug <slug>] [--team <id>] [--dir <path>]
|
|
104
105
|
${CLI} playground [--url <baseUrl> | --prod] [--session <id>] [--print]
|
|
@@ -108,6 +109,7 @@ Usage:
|
|
|
108
109
|
[--session <id>] [--continuation-token <t>]
|
|
109
110
|
[--events <file.ndjson>] [--no-events] [--text]
|
|
110
111
|
[--timeout-ms <n>] [--no-stream] [--slug <slug>] [--team <id>]
|
|
112
|
+
[--dry-run] [--as-of <instant>]
|
|
111
113
|
${CLI} trajectory --events <file.ndjson> [--text]
|
|
112
114
|
${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
|
|
113
115
|
[--session <id>] [--slug <slug>] [--team <id>]
|
|
@@ -197,6 +199,10 @@ Commands:
|
|
|
197
199
|
Writes a single events.ndjson trace (summarize with trajectory).
|
|
198
200
|
Streams tool calls and reply text to stderr when stderr is a TTY.
|
|
199
201
|
Pass --prod to hit the hosted deployment instead of a local server.
|
|
202
|
+
On an AgentSDK v2 slug, --prod starts a hosted session through
|
|
203
|
+
the control plane (Temporal, no resident engine); --session
|
|
204
|
+
ses_… resumes that exact session. A 404 falls back to the v1
|
|
205
|
+
engine alias.
|
|
200
206
|
trajectory Summarize an events.ndjson file into a trajectory.
|
|
201
207
|
call Call an authored server tool deterministically (no model turn)
|
|
202
208
|
via POST /v1/tools/:toolName. --session runs it inside an
|
|
@@ -311,8 +317,11 @@ Options:
|
|
|
311
317
|
ALB/ECS checks; use single when one agent is the whole host.
|
|
312
318
|
--dev Dev mode: mounts POST /v1/dev/schedules/:scheduleId and
|
|
313
319
|
disables the cron runner (dispatch schedules by hand).
|
|
314
|
-
--api-key Cursor API key (defaults to CURSOR_API_KEY, then
|
|
315
|
-
|
|
320
|
+
--api-key Cursor API key (defaults to CURSOR_API_KEY, then
|
|
321
|
+
CURSOR_API_KEY_FILE — hosted default
|
|
322
|
+
/run/cursor/secrets/CURSOR_API_KEY when unset —
|
|
323
|
+
then CURSOR_SERVICE_ACCOUNT_KEY, then the stored
|
|
324
|
+
\`${CLI} login\` credential).
|
|
316
325
|
--key-name login: label for the minted API key (defaults to
|
|
317
326
|
"${CLI} (<hostname>)").
|
|
318
327
|
--state-root Durable state directory (default <dir>/.agent-serve). Put it
|
|
@@ -361,6 +370,9 @@ Options:
|
|
|
361
370
|
--dir basename. Mutually exclusive with --url. Requires
|
|
362
371
|
\`${CLI} login\`. For eval, this is how you opt into the
|
|
363
372
|
persisted server-side batch (default is local).
|
|
373
|
+
--dry-run run/session --prod: mark the hosted v2 turn non-mutating.
|
|
374
|
+
--as-of run/session --prod: freeze the session clock at this
|
|
375
|
+
timezone-bearing ISO-8601 instant.
|
|
364
376
|
--once logs: print current progress / log buffer once and exit
|
|
365
377
|
(default is to follow).
|
|
366
378
|
--print playground/docs: print the URL only; do not open a
|
|
@@ -571,6 +583,7 @@ async function main(argv: string[]): Promise<number> {
|
|
|
571
583
|
context: { type: "string" },
|
|
572
584
|
comment: { type: "string" },
|
|
573
585
|
"dry-run": { type: "boolean", default: false },
|
|
586
|
+
"as-of": { type: "string" },
|
|
574
587
|
out: { type: "string" },
|
|
575
588
|
team: { type: "string" },
|
|
576
589
|
"no-wait": { type: "boolean", default: false },
|
|
@@ -914,6 +927,8 @@ async function main(argv: string[]): Promise<number> {
|
|
|
914
927
|
stateRoot: values["state-root"],
|
|
915
928
|
timeoutMs: parseTimeoutMs(values["timeout-ms"]),
|
|
916
929
|
stream: values["no-stream"] ? false : undefined,
|
|
930
|
+
dryRun: values["dry-run"],
|
|
931
|
+
asOf: values["as-of"],
|
|
917
932
|
})
|
|
918
933
|
);
|
|
919
934
|
}
|
|
@@ -1094,6 +1109,10 @@ async function main(argv: string[]): Promise<number> {
|
|
|
1094
1109
|
}
|
|
1095
1110
|
|
|
1096
1111
|
case "session": {
|
|
1112
|
+
const messages = await loadMessages(
|
|
1113
|
+
values.message,
|
|
1114
|
+
values["messages-file"]
|
|
1115
|
+
);
|
|
1097
1116
|
return cmdSession(
|
|
1098
1117
|
positionals[0],
|
|
1099
1118
|
axFromOptions({
|
|
@@ -1108,6 +1127,10 @@ async function main(argv: string[]): Promise<number> {
|
|
|
1108
1127
|
text: values.text,
|
|
1109
1128
|
rawEvents: values["raw-events"],
|
|
1110
1129
|
out: values.out,
|
|
1130
|
+
messages,
|
|
1131
|
+
sessionId: values["session-id"] ?? values.session,
|
|
1132
|
+
dryRun: values["dry-run"],
|
|
1133
|
+
asOf: values["as-of"],
|
|
1111
1134
|
})
|
|
1112
1135
|
);
|
|
1113
1136
|
}
|
|
@@ -1488,6 +1511,8 @@ function axFromOptions(
|
|
|
1488
1511
|
sessionId: partial.sessionId,
|
|
1489
1512
|
resume: partial.resume,
|
|
1490
1513
|
continuationToken: partial.continuationToken,
|
|
1514
|
+
dryRun: partial.dryRun,
|
|
1515
|
+
asOf: partial.asOf,
|
|
1491
1516
|
timeoutMs: partial.timeoutMs,
|
|
1492
1517
|
events: partial.events,
|
|
1493
1518
|
text: partial.text,
|
|
@@ -290,6 +290,8 @@ export interface BitbucketApiPullRequest {
|
|
|
290
290
|
title?: string;
|
|
291
291
|
description?: string;
|
|
292
292
|
state?: string;
|
|
293
|
+
draft?: boolean;
|
|
294
|
+
authorUsername?: string;
|
|
293
295
|
sourceBranch?: string;
|
|
294
296
|
targetBranch?: string;
|
|
295
297
|
headSha?: string;
|
|
@@ -298,6 +300,20 @@ export interface BitbucketApiPullRequest {
|
|
|
298
300
|
raw: unknown;
|
|
299
301
|
}
|
|
300
302
|
|
|
303
|
+
export interface BitbucketApiChangedFile {
|
|
304
|
+
path: string;
|
|
305
|
+
previousPath?: string;
|
|
306
|
+
status: "added" | "modified" | "removed" | "renamed";
|
|
307
|
+
patch?: string;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface BitbucketPullRequestDiffInput {
|
|
311
|
+
headSha?: string;
|
|
312
|
+
baseSha?: string;
|
|
313
|
+
mergeBaseSha?: string;
|
|
314
|
+
mergeBaseResolved?: boolean;
|
|
315
|
+
}
|
|
316
|
+
|
|
301
317
|
/**
|
|
302
318
|
* The handful of operations review products need, implemented once per
|
|
303
319
|
* dialect. `ctx.bitbucket.api` is the repo-bound instance.
|
|
@@ -318,6 +334,30 @@ export interface BitbucketApi {
|
|
|
318
334
|
getFileAtRef(path: string, ref: string): Promise<string>;
|
|
319
335
|
}
|
|
320
336
|
|
|
337
|
+
export interface BitbucketPullRequestReadApi {
|
|
338
|
+
getPullRequest(id: number): Promise<BitbucketApiPullRequest>;
|
|
339
|
+
getMergeBaseSha(
|
|
340
|
+
id: number,
|
|
341
|
+
base: string,
|
|
342
|
+
headSha: string
|
|
343
|
+
): Promise<string | undefined>;
|
|
344
|
+
listChangedFiles(
|
|
345
|
+
id: number,
|
|
346
|
+
input?: BitbucketPullRequestDiffInput
|
|
347
|
+
): Promise<BitbucketApiChangedFile[]>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface BitbucketPullRequestReadClient {
|
|
351
|
+
readonly repository: BitbucketRepositoryRef;
|
|
352
|
+
readonly api: Pick<BitbucketApi, "getPullRequest" | "getPullRequestDiff">;
|
|
353
|
+
request<T = unknown>(input: BitbucketRequestInput): Promise<T>;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export type BitbucketPullRequestReadDiagnostic =
|
|
357
|
+
| { kind: "commit-expansion-failed"; sha: string; error: unknown }
|
|
358
|
+
| { kind: "diff-fallback"; status: number }
|
|
359
|
+
| { kind: "metadata-fallback"; status: number };
|
|
360
|
+
|
|
321
361
|
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
322
362
|
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
323
363
|
? (value as Record<string, unknown>)
|
|
@@ -334,6 +374,111 @@ function num(value: unknown): number | undefined {
|
|
|
334
374
|
: undefined;
|
|
335
375
|
}
|
|
336
376
|
|
|
377
|
+
function errorStatus(error: unknown): number | undefined {
|
|
378
|
+
return num(asRecord(error)?.status);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function bitbucketAuthorUsername(raw: unknown): string | undefined {
|
|
382
|
+
const author = asRecord(asRecord(raw)?.author);
|
|
383
|
+
const user = asRecord(author?.user);
|
|
384
|
+
return (
|
|
385
|
+
str(author?.nickname) ??
|
|
386
|
+
str(user?.name) ??
|
|
387
|
+
str(user?.slug) ??
|
|
388
|
+
str(author?.display_name) ??
|
|
389
|
+
str(user?.displayName)
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const GIT_PATH_ESCAPES: Readonly<Record<string, string>> = {
|
|
394
|
+
a: "\u0007",
|
|
395
|
+
b: "\b",
|
|
396
|
+
f: "\f",
|
|
397
|
+
n: "\n",
|
|
398
|
+
r: "\r",
|
|
399
|
+
t: "\t",
|
|
400
|
+
v: "\v",
|
|
401
|
+
"\\": "\\",
|
|
402
|
+
'"': '"',
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
function unescapeGitPath(path: string, quoted: boolean): string {
|
|
406
|
+
if (!quoted) {
|
|
407
|
+
return path;
|
|
408
|
+
}
|
|
409
|
+
const bytes: number[] = [];
|
|
410
|
+
let output = "";
|
|
411
|
+
const flush = () => {
|
|
412
|
+
if (bytes.length > 0) {
|
|
413
|
+
output += Buffer.from(bytes).toString("utf8");
|
|
414
|
+
bytes.length = 0;
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
for (let index = 0; index < path.length; index += 1) {
|
|
418
|
+
const character = path[index] as string;
|
|
419
|
+
if (character !== "\\") {
|
|
420
|
+
flush();
|
|
421
|
+
output += character;
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
const octal = /^[0-7]{1,3}/.exec(path.slice(index + 1));
|
|
425
|
+
if (octal !== null) {
|
|
426
|
+
bytes.push(Number.parseInt(octal[0], 8));
|
|
427
|
+
index += octal[0].length;
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
flush();
|
|
431
|
+
const next = path[index + 1] ?? "";
|
|
432
|
+
output += GIT_PATH_ESCAPES[next] ?? next;
|
|
433
|
+
index += 1;
|
|
434
|
+
}
|
|
435
|
+
flush();
|
|
436
|
+
return output;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/** Split a Git-style unified diff into normalized changed files. */
|
|
440
|
+
export function splitBitbucketUnifiedDiff(
|
|
441
|
+
diff: string
|
|
442
|
+
): BitbucketApiChangedFile[] {
|
|
443
|
+
const files: BitbucketApiChangedFile[] = [];
|
|
444
|
+
const sections = diff.split(/^(?=diff --git )/m).filter(Boolean);
|
|
445
|
+
for (const section of sections) {
|
|
446
|
+
const lines = section.replace(/\n$/, "").split("\n");
|
|
447
|
+
const header = /^diff --git ("?)a\/(.+?)\1 ("?)b\/(.+?)\3$/.exec(
|
|
448
|
+
lines[0] ?? ""
|
|
449
|
+
);
|
|
450
|
+
if (header === null) {
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
const oldPath = unescapeGitPath(header[2] ?? "", header[1] !== "");
|
|
454
|
+
const newPath = unescapeGitPath(header[4] ?? "", header[3] !== "");
|
|
455
|
+
let status: BitbucketApiChangedFile["status"] = "modified";
|
|
456
|
+
let bodyStart = 1;
|
|
457
|
+
for (; bodyStart < lines.length; bodyStart += 1) {
|
|
458
|
+
const line = lines[bodyStart] ?? "";
|
|
459
|
+
if (line.startsWith("@@")) {
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
if (line === "--- /dev/null") {
|
|
463
|
+
status = "added";
|
|
464
|
+
} else if (line === "+++ /dev/null") {
|
|
465
|
+
status = "removed";
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (status === "modified" && oldPath !== newPath) {
|
|
469
|
+
status = "renamed";
|
|
470
|
+
}
|
|
471
|
+
const patch = lines.slice(bodyStart).join("\n");
|
|
472
|
+
files.push({
|
|
473
|
+
path: newPath,
|
|
474
|
+
previousPath: status === "renamed" ? oldPath : undefined,
|
|
475
|
+
status,
|
|
476
|
+
patch: patch === "" ? undefined : patch,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
return files;
|
|
480
|
+
}
|
|
481
|
+
|
|
337
482
|
function encodePath(path: string): string {
|
|
338
483
|
return path
|
|
339
484
|
.split("/")
|
|
@@ -367,6 +512,202 @@ export function bitbucketDataCenterRepoPath(repository: {
|
|
|
367
512
|
return `/projects/${encodeURIComponent(repository.owner)}/repos/${encodeURIComponent(repository.slug)}`;
|
|
368
513
|
}
|
|
369
514
|
|
|
515
|
+
export async function expandBitbucketCloudCommitSha(
|
|
516
|
+
bitbucket: Pick<BitbucketClient, "request">,
|
|
517
|
+
repository: Pick<BitbucketRepositoryRef, "owner" | "slug">,
|
|
518
|
+
sha: string | undefined,
|
|
519
|
+
onError?: (error: unknown) => void
|
|
520
|
+
): Promise<string | undefined> {
|
|
521
|
+
if (sha === undefined || !/^[0-9a-f]{7,39}$/i.test(sha)) {
|
|
522
|
+
return sha;
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
const commit = await bitbucket.request<{ hash?: string }>({
|
|
526
|
+
method: "GET",
|
|
527
|
+
path: `${bitbucketCloudRepoPath(repository)}/commit/${encodeURIComponent(sha)}`,
|
|
528
|
+
});
|
|
529
|
+
return /^[0-9a-f]{40}$/i.test(commit.hash ?? "") ? commit.hash : sha;
|
|
530
|
+
} catch (error) {
|
|
531
|
+
onError?.(error);
|
|
532
|
+
return sha;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function bitbucketPullRequestFromRaw(
|
|
537
|
+
raw: Record<string, unknown>,
|
|
538
|
+
id: number,
|
|
539
|
+
htmlUrl?: string
|
|
540
|
+
): BitbucketApiPullRequest {
|
|
541
|
+
const source = asRecord(raw.source);
|
|
542
|
+
const destination = asRecord(raw.destination);
|
|
543
|
+
return {
|
|
544
|
+
id,
|
|
545
|
+
title: str(raw.title),
|
|
546
|
+
description: str(raw.description),
|
|
547
|
+
state: str(raw.state),
|
|
548
|
+
draft: typeof raw.draft === "boolean" ? raw.draft : undefined,
|
|
549
|
+
authorUsername: bitbucketAuthorUsername(raw),
|
|
550
|
+
sourceBranch:
|
|
551
|
+
str(asRecord(source?.branch)?.name) ??
|
|
552
|
+
str(asRecord(raw.fromRef)?.displayId),
|
|
553
|
+
targetBranch:
|
|
554
|
+
str(asRecord(destination?.branch)?.name) ??
|
|
555
|
+
str(asRecord(raw.toRef)?.displayId),
|
|
556
|
+
headSha:
|
|
557
|
+
str(asRecord(source?.commit)?.hash) ??
|
|
558
|
+
str(asRecord(raw.fromRef)?.latestCommit),
|
|
559
|
+
baseSha:
|
|
560
|
+
str(asRecord(destination?.commit)?.hash) ??
|
|
561
|
+
str(asRecord(raw.toRef)?.latestCommit),
|
|
562
|
+
htmlUrl,
|
|
563
|
+
raw,
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export function createBitbucketPullRequestReadApi(
|
|
568
|
+
bitbucket: BitbucketPullRequestReadClient,
|
|
569
|
+
options: {
|
|
570
|
+
onDiagnostic?: (diagnostic: BitbucketPullRequestReadDiagnostic) => void;
|
|
571
|
+
} = {}
|
|
572
|
+
): BitbucketPullRequestReadApi {
|
|
573
|
+
const { repository } = bitbucket;
|
|
574
|
+
const repo =
|
|
575
|
+
repository.dialect === "cloud"
|
|
576
|
+
? bitbucketCloudRepoPath(repository)
|
|
577
|
+
: bitbucketDataCenterRepoPath(repository);
|
|
578
|
+
const cloudPullRequestFromActivity = async (
|
|
579
|
+
id: number
|
|
580
|
+
): Promise<BitbucketApiPullRequest | undefined> => {
|
|
581
|
+
let path = `${repo}/pullrequests/${id}/activity`;
|
|
582
|
+
let query: Record<string, string | number> | undefined = { pagelen: 50 };
|
|
583
|
+
for (let page = 0; page < 20; page += 1) {
|
|
584
|
+
const response = await bitbucket.request<Record<string, unknown>>({
|
|
585
|
+
method: "GET",
|
|
586
|
+
path,
|
|
587
|
+
query,
|
|
588
|
+
});
|
|
589
|
+
for (const value of Array.isArray(response.values)
|
|
590
|
+
? response.values
|
|
591
|
+
: []) {
|
|
592
|
+
const update = asRecord(asRecord(value)?.update);
|
|
593
|
+
if (update !== undefined) {
|
|
594
|
+
return bitbucketPullRequestFromRaw(update, id);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const next = str(response.next);
|
|
598
|
+
if (next === undefined) {
|
|
599
|
+
return undefined;
|
|
600
|
+
}
|
|
601
|
+
const nextUrl = new URL(next);
|
|
602
|
+
const marker = nextUrl.pathname.indexOf("/repositories/");
|
|
603
|
+
path = marker === -1 ? nextUrl.pathname : nextUrl.pathname.slice(marker);
|
|
604
|
+
query = Object.fromEntries(nextUrl.searchParams.entries());
|
|
605
|
+
}
|
|
606
|
+
return undefined;
|
|
607
|
+
};
|
|
608
|
+
return {
|
|
609
|
+
async getPullRequest(id) {
|
|
610
|
+
let pullRequest: BitbucketApiPullRequest;
|
|
611
|
+
try {
|
|
612
|
+
pullRequest = await bitbucket.api.getPullRequest(id);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
const status = errorStatus(error);
|
|
615
|
+
if (
|
|
616
|
+
repository.dialect !== "cloud" ||
|
|
617
|
+
status === undefined ||
|
|
618
|
+
status < 500
|
|
619
|
+
) {
|
|
620
|
+
throw error;
|
|
621
|
+
}
|
|
622
|
+
options.onDiagnostic?.({ kind: "metadata-fallback", status });
|
|
623
|
+
const fallback = await cloudPullRequestFromActivity(id);
|
|
624
|
+
if (fallback === undefined) {
|
|
625
|
+
throw error;
|
|
626
|
+
}
|
|
627
|
+
pullRequest = fallback;
|
|
628
|
+
}
|
|
629
|
+
const normalized = {
|
|
630
|
+
...pullRequest,
|
|
631
|
+
draft: asRecord(pullRequest.raw)?.draft === true,
|
|
632
|
+
authorUsername: bitbucketAuthorUsername(pullRequest.raw),
|
|
633
|
+
};
|
|
634
|
+
if (repository.dialect !== "cloud") {
|
|
635
|
+
return normalized;
|
|
636
|
+
}
|
|
637
|
+
const [headSha, baseSha] = await Promise.all([
|
|
638
|
+
expandBitbucketCloudCommitSha(
|
|
639
|
+
bitbucket,
|
|
640
|
+
repository,
|
|
641
|
+
pullRequest.headSha,
|
|
642
|
+
(error) =>
|
|
643
|
+
pullRequest.headSha === undefined
|
|
644
|
+
? undefined
|
|
645
|
+
: options.onDiagnostic?.({
|
|
646
|
+
kind: "commit-expansion-failed",
|
|
647
|
+
sha: pullRequest.headSha,
|
|
648
|
+
error,
|
|
649
|
+
})
|
|
650
|
+
),
|
|
651
|
+
expandBitbucketCloudCommitSha(
|
|
652
|
+
bitbucket,
|
|
653
|
+
repository,
|
|
654
|
+
pullRequest.baseSha,
|
|
655
|
+
(error) =>
|
|
656
|
+
pullRequest.baseSha === undefined
|
|
657
|
+
? undefined
|
|
658
|
+
: options.onDiagnostic?.({
|
|
659
|
+
kind: "commit-expansion-failed",
|
|
660
|
+
sha: pullRequest.baseSha,
|
|
661
|
+
error,
|
|
662
|
+
})
|
|
663
|
+
),
|
|
664
|
+
]);
|
|
665
|
+
return { ...normalized, headSha, baseSha };
|
|
666
|
+
},
|
|
667
|
+
async getMergeBaseSha(id, base, headSha) {
|
|
668
|
+
if (repository.dialect === "cloud") {
|
|
669
|
+
const commit = await bitbucket.request<{ hash?: string }>({
|
|
670
|
+
method: "GET",
|
|
671
|
+
path: `${repo}/merge-base/${encodeURIComponent(headSha)}..${encodeURIComponent(base)}`,
|
|
672
|
+
});
|
|
673
|
+
return str(commit.hash);
|
|
674
|
+
}
|
|
675
|
+
const commit = await bitbucket.request<{ id?: string }>({
|
|
676
|
+
method: "GET",
|
|
677
|
+
path: `${repo}/pull-requests/${id}/merge-base`,
|
|
678
|
+
});
|
|
679
|
+
return str(commit.id);
|
|
680
|
+
},
|
|
681
|
+
async listChangedFiles(id, input) {
|
|
682
|
+
try {
|
|
683
|
+
return splitBitbucketUnifiedDiff(
|
|
684
|
+
await bitbucket.api.getPullRequestDiff(id)
|
|
685
|
+
);
|
|
686
|
+
} catch (error) {
|
|
687
|
+
const status = errorStatus(error);
|
|
688
|
+
const comparisonBase = input?.mergeBaseSha ?? input?.baseSha;
|
|
689
|
+
if (
|
|
690
|
+
repository.dialect !== "cloud" ||
|
|
691
|
+
status === undefined ||
|
|
692
|
+
status < 500 ||
|
|
693
|
+
input?.headSha === undefined ||
|
|
694
|
+
comparisonBase === undefined
|
|
695
|
+
) {
|
|
696
|
+
throw error;
|
|
697
|
+
}
|
|
698
|
+
options.onDiagnostic?.({ kind: "diff-fallback", status });
|
|
699
|
+
const diff = await bitbucket.request<string>({
|
|
700
|
+
method: "GET",
|
|
701
|
+
path: `${repo}/diff/${encodeURIComponent(input.headSha)}..${encodeURIComponent(comparisonBase)}`,
|
|
702
|
+
query: { topic: input.mergeBaseResolved === true ? "false" : "true" },
|
|
703
|
+
accept: "text/plain",
|
|
704
|
+
});
|
|
705
|
+
return splitBitbucketUnifiedDiff(diff);
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
|
|
370
711
|
export function cloudBitbucketApi(
|
|
371
712
|
client: BitbucketClient,
|
|
372
713
|
repository: BitbucketRepositoryRef
|
|
@@ -265,6 +265,31 @@ export function bitbucketPullRequestUrl(
|
|
|
265
265
|
: `${repository.htmlUrl.replace(/\/browse\/?$/, "")}/pull-requests/${id}`;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
/** Absolute PR URL, or undefined when a Data Center payload has no repo URL. */
|
|
269
|
+
export function bitbucketAbsolutePullRequestUrl(
|
|
270
|
+
repository: BitbucketRepositoryRef,
|
|
271
|
+
id: number,
|
|
272
|
+
explicit?: string
|
|
273
|
+
): string | undefined {
|
|
274
|
+
if (explicit !== undefined) {
|
|
275
|
+
return explicit;
|
|
276
|
+
}
|
|
277
|
+
if (repository.dialect === "cloud") {
|
|
278
|
+
return `https://bitbucket.org/${repository.fullName}/pull-requests/${id}`;
|
|
279
|
+
}
|
|
280
|
+
return repository.htmlUrl === undefined
|
|
281
|
+
? undefined
|
|
282
|
+
: `${repository.htmlUrl.replace(/\/+$/, "").replace(/\/browse$/, "")}/pull-requests/${id}`;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Whether a Data Center `updated` payload publishes a draft pull request. */
|
|
286
|
+
export function bitbucketDraftMarkedReady(
|
|
287
|
+
payload: Record<string, unknown>,
|
|
288
|
+
draft: boolean | undefined
|
|
289
|
+
): boolean {
|
|
290
|
+
return payload.previousDraft === true && draft === false;
|
|
291
|
+
}
|
|
292
|
+
|
|
268
293
|
/**
|
|
269
294
|
* Normalize the pull request from either dialect. `action` is the suffix of
|
|
270
295
|
* the Cloud-normalized event key (`pullrequest:created` → `created`).
|
|
@@ -24,8 +24,10 @@
|
|
|
24
24
|
export * from "./api.js";
|
|
25
25
|
export {
|
|
26
26
|
type BitbucketHandle,
|
|
27
|
+
bitbucketAbsolutePullRequestUrl,
|
|
27
28
|
bitbucketCommentFromPayload,
|
|
28
29
|
bitbucketDialectOf,
|
|
30
|
+
bitbucketDraftMarkedReady,
|
|
29
31
|
bitbucketPullRequestFromPayload,
|
|
30
32
|
bitbucketPullRequestUrl,
|
|
31
33
|
bitbucketPushFromPayload,
|
|
@@ -831,11 +831,9 @@ async function handlePullRequest(input: {
|
|
|
831
831
|
dispatch.message ?? defaultGitHubPullRequestMessage(ctx, pullRequest),
|
|
832
832
|
...(dispatch.context ?? []),
|
|
833
833
|
].join("\n");
|
|
834
|
-
const cloud =
|
|
835
|
-
|
|
836
|
-
ctx,
|
|
837
|
-
pullRequest
|
|
838
|
-
);
|
|
834
|
+
const cloud =
|
|
835
|
+
dispatch.cloud ??
|
|
836
|
+
(await resolveCloudOptions(input.options.cloud, ctx, pullRequest));
|
|
839
837
|
return startTurn({
|
|
840
838
|
options: input.options,
|
|
841
839
|
args: input.args,
|
|
@@ -1558,6 +1556,8 @@ async function startTurn(input: {
|
|
|
1558
1556
|
}): Promise<Response> {
|
|
1559
1557
|
const files = input.dispatch.workspaceFiles;
|
|
1560
1558
|
const lazy = typeof files === "function";
|
|
1559
|
+
const cloud = input.dispatch.cloud ?? input.cloud;
|
|
1560
|
+
const state = { ...input.dispatch.state, ...input.state };
|
|
1561
1561
|
|
|
1562
1562
|
const sendTurn = async () => {
|
|
1563
1563
|
const workspaceFiles = lazy ? await files() : files;
|
|
@@ -1568,11 +1568,11 @@ async function startTurn(input: {
|
|
|
1568
1568
|
? { continuationToken: githubContinuationKey(input.ctx) }
|
|
1569
1569
|
: {}),
|
|
1570
1570
|
title: input.dispatch.title ?? defaultGitHubTitle(input.ctx),
|
|
1571
|
-
|
|
1571
|
+
cloud,
|
|
1572
1572
|
...(workspaceFiles === undefined ? {} : { workspaceFiles }),
|
|
1573
|
-
state:
|
|
1573
|
+
state: state as unknown as JsonValue,
|
|
1574
1574
|
// Resume must refresh headSha / refs without wiping sticky banner id.
|
|
1575
|
-
refreshState:
|
|
1575
|
+
refreshState: state as unknown as JsonValue,
|
|
1576
1576
|
});
|
|
1577
1577
|
};
|
|
1578
1578
|
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ChannelEventHandlers,
|
|
8
8
|
ChannelStartArgs,
|
|
9
9
|
HostContext,
|
|
10
|
+
JsonObject,
|
|
10
11
|
SendMessageFn,
|
|
11
12
|
SendMessageOptions,
|
|
12
13
|
} from "../../types.js";
|
|
@@ -355,6 +356,10 @@ export interface GitHubTurnDispatch {
|
|
|
355
356
|
message?: string;
|
|
356
357
|
/** Optional session title override. */
|
|
357
358
|
title?: string;
|
|
359
|
+
/** Per-turn cloud options. Overrides the channel-level `cloud` resolver. */
|
|
360
|
+
cloud?: AgentCloudOptions;
|
|
361
|
+
/** Extra durable channel state. Provider-owned fields take precedence. */
|
|
362
|
+
state?: JsonObject;
|
|
358
363
|
/**
|
|
359
364
|
* Seeded into the session workspace before the turn (`send`'s
|
|
360
365
|
* `workspaceFiles`). A function runs after the webhook is
|