@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
|
@@ -1,921 +0,0 @@
|
|
|
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 { spawn } from "node:child_process";
|
|
11
|
-
import { parsePrUrl } from "./scm/pr-url.js";
|
|
12
|
-
/** Parse a PR URL into the SCM target to read or post comments on. */
|
|
13
|
-
export function resolveScmReviewTarget(prUrl) {
|
|
14
|
-
const parsed = parsePrUrl(prUrl);
|
|
15
|
-
if (parsed === undefined) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
provider: parsed.provider,
|
|
20
|
-
repo: `${parsed.owner}/${parsed.repo}`,
|
|
21
|
-
prNumber: parsed.number,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Lister for a resolved target, mirroring Bugbot's `createPrGitProvider`
|
|
26
|
-
* dispatch. Returns undefined when the host cannot serve that provider (no
|
|
27
|
-
* GitHub/Origin client bound), so callers degrade instead of throwing.
|
|
28
|
-
*/
|
|
29
|
-
export function createReviewCommentLister(args) {
|
|
30
|
-
switch (args.target.provider) {
|
|
31
|
-
case "github":
|
|
32
|
-
return args.github === undefined
|
|
33
|
-
? undefined
|
|
34
|
-
: createHostGithubReviewCommentLister(args.github, args.log);
|
|
35
|
-
case "origin":
|
|
36
|
-
return args.origin === undefined
|
|
37
|
-
? undefined
|
|
38
|
-
: createHostOriginReviewCommentLister(args.origin, args.log);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Resolver for a resolved target. Returns undefined when the host cannot
|
|
43
|
-
* serve that provider, so callers degrade instead of throwing.
|
|
44
|
-
*/
|
|
45
|
-
export function createReviewThreadResolver(args) {
|
|
46
|
-
switch (args.target.provider) {
|
|
47
|
-
case "github":
|
|
48
|
-
return args.github === undefined
|
|
49
|
-
? undefined
|
|
50
|
-
: createHostGithubReviewThreadResolver(args.github, args.log);
|
|
51
|
-
case "origin":
|
|
52
|
-
return args.origin === undefined
|
|
53
|
-
? undefined
|
|
54
|
-
: createHostOriginReviewThreadResolver(args.origin, args.log);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Resolve `threadIds` on `prUrl`'s PR.
|
|
59
|
-
*
|
|
60
|
-
* No-ops (never throws) when the PR is on an SCM this host cannot write,
|
|
61
|
-
* no client is bound, or `threadIds` is empty. Same degrade-don't-fail
|
|
62
|
-
* posture as {@link createReviewCommentLister}.
|
|
63
|
-
*/
|
|
64
|
-
export function resolveReviewThreads(args) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
var _a;
|
|
67
|
-
if (args.threadIds.length === 0) {
|
|
68
|
-
return skippedResolve("no threads to resolve");
|
|
69
|
-
}
|
|
70
|
-
const target = resolveScmReviewTarget(args.prUrl);
|
|
71
|
-
if (target === undefined) {
|
|
72
|
-
return skippedResolve("no SCM resolver for this PR URL");
|
|
73
|
-
}
|
|
74
|
-
const resolver = (_a = args.resolver) !== null && _a !== void 0 ? _a : createReviewThreadResolver({
|
|
75
|
-
target,
|
|
76
|
-
github: args.github,
|
|
77
|
-
origin: args.origin,
|
|
78
|
-
log: args.log,
|
|
79
|
-
});
|
|
80
|
-
if (resolver === undefined) {
|
|
81
|
-
return skippedResolve(`no ${target.provider} client bound to resolve threads`);
|
|
82
|
-
}
|
|
83
|
-
return resolver.resolveReviewThreads({
|
|
84
|
-
target,
|
|
85
|
-
threadIds: args.threadIds,
|
|
86
|
-
signal: args.signal,
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
/** Cap on pages pulled per PR; GitHub serves 100 comments per page. */
|
|
91
|
-
const REVIEW_COMMENTS_MAX_PAGES = 5;
|
|
92
|
-
const REVIEW_COMMENTS_PAGE_SIZE = 100;
|
|
93
|
-
/** Cap on review-thread pages when listing a PR's inline threads. */
|
|
94
|
-
const REVIEW_THREADS_MAX_PAGES = 20;
|
|
95
|
-
const REVIEW_THREADS_PAGE_SIZE = 100;
|
|
96
|
-
/** Cap on Origin comment pages pulled per PR (100 comments per page). */
|
|
97
|
-
const ORIGIN_COMMENTS_MAX_PAGES = 20;
|
|
98
|
-
const ORIGIN_COMMENTS_PAGE_SIZE = 100;
|
|
99
|
-
/**
|
|
100
|
-
* Repo-scope header for GraphQL calls through the Cursor github-proxy.
|
|
101
|
-
*
|
|
102
|
-
* The proxy authorizes each call from `x-cursor-github-repos`, which the
|
|
103
|
-
* channel Octokit derives from REST URLs (`/repos/{owner}/{repo}/…`).
|
|
104
|
-
* GraphQL posts to `/graphql` — no repo in the URL — so without this
|
|
105
|
-
* explicit header every GraphQL call is rejected in proxy mode. Harmless
|
|
106
|
-
* against api.github.com, which ignores unknown headers.
|
|
107
|
-
*/
|
|
108
|
-
function githubGraphqlScopeHeaders(repo) {
|
|
109
|
-
return { "x-cursor-github-repos": repo.toLowerCase() };
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* GitHub review thread → {@link ListedReviewComment} (its opening comment).
|
|
113
|
-
*
|
|
114
|
-
* Prefers the `original*` line fields — the position as of the review the
|
|
115
|
-
* thread belongs to. `line` drifts as the PR gains commits, so a caller
|
|
116
|
-
* correlating a comment with the review that produced it needs the original
|
|
117
|
-
* position, the same fields Bugbot carries on `PullRequestCommentOutput`.
|
|
118
|
-
*/
|
|
119
|
-
export function listedCommentFromGithubThread(thread) {
|
|
120
|
-
var _a, _b, _c, _d, _e;
|
|
121
|
-
var _f, _g, _h, _j, _k, _l;
|
|
122
|
-
const opener = (_b = (_a = thread.comments) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b[0];
|
|
123
|
-
if (thread.id === undefined ||
|
|
124
|
-
thread.id === "" ||
|
|
125
|
-
opener === null ||
|
|
126
|
-
opener === undefined ||
|
|
127
|
-
opener.databaseId === undefined ||
|
|
128
|
-
opener.databaseId === null ||
|
|
129
|
-
typeof opener.body !== "string" ||
|
|
130
|
-
typeof thread.path !== "string" ||
|
|
131
|
-
thread.path === "") {
|
|
132
|
-
return undefined;
|
|
133
|
-
}
|
|
134
|
-
// Take both lines from the same position set. Mixing them (original end
|
|
135
|
-
// line with the drifted current start line) would describe a range that
|
|
136
|
-
// never existed in either revision.
|
|
137
|
-
const original = (_f = thread.originalLine) !== null && _f !== void 0 ? _f : undefined;
|
|
138
|
-
const endLine = (_g = original !== null && original !== void 0 ? original : thread.line) !== null && _g !== void 0 ? _g : undefined;
|
|
139
|
-
if (endLine === undefined) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
const startLine = (_h = (original === undefined ? thread.startLine : thread.originalStartLine)) !== null && _h !== void 0 ? _h : endLine;
|
|
143
|
-
const commitSha = (_j = (_c = opener.originalCommit) === null || _c === void 0 ? void 0 : _c.oid) !== null && _j !== void 0 ? _j : undefined;
|
|
144
|
-
const authorLogin = (_k = (_d = opener.author) === null || _d === void 0 ? void 0 : _d.login) !== null && _k !== void 0 ? _k : undefined;
|
|
145
|
-
const authorType = (_l = (_e = opener.author) === null || _e === void 0 ? void 0 : _e.__typename) !== null && _l !== void 0 ? _l : undefined;
|
|
146
|
-
return Object.assign(Object.assign(Object.assign({ commentId: String(opener.databaseId), numericCommentId: opener.databaseId, threadId: thread.id, resolved: thread.isResolved === true, file: thread.path, startLine,
|
|
147
|
-
endLine, body: opener.body }, (commitSha === undefined ? {} : { commitSha })), (authorLogin === undefined ? {} : { authorLogin })), (authorType === undefined ? {} : { authorIsBot: authorType === "Bot" }));
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Lists the PR's inline review threads (their opening comments) through the
|
|
151
|
-
* host GitHub client (Cursor account lease, App installation token, or
|
|
152
|
-
* PAT). One paged GraphQL query yields, per thread: the resolvable thread
|
|
153
|
-
* node id, its resolution state, the opener's body/position, and the commit
|
|
154
|
-
* it was filed against — everything a Bugbot-style re-review needs.
|
|
155
|
-
*/
|
|
156
|
-
export function createHostGithubReviewCommentLister(github, log) {
|
|
157
|
-
return {
|
|
158
|
-
listReviewComments(_a) {
|
|
159
|
-
return __awaiter(this, arguments, void 0, function* ({ target, signal }) {
|
|
160
|
-
var _b, _c;
|
|
161
|
-
var _d;
|
|
162
|
-
const [owner, repo] = target.repo.split("/", 2);
|
|
163
|
-
if (owner === undefined || repo === undefined || repo === "") {
|
|
164
|
-
log === null || log === void 0 ? void 0 : log(`github list: unparseable owner/repo "${target.repo}"`);
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
const octokit = yield github.getOctokit();
|
|
168
|
-
const comments = [];
|
|
169
|
-
let threadCount = 0;
|
|
170
|
-
let cursor = null;
|
|
171
|
-
for (let page = 0; page < REVIEW_THREADS_MAX_PAGES; page++) {
|
|
172
|
-
signal === null || signal === void 0 ? void 0 : signal.throwIfAborted();
|
|
173
|
-
const response = (yield octokit.graphql(REVIEW_THREAD_COMMENTS_FOR_PR_QUERY, {
|
|
174
|
-
owner,
|
|
175
|
-
repo,
|
|
176
|
-
number: target.prNumber,
|
|
177
|
-
cursor,
|
|
178
|
-
headers: githubGraphqlScopeHeaders(target.repo),
|
|
179
|
-
}));
|
|
180
|
-
const reviewThreads = (_c = (_b = response.repository) === null || _b === void 0 ? void 0 : _b.pullRequest) === null || _c === void 0 ? void 0 : _c.reviewThreads;
|
|
181
|
-
for (const thread of (_d = reviewThreads === null || reviewThreads === void 0 ? void 0 : reviewThreads.nodes) !== null && _d !== void 0 ? _d : []) {
|
|
182
|
-
if (thread === null || thread === undefined) {
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
threadCount += 1;
|
|
186
|
-
const listed = listedCommentFromGithubThread(thread);
|
|
187
|
-
if (listed !== undefined) {
|
|
188
|
-
comments.push(listed);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const pageInfo = reviewThreads === null || reviewThreads === void 0 ? void 0 : reviewThreads.pageInfo;
|
|
192
|
-
if ((pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.hasNextPage) !== true || !pageInfo.endCursor) {
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
cursor = pageInfo.endCursor;
|
|
196
|
-
}
|
|
197
|
-
log === null || log === void 0 ? void 0 : log(`github list: ${target.repo}#${target.prNumber} has ${threadCount} review thread(s), ${comments.length} with a normalizable opening comment`);
|
|
198
|
-
return comments;
|
|
199
|
-
});
|
|
200
|
-
},
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Resolves inline review threads by GraphQL thread node id through the host
|
|
205
|
-
* GitHub client (Cursor account lease, App installation token, or PAT) —
|
|
206
|
-
* the id the lister already returned, so no comment→thread mapping pass is
|
|
207
|
-
* needed. Same mutation as Bugbot's `resolveReviewThreadForComment`.
|
|
208
|
-
*/
|
|
209
|
-
export function createHostGithubReviewThreadResolver(github, log) {
|
|
210
|
-
return {
|
|
211
|
-
resolveReviewThreads(_a) {
|
|
212
|
-
return __awaiter(this, arguments, void 0, function* ({ target, threadIds, signal }) {
|
|
213
|
-
var _b, _c;
|
|
214
|
-
const uniqueIds = [...new Set(threadIds.filter((id) => id !== ""))];
|
|
215
|
-
if (uniqueIds.length === 0) {
|
|
216
|
-
return skippedResolve("no threads to resolve");
|
|
217
|
-
}
|
|
218
|
-
let resolved = 0;
|
|
219
|
-
let failed = 0;
|
|
220
|
-
try {
|
|
221
|
-
const octokit = yield github.getOctokit();
|
|
222
|
-
for (const threadId of uniqueIds) {
|
|
223
|
-
signal === null || signal === void 0 ? void 0 : signal.throwIfAborted();
|
|
224
|
-
try {
|
|
225
|
-
const mutation = (yield octokit.graphql(RESOLVE_REVIEW_THREAD_MUTATION, {
|
|
226
|
-
threadId,
|
|
227
|
-
headers: githubGraphqlScopeHeaders(target.repo),
|
|
228
|
-
}));
|
|
229
|
-
if (((_c = (_b = mutation.resolveReviewThread) === null || _b === void 0 ? void 0 : _b.thread) === null || _c === void 0 ? void 0 : _c.isResolved) === true) {
|
|
230
|
-
resolved += 1;
|
|
231
|
-
log === null || log === void 0 ? void 0 : log(`github resolve: thread ${threadId} resolved`);
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
failed += 1;
|
|
235
|
-
log === null || log === void 0 ? void 0 : log(`github resolve: thread ${threadId} mutation did not mark the thread resolved`);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
catch (error) {
|
|
239
|
-
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
240
|
-
throw error;
|
|
241
|
-
}
|
|
242
|
-
failed += 1;
|
|
243
|
-
log === null || log === void 0 ? void 0 : log(`github resolve: thread ${threadId} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return {
|
|
247
|
-
requested: uniqueIds.length,
|
|
248
|
-
resolved,
|
|
249
|
-
failed,
|
|
250
|
-
detail: `resolved ${resolved} of ${uniqueIds.length} thread(s) on ${target.repo}#${target.prNumber} via host GitHub (${failed} failed)`,
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
255
|
-
throw error;
|
|
256
|
-
}
|
|
257
|
-
return {
|
|
258
|
-
requested: uniqueIds.length,
|
|
259
|
-
resolved,
|
|
260
|
-
failed: uniqueIds.length - resolved,
|
|
261
|
-
detail: `host GitHub thread resolve failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
const REVIEW_THREAD_COMMENTS_FOR_PR_QUERY = `
|
|
269
|
-
query ReviewThreadCommentsForPr(
|
|
270
|
-
$owner: String!
|
|
271
|
-
$repo: String!
|
|
272
|
-
$number: Int!
|
|
273
|
-
$cursor: String
|
|
274
|
-
) {
|
|
275
|
-
repository(owner: $owner, name: $repo) {
|
|
276
|
-
pullRequest(number: $number) {
|
|
277
|
-
reviewThreads(first: ${REVIEW_THREADS_PAGE_SIZE}, after: $cursor) {
|
|
278
|
-
nodes {
|
|
279
|
-
id
|
|
280
|
-
isResolved
|
|
281
|
-
path
|
|
282
|
-
line
|
|
283
|
-
originalLine
|
|
284
|
-
startLine
|
|
285
|
-
originalStartLine
|
|
286
|
-
comments(first: 1) {
|
|
287
|
-
nodes {
|
|
288
|
-
databaseId
|
|
289
|
-
body
|
|
290
|
-
author { login __typename }
|
|
291
|
-
originalCommit { oid }
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
pageInfo { hasNextPage endCursor }
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
`;
|
|
301
|
-
const RESOLVE_REVIEW_THREAD_MUTATION = `
|
|
302
|
-
mutation ResolveReviewThread($threadId: ID!) {
|
|
303
|
-
resolveReviewThread(input: { threadId: $threadId }) {
|
|
304
|
-
thread { isResolved }
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
`;
|
|
308
|
-
const GITHUB_VIEWER_LOGIN_QUERY = `
|
|
309
|
-
query ViewerLogin {
|
|
310
|
-
viewer { login }
|
|
311
|
-
}
|
|
312
|
-
`;
|
|
313
|
-
/**
|
|
314
|
-
* The login the bound GitHub client itself acts as — the identity its posts
|
|
315
|
-
* appear under. Works for installation tokens too (GraphQL `viewer` returns
|
|
316
|
-
* the app's bot, e.g. `cursor[bot]`), so a reader can trust comments whose
|
|
317
|
-
* author is provably the same identity it posts with, across every
|
|
318
|
-
* environment's app (prod/staging/cloud-dev/custom) without hardcoding.
|
|
319
|
-
* `repo` scopes the call through the Cursor github-proxy (the minted token
|
|
320
|
-
* — and so the viewer — is per-repo there). Best-effort: `undefined` when
|
|
321
|
-
* the lookup fails.
|
|
322
|
-
*/
|
|
323
|
-
export function fetchGithubSelfLogin(github, args) {
|
|
324
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
var _a, _b, _c, _d;
|
|
326
|
-
try {
|
|
327
|
-
const octokit = yield github.getOctokit();
|
|
328
|
-
(_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
329
|
-
const response = (yield octokit.graphql(GITHUB_VIEWER_LOGIN_QUERY, {
|
|
330
|
-
headers: githubGraphqlScopeHeaders(args.repo),
|
|
331
|
-
}));
|
|
332
|
-
const login = (_b = response.viewer) === null || _b === void 0 ? void 0 : _b.login;
|
|
333
|
-
return typeof login === "string" && login !== "" ? login : undefined;
|
|
334
|
-
}
|
|
335
|
-
catch (error) {
|
|
336
|
-
if ((_c = args.signal) === null || _c === void 0 ? void 0 : _c.aborted) {
|
|
337
|
-
throw error;
|
|
338
|
-
}
|
|
339
|
-
(_d = args.log) === null || _d === void 0 ? void 0 : _d.call(args, `github viewer lookup failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
340
|
-
return undefined;
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Origin public comment → {@link ListedReviewComment}. Only line-anchored
|
|
346
|
-
* threads qualify (general-discussion and file-level threads carry no
|
|
347
|
-
* position a review finding can be pinned to).
|
|
348
|
-
*/
|
|
349
|
-
export function listedCommentFromOriginComment(comment) {
|
|
350
|
-
var _a, _b, _c, _d, _e;
|
|
351
|
-
var _f, _g;
|
|
352
|
-
const thread = comment.thread;
|
|
353
|
-
if (typeof comment.id !== "string" ||
|
|
354
|
-
comment.id === "" ||
|
|
355
|
-
typeof comment.body !== "string" ||
|
|
356
|
-
thread === undefined ||
|
|
357
|
-
typeof thread.id !== "string" ||
|
|
358
|
-
thread.id === "" ||
|
|
359
|
-
typeof thread.path !== "string" ||
|
|
360
|
-
thread.path === "" ||
|
|
361
|
-
typeof thread.startLine !== "number" ||
|
|
362
|
-
thread.startLine <= 0) {
|
|
363
|
-
return undefined;
|
|
364
|
-
}
|
|
365
|
-
const startLine = thread.startLine;
|
|
366
|
-
const endLine = typeof thread.endLine === "number" && thread.endLine >= startLine
|
|
367
|
-
? thread.endLine
|
|
368
|
-
: startLine;
|
|
369
|
-
const commitSha = (_a = thread.version) === null || _a === void 0 ? void 0 : _a.headSha;
|
|
370
|
-
const author = comment.author;
|
|
371
|
-
const authorLogin = (_g = (_f = (_b = author === null || author === void 0 ? void 0 : author.app) === null || _b === void 0 ? void 0 : _b.displayName) !== null && _f !== void 0 ? _f : (_c = author === null || author === void 0 ? void 0 : author.app) === null || _c === void 0 ? void 0 : _c.id) !== null && _g !== void 0 ? _g : (_d = author === null || author === void 0 ? void 0 : author.user) === null || _d === void 0 ? void 0 : _d.email;
|
|
372
|
-
// App and service-account actors are machine identities; only a `user`
|
|
373
|
-
// actor is a human PR participant.
|
|
374
|
-
const authorIsBot = author === undefined
|
|
375
|
-
? undefined
|
|
376
|
-
: author.app !== undefined || author.serviceAccount !== undefined;
|
|
377
|
-
const authorAppId = (_e = author === null || author === void 0 ? void 0 : author.app) === null || _e === void 0 ? void 0 : _e.id;
|
|
378
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({ commentId: comment.id, threadId: thread.id, resolved: typeof thread.resolvedAt === "string" && thread.resolvedAt !== "", file: thread.path, startLine,
|
|
379
|
-
endLine, body: comment.body }, (typeof commitSha === "string" && commitSha !== "" ? { commitSha } : {})), (typeof authorLogin === "string" && authorLogin !== ""
|
|
380
|
-
? { authorLogin }
|
|
381
|
-
: {})), (authorIsBot === undefined ? {} : { authorIsBot })), (typeof authorAppId === "string" && authorAppId !== ""
|
|
382
|
-
? { authorAppId }
|
|
383
|
-
: {}));
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Lists the PR's inline review threads through the Origin public REST API
|
|
387
|
-
* (`GET …/pulls/{n}/comments`, paged). The flattened comment list is
|
|
388
|
-
* ordered by creation time, so the first comment seen per thread is the
|
|
389
|
-
* thread opener; replies are dropped.
|
|
390
|
-
*/
|
|
391
|
-
export function createHostOriginReviewCommentLister(origin, log) {
|
|
392
|
-
return {
|
|
393
|
-
listReviewComments(_a) {
|
|
394
|
-
return __awaiter(this, arguments, void 0, function* ({ target, signal }) {
|
|
395
|
-
var _b, _c;
|
|
396
|
-
const [owner, repo] = target.repo.split("/", 2);
|
|
397
|
-
if (owner === undefined || repo === undefined || repo === "") {
|
|
398
|
-
log === null || log === void 0 ? void 0 : log(`origin list: unparseable owner/repo "${target.repo}"`);
|
|
399
|
-
return [];
|
|
400
|
-
}
|
|
401
|
-
const basePath = `/v1/origin/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls/${target.prNumber}/comments`;
|
|
402
|
-
const comments = [];
|
|
403
|
-
const seenThreads = new Set();
|
|
404
|
-
let totalComments = 0;
|
|
405
|
-
let pageToken = "";
|
|
406
|
-
for (let page = 0; page < ORIGIN_COMMENTS_MAX_PAGES; page++) {
|
|
407
|
-
signal === null || signal === void 0 ? void 0 : signal.throwIfAborted();
|
|
408
|
-
const query = pageToken === ""
|
|
409
|
-
? `?pageSize=${ORIGIN_COMMENTS_PAGE_SIZE}`
|
|
410
|
-
: `?pageSize=${ORIGIN_COMMENTS_PAGE_SIZE}&pageToken=${encodeURIComponent(pageToken)}`;
|
|
411
|
-
const response = (yield origin.request({
|
|
412
|
-
method: "GET",
|
|
413
|
-
path: `${basePath}${query}`,
|
|
414
|
-
}));
|
|
415
|
-
for (const comment of (_b = response === null || response === void 0 ? void 0 : response.comments) !== null && _b !== void 0 ? _b : []) {
|
|
416
|
-
if (comment === null || comment === undefined) {
|
|
417
|
-
continue;
|
|
418
|
-
}
|
|
419
|
-
totalComments += 1;
|
|
420
|
-
const listed = listedCommentFromOriginComment(comment);
|
|
421
|
-
if (listed === undefined || seenThreads.has(listed.threadId)) {
|
|
422
|
-
// Not line-anchored, or a reply on a thread whose opener was
|
|
423
|
-
// already taken (the list is oldest-first).
|
|
424
|
-
continue;
|
|
425
|
-
}
|
|
426
|
-
seenThreads.add(listed.threadId);
|
|
427
|
-
comments.push(listed);
|
|
428
|
-
}
|
|
429
|
-
pageToken = (_c = response === null || response === void 0 ? void 0 : response.nextPageToken) !== null && _c !== void 0 ? _c : "";
|
|
430
|
-
if (pageToken === "") {
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
log === null || log === void 0 ? void 0 : log(`origin list: ${target.repo}#${target.prNumber} has ${totalComments} comment(s), ${comments.length} line-anchored thread opener(s)`);
|
|
435
|
-
return comments;
|
|
436
|
-
});
|
|
437
|
-
},
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Resolves Origin comment threads through the public REST API
|
|
442
|
-
* (`PATCH …/pulls/threads/{thread_id}` with `resolved: true`).
|
|
443
|
-
*/
|
|
444
|
-
export function createHostOriginReviewThreadResolver(origin, log) {
|
|
445
|
-
return {
|
|
446
|
-
resolveReviewThreads(_a) {
|
|
447
|
-
return __awaiter(this, arguments, void 0, function* ({ target, threadIds, signal }) {
|
|
448
|
-
const uniqueIds = [...new Set(threadIds.filter((id) => id !== ""))];
|
|
449
|
-
if (uniqueIds.length === 0) {
|
|
450
|
-
return skippedResolve("no threads to resolve");
|
|
451
|
-
}
|
|
452
|
-
const [owner, repo] = target.repo.split("/", 2);
|
|
453
|
-
if (owner === undefined || repo === undefined || repo === "") {
|
|
454
|
-
return skippedResolve("unparseable owner/repo from PR URL");
|
|
455
|
-
}
|
|
456
|
-
let resolved = 0;
|
|
457
|
-
let failed = 0;
|
|
458
|
-
for (const threadId of uniqueIds) {
|
|
459
|
-
signal === null || signal === void 0 ? void 0 : signal.throwIfAborted();
|
|
460
|
-
try {
|
|
461
|
-
yield origin.request({
|
|
462
|
-
method: "PATCH",
|
|
463
|
-
path: `/v1/origin/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls/threads/${encodeURIComponent(threadId)}`,
|
|
464
|
-
body: { resolved: true },
|
|
465
|
-
});
|
|
466
|
-
resolved += 1;
|
|
467
|
-
log === null || log === void 0 ? void 0 : log(`origin resolve: thread ${threadId} resolved`);
|
|
468
|
-
}
|
|
469
|
-
catch (error) {
|
|
470
|
-
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
471
|
-
throw error;
|
|
472
|
-
}
|
|
473
|
-
failed += 1;
|
|
474
|
-
log === null || log === void 0 ? void 0 : log(`origin resolve: thread ${threadId} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
return {
|
|
478
|
-
requested: uniqueIds.length,
|
|
479
|
-
resolved,
|
|
480
|
-
failed,
|
|
481
|
-
detail: `resolved ${resolved} of ${uniqueIds.length} thread(s) on ${target.repo}#${target.prNumber} via host Origin (${failed} failed)`,
|
|
482
|
-
};
|
|
483
|
-
});
|
|
484
|
-
},
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Prepares the provider-neutral review payload used by local `gh` posting.
|
|
489
|
-
*/
|
|
490
|
-
export function prepareReviewCommentsRequest(args) {
|
|
491
|
-
var _a;
|
|
492
|
-
const target = parseGithubPrUrl(args.prUrl);
|
|
493
|
-
if (target.kind === "invalid") {
|
|
494
|
-
return { kind: "skipped", result: skipped(target.detail) };
|
|
495
|
-
}
|
|
496
|
-
return {
|
|
497
|
-
kind: "prepared",
|
|
498
|
-
request: {
|
|
499
|
-
provider: "github",
|
|
500
|
-
repo: target.value.repo,
|
|
501
|
-
prNumber: target.value.prNumber,
|
|
502
|
-
headSha: args.reviewedHeadSha,
|
|
503
|
-
message: args.message,
|
|
504
|
-
comments: args.comments,
|
|
505
|
-
cleanupPrevious: (_a = args.cleanupPrevious) !== null && _a !== void 0 ? _a : true,
|
|
506
|
-
},
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Posts a PR review with the local `gh` credentials (`gh auth` / GITHUB_TOKEN /
|
|
511
|
-
* GH_TOKEN). Does not use the security-bugbot comments service.
|
|
512
|
-
*/
|
|
513
|
-
export function createLocalGhReviewPublisher() {
|
|
514
|
-
return {
|
|
515
|
-
postReview(args) {
|
|
516
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
517
|
-
return postReviewViaLocalGh(args);
|
|
518
|
-
});
|
|
519
|
-
},
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Posts a PR review through the host GitHub client (Cursor account lease,
|
|
524
|
-
* App installation token, or PAT). Prefer this on Cursor-deployed agents —
|
|
525
|
-
* no separate GitHub write secret is required when `githubChannel({
|
|
526
|
-
* cursorAccount })` is bound.
|
|
527
|
-
*/
|
|
528
|
-
export function createHostGithubReviewPublisher(github) {
|
|
529
|
-
return {
|
|
530
|
-
postReview(args) {
|
|
531
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
532
|
-
return postReviewViaHostGithub(github, args);
|
|
533
|
-
});
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Pick the publisher for `prUrl`'s SCM. GitHub falls back to local `gh`
|
|
539
|
-
* when no host client is bound (CLI). Origin has no local CLI publisher —
|
|
540
|
-
* returns undefined unless an Origin REST client is provided.
|
|
541
|
-
*/
|
|
542
|
-
export function createReviewCommentPublisher(args) {
|
|
543
|
-
const target = resolveScmReviewTarget(args.prUrl);
|
|
544
|
-
if (target === undefined) {
|
|
545
|
-
return undefined;
|
|
546
|
-
}
|
|
547
|
-
switch (target.provider) {
|
|
548
|
-
case "github":
|
|
549
|
-
return args.github !== undefined
|
|
550
|
-
? createHostGithubReviewPublisher(args.github)
|
|
551
|
-
: createLocalGhReviewPublisher();
|
|
552
|
-
case "origin":
|
|
553
|
-
return args.origin === undefined
|
|
554
|
-
? undefined
|
|
555
|
-
: createHostOriginReviewPublisher(args.origin);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* Posts a COMMENT-verdict Origin review through the public REST API.
|
|
560
|
-
*
|
|
561
|
-
* Inline comments post as diff-anchored threads via the review's
|
|
562
|
-
* `comments` field (`ReviewCommentInput` with an `InlineCommentAnchor`).
|
|
563
|
-
* Origin rejects the whole request with INVALID_ARGUMENT when any anchor
|
|
564
|
-
* is off the reviewed version's diff — the caller's body-only retry (the
|
|
565
|
-
* same fallback GitHub's 422 takes) then folds the findings into the
|
|
566
|
-
* review body.
|
|
567
|
-
*/
|
|
568
|
-
export function createHostOriginReviewPublisher(origin) {
|
|
569
|
-
return {
|
|
570
|
-
postReview(args) {
|
|
571
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
572
|
-
return postReviewViaHostOrigin(origin, args);
|
|
573
|
-
});
|
|
574
|
-
},
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
function postReviewViaHostGithub(github, args) {
|
|
578
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
579
|
-
var _a, _b, _c;
|
|
580
|
-
const prepared = prepareReviewCommentsRequest(args);
|
|
581
|
-
if (prepared.kind === "skipped") {
|
|
582
|
-
return Object.assign(Object.assign({}, prepared.result), { publisher: "host_github" });
|
|
583
|
-
}
|
|
584
|
-
const { request } = prepared;
|
|
585
|
-
const [owner, repo] = request.repo.split("/", 2);
|
|
586
|
-
if (owner === undefined || repo === undefined || repo === "") {
|
|
587
|
-
return skippedHost("unparseable owner/repo from PR URL");
|
|
588
|
-
}
|
|
589
|
-
try {
|
|
590
|
-
(_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
591
|
-
const octokit = yield github.getOctokit();
|
|
592
|
-
(_b = args.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
593
|
-
const response = yield octokit.rest.pulls.createReview({
|
|
594
|
-
owner,
|
|
595
|
-
repo,
|
|
596
|
-
pull_number: request.prNumber,
|
|
597
|
-
commit_id: request.headSha,
|
|
598
|
-
body: request.message,
|
|
599
|
-
event: "COMMENT",
|
|
600
|
-
comments: request.comments.map(toGithubPullRequestReviewComment),
|
|
601
|
-
});
|
|
602
|
-
const htmlUrl = typeof response.data.html_url === "string"
|
|
603
|
-
? response.data.html_url
|
|
604
|
-
: undefined;
|
|
605
|
-
const inlineCommentCount = request.comments.length;
|
|
606
|
-
return {
|
|
607
|
-
posted: true,
|
|
608
|
-
publisher: "host_github",
|
|
609
|
-
mode: inlineCommentCount > 0
|
|
610
|
-
? "review_with_inline_comments"
|
|
611
|
-
: "review_body_only",
|
|
612
|
-
inlineCommentCount,
|
|
613
|
-
detail: htmlUrl
|
|
614
|
-
? `posted via host GitHub: ${htmlUrl}`
|
|
615
|
-
: `posted via host GitHub with ${inlineCommentCount} inline comment(s)`,
|
|
616
|
-
postedComments: yield readPostedComments({
|
|
617
|
-
octokit,
|
|
618
|
-
owner,
|
|
619
|
-
repo,
|
|
620
|
-
prNumber: request.prNumber,
|
|
621
|
-
reviewId: response.data.id,
|
|
622
|
-
expected: inlineCommentCount,
|
|
623
|
-
signal: args.signal,
|
|
624
|
-
}),
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
catch (error) {
|
|
628
|
-
if ((_c = args.signal) === null || _c === void 0 ? void 0 : _c.aborted) {
|
|
629
|
-
throw error;
|
|
630
|
-
}
|
|
631
|
-
return skippedHost(`host GitHub review post failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Ids of the inline comments a just-created review owns.
|
|
637
|
-
*
|
|
638
|
-
* `pulls.createReview` returns the review, not its comments.
|
|
639
|
-
* `listCommentsForReview` either omits those rows or returns them with
|
|
640
|
-
* `line` / `original_line` unset, so the line filter drops every id, the
|
|
641
|
-
* store records no findings, and the next run cannot judge or resolve
|
|
642
|
-
* those threads. Read the PR-wide list instead and keep only this
|
|
643
|
-
* review's rows. Newest-first so a busy PR's older comments cannot push
|
|
644
|
-
* ours past the page cap.
|
|
645
|
-
* Best-effort: any failure yields an empty list, which costs the next run
|
|
646
|
-
* its prior findings rather than risking a wrong id. Never throws — the
|
|
647
|
-
* review is already posted by this point.
|
|
648
|
-
*/
|
|
649
|
-
function readPostedComments(args) {
|
|
650
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
651
|
-
var _a;
|
|
652
|
-
var _b;
|
|
653
|
-
if (args.expected === 0) {
|
|
654
|
-
return [];
|
|
655
|
-
}
|
|
656
|
-
try {
|
|
657
|
-
const posted = [];
|
|
658
|
-
for (let page = 1; page <= REVIEW_COMMENTS_MAX_PAGES; page++) {
|
|
659
|
-
(_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
660
|
-
const response = yield args.octokit.rest.pulls.listReviewComments({
|
|
661
|
-
owner: args.owner,
|
|
662
|
-
repo: args.repo,
|
|
663
|
-
pull_number: args.prNumber,
|
|
664
|
-
sort: "created",
|
|
665
|
-
direction: "desc",
|
|
666
|
-
per_page: REVIEW_COMMENTS_PAGE_SIZE,
|
|
667
|
-
page,
|
|
668
|
-
});
|
|
669
|
-
for (const comment of response.data) {
|
|
670
|
-
if (comment.pull_request_review_id !== args.reviewId) {
|
|
671
|
-
continue;
|
|
672
|
-
}
|
|
673
|
-
const line = (_b = comment.original_line) !== null && _b !== void 0 ? _b : comment.line;
|
|
674
|
-
if (line === null || line === undefined) {
|
|
675
|
-
continue;
|
|
676
|
-
}
|
|
677
|
-
posted.push({ id: comment.id, file: comment.path, line });
|
|
678
|
-
}
|
|
679
|
-
if (posted.length >= args.expected ||
|
|
680
|
-
response.data.length < REVIEW_COMMENTS_PAGE_SIZE) {
|
|
681
|
-
break;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
return posted;
|
|
685
|
-
}
|
|
686
|
-
catch (_c) {
|
|
687
|
-
return [];
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
function postReviewViaLocalGh(args) {
|
|
692
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
693
|
-
var _a, _b;
|
|
694
|
-
const prepared = prepareReviewCommentsRequest(args);
|
|
695
|
-
if (prepared.kind === "skipped") {
|
|
696
|
-
return prepared.result;
|
|
697
|
-
}
|
|
698
|
-
const { request } = prepared;
|
|
699
|
-
const path = `repos/${request.repo}/pulls/${request.prNumber}/reviews`;
|
|
700
|
-
const payload = {
|
|
701
|
-
commit_id: request.headSha,
|
|
702
|
-
body: request.message,
|
|
703
|
-
event: "COMMENT",
|
|
704
|
-
comments: request.comments.map(toGithubReviewComment),
|
|
705
|
-
};
|
|
706
|
-
try {
|
|
707
|
-
(_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
708
|
-
const response = yield ghApiPostJson(path, payload, args.signal);
|
|
709
|
-
const htmlUrl = typeof response.html_url === "string" ? response.html_url : undefined;
|
|
710
|
-
const inlineCommentCount = request.comments.length;
|
|
711
|
-
return {
|
|
712
|
-
posted: true,
|
|
713
|
-
publisher: "local_gh",
|
|
714
|
-
mode: inlineCommentCount > 0
|
|
715
|
-
? "review_with_inline_comments"
|
|
716
|
-
: "review_body_only",
|
|
717
|
-
inlineCommentCount,
|
|
718
|
-
detail: htmlUrl
|
|
719
|
-
? `posted via local gh: ${htmlUrl}`
|
|
720
|
-
: `posted via local gh with ${inlineCommentCount} inline comment(s)`,
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
catch (error) {
|
|
724
|
-
if ((_b = args.signal) === null || _b === void 0 ? void 0 : _b.aborted) {
|
|
725
|
-
throw error;
|
|
726
|
-
}
|
|
727
|
-
return skipped(`local gh review post failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
function toGithubReviewComment(comment) {
|
|
732
|
-
return toGithubPullRequestReviewComment(comment);
|
|
733
|
-
}
|
|
734
|
-
function toGithubPullRequestReviewComment(comment) {
|
|
735
|
-
const body = {
|
|
736
|
-
path: comment.file,
|
|
737
|
-
body: comment.body,
|
|
738
|
-
line: comment.line,
|
|
739
|
-
side: "RIGHT",
|
|
740
|
-
};
|
|
741
|
-
if (comment.start_line !== undefined &&
|
|
742
|
-
comment.start_line > 0 &&
|
|
743
|
-
comment.start_line !== comment.line) {
|
|
744
|
-
body.start_line = comment.start_line;
|
|
745
|
-
body.start_side = "RIGHT";
|
|
746
|
-
}
|
|
747
|
-
return body;
|
|
748
|
-
}
|
|
749
|
-
function skipped(detail) {
|
|
750
|
-
return {
|
|
751
|
-
posted: false,
|
|
752
|
-
publisher: "local_gh",
|
|
753
|
-
mode: "skipped",
|
|
754
|
-
inlineCommentCount: 0,
|
|
755
|
-
detail,
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
function skippedHost(detail) {
|
|
759
|
-
return {
|
|
760
|
-
posted: false,
|
|
761
|
-
publisher: "host_github",
|
|
762
|
-
mode: "skipped",
|
|
763
|
-
inlineCommentCount: 0,
|
|
764
|
-
detail,
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
function skippedOrigin(detail) {
|
|
768
|
-
return {
|
|
769
|
-
posted: false,
|
|
770
|
-
publisher: "host_origin",
|
|
771
|
-
mode: "skipped",
|
|
772
|
-
inlineCommentCount: 0,
|
|
773
|
-
detail,
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
function postReviewViaHostOrigin(origin, args) {
|
|
777
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
778
|
-
var _a, _b;
|
|
779
|
-
const target = resolveScmReviewTarget(args.prUrl);
|
|
780
|
-
if (target === undefined || target.provider !== "origin") {
|
|
781
|
-
return skippedOrigin("host Origin publisher only supports Origin PRs");
|
|
782
|
-
}
|
|
783
|
-
const [owner, repo] = target.repo.split("/", 2);
|
|
784
|
-
if (owner === undefined || repo === undefined || repo === "") {
|
|
785
|
-
return skippedOrigin("unparseable owner/repo from PR URL");
|
|
786
|
-
}
|
|
787
|
-
try {
|
|
788
|
-
(_a = args.signal) === null || _a === void 0 ? void 0 : _a.throwIfAborted();
|
|
789
|
-
yield origin.request({
|
|
790
|
-
method: "POST",
|
|
791
|
-
path: `/v1/origin/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pulls/${target.prNumber}/reviews`,
|
|
792
|
-
body: {
|
|
793
|
-
verdict: "comment",
|
|
794
|
-
body: args.message,
|
|
795
|
-
comments: args.comments.map(toOriginReviewCommentInput),
|
|
796
|
-
},
|
|
797
|
-
});
|
|
798
|
-
const inlineCommentCount = args.comments.length;
|
|
799
|
-
return {
|
|
800
|
-
posted: true,
|
|
801
|
-
publisher: "host_origin",
|
|
802
|
-
mode: inlineCommentCount > 0
|
|
803
|
-
? "review_with_inline_comments"
|
|
804
|
-
: "review_body_only",
|
|
805
|
-
inlineCommentCount,
|
|
806
|
-
detail: `posted Origin review on ${target.repo}#${target.prNumber} with ${inlineCommentCount} inline comment(s)`,
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
catch (error) {
|
|
810
|
-
if ((_b = args.signal) === null || _b === void 0 ? void 0 : _b.aborted) {
|
|
811
|
-
throw error;
|
|
812
|
-
}
|
|
813
|
-
return skippedOrigin(`host Origin review post failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
814
|
-
}
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
/** Provider-neutral inline comment → Origin `ReviewCommentInput`. */
|
|
818
|
-
function toOriginReviewCommentInput(comment) {
|
|
819
|
-
const startLine = comment.start_line !== undefined &&
|
|
820
|
-
comment.start_line > 0 &&
|
|
821
|
-
comment.start_line < comment.line
|
|
822
|
-
? comment.start_line
|
|
823
|
-
: comment.line;
|
|
824
|
-
return {
|
|
825
|
-
body: comment.body,
|
|
826
|
-
inline: Object.assign({ path: comment.file, side: "right", startLine }, (startLine === comment.line ? {} : { endLine: comment.line })),
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
function skippedResolve(detail) {
|
|
830
|
-
return {
|
|
831
|
-
requested: 0,
|
|
832
|
-
resolved: 0,
|
|
833
|
-
failed: 0,
|
|
834
|
-
detail,
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
function parseGithubPrUrl(prUrl) {
|
|
838
|
-
let url;
|
|
839
|
-
try {
|
|
840
|
-
url = new URL(prUrl);
|
|
841
|
-
}
|
|
842
|
-
catch (error) {
|
|
843
|
-
return {
|
|
844
|
-
kind: "invalid",
|
|
845
|
-
detail: `unparseable PR URL: ${error instanceof Error ? error.message : String(error)}`,
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
if (url.hostname !== "github.com") {
|
|
849
|
-
return {
|
|
850
|
-
kind: "invalid",
|
|
851
|
-
detail: "local gh publisher only supports github.com PRs",
|
|
852
|
-
};
|
|
853
|
-
}
|
|
854
|
-
const parts = url.pathname.split("/").filter(Boolean);
|
|
855
|
-
if (parts.length !== 4 || parts[2] !== "pull") {
|
|
856
|
-
return {
|
|
857
|
-
kind: "invalid",
|
|
858
|
-
detail: "unparseable PR URL: expected https://github.com/{owner}/{repo}/pull/{number}",
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
const prNumber = Number(parts[3]);
|
|
862
|
-
if (!Number.isInteger(prNumber) || prNumber <= 0) {
|
|
863
|
-
return {
|
|
864
|
-
kind: "invalid",
|
|
865
|
-
detail: "unparseable PR URL: pull request number must be a positive integer",
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
return {
|
|
869
|
-
kind: "valid",
|
|
870
|
-
value: {
|
|
871
|
-
repo: `${parts[0]}/${parts[1]}`,
|
|
872
|
-
prNumber,
|
|
873
|
-
},
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
function ghApiPostJson(path, payload, signal) {
|
|
877
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
878
|
-
return new Promise((resolvePromise, rejectPromise) => {
|
|
879
|
-
const child = spawn("gh", ["api", path, "--method", "POST", "--input", "-"], {
|
|
880
|
-
env: Object.assign(Object.assign({}, process.env), { GH_PROMPT_DISABLED: "1" }),
|
|
881
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
882
|
-
});
|
|
883
|
-
let stdout = "";
|
|
884
|
-
let stderr = "";
|
|
885
|
-
const onAbort = () => {
|
|
886
|
-
var _a;
|
|
887
|
-
child.kill("SIGTERM");
|
|
888
|
-
rejectPromise((_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : new Error("aborted"));
|
|
889
|
-
};
|
|
890
|
-
signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
891
|
-
child.stdout.on("data", (chunk) => {
|
|
892
|
-
stdout += String(chunk);
|
|
893
|
-
});
|
|
894
|
-
child.stderr.on("data", (chunk) => {
|
|
895
|
-
stderr += String(chunk);
|
|
896
|
-
});
|
|
897
|
-
child.on("error", (error) => {
|
|
898
|
-
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
899
|
-
rejectPromise(error);
|
|
900
|
-
});
|
|
901
|
-
child.on("close", (code) => {
|
|
902
|
-
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
903
|
-
if (code !== 0) {
|
|
904
|
-
rejectPromise(new Error(`gh api ${path} exited with ${code}: ${stderr.trim().slice(0, 2000)}`));
|
|
905
|
-
return;
|
|
906
|
-
}
|
|
907
|
-
if (!stdout.trim()) {
|
|
908
|
-
resolvePromise({});
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
try {
|
|
912
|
-
resolvePromise(JSON.parse(stdout));
|
|
913
|
-
}
|
|
914
|
-
catch (error) {
|
|
915
|
-
rejectPromise(new Error(`gh api ${path} returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`));
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
child.stdin.end(JSON.stringify(payload));
|
|
919
|
-
});
|
|
920
|
-
});
|
|
921
|
-
}
|