@cursor/july 0.1.102 → 0.1.103
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 +34 -32
- package/README.md +10 -12
- package/dist/ab.d.ts +1 -1
- package/dist/ab.js +1 -1
- package/dist/bin/agent-serve.d.ts +12 -12
- package/dist/bin/agent-serve.js +114 -36
- package/dist/channels/bitbucket/api.d.ts +176 -0
- package/dist/channels/bitbucket/api.d.ts.map +1 -0
- package/dist/channels/bitbucket/api.js +419 -0
- package/dist/channels/bitbucket/binding.d.ts +71 -0
- package/dist/channels/bitbucket/binding.d.ts.map +1 -0
- package/dist/channels/bitbucket/binding.js +269 -0
- package/dist/channels/bitbucket/bitbucket-channel.d.ts +33 -0
- package/dist/channels/bitbucket/bitbucket-channel.d.ts.map +1 -0
- package/dist/channels/bitbucket/bitbucket-channel.js +120 -0
- package/dist/channels/bitbucket/bitbucket-webhook.d.ts +61 -0
- package/dist/channels/bitbucket/bitbucket-webhook.d.ts.map +1 -0
- package/dist/channels/bitbucket/bitbucket-webhook.js +394 -0
- package/dist/channels/bitbucket/checks.d.ts +67 -0
- package/dist/channels/bitbucket/checks.d.ts.map +1 -0
- package/dist/channels/bitbucket/checks.js +102 -0
- package/dist/channels/bitbucket/cursor-account.d.ts +37 -0
- package/dist/channels/bitbucket/cursor-account.d.ts.map +1 -0
- package/dist/channels/bitbucket/cursor-account.js +65 -0
- package/dist/channels/bitbucket/defaults.d.ts +26 -0
- package/dist/channels/bitbucket/defaults.d.ts.map +1 -0
- package/dist/channels/bitbucket/defaults.js +73 -0
- package/dist/channels/bitbucket/events.d.ts +22 -0
- package/dist/channels/bitbucket/events.d.ts.map +1 -0
- package/dist/channels/bitbucket/events.js +64 -0
- package/dist/channels/bitbucket/index.d.ts +34 -0
- package/dist/channels/bitbucket/index.d.ts.map +1 -0
- package/dist/channels/bitbucket/index.js +33 -0
- package/dist/channels/bitbucket/replay.d.ts +63 -0
- package/dist/channels/bitbucket/replay.d.ts.map +1 -0
- package/dist/channels/bitbucket/replay.js +304 -0
- package/dist/channels/bitbucket/state.d.ts +35 -0
- package/dist/channels/bitbucket/state.d.ts.map +1 -0
- package/dist/channels/bitbucket/state.js +21 -0
- package/dist/channels/bitbucket/types.d.ts +229 -0
- package/dist/channels/bitbucket/types.d.ts.map +1 -0
- package/dist/channels/bitbucket/types.js +1 -0
- package/dist/channels/deployments/deployments-channel.d.ts +22 -14
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
- package/dist/channels/deployments/deployments-channel.js +25 -27
- package/dist/channels/deployments/types.d.ts +12 -6
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/github/binding.d.ts +6 -0
- package/dist/channels/github/binding.d.ts.map +1 -1
- package/dist/channels/github/binding.js +3 -3
- package/dist/channels/github/cursor-account.d.ts +7 -3
- package/dist/channels/github/cursor-account.d.ts.map +1 -1
- package/dist/channels/github/cursor-account.js +10 -6
- package/dist/channels/github/events.d.ts +1 -1
- package/dist/channels/github/events.js +1 -1
- package/dist/channels/github/forward.d.ts +1 -1
- package/dist/channels/github/forward.d.ts.map +1 -1
- package/dist/channels/github/forward.js +3 -2
- package/dist/channels/github/github-channel.d.ts +29 -39
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +68 -101
- package/dist/channels/github/replay.d.ts +1 -1
- package/dist/channels/github/replay.js +1 -1
- package/dist/channels/github/state.d.ts +2 -0
- package/dist/channels/github/state.d.ts.map +1 -1
- package/dist/channels/github/state.js +14 -11
- package/dist/channels/github/types.d.ts +2 -4
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/gitlab/api.d.ts +91 -0
- package/dist/channels/gitlab/api.d.ts.map +1 -0
- package/dist/channels/gitlab/api.js +150 -0
- package/dist/channels/gitlab/binding.d.ts +58 -0
- package/dist/channels/gitlab/binding.d.ts.map +1 -0
- package/dist/channels/gitlab/binding.js +139 -0
- package/dist/channels/gitlab/checks.d.ts +110 -0
- package/dist/channels/gitlab/checks.d.ts.map +1 -0
- package/dist/channels/gitlab/checks.js +126 -0
- package/dist/channels/gitlab/cursor-account.d.ts +36 -0
- package/dist/channels/gitlab/cursor-account.d.ts.map +1 -0
- package/dist/channels/gitlab/cursor-account.js +65 -0
- package/dist/channels/gitlab/defaults.d.ts +25 -0
- package/dist/channels/gitlab/defaults.d.ts.map +1 -0
- package/dist/channels/gitlab/defaults.js +60 -0
- package/dist/channels/gitlab/events.d.ts +12 -0
- package/dist/channels/gitlab/events.d.ts.map +1 -0
- package/dist/channels/gitlab/events.js +28 -0
- package/dist/channels/gitlab/gitlab-channel.d.ts +33 -0
- package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -0
- package/dist/channels/gitlab/gitlab-channel.js +120 -0
- package/dist/channels/gitlab/gitlab-webhook.d.ts +45 -0
- package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -0
- package/dist/channels/gitlab/gitlab-webhook.js +397 -0
- package/dist/channels/gitlab/index.d.ts +31 -0
- package/dist/channels/gitlab/index.d.ts.map +1 -0
- package/dist/channels/gitlab/index.js +30 -0
- package/dist/channels/gitlab/replay.d.ts +105 -0
- package/dist/channels/gitlab/replay.d.ts.map +1 -0
- package/dist/channels/gitlab/replay.js +206 -0
- package/dist/channels/gitlab/state.d.ts +33 -0
- package/dist/channels/gitlab/state.d.ts.map +1 -0
- package/dist/channels/gitlab/state.js +23 -0
- package/dist/channels/gitlab/types.d.ts +214 -0
- package/dist/channels/gitlab/types.d.ts.map +1 -0
- package/dist/channels/gitlab/types.js +1 -0
- package/dist/channels/origin/api.d.ts.map +1 -1
- package/dist/channels/origin/api.js +4 -2
- package/dist/channels/origin/origin-channel.d.ts +4 -9
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +8 -48
- package/dist/channels/origin/types.d.ts +20 -2
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/eval-directive.d.ts.map +1 -1
- package/dist/channels/slack/eval-directive.js +1 -7
- package/dist/channels/slack/init.d.ts.map +1 -1
- package/dist/channels/slack/init.js +3 -3
- package/dist/channels/slack/setup.d.ts +1 -1
- package/dist/channels/slack/setup.d.ts.map +1 -1
- package/dist/channels/slack/setup.js +6 -13
- package/dist/channels/slack/types.d.ts +1 -1
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/channels.d.ts +1 -1
- package/dist/channels.d.ts.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/connections.d.ts +1 -1
- package/dist/connections.js +1 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.CLA03RCz.js → app.DW9pXkpL.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.nrl1ifBq.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.ifxv-cJV.js → VPLocalSearchBox.CdEIUwDg.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DWCwM6p-.js → theme.YZMHgPgg.js} +2 -2
- package/dist/docs/assets/concepts.md.DgEcZOfT.js +1 -0
- package/dist/docs/assets/{concepts.md.rPzW2HZN.lean.js → concepts.md.DgEcZOfT.lean.js} +1 -1
- package/dist/docs/assets/{evals.md.CPzDAwoH.js → evals.md.CbMoebP1.js} +1 -1
- package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +9 -0
- package/dist/docs/assets/{guides_github.md.BtPr9GaP.js → guides_github.md.DKYiT9do.js} +1 -1
- package/dist/docs/assets/{guides_opentelemetry.md.BVTXDCRg.js → guides_opentelemetry.md.COh9jFVg.js} +7 -8
- package/dist/docs/assets/{guides_opentelemetry.md.BVTXDCRg.lean.js → guides_opentelemetry.md.COh9jFVg.lean.js} +1 -1
- package/dist/docs/assets/{index.md.Kiht7ell.js → index.md.D75GWhPl.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.BHeYMgme.js → reference_agent-config.md.CHNpiyp4.js} +3 -3
- package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.js → reference_channels.md.Dz8Cnudp.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.lean.js → reference_channels.md.Dz8Cnudp.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.DfoeyvL0.js → reference_cli.md.CJNc_xYK.js} +1 -1
- package/dist/docs/assets/{reference_extensions.md.9WQMZe1l.js → reference_extensions.md.DykHW3qL.js} +11 -5
- package/dist/docs/assets/reference_extensions.md.DykHW3qL.lean.js +1 -0
- package/dist/docs/assets/reference_hooks.md.Ddt5DdgJ.js +73 -0
- package/dist/docs/assets/{reference_hooks.md.a8BJxMR5.lean.js → reference_hooks.md.Ddt5DdgJ.lean.js} +1 -1
- package/dist/docs/assets/{reference_playground.md.DnX5nL-B.js → reference_playground.md.4myJPxrf.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md.CA6QP6Lw.js → reference_project-layout.md.DuBu9a96.js} +2 -2
- package/dist/docs/assets/reference_result.md.BK5SxDrf.js +19 -0
- package/dist/docs/assets/reference_result.md.BK5SxDrf.lean.js +1 -0
- package/dist/docs/assets/{reference_sessions.md.NxFP_CAC.js → reference_sessions.md.CueyOHSL.js} +1 -1
- package/dist/docs/assets/{reference_sessions.md.NxFP_CAC.lean.js → reference_sessions.md.CueyOHSL.lean.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.B1up2r9W.js → reference_tools.md.aGrn99hP.js} +1 -1
- package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +1 -0
- package/dist/docs/assets/{skills_otel.md.CgiZryR3.js → skills_otel.md.CqhobH3B.js} +3 -3
- package/dist/docs/assets/{skills_otel.md.CgiZryR3.lean.js → skills_otel.md.CqhobH3B.lean.js} +1 -1
- package/dist/docs/assets/{templates_pr-autofixer.md.x5zl6-GT.js → templates_pr-autofixer.md.Bds_XWcV.js} +2 -2
- package/dist/docs/assets/{templates_pr-autofixer.md.x5zl6-GT.lean.js → templates_pr-autofixer.md.Bds_XWcV.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/concepts.md +2 -4
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/design/runtime-abstraction.md +2 -3
- package/dist/docs/evals.html +6 -6
- package/dist/docs/evals.md +9 -7
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-agents.html +6 -6
- package/dist/docs/guides/cloud-agents.md +4 -6
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +6 -6
- package/dist/docs/guides/github.md +0 -1
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +5 -5
- package/dist/docs/guides/opentelemetry.html +10 -11
- package/dist/docs/guides/opentelemetry.md +41 -17
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +2 -2
- package/dist/docs/llms-full.txt +501 -262
- package/dist/docs/llms.txt +2 -2
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +8 -8
- package/dist/docs/reference/agent-config.md +6 -10
- package/dist/docs/reference/artifacts.html +5 -5
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/channels.md +18 -8
- package/dist/docs/reference/cli.html +5 -5
- package/dist/docs/reference/cli.md +3 -4
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/extensions.html +16 -10
- package/dist/docs/reference/extensions.md +86 -22
- package/dist/docs/reference/hooks.html +69 -10
- package/dist/docs/reference/hooks.md +215 -46
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +5 -5
- package/dist/docs/reference/playground.md +3 -0
- package/dist/docs/reference/project-layout.html +6 -6
- package/dist/docs/reference/project-layout.md +2 -1
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/result.html +45 -0
- package/dist/docs/reference/result.md +89 -0
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +5 -5
- package/dist/docs/reference/sessions.md +3 -1
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +5 -5
- package/dist/docs/reference/tools.md +1 -2
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/skills/ab.html +4 -4
- package/dist/docs/skills/create-agent.html +4 -4
- package/dist/docs/skills/debug.html +4 -4
- package/dist/docs/skills/evals.html +4 -4
- package/dist/docs/skills/framework-map.html +5 -5
- package/dist/docs/skills/framework-map.md +3 -1
- package/dist/docs/skills/github.html +4 -4
- package/dist/docs/skills/hillclimb.html +4 -4
- package/dist/docs/skills/index.html +4 -4
- package/dist/docs/skills/mcp-auth.html +4 -4
- package/dist/docs/skills/otel.html +7 -7
- package/dist/docs/skills/otel.md +8 -3
- package/dist/docs/skills/setup-slack.html +4 -4
- package/dist/docs/storage.html +4 -4
- 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/pr-autofixer.html +6 -6
- package/dist/docs/templates/pr-autofixer.md +0 -3
- 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 +4 -4
- package/dist/evals.d.ts +1 -1
- package/dist/evals.d.ts.map +1 -1
- package/dist/extensions.d.ts +20 -7
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +36 -5
- package/dist/files.d.ts +16 -3
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +16 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/internal/ab-snapshot.d.ts.map +1 -1
- package/dist/internal/ab-snapshot.js +0 -1
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +1 -3
- package/dist/internal/authored-alias-hooks.d.ts +4 -13
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +4 -20
- package/dist/internal/authored-loaders.d.ts +2 -3
- package/dist/internal/authored-loaders.d.ts.map +1 -1
- package/dist/internal/authored-loaders.js +6 -20
- package/dist/internal/channel-dispatch.d.ts +43 -0
- package/dist/internal/channel-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-dispatch.js +77 -0
- package/dist/internal/chat-client.d.ts +1 -1
- package/dist/internal/chat-client.js +1 -1
- package/dist/internal/cli-ax.d.ts +5 -5
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +5 -5
- package/dist/internal/cli-bitbucket.d.ts +33 -0
- package/dist/internal/cli-bitbucket.d.ts.map +1 -0
- package/dist/internal/cli-bitbucket.js +359 -0
- package/dist/internal/cli-convert-automation.d.ts +1 -1
- package/dist/internal/cli-convert-automation.js +2 -2
- package/dist/internal/cli-cursor.d.ts +1 -1
- package/dist/internal/cli-cursor.d.ts.map +1 -1
- package/dist/internal/cli-cursor.js +2 -4
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +2 -6
- package/dist/internal/cli-github.d.ts +1 -1
- package/dist/internal/cli-github.js +3 -3
- package/dist/internal/cli-gitlab.d.ts +37 -0
- package/dist/internal/cli-gitlab.d.ts.map +1 -0
- package/dist/internal/cli-gitlab.js +380 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -1
- package/dist/internal/cli-mcp.js +2 -6
- package/dist/internal/cli-slack.d.ts +1 -1
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +2 -4
- package/dist/internal/continuation-channel.d.ts +14 -0
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +56 -3
- package/dist/internal/continuation-identity.d.ts +14 -15
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +182 -7
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +4 -3
- package/dist/internal/convert-automation/types.d.ts +1 -1
- package/dist/internal/convert-automation/types.js +1 -1
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +1 -3
- package/dist/internal/cursor/backend-client.d.ts +5 -4
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +5 -6
- package/dist/internal/cursor/bound-secret-file.d.ts +56 -0
- package/dist/internal/cursor/bound-secret-file.d.ts.map +1 -0
- package/dist/internal/cursor/bound-secret-file.js +88 -0
- package/dist/internal/cursor/credentials.d.ts +39 -5
- package/dist/internal/cursor/credentials.d.ts.map +1 -1
- package/dist/internal/cursor/credentials.js +58 -8
- package/dist/internal/cursor/hosted-bound-secrets.d.ts +41 -0
- package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-bound-secrets.js +54 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts +19 -5
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -1
- package/dist/internal/cursor/hosted-deployment-secrets.js +29 -9
- package/dist/internal/cursor/hosted-store-secrets.d.ts +1 -1
- package/dist/internal/cursor/hosted-store-secrets.js +1 -1
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
- package/dist/internal/cursor-account-mcp-auth.js +2 -4
- package/dist/internal/cursor-deployment-relay.d.ts +6 -2
- package/dist/internal/cursor-deployment-relay.d.ts.map +1 -1
- package/dist/internal/cursor-deployment-relay.js +13 -9
- package/dist/internal/deploy-manifest.d.ts +1 -1
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +1 -1
- package/dist/internal/discovery/ab.d.ts +1 -1
- package/dist/internal/discovery/ab.d.ts.map +1 -1
- package/dist/internal/discovery/ab.js +21 -9
- package/dist/internal/discovery/agent.d.ts +6 -1
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +65 -116
- package/dist/internal/discovery/channels.d.ts +1 -1
- package/dist/internal/discovery/channels.d.ts.map +1 -1
- package/dist/internal/discovery/channels.js +14 -14
- package/dist/internal/discovery/connections.d.ts +1 -5
- package/dist/internal/discovery/connections.d.ts.map +1 -1
- package/dist/internal/discovery/connections.js +30 -44
- package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -1
- package/dist/internal/discovery/cursor-plugin.js +1 -3
- package/dist/internal/discovery/extension-overlay.d.ts +32 -0
- package/dist/internal/discovery/extension-overlay.d.ts.map +1 -0
- package/dist/internal/discovery/extension-overlay.js +191 -0
- package/dist/internal/discovery/extensions.d.ts +11 -2
- package/dist/internal/discovery/extensions.d.ts.map +1 -1
- package/dist/internal/discovery/extensions.js +211 -74
- package/dist/internal/discovery/hooks.d.ts +1 -1
- package/dist/internal/discovery/hooks.d.ts.map +1 -1
- package/dist/internal/discovery/hooks.js +15 -2
- package/dist/internal/discovery/info.d.ts.map +1 -1
- package/dist/internal/discovery/info.js +7 -1
- package/dist/internal/discovery/modules.d.ts.map +1 -1
- package/dist/internal/discovery/modules.js +8 -2
- package/dist/internal/discovery/names.d.ts +1 -1
- package/dist/internal/discovery/names.d.ts.map +1 -1
- package/dist/internal/discovery/names.js +1 -0
- package/dist/internal/discovery/project.d.ts +0 -2
- package/dist/internal/discovery/project.d.ts.map +1 -1
- package/dist/internal/discovery/project.js +64 -10
- package/dist/internal/discovery/runtime.d.ts.map +1 -1
- package/dist/internal/discovery/runtime.js +1 -2
- package/dist/internal/discovery/schedules.d.ts +1 -1
- package/dist/internal/discovery/schedules.d.ts.map +1 -1
- package/dist/internal/discovery/schedules.js +23 -2
- package/dist/internal/discovery/services.d.ts +6 -2
- package/dist/internal/discovery/services.d.ts.map +1 -1
- package/dist/internal/discovery/services.js +31 -1
- package/dist/internal/discovery/skills.d.ts +1 -6
- package/dist/internal/discovery/skills.d.ts.map +1 -1
- package/dist/internal/discovery/skills.js +8 -3
- package/dist/internal/discovery/subagent.d.ts +3 -0
- package/dist/internal/discovery/subagent.d.ts.map +1 -1
- package/dist/internal/discovery/subagent.js +109 -0
- package/dist/internal/discovery.d.ts +1 -2
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +1 -2
- package/dist/internal/distribution.d.ts +10 -27
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +25 -73
- package/dist/internal/docs-site.js +1 -1
- package/dist/internal/eval-run-store.d.ts +0 -1
- package/dist/internal/eval-run-store.d.ts.map +1 -1
- package/dist/internal/eval-runner.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.d.ts +8 -0
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +8 -8
- package/dist/internal/github-fanout.d.ts +1 -1
- package/dist/internal/github-fanout.js +1 -1
- package/dist/internal/guest-network.d.ts +101 -0
- package/dist/internal/guest-network.d.ts.map +1 -0
- package/dist/internal/guest-network.js +304 -0
- package/dist/internal/host-otel.d.ts +3 -3
- package/dist/internal/host-otel.d.ts.map +1 -1
- package/dist/internal/host-otel.js +8 -4
- package/dist/internal/hosted-admission-adapter.d.ts +8 -7
- package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.d.ts +6 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +18 -5
- package/dist/internal/hosted-delivery.d.ts +18 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +248 -118
- package/dist/internal/http-channel.d.ts.map +1 -1
- package/dist/internal/http-channel.js +1 -3
- package/dist/internal/init-interview.d.ts.map +1 -1
- package/dist/internal/init-interview.js +1 -3
- package/dist/internal/init-project.d.ts +2 -2
- package/dist/internal/init-project.js +2 -2
- package/dist/internal/inline-stdio-define-stub.d.ts +1 -1
- package/dist/internal/inline-stdio-define-stub.d.ts.map +1 -1
- package/dist/internal/inline-stdio-define-stub.js +1 -1
- package/dist/internal/is-record.d.ts +2 -0
- package/dist/internal/is-record.d.ts.map +1 -0
- package/dist/internal/is-record.js +3 -0
- package/dist/internal/json-schema.d.ts.map +1 -1
- package/dist/internal/json-schema.js +18 -10
- package/dist/internal/local-control-plane.d.ts +1 -2
- package/dist/internal/local-control-plane.d.ts.map +1 -1
- package/dist/internal/local-control-plane.js +3 -20
- package/dist/internal/mcp-endpoint.d.ts.map +1 -1
- package/dist/internal/mcp-endpoint.js +1 -3
- package/dist/internal/otel/collector.d.ts +12 -3
- package/dist/internal/otel/collector.d.ts.map +1 -1
- package/dist/internal/otel/collector.js +77 -125
- package/dist/internal/otel/config.d.ts +0 -2
- package/dist/internal/otel/config.d.ts.map +1 -1
- package/dist/internal/otel/config.js +17 -20
- package/dist/internal/otel/http.d.ts +2 -0
- package/dist/internal/otel/http.d.ts.map +1 -1
- package/dist/internal/otel/http.js +7 -1
- package/dist/internal/otel/mcp.d.ts.map +1 -1
- package/dist/internal/otel/mcp.js +3 -16
- package/dist/internal/otel/runtime.d.ts +26 -1
- package/dist/internal/otel/runtime.d.ts.map +1 -1
- package/dist/internal/otel/runtime.js +164 -15
- package/dist/internal/package-inline-stdio.d.ts.map +1 -1
- package/dist/internal/package-inline-stdio.js +3 -11
- package/dist/internal/playground/toolchain.d.ts +1 -1
- package/dist/internal/playground/toolchain.d.ts.map +1 -1
- package/dist/internal/playground/toolchain.js +1 -1
- package/dist/internal/request-error-status.d.ts +12 -0
- package/dist/internal/request-error-status.d.ts.map +1 -0
- package/dist/internal/request-error-status.js +52 -0
- package/dist/internal/resolve-prod-target.d.ts +1 -1
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +3 -7
- package/dist/internal/result-output.d.ts +18 -0
- package/dist/internal/result-output.d.ts.map +1 -0
- package/dist/internal/result-output.js +33 -0
- package/dist/internal/run-client.d.ts +2 -2
- package/dist/internal/run-client.js +2 -2
- package/dist/internal/runtime-dispatch-runner.d.ts +1 -11
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
- package/dist/internal/runtime-dispatch-runner.js +2 -15
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +3 -6
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +110 -35
- package/dist/internal/session-cost.d.ts +3 -3
- package/dist/internal/session-cost.d.ts.map +1 -1
- package/dist/internal/session-cost.js +3 -3
- package/dist/internal/session-engine.d.ts +26 -11
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +146 -76
- package/dist/internal/session-run-log.d.ts.map +1 -1
- package/dist/internal/session-run-log.js +1 -3
- package/dist/internal/skills-sync.d.ts +1 -4
- package/dist/internal/skills-sync.d.ts.map +1 -1
- package/dist/internal/skills-sync.js +10 -50
- package/dist/internal/sleep.d.ts +2 -0
- package/dist/internal/sleep.d.ts.map +1 -0
- package/dist/internal/sleep.js +3 -0
- package/dist/internal/store-mirror.d.ts +29 -0
- package/dist/internal/store-mirror.d.ts.map +1 -0
- package/dist/internal/store-mirror.js +70 -0
- package/dist/internal/tenant-slack/relay.d.ts +73 -0
- package/dist/internal/tenant-slack/relay.d.ts.map +1 -0
- package/dist/internal/tenant-slack/relay.js +138 -0
- package/dist/internal/testing/scm-continuation-fixtures.d.ts +33 -0
- package/dist/internal/testing/scm-continuation-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/scm-continuation-fixtures.js +253 -0
- package/dist/internal/workspace-sync.d.ts +22 -0
- package/dist/internal/workspace-sync.d.ts.map +1 -0
- package/dist/internal/workspace-sync.js +49 -0
- package/dist/internal/workspace.d.ts +7 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +13 -0
- package/dist/otel.d.ts +23 -1
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +93 -2
- package/dist/playground/assets/index-59KvgREd.js +67 -0
- package/dist/playground/assets/index-MbMxXg-y.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/result.d.ts +24 -0
- package/dist/result.d.ts.map +1 -0
- package/dist/result.js +27 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +7 -4
- package/dist/storage-protocol.d.ts.map +1 -1
- package/dist/storage-protocol.js +1 -3
- package/dist/types.d.ts +90 -23
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +2 -2
- package/docs/concepts.md +2 -4
- package/docs/design/runtime-abstraction.md +2 -3
- package/docs/evals.md +9 -7
- package/docs/guides/cloud-agents.md +4 -6
- package/docs/guides/github.md +0 -1
- package/docs/guides/opentelemetry.md +41 -17
- package/docs/reference/agent-config.md +6 -10
- package/docs/reference/channels.md +18 -8
- package/docs/reference/cli.md +3 -4
- package/docs/reference/extensions.md +87 -23
- package/docs/reference/hooks.md +215 -46
- package/docs/reference/playground.md +3 -0
- package/docs/reference/project-layout.md +2 -1
- package/docs/reference/result.md +94 -0
- package/docs/reference/sessions.md +3 -1
- package/docs/reference/tools.md +1 -2
- package/docs/templates/pr-autofixer.md +0 -3
- package/package.json +29 -10
- package/skills/framework-map/SKILL.md +3 -1
- package/skills/otel/SKILL.md +8 -3
- package/src/ab.ts +1 -1
- package/src/bin/agent-serve.ts +121 -21
- package/src/channels/bitbucket/api.ts +623 -0
- package/src/channels/bitbucket/binding.ts +414 -0
- package/src/channels/bitbucket/bitbucket-channel.ts +182 -0
- package/src/channels/bitbucket/bitbucket-webhook.ts +576 -0
- package/src/channels/bitbucket/checks.ts +154 -0
- package/src/channels/bitbucket/cursor-account.ts +117 -0
- package/src/channels/bitbucket/defaults.ts +110 -0
- package/src/channels/bitbucket/events.ts +84 -0
- package/src/channels/bitbucket/index.ts +49 -0
- package/src/channels/bitbucket/replay.ts +439 -0
- package/src/channels/bitbucket/state.ts +59 -0
- package/src/channels/bitbucket/types.ts +266 -0
- package/src/channels/deployments/deployments-channel.ts +25 -43
- package/src/channels/deployments/types.ts +12 -6
- package/src/channels/github/binding.ts +8 -1
- package/src/channels/github/cursor-account.ts +17 -6
- package/src/channels/github/events.ts +1 -1
- package/src/channels/github/forward.ts +3 -2
- package/src/channels/github/github-channel.ts +74 -221
- package/src/channels/github/replay.ts +1 -1
- package/src/channels/github/state.ts +6 -0
- package/src/channels/github/types.ts +2 -5
- package/src/channels/gitlab/api.ts +228 -0
- package/src/channels/gitlab/binding.ts +233 -0
- package/src/channels/gitlab/checks.ts +243 -0
- package/src/channels/gitlab/cursor-account.ts +114 -0
- package/src/channels/gitlab/defaults.ts +93 -0
- package/src/channels/gitlab/events.ts +44 -0
- package/src/channels/gitlab/gitlab-channel.ts +176 -0
- package/src/channels/gitlab/gitlab-webhook.ts +555 -0
- package/src/channels/gitlab/index.ts +43 -0
- package/src/channels/gitlab/replay.ts +347 -0
- package/src/channels/gitlab/state.ts +55 -0
- package/src/channels/gitlab/types.ts +263 -0
- package/src/channels/origin/api.ts +4 -2
- package/src/channels/origin/origin-channel.ts +19 -94
- package/src/channels/origin/types.ts +23 -2
- package/src/channels/slack/eval-directive.ts +1 -6
- package/src/channels/slack/init.ts +6 -3
- package/src/channels/slack/setup.ts +7 -6
- package/src/channels/slack/types.ts +1 -1
- package/src/channels.ts +0 -1
- package/src/client.ts +1 -1
- package/src/connections.ts +1 -1
- package/src/evals.ts +1 -1
- package/src/extensions.ts +47 -5
- package/src/files.ts +21 -3
- package/src/index.ts +20 -28
- package/src/internal/ab-snapshot.ts +0 -3
- package/src/internal/advertise-tools.ts +1 -4
- package/src/internal/authored-alias-hooks.ts +4 -21
- package/src/internal/authored-loaders.ts +6 -23
- package/src/internal/channel-dispatch.ts +160 -0
- package/src/internal/chat-client.ts +1 -1
- package/src/internal/cli-ax.ts +5 -5
- package/src/internal/cli-bitbucket.ts +477 -0
- package/src/internal/cli-convert-automation.ts +7 -7
- package/src/internal/cli-cursor.ts +2 -5
- package/src/internal/cli-deploy.ts +2 -8
- package/src/internal/cli-github.ts +3 -3
- package/src/internal/cli-gitlab.ts +485 -0
- package/src/internal/cli-mcp.ts +2 -7
- package/src/internal/cli-slack.ts +2 -5
- package/src/internal/continuation-channel.ts +82 -1
- package/src/internal/continuation-identity.ts +229 -11
- package/src/internal/conversation-mirror.ts +4 -3
- package/src/internal/convert-automation/types.ts +1 -1
- package/src/internal/cursor/account-mcp.ts +1 -4
- package/src/internal/cursor/backend-client.ts +9 -10
- package/src/internal/cursor/bound-secret-file.ts +108 -0
- package/src/internal/cursor/credentials.ts +75 -10
- package/src/internal/cursor/hosted-bound-secrets.ts +75 -0
- package/src/internal/cursor/hosted-deployment-secrets.ts +42 -11
- package/src/internal/cursor/hosted-store-secrets.ts +1 -1
- package/src/internal/cursor-account-mcp-auth.ts +2 -5
- package/src/internal/cursor-deployment-relay.ts +11 -7
- package/src/internal/deploy-manifest.ts +4 -2
- package/src/internal/discovery/ab.ts +29 -9
- package/src/internal/discovery/agent.ts +94 -135
- package/src/internal/discovery/channels.ts +15 -13
- package/src/internal/discovery/connections.ts +55 -50
- package/src/internal/discovery/cursor-plugin.ts +1 -4
- package/src/internal/discovery/extension-overlay.ts +274 -0
- package/src/internal/discovery/extensions.ts +330 -105
- package/src/internal/discovery/hooks.ts +20 -2
- package/src/internal/discovery/info.ts +7 -0
- package/src/internal/discovery/modules.ts +8 -2
- package/src/internal/discovery/names.ts +2 -1
- package/src/internal/discovery/project.ts +80 -9
- package/src/internal/discovery/runtime.ts +1 -2
- package/src/internal/discovery/schedules.ts +28 -2
- package/src/internal/discovery/services.ts +37 -1
- package/src/internal/discovery/skills.ts +13 -3
- package/src/internal/discovery/subagent.ts +107 -0
- package/src/internal/discovery.ts +0 -2
- package/src/internal/distribution.ts +35 -83
- package/src/internal/docs-site.ts +1 -1
- package/src/internal/eval-run-store.ts +0 -7
- package/src/internal/eval-runner.ts +0 -1
- package/src/internal/framework-file-storage.ts +8 -8
- package/src/internal/github-fanout.ts +1 -1
- package/src/internal/guest-network.ts +383 -0
- package/src/internal/host-otel.ts +8 -4
- package/src/internal/hosted-admission-adapter.ts +8 -8
- package/src/internal/hosted-delivery-protocol.ts +26 -1
- package/src/internal/hosted-delivery.ts +376 -192
- package/src/internal/http-channel.ts +1 -4
- package/src/internal/init-interview.ts +1 -4
- package/src/internal/init-project.ts +2 -2
- package/src/internal/inline-stdio-define-stub.ts +1 -1
- package/src/internal/is-record.ts +3 -0
- package/src/internal/json-schema.ts +19 -10
- package/src/internal/local-control-plane.ts +5 -24
- package/src/internal/mcp-endpoint.ts +1 -4
- package/src/internal/otel/collector.ts +94 -159
- package/src/internal/otel/config.ts +10 -14
- package/src/internal/otel/http.ts +14 -1
- package/src/internal/otel/mcp.ts +3 -16
- package/src/internal/otel/runtime.ts +240 -25
- package/src/internal/package-inline-stdio.ts +3 -12
- package/src/internal/playground/toolchain.ts +1 -1
- package/src/internal/request-error-status.ts +72 -0
- package/src/internal/resolve-prod-target.ts +3 -8
- package/src/internal/result-output.ts +34 -0
- package/src/internal/run-client.ts +2 -2
- package/src/internal/runtime-dispatch-runner.ts +3 -21
- package/src/internal/sdk-runner.ts +3 -7
- package/src/internal/server.ts +153 -44
- package/src/internal/session-cost.ts +3 -3
- package/src/internal/session-engine.ts +182 -74
- package/src/internal/session-run-log.ts +1 -4
- package/src/internal/skills-sync.ts +13 -63
- package/src/internal/sleep.ts +3 -0
- package/src/internal/store-mirror.ts +86 -0
- package/src/internal/tenant-slack/relay.ts +179 -0
- package/src/internal/testing/scm-continuation-fixtures.ts +286 -0
- package/src/internal/workspace-sync.ts +55 -0
- package/src/internal/workspace.ts +14 -0
- package/src/otel.ts +143 -3
- package/src/result.ts +36 -0
- package/src/storage-backends/cursor-hosted.ts +7 -4
- package/src/storage-protocol.ts +1 -4
- package/src/types.ts +105 -34
- package/templates/triage/agent/lib/types.ts +0 -2
- package/dist/continuation.d.ts +0 -20
- package/dist/continuation.d.ts.map +0 -1
- package/dist/continuation.js +0 -18
- package/dist/docs/assets/chunks/@localSearchIndexroot.FAqdWIXo.js +0 -1
- package/dist/docs/assets/concepts.md.rPzW2HZN.js +0 -1
- package/dist/docs/assets/guides_cloud-agents.md.DumwWXba.js +0 -9
- package/dist/docs/assets/guides_cloud-runtime.md.BRirbRAN.js +0 -9
- package/dist/docs/assets/guides_cloud-runtime.md.BRirbRAN.lean.js +0 -1
- package/dist/docs/assets/reference_extensions.md.9WQMZe1l.lean.js +0 -1
- package/dist/docs/assets/reference_hooks.md.a8BJxMR5.js +0 -14
- package/dist/docs/assets/skills_framework-map.md.DDa4MeEW.js +0 -1
- package/dist/docs/guides/cloud-runtime.html +0 -35
- package/dist/docs/guides/cloud-runtime.md +0 -117
- package/dist/internal/convert-automation/index.d.ts +0 -3
- package/dist/internal/convert-automation/index.d.ts.map +0 -1
- package/dist/internal/convert-automation/index.js +0 -1
- package/dist/internal/grokbot/runner.d.ts +0 -64
- package/dist/internal/grokbot/runner.d.ts.map +0 -1
- package/dist/internal/grokbot/runner.js +0 -282
- package/dist/internal/managed-delivery.d.ts +0 -80
- package/dist/internal/managed-delivery.d.ts.map +0 -1
- package/dist/internal/managed-delivery.js +0 -86
- package/dist/internal/review-comments.d.ts +0 -370
- package/dist/internal/review-comments.d.ts.map +0 -1
- package/dist/internal/review-comments.js +0 -921
- package/dist/internal/shallow-clone.d.ts +0 -176
- package/dist/internal/shallow-clone.d.ts.map +0 -1
- package/dist/internal/shallow-clone.js +0 -419
- package/dist/playground/assets/index-B6C9S9nG.css +0 -1
- package/dist/playground/assets/index-ZqNoT8Ie.js +0 -69
- package/docs/guides/cloud-runtime.md +0 -122
- package/src/continuation.ts +0 -49
- package/src/internal/convert-automation/index.ts +0 -10
- package/src/internal/grokbot/runner.ts +0 -370
- package/src/internal/managed-delivery.ts +0 -125
- package/src/internal/review-comments.ts +0 -1363
- package/src/internal/shallow-clone.ts +0 -609
- /package/dist/docs/assets/{evals.md.CPzDAwoH.lean.js → evals.md.CbMoebP1.lean.js} +0 -0
- /package/dist/docs/assets/{guides_cloud-agents.md.DumwWXba.lean.js → guides_cloud-agents.md.DS8RIjwx.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.BtPr9GaP.lean.js → guides_github.md.DKYiT9do.lean.js} +0 -0
- /package/dist/docs/assets/{index.md.Kiht7ell.lean.js → index.md.D75GWhPl.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.BHeYMgme.lean.js → reference_agent-config.md.CHNpiyp4.lean.js} +0 -0
- /package/dist/docs/assets/{reference_cli.md.DfoeyvL0.lean.js → reference_cli.md.CJNc_xYK.lean.js} +0 -0
- /package/dist/docs/assets/{reference_playground.md.DnX5nL-B.lean.js → reference_playground.md.4myJPxrf.lean.js} +0 -0
- /package/dist/docs/assets/{reference_project-layout.md.CA6QP6Lw.lean.js → reference_project-layout.md.DuBu9a96.lean.js} +0 -0
- /package/dist/docs/assets/{reference_tools.md.B1up2r9W.lean.js → reference_tools.md.aGrn99hP.lean.js} +0 -0
- /package/dist/docs/assets/{skills_framework-map.md.DDa4MeEW.lean.js → skills_framework-map.md.haibFyoB.lean.js} +0 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
11
|
+
import { acknowledgeTask, isTaskDispatch, skipped, turnStarted, } from "../../internal/channel-dispatch.js";
|
|
12
|
+
import { continuationSource } from "../../internal/continuation-identity.js";
|
|
13
|
+
import { bindLocalIngressSend } from "../../internal/local-ingress.js";
|
|
14
|
+
import { asNonEmptyString, asPositiveInt, asRecord, bitbucketCommentFromPayload, bitbucketPullRequestFromPayload, bitbucketPullRequestRecord, bitbucketPullRequestUrl, bitbucketPushFromPayload, bitbucketRepositoryFromPayload, bitbucketUser, buildBitbucketBinding, } from "./binding.js";
|
|
15
|
+
import { defaultBitbucketPullRequestDispatch, defaultBitbucketPullRequestMessage, defaultBitbucketTitle, } from "./defaults.js";
|
|
16
|
+
import { BITBUCKET_CHANNEL_KIND, BITBUCKET_PULL_REQUEST_EVENTS, normalizeBitbucketEventKey, } from "./events.js";
|
|
17
|
+
import { bitbucketChannelStateForEvent, } from "./state.js";
|
|
18
|
+
/** `BITBUCKET_WEBHOOK_SECRET` fallback for {@link BitbucketChannelOptions.webhookSecret}. */
|
|
19
|
+
export function envBitbucketWebhookSecret() {
|
|
20
|
+
var _a;
|
|
21
|
+
const value = (_a = process.env.BITBUCKET_WEBHOOK_SECRET) === null || _a === void 0 ? void 0 : _a.trim();
|
|
22
|
+
return value === undefined || value === "" ? undefined : value;
|
|
23
|
+
}
|
|
24
|
+
export function resolveBitbucketWebhookSecret(options) {
|
|
25
|
+
const authored = typeof options.webhookSecret === "function"
|
|
26
|
+
? options.webhookSecret()
|
|
27
|
+
: options.webhookSecret;
|
|
28
|
+
const trimmed = authored === null || authored === void 0 ? void 0 : authored.trim();
|
|
29
|
+
return trimmed === undefined || trimmed === ""
|
|
30
|
+
? envBitbucketWebhookSecret()
|
|
31
|
+
: trimmed;
|
|
32
|
+
}
|
|
33
|
+
const SIGNATURE_PREFIX = "sha256=";
|
|
34
|
+
/** The `X-Hub-Signature` value Bitbucket sends for a raw body. */
|
|
35
|
+
export function signBitbucketWebhookBody(rawBody, secret) {
|
|
36
|
+
return `${SIGNATURE_PREFIX}${createHmac("sha256", secret).update(rawBody).digest("hex")}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Both dialects sign the raw body with HMAC-SHA256 in `X-Hub-Signature`
|
|
40
|
+
* (`sha256=<hex>`, GitHub-shaped). Constant-time compare; a missing or
|
|
41
|
+
* malformed header is a plain `false`.
|
|
42
|
+
*/
|
|
43
|
+
export function verifyBitbucketWebhookSignature(rawBody, signatureHeader, secret) {
|
|
44
|
+
if (signatureHeader === null ||
|
|
45
|
+
signatureHeader === undefined ||
|
|
46
|
+
!signatureHeader.startsWith(SIGNATURE_PREFIX)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const provided = Buffer.from(signatureHeader, "utf8");
|
|
50
|
+
const computed = Buffer.from(signBitbucketWebhookBody(rawBody, secret), "utf8");
|
|
51
|
+
return (provided.length === computed.length && timingSafeEqual(provided, computed));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Accept a raw Bitbucket payload plus the event key. The key comes from
|
|
55
|
+
* `X-Event-Key` (HTTP) or the hosted envelope; Data Center bodies also carry
|
|
56
|
+
* it as `eventKey`. Data Center keys are normalized to the Cloud vocabulary.
|
|
57
|
+
*
|
|
58
|
+
* The body's `eventKey` is authoritative when present: `X-Hub-Signature`
|
|
59
|
+
* covers the body but not the header, so a captured signed Data Center
|
|
60
|
+
* delivery must not be re-dispatched as a different event by rewriting the
|
|
61
|
+
* header. A header that disagrees with the signed body rejects the delivery.
|
|
62
|
+
*
|
|
63
|
+
* Cloud bodies carry no `eventKey`, but each event family has a signed
|
|
64
|
+
* discriminator object (`comment`, `approval`, `changes_request`, `push`).
|
|
65
|
+
* A header naming a family the body does not match — e.g. a signed
|
|
66
|
+
* `pullrequest:comment_created` body replayed as `pullrequest:created` —
|
|
67
|
+
* is rejected the same way. `created` vs `updated` bodies are shape-identical
|
|
68
|
+
* and cannot be told apart without the key.
|
|
69
|
+
*/
|
|
70
|
+
export function parseBitbucketWebhookPayload(payload, eventKey) {
|
|
71
|
+
const record = asRecord(payload);
|
|
72
|
+
if (record === undefined) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const fromBody = asNonEmptyString(record.eventKey);
|
|
76
|
+
const fromHeader = (eventKey === null || eventKey === void 0 ? void 0 : eventKey.trim()) || undefined;
|
|
77
|
+
if (fromBody !== undefined &&
|
|
78
|
+
fromHeader !== undefined &&
|
|
79
|
+
normalizeBitbucketEventKey(fromBody) !==
|
|
80
|
+
normalizeBitbucketEventKey(fromHeader)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const raw = fromBody !== null && fromBody !== void 0 ? fromBody : fromHeader;
|
|
84
|
+
if (raw === undefined) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const eventType = normalizeBitbucketEventKey(raw);
|
|
88
|
+
if (fromBody === undefined &&
|
|
89
|
+
bitbucketCloudEventFamily(eventType) !== cloudBodyFamily(record)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
eventType,
|
|
94
|
+
rawEventType: raw,
|
|
95
|
+
payload: record,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** Event family a Cloud key belongs to, by its signed body discriminator. */
|
|
99
|
+
function bitbucketCloudEventFamily(eventType) {
|
|
100
|
+
if (eventType.startsWith("repo:")) {
|
|
101
|
+
return eventType === "repo:push" ? "push" : "other";
|
|
102
|
+
}
|
|
103
|
+
if (!eventType.startsWith("pullrequest:")) {
|
|
104
|
+
return "other";
|
|
105
|
+
}
|
|
106
|
+
const action = eventType.slice("pullrequest:".length);
|
|
107
|
+
if (action.startsWith("comment_")) {
|
|
108
|
+
return "comment";
|
|
109
|
+
}
|
|
110
|
+
if (action === "approved" || action === "unapproved") {
|
|
111
|
+
return "approval";
|
|
112
|
+
}
|
|
113
|
+
if (action.startsWith("changes_request_")) {
|
|
114
|
+
return "changes_request";
|
|
115
|
+
}
|
|
116
|
+
return "pull_request";
|
|
117
|
+
}
|
|
118
|
+
/** Event family a Cloud body proves by the discriminator object it carries. */
|
|
119
|
+
function cloudBodyFamily(record) {
|
|
120
|
+
if (asRecord(record.comment) !== undefined) {
|
|
121
|
+
return "comment";
|
|
122
|
+
}
|
|
123
|
+
if (asRecord(record.approval) !== undefined) {
|
|
124
|
+
return "approval";
|
|
125
|
+
}
|
|
126
|
+
if (asRecord(record.changes_request) !== undefined) {
|
|
127
|
+
return "changes_request";
|
|
128
|
+
}
|
|
129
|
+
if (asRecord(record.push) !== undefined) {
|
|
130
|
+
return "push";
|
|
131
|
+
}
|
|
132
|
+
return asRecord(record.pullrequest) !== undefined ? "pull_request" : "other";
|
|
133
|
+
}
|
|
134
|
+
function configuredRepoAllowlist(options) {
|
|
135
|
+
const repos = [];
|
|
136
|
+
if (options.repos !== undefined) {
|
|
137
|
+
repos.push(...options.repos);
|
|
138
|
+
}
|
|
139
|
+
if (typeof options.cursorAccount === "object") {
|
|
140
|
+
repos.push(...options.cursorAccount.repos);
|
|
141
|
+
}
|
|
142
|
+
const normalized = repos
|
|
143
|
+
.map((repo) => repo
|
|
144
|
+
.trim()
|
|
145
|
+
.replace(/^\/+|\/+$/g, "")
|
|
146
|
+
.toLowerCase())
|
|
147
|
+
.filter(Boolean);
|
|
148
|
+
return normalized.length === 0 ? undefined : new Set(normalized);
|
|
149
|
+
}
|
|
150
|
+
function isPullRequestEvent(eventType) {
|
|
151
|
+
return BITBUCKET_PULL_REQUEST_EVENTS.includes(eventType);
|
|
152
|
+
}
|
|
153
|
+
export function parseBitbucketEventContext(delivery) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
var _c;
|
|
156
|
+
const repository = bitbucketRepositoryFromPayload(delivery.payload);
|
|
157
|
+
if (repository === undefined) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const pullRequestRecord = bitbucketPullRequestRecord(delivery.payload);
|
|
161
|
+
const pullRequestId = asPositiveInt(pullRequestRecord === null || pullRequestRecord === void 0 ? void 0 : pullRequestRecord.id);
|
|
162
|
+
return Object.assign(Object.assign({ deliveryId: delivery.deliveryId, eventType: delivery.eventType, rawEventType: (_c = delivery.rawEventType) !== null && _c !== void 0 ? _c : delivery.eventType, repository }, (pullRequestId === undefined
|
|
163
|
+
? {}
|
|
164
|
+
: {
|
|
165
|
+
pullRequestId,
|
|
166
|
+
pullRequestUrl: bitbucketPullRequestUrl(repository, pullRequestId, asNonEmptyString((_b = asRecord((_a = asRecord(pullRequestRecord === null || pullRequestRecord === void 0 ? void 0 : pullRequestRecord.links)) === null || _a === void 0 ? void 0 : _a.html)) === null || _b === void 0 ? void 0 : _b.href)),
|
|
167
|
+
})), { payload: delivery.payload, sender: bitbucketUser(delivery.payload.actor) });
|
|
168
|
+
}
|
|
169
|
+
function invalidPayload(error) {
|
|
170
|
+
return Response.json({ ok: false, error }, { status: 400 });
|
|
171
|
+
}
|
|
172
|
+
function startTurn(input) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
var _a;
|
|
175
|
+
const source = continuationSource(input.options.continuation, "bitbucket");
|
|
176
|
+
const session = yield input.args.send(input.message, Object.assign(Object.assign(Object.assign(Object.assign({ auth: input.dispatch.auth }, (source === "engine" && input.ctx.pullRequestId !== undefined
|
|
177
|
+
? {
|
|
178
|
+
continuationToken: `bitbucket-pr:${input.ctx.repository.fullName.toLowerCase()}#${input.ctx.pullRequestId}`,
|
|
179
|
+
}
|
|
180
|
+
: {})), { title: (_a = input.dispatch.title) !== null && _a !== void 0 ? _a : defaultBitbucketTitle(input.ctx) }), (input.cloud === undefined ? {} : { cloud: input.cloud })), { state: input.state, refreshState: input.state }));
|
|
181
|
+
return turnStarted(session);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function resolveCloudOptions(cloud, ctx, pullRequest) {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
var _a;
|
|
187
|
+
if (cloud === undefined || cloud === false) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
if (cloud === true) {
|
|
191
|
+
const url = (_a = ctx.repository.htmlUrl) !== null && _a !== void 0 ? _a : (ctx.repository.dialect === "cloud"
|
|
192
|
+
? `https://bitbucket.org/${ctx.repository.fullName}`
|
|
193
|
+
: undefined);
|
|
194
|
+
if (url === undefined) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
repos: [
|
|
199
|
+
{
|
|
200
|
+
url,
|
|
201
|
+
prUrl: pullRequest.htmlUrl,
|
|
202
|
+
startingRef: pullRequest.headSha,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (typeof cloud === "function") {
|
|
208
|
+
return yield cloud(ctx, pullRequest);
|
|
209
|
+
}
|
|
210
|
+
return cloud;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function applyDispatch(input) {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
if (input.dispatch === null) {
|
|
217
|
+
return skipped("not_dispatched", input.extra);
|
|
218
|
+
}
|
|
219
|
+
if (isTaskDispatch(input.dispatch)) {
|
|
220
|
+
return acknowledgeTask(input.args, BITBUCKET_CHANNEL_KIND, input.dispatch, input.extra);
|
|
221
|
+
}
|
|
222
|
+
const message = [
|
|
223
|
+
(_a = input.dispatch.message) !== null && _a !== void 0 ? _a : input.message,
|
|
224
|
+
...((_b = input.dispatch.context) !== null && _b !== void 0 ? _b : []),
|
|
225
|
+
].join("\n");
|
|
226
|
+
return startTurn({
|
|
227
|
+
options: input.options,
|
|
228
|
+
args: input.args,
|
|
229
|
+
ctx: input.ctx,
|
|
230
|
+
message,
|
|
231
|
+
dispatch: input.dispatch,
|
|
232
|
+
cloud: input.cloud,
|
|
233
|
+
state: bitbucketChannelStateForEvent({
|
|
234
|
+
repository: input.ctx.repository,
|
|
235
|
+
pullRequestId: input.ctx.pullRequestId,
|
|
236
|
+
headSha: input.headSha,
|
|
237
|
+
deliveryId: input.ctx.deliveryId,
|
|
238
|
+
eventType: input.ctx.eventType,
|
|
239
|
+
triggeringCommentId: input.triggeringCommentId,
|
|
240
|
+
}),
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Run the authored hooks for one Bitbucket delivery and `send()` the turn.
|
|
246
|
+
* Callers own delivery auth: the HTTP route verifies `X-Hub-Signature`;
|
|
247
|
+
* hosted admission arrives verified. The v2 mailbox is stamped upstream
|
|
248
|
+
* (local CP or hosted ingress), never here.
|
|
249
|
+
*/
|
|
250
|
+
export function dispatchBitbucketWebhook(input) {
|
|
251
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
var _a;
|
|
253
|
+
const { eventType, payload } = input.delivery;
|
|
254
|
+
const parsed = parseBitbucketEventContext(input.delivery);
|
|
255
|
+
if (parsed === null) {
|
|
256
|
+
return invalidPayload("invalid_bitbucket_payload");
|
|
257
|
+
}
|
|
258
|
+
const args = input.args;
|
|
259
|
+
const ctx = Object.assign(Object.assign({}, parsed), { bitbucket: buildBitbucketBinding({
|
|
260
|
+
repository: parsed.repository,
|
|
261
|
+
proxy: (_a = input.proxy) === null || _a === void 0 ? void 0 : _a.call(input),
|
|
262
|
+
token: input.options.token,
|
|
263
|
+
apiBaseUrl: input.options.apiBaseUrl,
|
|
264
|
+
}), host: args.host, artifacts: args.artifacts, send: args.send });
|
|
265
|
+
const allowlist = configuredRepoAllowlist(input.options);
|
|
266
|
+
if (allowlist !== undefined &&
|
|
267
|
+
!allowlist.has(ctx.repository.fullName.toLowerCase())) {
|
|
268
|
+
return skipped("repo_not_allowed", { repo: ctx.repository.fullName });
|
|
269
|
+
}
|
|
270
|
+
const extra = { event: eventType, rawEvent: ctx.rawEventType };
|
|
271
|
+
if (isPullRequestEvent(eventType)) {
|
|
272
|
+
const action = eventType.slice("pullrequest:".length);
|
|
273
|
+
const pullRequest = bitbucketPullRequestFromPayload(ctx.repository, payload, action);
|
|
274
|
+
if (pullRequest === undefined) {
|
|
275
|
+
return invalidPayload("invalid_bitbucket_pull_request_payload");
|
|
276
|
+
}
|
|
277
|
+
const dispatch = input.options.onPullRequest === undefined
|
|
278
|
+
? defaultBitbucketPullRequestDispatch(ctx, pullRequest)
|
|
279
|
+
: yield input.options.onPullRequest(ctx, pullRequest);
|
|
280
|
+
return applyDispatch({
|
|
281
|
+
options: input.options,
|
|
282
|
+
args,
|
|
283
|
+
ctx,
|
|
284
|
+
dispatch,
|
|
285
|
+
extra: Object.assign(Object.assign({}, extra), { action }),
|
|
286
|
+
message: defaultBitbucketPullRequestMessage(ctx, pullRequest),
|
|
287
|
+
cloud: yield resolveCloudOptions(input.options.cloud, ctx, pullRequest),
|
|
288
|
+
headSha: pullRequest.headSha,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
switch (eventType) {
|
|
292
|
+
case "pullrequest:comment_created": {
|
|
293
|
+
if (input.options.onPullRequestComment === undefined) {
|
|
294
|
+
return skipped("no_handler", extra);
|
|
295
|
+
}
|
|
296
|
+
const comment = bitbucketCommentFromPayload(payload);
|
|
297
|
+
const pullRequest = bitbucketPullRequestFromPayload(ctx.repository, payload, "comment_created");
|
|
298
|
+
if (comment === undefined || pullRequest === undefined) {
|
|
299
|
+
return invalidPayload("invalid_bitbucket_comment_payload");
|
|
300
|
+
}
|
|
301
|
+
const dispatch = yield input.options.onPullRequestComment(ctx, comment, pullRequest);
|
|
302
|
+
return applyDispatch({
|
|
303
|
+
options: input.options,
|
|
304
|
+
args,
|
|
305
|
+
ctx,
|
|
306
|
+
dispatch,
|
|
307
|
+
extra,
|
|
308
|
+
message: `Bitbucket comment on ${ctx.repository.fullName}#${pullRequest.id}`,
|
|
309
|
+
headSha: pullRequest.headSha,
|
|
310
|
+
triggeringCommentId: comment.id,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
case "repo:push": {
|
|
314
|
+
if (input.options.onPush === undefined) {
|
|
315
|
+
return skipped("no_handler", extra);
|
|
316
|
+
}
|
|
317
|
+
const push = bitbucketPushFromPayload(payload);
|
|
318
|
+
if (push === undefined) {
|
|
319
|
+
return invalidPayload("invalid_bitbucket_push_payload");
|
|
320
|
+
}
|
|
321
|
+
const dispatch = yield input.options.onPush(ctx, push);
|
|
322
|
+
const first = push.changes[0];
|
|
323
|
+
return applyDispatch({
|
|
324
|
+
options: input.options,
|
|
325
|
+
args,
|
|
326
|
+
ctx,
|
|
327
|
+
dispatch,
|
|
328
|
+
extra,
|
|
329
|
+
message: `Bitbucket push to ${ctx.repository.fullName}${(first === null || first === void 0 ? void 0 : first.name) === undefined ? "" : ` ${first.name}`}`,
|
|
330
|
+
headSha: first === null || first === void 0 ? void 0 : first.after,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
default: {
|
|
334
|
+
if (input.options.onEvent === undefined) {
|
|
335
|
+
return skipped("unsupported_event", extra);
|
|
336
|
+
}
|
|
337
|
+
const dispatch = yield input.options.onEvent(ctx, {
|
|
338
|
+
eventType,
|
|
339
|
+
rawEventType: ctx.rawEventType,
|
|
340
|
+
payload,
|
|
341
|
+
});
|
|
342
|
+
return applyDispatch({
|
|
343
|
+
options: input.options,
|
|
344
|
+
args,
|
|
345
|
+
ctx,
|
|
346
|
+
dispatch,
|
|
347
|
+
extra,
|
|
348
|
+
message: `Bitbucket ${eventType} event on ${ctx.repository.fullName}`,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* HTTP entry for a single agent's Bitbucket channel: `X-Hub-Signature` HMAC
|
|
356
|
+
* when a secret is configured, then {@link dispatchBitbucketWebhook}.
|
|
357
|
+
* Without a secret the route auth owns admission (`serve --dev` admits
|
|
358
|
+
* loopback only; production stays loopback-strict).
|
|
359
|
+
*/
|
|
360
|
+
export function handleBitbucketWebhookRequest(input) {
|
|
361
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
+
var _a, _b;
|
|
363
|
+
const bodyText = yield input.request.text();
|
|
364
|
+
const secret = resolveBitbucketWebhookSecret(input.options);
|
|
365
|
+
if (secret !== undefined && input.skipSignatureVerification !== true) {
|
|
366
|
+
if (!verifyBitbucketWebhookSignature(bodyText, input.request.headers.get("x-hub-signature"), secret)) {
|
|
367
|
+
return Response.json({ ok: false, error: "invalid_signature" }, { status: 401 });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
let payload;
|
|
371
|
+
try {
|
|
372
|
+
payload = JSON.parse(bodyText);
|
|
373
|
+
}
|
|
374
|
+
catch (_c) {
|
|
375
|
+
return Response.json({ ok: false, error: "invalid_json" }, { status: 400 });
|
|
376
|
+
}
|
|
377
|
+
const delivery = parseBitbucketWebhookPayload(payload, input.request.headers.get("x-event-key"));
|
|
378
|
+
if (delivery === null) {
|
|
379
|
+
return invalidPayload("invalid_bitbucket_payload");
|
|
380
|
+
}
|
|
381
|
+
delivery.deliveryId = (_b = (_a = input.request.headers.get("x-request-uuid")) !== null && _a !== void 0 ? _a : input.request.headers.get("x-request-id")) !== null && _b !== void 0 ? _b : undefined;
|
|
382
|
+
return dispatchBitbucketWebhook({
|
|
383
|
+
options: input.options,
|
|
384
|
+
delivery,
|
|
385
|
+
proxy: input.proxy,
|
|
386
|
+
args: bindLocalIngressSend(input.args, {
|
|
387
|
+
identity: input.options.continuation,
|
|
388
|
+
kind: BITBUCKET_CHANNEL_KIND,
|
|
389
|
+
eventType: delivery.eventType,
|
|
390
|
+
payload: delivery.payload,
|
|
391
|
+
}),
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitbucket build statuses — the Bitbucket {@link CiCheckWriter} behind the
|
|
3
|
+
* shared check lifecycle in `../checks.js`.
|
|
4
|
+
*
|
|
5
|
+
* Bitbucket has no Checks API; the PR page shows **build statuses** keyed
|
|
6
|
+
* by `(commit, key)`. Cloud: `POST /repositories/{ws}/{slug}/commit/{sha}/
|
|
7
|
+
* statuses/build`; Data Center: `POST /projects/{KEY}/repos/{slug}/commits/
|
|
8
|
+
* {sha}/builds`. The writer maps the shared status / conclusion pair onto
|
|
9
|
+
* Bitbucket's state set and re-posts the full desired state on every write,
|
|
10
|
+
* so `resumeBitbucketCheck` needs only `(sha, key)` to rebuild a handle.
|
|
11
|
+
*/
|
|
12
|
+
import { type CiCheck, type CiCheckConcludeInput, type CiCheckConclusion, type CiCheckCreateInput, type CiCheckOutput, type CiCheckRef, type CiCheckStatus, type CiChecksClient, type CiCheckUpdateInput } from "../checks.js";
|
|
13
|
+
import type { BitbucketApi, BitbucketBuildStatusState } from "./api.js";
|
|
14
|
+
/** Anything that can post a Bitbucket build status. */
|
|
15
|
+
export type BitbucketCheckClient = Pick<BitbucketApi, "setBuildStatus">;
|
|
16
|
+
/** Shared check status / conclusion → Bitbucket build-status state. */
|
|
17
|
+
export declare function bitbucketBuildStatusState(input: {
|
|
18
|
+
status: CiCheckStatus;
|
|
19
|
+
conclusion?: CiCheckConclusion;
|
|
20
|
+
}): BitbucketBuildStatusState;
|
|
21
|
+
export type BitbucketCheckOutput = CiCheckOutput;
|
|
22
|
+
export type BitbucketCheckUpdateInput = CiCheckUpdateInput;
|
|
23
|
+
export type BitbucketCheckConcludeInput = CiCheckConcludeInput;
|
|
24
|
+
/** A created build status. All methods throw `BitbucketApiError` on failure. */
|
|
25
|
+
export type BitbucketCheck = CiCheck & CiCheckRef;
|
|
26
|
+
export interface BitbucketCheckIdentityInput {
|
|
27
|
+
/** Client used for every API call on the returned handle. */
|
|
28
|
+
bitbucket: BitbucketCheckClient;
|
|
29
|
+
/** Status key shown on the PR, e.g. `"cursor/security-review"`. */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Commit the status attaches to (usually the PR head SHA). */
|
|
32
|
+
sha: string;
|
|
33
|
+
}
|
|
34
|
+
export interface BitbucketCheckCreateInput extends BitbucketCheckIdentityInput, CiCheckCreateInput {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Open a build status on `sha` and return a handle for later updates.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* const check = await createBitbucketCheck({
|
|
41
|
+
* bitbucket: ctx.bitbucket.api,
|
|
42
|
+
* name: "cursor/security-review",
|
|
43
|
+
* sha: pullRequest.headSha,
|
|
44
|
+
* detailsUrl: sessionUrl,
|
|
45
|
+
* output: { title: "Running…", summary: "" },
|
|
46
|
+
* });
|
|
47
|
+
* await check.conclude({ conclusion: "success", output: { title: "Clean", summary: "" } });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function createBitbucketCheck(input: BitbucketCheckCreateInput): Promise<BitbucketCheck>;
|
|
51
|
+
/**
|
|
52
|
+
* Rebuild a {@link BitbucketCheck} handle for an existing status row from
|
|
53
|
+
* its identity. No API call is made until the first update.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resumeBitbucketCheck(input: BitbucketCheckIdentityInput & {
|
|
56
|
+
/** Last known status; defaults to `"in_progress"`. */
|
|
57
|
+
status?: CiCheckStatus;
|
|
58
|
+
url?: string;
|
|
59
|
+
}): BitbucketCheck;
|
|
60
|
+
/**
|
|
61
|
+
* Repo-bound checks adapter satisfying the shared {@link CiChecksClient}
|
|
62
|
+
* contract for forge-agnostic check code.
|
|
63
|
+
*/
|
|
64
|
+
export declare function bindBitbucketChecks(input: {
|
|
65
|
+
bitbucket: BitbucketCheckClient;
|
|
66
|
+
}): CiChecksClient;
|
|
67
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/channels/bitbucket/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EAIxB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAExE,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAExE,uEAAuE;AACvE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC,GAAG,yBAAyB,CAiB5B;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC;AACjD,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAE/D,gFAAgF;AAChF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC;AAElD,MAAM,WAAW,2BAA2B;IAC1C,6DAA6D;IAC7D,SAAS,EAAE,oBAAoB,CAAC;IAChC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,yBACf,SAAQ,2BAA2B,EACjC,kBAAkB;CAAG;AAiCzB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,2BAA2B,GAAG;IACnC,sDAAsD;IACtD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GACA,cAAc,CAKhB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,SAAS,EAAE,oBAAoB,CAAC;CACjC,GAAG,cAAc,CAKjB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitbucket build statuses — the Bitbucket {@link CiCheckWriter} behind the
|
|
3
|
+
* shared check lifecycle in `../checks.js`.
|
|
4
|
+
*
|
|
5
|
+
* Bitbucket has no Checks API; the PR page shows **build statuses** keyed
|
|
6
|
+
* by `(commit, key)`. Cloud: `POST /repositories/{ws}/{slug}/commit/{sha}/
|
|
7
|
+
* statuses/build`; Data Center: `POST /projects/{KEY}/repos/{slug}/commits/
|
|
8
|
+
* {sha}/builds`. The writer maps the shared status / conclusion pair onto
|
|
9
|
+
* Bitbucket's state set and re-posts the full desired state on every write,
|
|
10
|
+
* so `resumeBitbucketCheck` needs only `(sha, key)` to rebuild a handle.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { openCiCheck, resumeCiCheck, } from "../checks.js";
|
|
22
|
+
/** Shared check status / conclusion → Bitbucket build-status state. */
|
|
23
|
+
export function bitbucketBuildStatusState(input) {
|
|
24
|
+
if (input.status === "queued" || input.status === "in_progress") {
|
|
25
|
+
return "INPROGRESS";
|
|
26
|
+
}
|
|
27
|
+
switch (input.conclusion) {
|
|
28
|
+
case "success":
|
|
29
|
+
case "neutral":
|
|
30
|
+
case "skipped":
|
|
31
|
+
return "SUCCESSFUL";
|
|
32
|
+
case "cancelled":
|
|
33
|
+
return "STOPPED";
|
|
34
|
+
case "failure":
|
|
35
|
+
case "action_required":
|
|
36
|
+
case "timed_out":
|
|
37
|
+
case undefined:
|
|
38
|
+
return "FAILED";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Bitbucket writer: every write re-posts the status row for `(sha, key)`.
|
|
43
|
+
* Tracks the last written status so an output-only update keeps the state.
|
|
44
|
+
* Build statuses have no server id or page URL of their own.
|
|
45
|
+
*/
|
|
46
|
+
function bitbucketCheckWriter(input) {
|
|
47
|
+
var _a;
|
|
48
|
+
let lastStatus = (_a = input.status) !== null && _a !== void 0 ? _a : "in_progress";
|
|
49
|
+
let lastUrl = input.url;
|
|
50
|
+
return (write) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
var _c, _d, _e;
|
|
53
|
+
const status = (_c = write.status) !== null && _c !== void 0 ? _c : (write.conclusion === undefined ? lastStatus : "completed");
|
|
54
|
+
lastStatus = status;
|
|
55
|
+
lastUrl = (_d = write.detailsUrl) !== null && _d !== void 0 ? _d : lastUrl;
|
|
56
|
+
yield input.bitbucket.setBuildStatus({
|
|
57
|
+
sha: input.sha,
|
|
58
|
+
key: input.name,
|
|
59
|
+
name: (_e = (_a = write.output) === null || _a === void 0 ? void 0 : _a.title) !== null && _e !== void 0 ? _e : input.name,
|
|
60
|
+
state: bitbucketBuildStatusState({
|
|
61
|
+
status,
|
|
62
|
+
conclusion: write.conclusion,
|
|
63
|
+
}),
|
|
64
|
+
url: lastUrl,
|
|
65
|
+
description: (_b = write.output) === null || _b === void 0 ? void 0 : _b.summary,
|
|
66
|
+
});
|
|
67
|
+
return lastUrl === undefined ? undefined : { url: lastUrl };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Open a build status on `sha` and return a handle for later updates.
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* const check = await createBitbucketCheck({
|
|
75
|
+
* bitbucket: ctx.bitbucket.api,
|
|
76
|
+
* name: "cursor/security-review",
|
|
77
|
+
* sha: pullRequest.headSha,
|
|
78
|
+
* detailsUrl: sessionUrl,
|
|
79
|
+
* output: { title: "Running…", summary: "" },
|
|
80
|
+
* });
|
|
81
|
+
* await check.conclude({ conclusion: "success", output: { title: "Clean", summary: "" } });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function createBitbucketCheck(input) {
|
|
85
|
+
return openCiCheck(bitbucketCheckWriter(input), input);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Rebuild a {@link BitbucketCheck} handle for an existing status row from
|
|
89
|
+
* its identity. No API call is made until the first update.
|
|
90
|
+
*/
|
|
91
|
+
export function resumeBitbucketCheck(input) {
|
|
92
|
+
return resumeCiCheck(bitbucketCheckWriter(input), input.url === undefined ? undefined : { url: input.url });
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Repo-bound checks adapter satisfying the shared {@link CiChecksClient}
|
|
96
|
+
* contract for forge-agnostic check code.
|
|
97
|
+
*/
|
|
98
|
+
export function bindBitbucketChecks(input) {
|
|
99
|
+
return {
|
|
100
|
+
createCheck: (check) => createBitbucketCheck(Object.assign(Object.assign({}, check), { bitbucket: input.bitbucket })),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor-account mode for Bitbucket channels.
|
|
3
|
+
*
|
|
4
|
+
* `bitbucketChannel({ cursorAccount })` declares that outbound Bitbucket
|
|
5
|
+
* calls run through the Cursor SCM proxy (`/v0/bitbucket-proxy`) with the
|
|
6
|
+
* tenant's credential swapped in server-side. The serve host binds the
|
|
7
|
+
* Cursor API key and the proxy transport at startup when
|
|
8
|
+
* `--cursor-scm-proxy` is set; until then `ctx.bitbucket` falls back to
|
|
9
|
+
* direct `BITBUCKET_TOKEN` access.
|
|
10
|
+
*/
|
|
11
|
+
import type { BitbucketProxyTransport } from "./api.js";
|
|
12
|
+
import type { BitbucketChannelOptions } from "./types.js";
|
|
13
|
+
export declare const CURSOR_BITBUCKET_MAX_REPOS = 20;
|
|
14
|
+
export interface CursorBitbucketRepoScope {
|
|
15
|
+
/** Lowercased `owner/slug` repos. */
|
|
16
|
+
repos: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
/** Host-bound credential: Cursor API key + proxy transport, bound at serve. */
|
|
19
|
+
export interface PendingCursorBitbucketCredentials {
|
|
20
|
+
bind(getApiKey: () => Promise<string>): void;
|
|
21
|
+
bindProxyTransport(transport: Omit<BitbucketProxyTransport, "getApiKey">): void;
|
|
22
|
+
/** The full proxy transport once both halves are bound. */
|
|
23
|
+
getProxyTransport(): BitbucketProxyTransport | undefined;
|
|
24
|
+
}
|
|
25
|
+
export interface BitbucketCursorAccountRuntime {
|
|
26
|
+
/** Authored channel options (not rewritten). */
|
|
27
|
+
options: BitbucketChannelOptions;
|
|
28
|
+
credentials: PendingCursorBitbucketCredentials;
|
|
29
|
+
scope: CursorBitbucketRepoScope | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare function parseCursorBitbucketRepoScope(values: readonly string[]): CursorBitbucketRepoScope;
|
|
32
|
+
export declare function createPendingCursorBitbucketCredentials(): PendingCursorBitbucketCredentials;
|
|
33
|
+
/** Bitbucket-proxy base URL (`/v0/bitbucket-proxy`, `AGENT_SERVE_BITBUCKET_PROXY_URL`). */
|
|
34
|
+
export declare function resolveCursorBitbucketProxyUrl(backendBaseUrl: string): string;
|
|
35
|
+
export declare function registerBitbucketCursorAccountRuntime(definition: object, runtime: BitbucketCursorAccountRuntime): void;
|
|
36
|
+
export declare function getBitbucketCursorAccountRuntime(definition: object): BitbucketCursorAccountRuntime | undefined;
|
|
37
|
+
//# sourceMappingURL=cursor-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-account.d.ts","sourceRoot":"","sources":["../../../src/channels/bitbucket/cursor-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAI7C,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,+EAA+E;AAC/E,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7C,kBAAkB,CAChB,SAAS,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,CAAC,GACpD,IAAI,CAAC;IACR,2DAA2D;IAC3D,iBAAiB,IAAI,uBAAuB,GAAG,SAAS,CAAC;CAC1D;AAED,MAAM,WAAW,6BAA6B;IAC5C,gDAAgD;IAChD,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,EAAE,iCAAiC,CAAC;IAC/C,KAAK,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAC7C;AAOD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,wBAAwB,CA+B1B;AAED,wBAAgB,uCAAuC,IAAI,iCAAiC,CAiB3F;AAED,2FAA2F;AAC3F,wBAAgB,8BAA8B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,6BAA6B,GACrC,IAAI,CAEN;AAED,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,GACjB,6BAA6B,GAAG,SAAS,CAE3C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor-account mode for Bitbucket channels.
|
|
3
|
+
*
|
|
4
|
+
* `bitbucketChannel({ cursorAccount })` declares that outbound Bitbucket
|
|
5
|
+
* calls run through the Cursor SCM proxy (`/v0/bitbucket-proxy`) with the
|
|
6
|
+
* tenant's credential swapped in server-side. The serve host binds the
|
|
7
|
+
* Cursor API key and the proxy transport at startup when
|
|
8
|
+
* `--cursor-scm-proxy` is set; until then `ctx.bitbucket` falls back to
|
|
9
|
+
* direct `BITBUCKET_TOKEN` access.
|
|
10
|
+
*/
|
|
11
|
+
import { resolveCursorScmProxyUrl } from "../github/cursor-account.js";
|
|
12
|
+
export const CURSOR_BITBUCKET_MAX_REPOS = 20;
|
|
13
|
+
/** `workspace/slug` (Cloud) or `PROJECT/slug` (Data Center). */
|
|
14
|
+
const CURSOR_BITBUCKET_REPO_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
15
|
+
const runtimeByDefinition = new WeakMap();
|
|
16
|
+
export function parseCursorBitbucketRepoScope(values) {
|
|
17
|
+
const repos = [
|
|
18
|
+
...new Set(values
|
|
19
|
+
.map((repo) => repo
|
|
20
|
+
.trim()
|
|
21
|
+
.replace(/^\/+|\/+$/g, "")
|
|
22
|
+
.toLowerCase())
|
|
23
|
+
.filter(Boolean)),
|
|
24
|
+
];
|
|
25
|
+
if (repos.length === 0) {
|
|
26
|
+
throw new Error("bitbucketChannel({ cursorAccount }) requires at least one repo.");
|
|
27
|
+
}
|
|
28
|
+
if (repos.length > CURSOR_BITBUCKET_MAX_REPOS) {
|
|
29
|
+
throw new Error(`bitbucketChannel({ cursorAccount }) supports at most ${CURSOR_BITBUCKET_MAX_REPOS} repos.`);
|
|
30
|
+
}
|
|
31
|
+
for (const repo of repos) {
|
|
32
|
+
if (!CURSOR_BITBUCKET_REPO_PATTERN.test(repo) || repo.includes("..")) {
|
|
33
|
+
throw new Error(`Invalid Bitbucket repo "${repo}"; expected workspace/repo or PROJECT/repo.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { repos };
|
|
37
|
+
}
|
|
38
|
+
export function createPendingCursorBitbucketCredentials() {
|
|
39
|
+
let getApiKey;
|
|
40
|
+
let transport;
|
|
41
|
+
return {
|
|
42
|
+
bind(next) {
|
|
43
|
+
getApiKey = next;
|
|
44
|
+
},
|
|
45
|
+
bindProxyTransport(next) {
|
|
46
|
+
transport = next;
|
|
47
|
+
},
|
|
48
|
+
getProxyTransport() {
|
|
49
|
+
if (getApiKey === undefined || transport === undefined) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return Object.assign(Object.assign({}, transport), { getApiKey });
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Bitbucket-proxy base URL (`/v0/bitbucket-proxy`, `AGENT_SERVE_BITBUCKET_PROXY_URL`). */
|
|
57
|
+
export function resolveCursorBitbucketProxyUrl(backendBaseUrl) {
|
|
58
|
+
return resolveCursorScmProxyUrl("bitbucket", backendBaseUrl);
|
|
59
|
+
}
|
|
60
|
+
export function registerBitbucketCursorAccountRuntime(definition, runtime) {
|
|
61
|
+
runtimeByDefinition.set(definition, runtime);
|
|
62
|
+
}
|
|
63
|
+
export function getBitbucketCursorAccountRuntime(definition) {
|
|
64
|
+
return runtimeByDefinition.get(definition);
|
|
65
|
+
}
|