@cursor/july 0.1.102 → 0.1.104
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/change-monitors/change-monitors-channel.d.ts +5 -0
- package/dist/channels/change-monitors/change-monitors-channel.d.ts.map +1 -0
- package/dist/channels/change-monitors/change-monitors-channel.js +41 -0
- package/dist/channels/change-monitors/index.d.ts +4 -0
- package/dist/channels/change-monitors/index.d.ts.map +1 -0
- package/dist/channels/change-monitors/index.js +2 -0
- package/dist/channels/change-monitors/types.d.ts +39 -0
- package/dist/channels/change-monitors/types.d.ts.map +1 -0
- package/dist/channels/change-monitors/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/defaults.d.ts.map +1 -1
- package/dist/channels/github/defaults.js +4 -0
- 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/progress.d.ts +22 -0
- package/dist/channels/github/progress.d.ts.map +1 -1
- package/dist/channels/github/progress.js +32 -5
- 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/issues/index.d.ts +4 -0
- package/dist/channels/issues/index.d.ts.map +1 -0
- package/dist/channels/issues/index.js +2 -0
- package/dist/channels/issues/issues-channel.d.ts +5 -0
- package/dist/channels/issues/issues-channel.d.ts.map +1 -0
- package/dist/channels/issues/issues-channel.js +37 -0
- package/dist/channels/issues/types.d.ts +33 -0
- package/dist/channels/issues/types.d.ts.map +1 -0
- package/dist/channels/issues/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.DbMWUyGb.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.Bqsulb9K.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.ifxv-cJV.js → VPLocalSearchBox.DcNeTh9o.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DWCwM6p-.js → theme.DMjhY3gl.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.c0gdGJ-D.js} +1 -1
- package/dist/docs/assets/{guides_github.md.BtPr9GaP.lean.js → guides_github.md.c0gdGJ-D.lean.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.DBGcaB7m.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.Cd2f2iyV.lean.js → reference_channels.md.DBGcaB7m.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/filesystem.md +376 -0
- 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 +5 -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 +907 -262
- package/dist/docs/llms.txt +3 -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 +38 -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/filesystem.d.ts +440 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +1694 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -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 +18 -2
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +67 -5
- package/dist/internal/continuation-identity.d.ts +24 -17
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +246 -32
- 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 +141 -120
- 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 +10 -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/factory-resource-channel.d.ts +33 -0
- package/dist/internal/factory-resource-channel.d.ts.map +1 -0
- package/dist/internal/factory-resource-channel.js +77 -0
- package/dist/internal/filesystem/errors.d.ts +64 -0
- package/dist/internal/filesystem/errors.d.ts.map +1 -0
- package/dist/internal/filesystem/errors.js +175 -0
- package/dist/internal/filesystem/format.d.ts +28 -0
- package/dist/internal/filesystem/format.d.ts.map +1 -0
- package/dist/internal/filesystem/format.js +213 -0
- package/dist/internal/filesystem/merge.d.ts +34 -0
- package/dist/internal/filesystem/merge.d.ts.map +1 -0
- package/dist/internal/filesystem/merge.js +196 -0
- package/dist/internal/filesystem/scratch.d.ts +59 -0
- package/dist/internal/filesystem/scratch.d.ts.map +1 -0
- package/dist/internal/filesystem/scratch.js +212 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts +29 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts.map +1 -0
- package/dist/internal/filesystem/sdk-schemas.js +153 -0
- package/dist/internal/filesystem/tools.d.ts +42 -0
- package/dist/internal/filesystem/tools.d.ts.map +1 -0
- package/dist/internal/filesystem/tools.js +618 -0
- package/dist/internal/filesystem/walk.d.ts +74 -0
- package/dist/internal/filesystem/walk.d.ts.map +1 -0
- package/dist/internal/filesystem/walk.js +339 -0
- 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 +104 -0
- package/dist/internal/guest-network.d.ts.map +1 -0
- package/dist/internal/guest-network.js +309 -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 +258 -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 +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +6 -7
- 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 +48 -11
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +507 -115
- 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/factory-resource-fixtures.d.ts +48 -0
- package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/factory-resource-fixtures.js +41 -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-8YiozU89.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 +141 -26
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +2 -2
- package/docs/concepts.md +2 -4
- package/docs/design/filesystem.md +376 -0
- 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 +5 -1
- package/docs/guides/opentelemetry.md +41 -17
- package/docs/reference/agent-config.md +6 -10
- package/docs/reference/channels.md +38 -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 +42 -9
- 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/change-monitors/change-monitors-channel.ts +62 -0
- package/src/channels/change-monitors/index.ts +8 -0
- package/src/channels/change-monitors/types.ts +44 -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/defaults.ts +4 -0
- 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/progress.ts +76 -10
- 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/issues/index.ts +9 -0
- package/src/channels/issues/issues-channel.ts +51 -0
- package/src/channels/issues/types.ts +41 -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/filesystem.ts +2074 -0
- package/src/index.ts +48 -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 +102 -4
- package/src/internal/continuation-identity.ts +338 -35
- 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 +181 -136
- 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 +10 -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/factory-resource-channel.ts +122 -0
- package/src/internal/filesystem/errors.ts +220 -0
- package/src/internal/filesystem/format.ts +276 -0
- package/src/internal/filesystem/merge.ts +195 -0
- package/src/internal/filesystem/scratch.ts +255 -0
- package/src/internal/filesystem/sdk-schemas.ts +204 -0
- package/src/internal/filesystem/tools.ts +821 -0
- package/src/internal/filesystem/walk.ts +369 -0
- package/src/internal/framework-file-storage.ts +8 -8
- package/src/internal/github-fanout.ts +1 -1
- package/src/internal/guest-network.ts +389 -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 +393 -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 +7 -7
- package/src/internal/server.ts +153 -44
- package/src/internal/session-cost.ts +3 -3
- package/src/internal/session-engine.ts +621 -103
- 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/factory-resource-fixtures.ts +85 -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 +154 -37
- 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/{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
|
@@ -28,12 +28,26 @@ import { resolveDedicatedSlackHostBinding } from "../channels/slack/slack-channe
|
|
|
28
28
|
import {
|
|
29
29
|
AGENT_SERVE_USER_STORE_FILES_SOURCE_ID,
|
|
30
30
|
agentStoreKeys,
|
|
31
|
+
DEPLOYMENT_STORE_MOUNT_PATH,
|
|
32
|
+
type FileSink,
|
|
33
|
+
USER_STORE_MOUNT_PATH,
|
|
31
34
|
} from "../files.js";
|
|
32
35
|
import {
|
|
33
36
|
cursorHostedFiles,
|
|
34
37
|
isCursorHostedFilesAvailable,
|
|
35
38
|
isCursorUserStoreFilesAvailable,
|
|
36
39
|
} from "../files-backends/cursor-hosted.js";
|
|
40
|
+
import {
|
|
41
|
+
type FileSystem,
|
|
42
|
+
isFileSystemToolAlias,
|
|
43
|
+
isMutatingFileSystemTool,
|
|
44
|
+
localFileSystem,
|
|
45
|
+
resolveFileSystemTools,
|
|
46
|
+
resolveHostHarnessToolOptions,
|
|
47
|
+
tempFs,
|
|
48
|
+
unionFs,
|
|
49
|
+
writeWorkspaceFilesToRoot,
|
|
50
|
+
} from "../filesystem.js";
|
|
37
51
|
import { storageKeysForArchitecture } from "../storage.js";
|
|
38
52
|
import {
|
|
39
53
|
type AgentProject,
|
|
@@ -66,10 +80,12 @@ import {
|
|
|
66
80
|
type PendingAuth,
|
|
67
81
|
type ReceiveInput,
|
|
68
82
|
type ResolvedAgent,
|
|
83
|
+
type RootContext,
|
|
69
84
|
type RunnerSubagent,
|
|
70
85
|
type RunnerTurnRequest,
|
|
71
86
|
type SendMessageFn,
|
|
72
87
|
type SendMessageOptions,
|
|
88
|
+
type SessionContext,
|
|
73
89
|
type SessionEvent,
|
|
74
90
|
type SessionEventPayload,
|
|
75
91
|
type SessionInfo,
|
|
@@ -116,9 +132,21 @@ import {
|
|
|
116
132
|
resolveV2Key,
|
|
117
133
|
V2EngineError,
|
|
118
134
|
} from "./continuation-identity.js";
|
|
135
|
+
import { describeError } from "./describe-error.js";
|
|
119
136
|
import { isDevMode } from "./dev-mode.js";
|
|
120
137
|
import { type EventLogMemoryStats, EventLogStore } from "./event-log.js";
|
|
121
138
|
import { TurnEventMapper } from "./event-mapper.js";
|
|
139
|
+
import {
|
|
140
|
+
applyWebScratchUpdate,
|
|
141
|
+
ingestHostAgentToolsScratch,
|
|
142
|
+
remapScratchPaths,
|
|
143
|
+
} from "./filesystem/scratch.js";
|
|
144
|
+
import {
|
|
145
|
+
fileSystemTool,
|
|
146
|
+
hostFileToolsFromAuthored,
|
|
147
|
+
rootFileToolsFromAuthored,
|
|
148
|
+
synthesizeFileSystemTools,
|
|
149
|
+
} from "./filesystem/tools.js";
|
|
122
150
|
import { selectFrameworkStorageDefinition } from "./framework-storage-selection.js";
|
|
123
151
|
import { createHostFilesApi } from "./host-files.js";
|
|
124
152
|
import { createHostKvApi } from "./host-kv.js";
|
|
@@ -152,6 +180,7 @@ import {
|
|
|
152
180
|
SCHEDULE_CHANNEL_PREFIX,
|
|
153
181
|
} from "./prompt-context.js";
|
|
154
182
|
import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections.js";
|
|
183
|
+
import { applyAuthoredResult } from "./result-output.js";
|
|
155
184
|
import type { AgentRunner, SteerAckOutcome } from "./sdk-runner.js";
|
|
156
185
|
import { sessionExternalLinks } from "./session-links.js";
|
|
157
186
|
import { SessionStore } from "./session-store.js";
|
|
@@ -173,16 +202,29 @@ import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
|
173
202
|
import {
|
|
174
203
|
buildAgentsMdContent,
|
|
175
204
|
buildCloudMemorySection,
|
|
205
|
+
buildCloudWorkspaceSection,
|
|
176
206
|
ensureOwnGitRoot,
|
|
177
207
|
isNestedInGitRepo,
|
|
178
208
|
materializeWorkspace,
|
|
179
209
|
SERVER_TOOLS_MCP_SERVER_NAME,
|
|
180
|
-
writeWorkspaceFiles,
|
|
181
210
|
} from "./workspace.js";
|
|
211
|
+
import { syncWorkspaceToStore } from "./workspace-sync.js";
|
|
182
212
|
|
|
183
213
|
export const HTTP_CHANNEL_ID = "http";
|
|
184
214
|
export { SCHEDULE_CHANNEL_PREFIX } from "./prompt-context.js";
|
|
185
215
|
|
|
216
|
+
/** Authored surfaces mirrored onto the Agent Store before a first cloud prompt. */
|
|
217
|
+
type CloudSyncSurface = "skills" | "workspace";
|
|
218
|
+
|
|
219
|
+
/** The Agent Store cloud turns read authored files from, and where the VM mounts it. */
|
|
220
|
+
interface CloudStoreTarget {
|
|
221
|
+
sink: FileSink;
|
|
222
|
+
mountPath: string;
|
|
223
|
+
skillsPrefix: string;
|
|
224
|
+
workspacePrefix: string;
|
|
225
|
+
label: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
186
228
|
export class SessionBusyError extends Error {
|
|
187
229
|
constructor(sessionId: string) {
|
|
188
230
|
super(
|
|
@@ -406,8 +448,8 @@ export class SessionEngine {
|
|
|
406
448
|
>();
|
|
407
449
|
/** Once-per-process cache for the A/B snapshot backfill (see abSnapshot). */
|
|
408
450
|
private restoredAbSnapshot: Promise<ABSnapshot | undefined> | undefined;
|
|
409
|
-
/** In-flight
|
|
410
|
-
private
|
|
451
|
+
/** In-flight authored files → Agent Store syncs (see syncToCloudStore). */
|
|
452
|
+
private readonly cloudSyncs = new Map<CloudSyncSurface, Promise<boolean>>();
|
|
411
453
|
|
|
412
454
|
private readonly runner: AgentRunner;
|
|
413
455
|
private readonly logger: (line: string) => void;
|
|
@@ -490,6 +532,15 @@ export class SessionEngine {
|
|
|
490
532
|
private readonly cloudCostBackfillDone = new Set<string>();
|
|
491
533
|
/** Deduped in-flight cloud cost backfills, keyed by session id. */
|
|
492
534
|
private readonly cloudCostBackfill = new Map<string, Promise<void>>();
|
|
535
|
+
/** Per-session FileSystem handle cache (not a tree snapshot). */
|
|
536
|
+
private readonly sessionRoots = new Map<string, FileSystem>();
|
|
537
|
+
/** In-flight factory resolves, so the first turn and a racing callTool share one handle. */
|
|
538
|
+
private readonly sessionRootInflight = new Map<string, Promise<FileSystem>>();
|
|
539
|
+
/** Per-turn `unionFs({ "/": authored, "/tmp": tempFs() })`. Dropped at end of turn. */
|
|
540
|
+
private readonly turnRoots = new Map<
|
|
541
|
+
string,
|
|
542
|
+
{ root: FileSystem; cwd: string }
|
|
543
|
+
>();
|
|
493
544
|
|
|
494
545
|
constructor(options: SessionEngineOptions) {
|
|
495
546
|
this.project = options.project;
|
|
@@ -678,9 +729,9 @@ export class SessionEngine {
|
|
|
678
729
|
}
|
|
679
730
|
|
|
680
731
|
/**
|
|
681
|
-
* Host services with `files` bound to one session, so a relative
|
|
682
|
-
*
|
|
683
|
-
*
|
|
732
|
+
* Host services with `files` and `otel` bound to one session, so a relative
|
|
733
|
+
* path resolves to that session's scope and can never read another
|
|
734
|
+
* session's. Unbound (no session) keeps `host.files` usable for
|
|
684
735
|
* `{ scope: "deployment" }` and fails loudly on session-scoped calls.
|
|
685
736
|
*/
|
|
686
737
|
private hostForSession(sessionId: string | undefined): HostContext {
|
|
@@ -1773,6 +1824,261 @@ export class SessionEngine {
|
|
|
1773
1824
|
return this.interrupt(existing.sessionId);
|
|
1774
1825
|
}
|
|
1775
1826
|
|
|
1827
|
+
private hasRootOverride(): boolean {
|
|
1828
|
+
return this.project.agent.root !== undefined;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* FileSystem for this turn or `callTool`. Authored `root` (static or
|
|
1833
|
+
* factory) is cached per session when `cache` is set; unscoped
|
|
1834
|
+
* `callTool` passes the invocation id and does not cache, so factories
|
|
1835
|
+
* cannot share one tree across callers. A static handle is used as
|
|
1836
|
+
* authored — every session sees that same object. Host-default agents
|
|
1837
|
+
* get `localFileSystem` against the harness cwd — same path verbs as
|
|
1838
|
+
* the Cursor SDK natives, always through the synthesized tools.
|
|
1839
|
+
*/
|
|
1840
|
+
private async resolveFileSystem(options: {
|
|
1841
|
+
sessionId: string;
|
|
1842
|
+
continuationKey?: string;
|
|
1843
|
+
cache: boolean;
|
|
1844
|
+
cwd: string;
|
|
1845
|
+
}): Promise<FileSystem> {
|
|
1846
|
+
const authored = this.project.agent.root;
|
|
1847
|
+
if (authored === undefined) {
|
|
1848
|
+
return localFileSystem({ cwd: options.cwd });
|
|
1849
|
+
}
|
|
1850
|
+
const authoredRoot = await this.resolveAuthoredFileSystem(options);
|
|
1851
|
+
if (options.cache) {
|
|
1852
|
+
const existing = this.turnRoots.get(options.sessionId);
|
|
1853
|
+
if (existing !== undefined) {
|
|
1854
|
+
return existing.root;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
const root = unionFs({
|
|
1858
|
+
"/": authoredRoot,
|
|
1859
|
+
"/tmp": tempFs(),
|
|
1860
|
+
});
|
|
1861
|
+
if (options.cache && this.isTurnRunning(options.sessionId)) {
|
|
1862
|
+
this.turnRoots.set(options.sessionId, { root, cwd: options.cwd });
|
|
1863
|
+
}
|
|
1864
|
+
return root;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
private async resolveAuthoredFileSystem(options: {
|
|
1868
|
+
sessionId: string;
|
|
1869
|
+
continuationKey?: string;
|
|
1870
|
+
cache: boolean;
|
|
1871
|
+
}): Promise<FileSystem> {
|
|
1872
|
+
const authored = this.project.agent.root;
|
|
1873
|
+
if (authored === undefined) {
|
|
1874
|
+
throw new Error("resolveAuthoredFileSystem requires an authored root");
|
|
1875
|
+
}
|
|
1876
|
+
if (options.cache) {
|
|
1877
|
+
const cached = this.sessionRoots.get(options.sessionId);
|
|
1878
|
+
if (cached !== undefined) {
|
|
1879
|
+
return cached;
|
|
1880
|
+
}
|
|
1881
|
+
const inflight = this.sessionRootInflight.get(options.sessionId);
|
|
1882
|
+
if (inflight !== undefined) {
|
|
1883
|
+
return inflight;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
const resolve = async (): Promise<FileSystem> => {
|
|
1887
|
+
if (typeof authored !== "function") {
|
|
1888
|
+
return authored;
|
|
1889
|
+
}
|
|
1890
|
+
const host = this.hostForSession(
|
|
1891
|
+
options.cache ? options.sessionId : undefined
|
|
1892
|
+
);
|
|
1893
|
+
const ctx: RootContext = {
|
|
1894
|
+
sessionId: options.sessionId,
|
|
1895
|
+
agentName: this.project.agent.name,
|
|
1896
|
+
...(options.continuationKey === undefined
|
|
1897
|
+
? {}
|
|
1898
|
+
: { continuationKey: options.continuationKey }),
|
|
1899
|
+
host: { files: host.files, reminders: host.reminders },
|
|
1900
|
+
};
|
|
1901
|
+
return await authored(ctx);
|
|
1902
|
+
};
|
|
1903
|
+
if (!options.cache) {
|
|
1904
|
+
return resolve();
|
|
1905
|
+
}
|
|
1906
|
+
const pending = resolve();
|
|
1907
|
+
this.sessionRootInflight.set(options.sessionId, pending);
|
|
1908
|
+
try {
|
|
1909
|
+
const resolved = await pending;
|
|
1910
|
+
this.sessionRoots.set(options.sessionId, resolved);
|
|
1911
|
+
return resolved;
|
|
1912
|
+
} finally {
|
|
1913
|
+
this.sessionRootInflight.delete(options.sessionId);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
private dropTurnFileSystem(sessionId: string): void {
|
|
1918
|
+
this.turnRoots.delete(sessionId);
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
private async prepareScratchToolInput(options: {
|
|
1922
|
+
sessionId?: string;
|
|
1923
|
+
input: Record<string, unknown>;
|
|
1924
|
+
}): Promise<Record<string, unknown>> {
|
|
1925
|
+
if (options.sessionId === undefined) {
|
|
1926
|
+
return options.input;
|
|
1927
|
+
}
|
|
1928
|
+
const turn = this.turnRoots.get(options.sessionId);
|
|
1929
|
+
if (turn === undefined) {
|
|
1930
|
+
return options.input;
|
|
1931
|
+
}
|
|
1932
|
+
await ingestHostAgentToolsScratch({
|
|
1933
|
+
cwd: turn.cwd,
|
|
1934
|
+
root: turn.root,
|
|
1935
|
+
});
|
|
1936
|
+
return remapScratchPaths(options.input, turn.cwd);
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
private withTurnScratchTools(
|
|
1940
|
+
tools: DiscoveredTool[],
|
|
1941
|
+
sessionId: string
|
|
1942
|
+
): DiscoveredTool[] {
|
|
1943
|
+
const turn = this.turnRoots.get(sessionId);
|
|
1944
|
+
if (turn === undefined) {
|
|
1945
|
+
return tools;
|
|
1946
|
+
}
|
|
1947
|
+
return tools.map((tool) => {
|
|
1948
|
+
const execute = tool.definition.execute;
|
|
1949
|
+
if (typeof execute !== "function") {
|
|
1950
|
+
return tool;
|
|
1951
|
+
}
|
|
1952
|
+
return {
|
|
1953
|
+
...tool,
|
|
1954
|
+
definition: {
|
|
1955
|
+
...tool.definition,
|
|
1956
|
+
execute: async (input, ctx) => {
|
|
1957
|
+
const remapped = await this.prepareScratchToolInput({
|
|
1958
|
+
sessionId,
|
|
1959
|
+
input:
|
|
1960
|
+
input !== null &&
|
|
1961
|
+
typeof input === "object" &&
|
|
1962
|
+
!Array.isArray(input)
|
|
1963
|
+
? (input as Record<string, unknown>)
|
|
1964
|
+
: {},
|
|
1965
|
+
});
|
|
1966
|
+
return execute(remapped as never, ctx);
|
|
1967
|
+
},
|
|
1968
|
+
},
|
|
1969
|
+
};
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
private async nativeFileSystemOutcome(options: {
|
|
1974
|
+
toolName: string;
|
|
1975
|
+
input: unknown;
|
|
1976
|
+
callId: string;
|
|
1977
|
+
sessionId?: string;
|
|
1978
|
+
continuationKey?: string;
|
|
1979
|
+
cwd: string;
|
|
1980
|
+
dryRun?: boolean;
|
|
1981
|
+
}): Promise<ToolCallOutcome | undefined> {
|
|
1982
|
+
const { toolName, input, callId } = options;
|
|
1983
|
+
if (!isFileSystemToolAlias(toolName)) {
|
|
1984
|
+
return undefined;
|
|
1985
|
+
}
|
|
1986
|
+
// Same policy the authored callTool path asks: a dry-run write is
|
|
1987
|
+
// answered by the host. Native edit/delete used to return before
|
|
1988
|
+
// decideToolCall and persist through the FileSystem.
|
|
1989
|
+
const decision = decideToolCall({
|
|
1990
|
+
dryRun: options.dryRun === true,
|
|
1991
|
+
effect: isMutatingFileSystemTool(toolName) ? "write" : "read",
|
|
1992
|
+
input,
|
|
1993
|
+
});
|
|
1994
|
+
if (decision.kind === "answer") {
|
|
1995
|
+
return {
|
|
1996
|
+
callId,
|
|
1997
|
+
toolName,
|
|
1998
|
+
isError: false,
|
|
1999
|
+
result: decision.result,
|
|
2000
|
+
durationMs: 0,
|
|
2001
|
+
sessionId: options.sessionId,
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
const root = await this.resolveFileSystem({
|
|
2005
|
+
sessionId: options.sessionId ?? callId,
|
|
2006
|
+
continuationKey: options.continuationKey,
|
|
2007
|
+
cache: options.sessionId !== undefined,
|
|
2008
|
+
cwd: options.cwd,
|
|
2009
|
+
});
|
|
2010
|
+
const rawArgs =
|
|
2011
|
+
input !== null && typeof input === "object" && !Array.isArray(input)
|
|
2012
|
+
? (input as Record<string, unknown>)
|
|
2013
|
+
: {};
|
|
2014
|
+
const args = await this.prepareScratchToolInput({
|
|
2015
|
+
sessionId: options.sessionId,
|
|
2016
|
+
input: rawArgs,
|
|
2017
|
+
});
|
|
2018
|
+
const tool = fileSystemTool(root, toolName, args);
|
|
2019
|
+
const execute = tool?.definition.execute;
|
|
2020
|
+
if (tool === undefined || typeof execute !== "function") {
|
|
2021
|
+
// A resolved root owns this native name. Falling through would let
|
|
2022
|
+
// an authored lookalike run, or surface UnknownToolError after we
|
|
2023
|
+
// already advertised the FileSystem tool.
|
|
2024
|
+
return {
|
|
2025
|
+
callId,
|
|
2026
|
+
toolName,
|
|
2027
|
+
isError: true,
|
|
2028
|
+
result: {
|
|
2029
|
+
status: "error",
|
|
2030
|
+
error: { message: `FileSystem cannot handle ${toolName}` },
|
|
2031
|
+
},
|
|
2032
|
+
durationMs: 0,
|
|
2033
|
+
sessionId: options.sessionId,
|
|
2034
|
+
errorMessage: `FileSystem cannot handle ${toolName}`,
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
const validation = validateToolInput(tool.definition.inputSchema, args);
|
|
2038
|
+
if (!validation.ok) {
|
|
2039
|
+
return {
|
|
2040
|
+
callId,
|
|
2041
|
+
toolName,
|
|
2042
|
+
isError: true,
|
|
2043
|
+
result: {
|
|
2044
|
+
status: "error",
|
|
2045
|
+
error: { message: validation.message },
|
|
2046
|
+
},
|
|
2047
|
+
durationMs: 0,
|
|
2048
|
+
sessionId: options.sessionId,
|
|
2049
|
+
errorMessage: validation.message,
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2052
|
+
try {
|
|
2053
|
+
const value = await execute(
|
|
2054
|
+
validation.value as never,
|
|
2055
|
+
{
|
|
2056
|
+
toolCallId: callId,
|
|
2057
|
+
workspaceDir: options.cwd,
|
|
2058
|
+
} as never
|
|
2059
|
+
);
|
|
2060
|
+
return {
|
|
2061
|
+
callId,
|
|
2062
|
+
toolName,
|
|
2063
|
+
isError: false,
|
|
2064
|
+
result: normalizeToolResult(value),
|
|
2065
|
+
durationMs: 0,
|
|
2066
|
+
sessionId: options.sessionId,
|
|
2067
|
+
};
|
|
2068
|
+
} catch (error) {
|
|
2069
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2070
|
+
return {
|
|
2071
|
+
callId,
|
|
2072
|
+
toolName,
|
|
2073
|
+
isError: true,
|
|
2074
|
+
result: { status: "error", error: { message } },
|
|
2075
|
+
durationMs: 0,
|
|
2076
|
+
sessionId: options.sessionId,
|
|
2077
|
+
errorMessage: message,
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
|
|
1776
2082
|
/**
|
|
1777
2083
|
* Local harness cwd for a session: per-send override, else the shared
|
|
1778
2084
|
* `agent.local.workspaceDir`, else `<agent.local.cwd>/<sessionId>`, else
|
|
@@ -1820,19 +2126,22 @@ export class SessionEngine {
|
|
|
1820
2126
|
if (
|
|
1821
2127
|
workspaceDir === undefined ||
|
|
1822
2128
|
agent.runtime !== "local" ||
|
|
2129
|
+
this.hasRootOverride() ||
|
|
1823
2130
|
this.runner.prewarm === undefined
|
|
1824
2131
|
) {
|
|
1825
2132
|
return;
|
|
1826
2133
|
}
|
|
1827
2134
|
const startedAt = Date.now();
|
|
1828
2135
|
try {
|
|
2136
|
+
const harness = resolveHostHarnessToolOptions(agent.allowedTools);
|
|
1829
2137
|
const outcome = await this.runner.prewarm({
|
|
1830
2138
|
workspaceDir,
|
|
1831
2139
|
runnerStateDir: join(this.stateRoot, "runner"),
|
|
1832
2140
|
sandbox: agent.local?.sandbox === true,
|
|
1833
|
-
...(
|
|
2141
|
+
...(harness.tools === undefined ? {} : { tools: harness.tools }),
|
|
2142
|
+
...(harness.disallowedTools === undefined
|
|
1834
2143
|
? {}
|
|
1835
|
-
: {
|
|
2144
|
+
: { disallowedTools: harness.disallowedTools }),
|
|
1836
2145
|
// No session yet, so auth'd connections are omitted rather than
|
|
1837
2146
|
// warmed without an identity; the per-send flag still has to match
|
|
1838
2147
|
// the turns' requests or the warmed executor is one no turn asks for.
|
|
@@ -1922,22 +2231,24 @@ export class SessionEngine {
|
|
|
1922
2231
|
// cwd is overridden (e.g. a PR worktree). A/B variant instruction
|
|
1923
2232
|
// overlays are applied via agentForSession.
|
|
1924
2233
|
const agent = this.agentForSession(record);
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2234
|
+
if (!this.hasRootOverride()) {
|
|
2235
|
+
await materializeWorkspace({
|
|
2236
|
+
agent,
|
|
2237
|
+
workspaceDir,
|
|
2238
|
+
seed: isFirstTurn,
|
|
2239
|
+
stateRoot: this.stateRoot,
|
|
2240
|
+
});
|
|
2241
|
+
this.materializedWorkspaces.add(sessionId);
|
|
2242
|
+
// Must precede the carrier: the harness resolves rules, skills,
|
|
2243
|
+
// `mcp.json` and hooks from its git root, so a workspace nested in an
|
|
2244
|
+
// outer repo would load that repo's hooks instead of the ones written
|
|
2245
|
+
// just below. Only for directories this session owns — a borrowed
|
|
2246
|
+
// checkout or worktree keeps its own root.
|
|
2247
|
+
if (!this.hasBorrowedWorkspace(record)) {
|
|
2248
|
+
await ensureOwnGitRoot(harnessCwd);
|
|
2249
|
+
}
|
|
2250
|
+
await this.materializeNudgeCarrier(record, harnessCwd);
|
|
1939
2251
|
}
|
|
1940
|
-
await this.materializeNudgeCarrier(record, harnessCwd);
|
|
1941
2252
|
// Baseline before the agent can run, so a follow-up that arrives and
|
|
1942
2253
|
// drains before the first tool boundary still counts as an increase.
|
|
1943
2254
|
await this.baselineDeliveredNudges(record);
|
|
@@ -1947,7 +2258,13 @@ export class SessionEngine {
|
|
|
1947
2258
|
pendingFiles !== undefined &&
|
|
1948
2259
|
Object.keys(pendingFiles).length > 0
|
|
1949
2260
|
) {
|
|
1950
|
-
await
|
|
2261
|
+
const root = await this.resolveFileSystem({
|
|
2262
|
+
sessionId,
|
|
2263
|
+
continuationKey: record.continuationKey ?? undefined,
|
|
2264
|
+
cache: true,
|
|
2265
|
+
cwd: harnessCwd,
|
|
2266
|
+
});
|
|
2267
|
+
await writeWorkspaceFilesToRoot(root, pendingFiles);
|
|
1951
2268
|
}
|
|
1952
2269
|
if (
|
|
1953
2270
|
(pendingFiles !== undefined &&
|
|
@@ -1984,6 +2301,14 @@ export class SessionEngine {
|
|
|
1984
2301
|
instructionsInvisibleToHarness,
|
|
1985
2302
|
emit,
|
|
1986
2303
|
async (update) => {
|
|
2304
|
+
const turn = this.turnRoots.get(sessionId);
|
|
2305
|
+
if (turn !== undefined) {
|
|
2306
|
+
update = await applyWebScratchUpdate({
|
|
2307
|
+
cwd: turn.cwd,
|
|
2308
|
+
root: turn.root,
|
|
2309
|
+
update,
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
1987
2312
|
mapper.handleUpdate(update);
|
|
1988
2313
|
// Yield so the HTTP NDJSON writer can flush tool start/result
|
|
1989
2314
|
// events while sibling parallel tools are still executing.
|
|
@@ -2006,7 +2331,9 @@ export class SessionEngine {
|
|
|
2006
2331
|
this.activeToolContexts.set(sessionId, { record, turnId, emit });
|
|
2007
2332
|
this.stubbedCallIds.set(sessionId, stubbed);
|
|
2008
2333
|
try {
|
|
2009
|
-
outcome = await this.
|
|
2334
|
+
outcome = await this.runTurnExecute(record, turnId, () =>
|
|
2335
|
+
this.runner.runTurn(request)
|
|
2336
|
+
);
|
|
2010
2337
|
} finally {
|
|
2011
2338
|
this.activeToolContexts.delete(sessionId);
|
|
2012
2339
|
this.stubbedCallIds.delete(sessionId);
|
|
@@ -2017,6 +2344,7 @@ export class SessionEngine {
|
|
|
2017
2344
|
outcome = { status: "error", errorMessage: describeError(error) };
|
|
2018
2345
|
} finally {
|
|
2019
2346
|
permit.release();
|
|
2347
|
+
this.dropTurnFileSystem(sessionId);
|
|
2020
2348
|
this.approvals.cancelSession(sessionId, "deny");
|
|
2021
2349
|
this.auths.cancelSession(sessionId, "deny");
|
|
2022
2350
|
await this.clearPendingApprovals(sessionId);
|
|
@@ -2049,14 +2377,39 @@ export class SessionEngine {
|
|
|
2049
2377
|
outcome = { ...outcome, cost: finalCost };
|
|
2050
2378
|
}
|
|
2051
2379
|
|
|
2380
|
+
const authored = this.project.result;
|
|
2381
|
+
if (outcome.status === "finished" && authored !== undefined) {
|
|
2382
|
+
const settled = await applyAuthoredResult({
|
|
2383
|
+
definition: authored,
|
|
2384
|
+
text: finalResult,
|
|
2385
|
+
dryRun: record.dryRun === true,
|
|
2386
|
+
ctx: {
|
|
2387
|
+
session: this.sessionInfo(record),
|
|
2388
|
+
host: this.hostForSession(sessionId),
|
|
2389
|
+
artifacts: this.artifactsApi({ sessionId, turnId }),
|
|
2390
|
+
stateRoot: this.stateRoot,
|
|
2391
|
+
workspaceDir: harnessCwd,
|
|
2392
|
+
},
|
|
2393
|
+
});
|
|
2394
|
+
if (!settled.ok) {
|
|
2395
|
+
outcome = {
|
|
2396
|
+
status: "error",
|
|
2397
|
+
result: finalResult,
|
|
2398
|
+
errorMessage: `turn output failed: ${settled.message}`,
|
|
2399
|
+
usage: finalUsage,
|
|
2400
|
+
cost: finalCost,
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2052
2405
|
if (outcome.status === "finished") {
|
|
2053
2406
|
await this.appendEvent(sessionId, {
|
|
2054
2407
|
type: "turn.completed",
|
|
2055
2408
|
turnId,
|
|
2056
2409
|
data: {
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2410
|
+
result: finalResult,
|
|
2411
|
+
usage: finalUsage,
|
|
2412
|
+
cost: finalCost,
|
|
2060
2413
|
},
|
|
2061
2414
|
});
|
|
2062
2415
|
} else {
|
|
@@ -2098,8 +2451,8 @@ export class SessionEngine {
|
|
|
2098
2451
|
|
|
2099
2452
|
return {
|
|
2100
2453
|
...outcome,
|
|
2101
|
-
|
|
2102
|
-
|
|
2454
|
+
result: finalResult,
|
|
2455
|
+
usage: finalUsage,
|
|
2103
2456
|
};
|
|
2104
2457
|
}
|
|
2105
2458
|
|
|
@@ -2110,48 +2463,75 @@ export class SessionEngine {
|
|
|
2110
2463
|
* first-turn S3 scan can discover them. False when the sync fails: the
|
|
2111
2464
|
* turn then runs without store skills rather than pointing discovery at
|
|
2112
2465
|
* paths that do not exist.
|
|
2113
|
-
|
|
2114
|
-
|
|
2466
|
+
*/
|
|
2467
|
+
private ensureCloudSkillsSynced(store: CloudStoreTarget): Promise<boolean> {
|
|
2468
|
+
const skills = this.project.agent.skills;
|
|
2469
|
+
return this.syncToCloudStore("skills", store, skills.length > 0, () =>
|
|
2470
|
+
syncSkillsToStore({
|
|
2471
|
+
sink: store.sink,
|
|
2472
|
+
agentName: this.project.name,
|
|
2473
|
+
skills,
|
|
2474
|
+
skillsPrefix: store.skillsPrefix,
|
|
2475
|
+
})
|
|
2476
|
+
);
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
/**
|
|
2480
|
+
* Sync `agent/sandbox/workspace/**` seeds onto the Agent Store at
|
|
2481
|
+
* `workspace/…` (hosted) or `agent-serve/<agent>/workspace/…`
|
|
2482
|
+
* (personal-key local+cloud) before the first cloud prompt, which names
|
|
2483
|
+
* the mounted directory (see buildCloudWorkspaceSection).
|
|
2484
|
+
*/
|
|
2485
|
+
private ensureCloudWorkspaceSynced(
|
|
2486
|
+
store: CloudStoreTarget
|
|
2487
|
+
): Promise<boolean> {
|
|
2488
|
+
const seedFiles = this.project.agent.seedFiles;
|
|
2489
|
+
return this.syncToCloudStore("workspace", store, seedFiles.length > 0, () =>
|
|
2490
|
+
syncWorkspaceToStore({
|
|
2491
|
+
sink: store.sink,
|
|
2492
|
+
seedFiles,
|
|
2493
|
+
workspacePrefix: store.workspacePrefix,
|
|
2494
|
+
})
|
|
2495
|
+
);
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
/**
|
|
2499
|
+
* With files authored, every first cloud turn re-copies the authored
|
|
2115
2500
|
* bytes and the memo only dedupes concurrent first turns. The mount is
|
|
2116
2501
|
* writable from cloud sessions, so a once-per-process copy would let one
|
|
2117
2502
|
* session's edits masquerade as agent definition for every later session
|
|
2118
2503
|
* until the engine restarts; re-syncing keeps the store true to discovery
|
|
2119
2504
|
* the same way local materialization always rewrites skills. Without
|
|
2120
|
-
*
|
|
2121
|
-
* process is enough, success or not — a deployment without the files
|
|
2505
|
+
* authored files the sync is best-effort stale cleanup and one attempt
|
|
2506
|
+
* per process is enough, success or not — a deployment without the files
|
|
2122
2507
|
* surface must not fail and log on every new session for a feature it
|
|
2123
2508
|
* does not use.
|
|
2124
2509
|
*/
|
|
2125
|
-
private
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2510
|
+
private syncToCloudStore(
|
|
2511
|
+
surface: CloudSyncSurface,
|
|
2512
|
+
store: CloudStoreTarget,
|
|
2513
|
+
authored: boolean,
|
|
2514
|
+
run: () => Promise<void>
|
|
2515
|
+
): Promise<boolean> {
|
|
2516
|
+
const inFlight = this.cloudSyncs.get(surface);
|
|
2517
|
+
if (inFlight !== undefined) {
|
|
2518
|
+
return inFlight;
|
|
2133
2519
|
}
|
|
2134
|
-
|
|
2135
|
-
let sync = syncSkillsToStore({
|
|
2136
|
-
sink: target.sink,
|
|
2137
|
-
agentName: this.project.name,
|
|
2138
|
-
skills,
|
|
2139
|
-
skillsPrefix: target.skillsPrefix,
|
|
2140
|
-
}).then(
|
|
2520
|
+
let sync = run().then(
|
|
2141
2521
|
() => true,
|
|
2142
2522
|
(error) => {
|
|
2143
2523
|
this.logger(
|
|
2144
|
-
`[
|
|
2524
|
+
`[${surface}] ${store.label} sync failed: ${error instanceof Error ? error.message : String(error)}`
|
|
2145
2525
|
);
|
|
2146
2526
|
return false;
|
|
2147
2527
|
}
|
|
2148
2528
|
);
|
|
2149
|
-
if (
|
|
2529
|
+
if (authored) {
|
|
2150
2530
|
sync = sync.finally(() => {
|
|
2151
|
-
this.
|
|
2531
|
+
this.cloudSyncs.delete(surface);
|
|
2152
2532
|
});
|
|
2153
2533
|
}
|
|
2154
|
-
this.
|
|
2534
|
+
this.cloudSyncs.set(surface, sync);
|
|
2155
2535
|
return sync;
|
|
2156
2536
|
}
|
|
2157
2537
|
|
|
@@ -2159,39 +2539,36 @@ export class SessionEngine {
|
|
|
2159
2539
|
* Hosted deployments own the deployment store. Local `serve`/`run` with
|
|
2160
2540
|
* a personal API key writes into the USER store under `agent-serve/`.
|
|
2161
2541
|
*/
|
|
2162
|
-
private
|
|
2163
|
-
| {
|
|
2164
|
-
sink: ReturnType<typeof cursorHostedFiles>;
|
|
2165
|
-
skillsPrefix: string;
|
|
2166
|
-
label: string;
|
|
2167
|
-
}
|
|
2168
|
-
| undefined {
|
|
2542
|
+
private cloudStore(): CloudStoreTarget | undefined {
|
|
2169
2543
|
const v2Hosting = resolveAgentV2Hosting({
|
|
2170
2544
|
architecture: this.project.agent.architecture,
|
|
2171
2545
|
});
|
|
2546
|
+
const deployment = {
|
|
2547
|
+
mountPath: DEPLOYMENT_STORE_MOUNT_PATH,
|
|
2548
|
+
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
2549
|
+
workspacePrefix: agentStoreKeys.workspacePrefix(),
|
|
2550
|
+
label: "deployment store",
|
|
2551
|
+
};
|
|
2172
2552
|
if (v2Hosting.kind === "cursor-managed") {
|
|
2173
2553
|
return {
|
|
2174
2554
|
sink: cursorHostedFiles({
|
|
2175
2555
|
resolveStoreSourceId: () =>
|
|
2176
2556
|
v2Hosting.resolveStoreIds().deploymentStoreSourceId,
|
|
2177
2557
|
}),
|
|
2178
|
-
|
|
2179
|
-
label: "deployment store",
|
|
2558
|
+
...deployment,
|
|
2180
2559
|
};
|
|
2181
2560
|
}
|
|
2182
2561
|
if (v2Hosting.kind === "not-v2" && isCursorHostedFilesAvailable()) {
|
|
2183
|
-
return {
|
|
2184
|
-
sink: cursorHostedFiles(),
|
|
2185
|
-
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
2186
|
-
label: "deployment store",
|
|
2187
|
-
};
|
|
2562
|
+
return { sink: cursorHostedFiles(), ...deployment };
|
|
2188
2563
|
}
|
|
2189
2564
|
if (isCursorUserStoreFilesAvailable()) {
|
|
2190
2565
|
return {
|
|
2191
2566
|
sink: cursorHostedFiles({
|
|
2192
2567
|
storeSourceId: AGENT_SERVE_USER_STORE_FILES_SOURCE_ID,
|
|
2193
2568
|
}),
|
|
2569
|
+
mountPath: USER_STORE_MOUNT_PATH,
|
|
2194
2570
|
skillsPrefix: agentStoreKeys.userSkillsPrefix(this.project.name),
|
|
2571
|
+
workspacePrefix: agentStoreKeys.userWorkspacePrefix(this.project.name),
|
|
2195
2572
|
label: "user store",
|
|
2196
2573
|
};
|
|
2197
2574
|
}
|
|
@@ -2220,6 +2597,17 @@ export class SessionEngine {
|
|
|
2220
2597
|
// allowlist, and a restriction that silently does not apply is worse
|
|
2221
2598
|
// than a refused turn. Non-local agents already fail discovery; this
|
|
2222
2599
|
// guards hybrid agents' per-send cloud sessions.
|
|
2600
|
+
//
|
|
2601
|
+
// Factory roots omit `allowedTools` at discovery (the live handle is
|
|
2602
|
+
// resolved per session). The allowlist guard below therefore never
|
|
2603
|
+
// fires for `defineAgent({ root: (ctx) => … })` with omitted `tools`,
|
|
2604
|
+
// and a per-send `cloud` attach would skip the virtual-root allowlist
|
|
2605
|
+
// and run unrestricted on a VM. Any authored root refuses non-local turns.
|
|
2606
|
+
if (runtime !== "local" && this.hasRootOverride()) {
|
|
2607
|
+
throw new Error(
|
|
2608
|
+
`Agent "${agent.name}" declares root, which cannot be served on ${runtime} turns. Refusing the session rather than running it against the host VM.`
|
|
2609
|
+
);
|
|
2610
|
+
}
|
|
2223
2611
|
if (runtime !== "local" && agent.allowedTools !== undefined) {
|
|
2224
2612
|
throw new Error(
|
|
2225
2613
|
`Agent "${agent.name}" declares a built-in tool allowlist (tools), which cannot be enforced on ${runtime} turns. Refusing the session rather than running it unrestricted.`
|
|
@@ -2248,6 +2636,48 @@ export class SessionEngine {
|
|
|
2248
2636
|
override: record.cloudOverride,
|
|
2249
2637
|
})
|
|
2250
2638
|
: undefined;
|
|
2639
|
+
const authoredRoot = this.hasRootOverride();
|
|
2640
|
+
const root =
|
|
2641
|
+
runtime === "local"
|
|
2642
|
+
? await this.resolveFileSystem({
|
|
2643
|
+
sessionId: record.sessionId,
|
|
2644
|
+
continuationKey: record.continuationKey ?? undefined,
|
|
2645
|
+
cache: true,
|
|
2646
|
+
cwd: this.harnessCwd(record),
|
|
2647
|
+
})
|
|
2648
|
+
: undefined;
|
|
2649
|
+
const harnessTools =
|
|
2650
|
+
runtime === "local" && root !== undefined
|
|
2651
|
+
? authoredRoot
|
|
2652
|
+
? {
|
|
2653
|
+
tools: resolveFileSystemTools({
|
|
2654
|
+
root,
|
|
2655
|
+
tools: agent.allowedTools,
|
|
2656
|
+
}),
|
|
2657
|
+
}
|
|
2658
|
+
: resolveHostHarnessToolOptions(agent.allowedTools)
|
|
2659
|
+
: undefined;
|
|
2660
|
+
const fileTools =
|
|
2661
|
+
root === undefined
|
|
2662
|
+
? []
|
|
2663
|
+
: synthesizeFileSystemTools(
|
|
2664
|
+
root,
|
|
2665
|
+
authoredRoot
|
|
2666
|
+
? rootFileToolsFromAuthored(agent.allowedTools)
|
|
2667
|
+
: hostFileToolsFromAuthored(agent.allowedTools)
|
|
2668
|
+
);
|
|
2669
|
+
// Host-default keeps native SemanticSearch (the host index).
|
|
2670
|
+
// `localFileSystem.search` is empty, so synthesizing would
|
|
2671
|
+
// replace a working index with an empty custom tool.
|
|
2672
|
+
const synthesized =
|
|
2673
|
+
root === undefined
|
|
2674
|
+
? []
|
|
2675
|
+
: this.withTurnScratchTools(
|
|
2676
|
+
authoredRoot
|
|
2677
|
+
? fileTools
|
|
2678
|
+
: fileTools.filter((tool) => tool.name !== "SemanticSearch"),
|
|
2679
|
+
record.sessionId
|
|
2680
|
+
);
|
|
2251
2681
|
let turnPrompt = prompt;
|
|
2252
2682
|
if (isFirstTurn) {
|
|
2253
2683
|
const contextBlock = buildSessionContextBlock({
|
|
@@ -2263,13 +2693,14 @@ export class SessionEngine {
|
|
|
2263
2693
|
if (isFirstTurn) {
|
|
2264
2694
|
if (runtime === "cloud") {
|
|
2265
2695
|
// Cloud VMs have no materialized workspace: ship the full context,
|
|
2266
|
-
// including agent tool script bodies.
|
|
2267
|
-
//
|
|
2268
|
-
//
|
|
2269
|
-
//
|
|
2270
|
-
//
|
|
2271
|
-
//
|
|
2272
|
-
//
|
|
2696
|
+
// including agent tool script bodies. Authored skills and workspace
|
|
2697
|
+
// seeds land on the store mount (skills for native discovery, seeds
|
|
2698
|
+
// for the model's file tools), and on hosted deployments the shared
|
|
2699
|
+
// memory journal is on that mount too — say where. When the turn
|
|
2700
|
+
// carries the session-bound server-tool MCP endpoint, the preamble
|
|
2701
|
+
// catalogs server tools under that MCP server name *before* the
|
|
2702
|
+
// agent-tool "write the script if missing" recipe, so a model told
|
|
2703
|
+
// to "use <server tool>" calls MCP instead of inventing a .sh.
|
|
2273
2704
|
const preamble = buildAgentsMdContent(agent, {
|
|
2274
2705
|
includeScripts: true,
|
|
2275
2706
|
serverToolsMcpName:
|
|
@@ -2278,17 +2709,42 @@ export class SessionEngine {
|
|
|
2278
2709
|
: SERVER_TOOLS_MCP_SERVER_NAME,
|
|
2279
2710
|
});
|
|
2280
2711
|
const hosted = isCursorHostedFilesAvailable();
|
|
2281
|
-
// Synced whenever a store is reachable, not just when skills
|
|
2282
|
-
// removing the last
|
|
2283
|
-
//
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2712
|
+
// Synced whenever a store is reachable, not just when skills or
|
|
2713
|
+
// seeds exist: removing the last one has to delete its store copies
|
|
2714
|
+
// too.
|
|
2715
|
+
const store =
|
|
2716
|
+
hosted || isCursorUserStoreFilesAvailable()
|
|
2717
|
+
? this.cloudStore()
|
|
2718
|
+
: undefined;
|
|
2719
|
+
let sections = "";
|
|
2720
|
+
if (store !== undefined) {
|
|
2721
|
+
const [, seedsSynced] = await Promise.all([
|
|
2722
|
+
this.ensureCloudSkillsSynced(store),
|
|
2723
|
+
this.ensureCloudWorkspaceSynced(store),
|
|
2724
|
+
]);
|
|
2725
|
+
// Only name the mount when the bytes landed; a failed sync must
|
|
2726
|
+
// not send the model looking for files that are not there.
|
|
2727
|
+
if (seedsSynced && agent.seedFiles.length > 0) {
|
|
2728
|
+
const dir = `${store.mountPath}/${store.workspacePrefix}`;
|
|
2729
|
+
sections += `\n\n${buildCloudWorkspaceSection(dir)}`;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if (hosted) {
|
|
2733
|
+
sections += `\n\n${buildCloudMemorySection(this.project.name)}`;
|
|
2287
2734
|
}
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2735
|
+
turnPrompt = `${preamble}${sections}\n\n${turnPrompt}`;
|
|
2736
|
+
} else if (runtime === "local" && authoredRoot) {
|
|
2737
|
+
// Virtual roots skip materialize, so AGENTS.md never lands on disk.
|
|
2738
|
+
// Ship the same preamble the borrowed-cwd local path uses.
|
|
2739
|
+
const preamble = buildAgentsMdContent(
|
|
2740
|
+
{ ...agent, tools: [...agent.tools, ...synthesized] },
|
|
2741
|
+
{ includeScripts: true }
|
|
2742
|
+
);
|
|
2743
|
+
const workspaceInfo = `<user_info>\nWorkspace Path: /\n</user_info>`;
|
|
2744
|
+
turnPrompt =
|
|
2745
|
+
preamble === ""
|
|
2746
|
+
? `${workspaceInfo}\n\n${turnPrompt}`
|
|
2747
|
+
: `${workspaceInfo}\n\n${preamble}\n\n${turnPrompt}`;
|
|
2292
2748
|
} else if (runtime === "local" && instructionsInvisibleToHarness) {
|
|
2293
2749
|
// Local workspace whose AGENTS.md the harness will not load. With a
|
|
2294
2750
|
// borrowed harness cwd, agent tool scripts live only in the durable
|
|
@@ -2307,9 +2763,18 @@ export class SessionEngine {
|
|
|
2307
2763
|
? {}
|
|
2308
2764
|
: { sdkAgentId: record.sdkAgentId }),
|
|
2309
2765
|
workspaceDir: this.harnessCwd(record),
|
|
2310
|
-
sandbox:
|
|
2311
|
-
|
|
2312
|
-
|
|
2766
|
+
sandbox: authoredRoot
|
|
2767
|
+
? false
|
|
2768
|
+
: this.project.agent.local?.sandbox === true,
|
|
2769
|
+
...(runtime === "local" && harnessTools !== undefined
|
|
2770
|
+
? {
|
|
2771
|
+
...(harnessTools.tools === undefined
|
|
2772
|
+
? {}
|
|
2773
|
+
: { tools: harnessTools.tools }),
|
|
2774
|
+
...(harnessTools.disallowedTools === undefined
|
|
2775
|
+
? {}
|
|
2776
|
+
: { disallowedTools: harnessTools.disallowedTools }),
|
|
2777
|
+
}
|
|
2313
2778
|
: {}),
|
|
2314
2779
|
runnerStateDir: join(this.stateRoot, "runner"),
|
|
2315
2780
|
prompt: turnPrompt,
|
|
@@ -2333,7 +2798,13 @@ export class SessionEngine {
|
|
|
2333
2798
|
: {}),
|
|
2334
2799
|
customTools:
|
|
2335
2800
|
runtime === "local"
|
|
2336
|
-
? await this.buildCustomTools(
|
|
2801
|
+
? await this.buildCustomTools(
|
|
2802
|
+
record,
|
|
2803
|
+
agent,
|
|
2804
|
+
turnId,
|
|
2805
|
+
emit,
|
|
2806
|
+
synthesized
|
|
2807
|
+
)
|
|
2337
2808
|
: {},
|
|
2338
2809
|
mcpServers: this.buildMcpServers(
|
|
2339
2810
|
runtime,
|
|
@@ -2627,7 +3098,8 @@ export class SessionEngine {
|
|
|
2627
3098
|
record: SessionRecord,
|
|
2628
3099
|
agent: ResolvedAgent,
|
|
2629
3100
|
turnId: string,
|
|
2630
|
-
emit: (payload: SessionEventPayload) => void
|
|
3101
|
+
emit: (payload: SessionEventPayload) => void,
|
|
3102
|
+
extraTools: DiscoveredTool[] = []
|
|
2631
3103
|
): Promise<Record<string, SDKCustomTool>> {
|
|
2632
3104
|
const tools: Record<string, SDKCustomTool> = {};
|
|
2633
3105
|
const register = (tool: ResolvedAgent["tools"][number]): void => {
|
|
@@ -2657,7 +3129,7 @@ export class SessionEngine {
|
|
|
2657
3129
|
},
|
|
2658
3130
|
};
|
|
2659
3131
|
};
|
|
2660
|
-
for (const tool of agent.tools) {
|
|
3132
|
+
for (const tool of [...agent.tools, ...extraTools]) {
|
|
2661
3133
|
if (tool.execution !== "server") {
|
|
2662
3134
|
continue;
|
|
2663
3135
|
}
|
|
@@ -2880,6 +3352,31 @@ export class SessionEngine {
|
|
|
2880
3352
|
}
|
|
2881
3353
|
}
|
|
2882
3354
|
|
|
3355
|
+
/**
|
|
3356
|
+
* Bind outbound inject (Factory / Cursor API `traceparent`) to the
|
|
3357
|
+
* turn span for the whole harness run. Host files / VFS RPCs happen
|
|
3358
|
+
* here, not under `runInCall`. No-op when OTel is off.
|
|
3359
|
+
*/
|
|
3360
|
+
private runTurnExecute<T>(
|
|
3361
|
+
record: SessionRecord,
|
|
3362
|
+
turnId: string,
|
|
3363
|
+
fn: () => T | Promise<T>
|
|
3364
|
+
): Promise<T> {
|
|
3365
|
+
const otel = this.otel;
|
|
3366
|
+
const run = (): Promise<T> => Promise.resolve(fn());
|
|
3367
|
+
if (otel === undefined) {
|
|
3368
|
+
return run();
|
|
3369
|
+
}
|
|
3370
|
+
return otel.runInTurn(
|
|
3371
|
+
{
|
|
3372
|
+
sessionId: record.sessionId,
|
|
3373
|
+
session: this.sessionInfo(record),
|
|
3374
|
+
turnId,
|
|
3375
|
+
},
|
|
3376
|
+
run
|
|
3377
|
+
);
|
|
3378
|
+
}
|
|
3379
|
+
|
|
2883
3380
|
/**
|
|
2884
3381
|
* Bind outbound inject (Factory / Cursor API `traceparent`) to the
|
|
2885
3382
|
* tool span. No-op when OTel is off.
|
|
@@ -3572,6 +4069,27 @@ export class SessionEngine {
|
|
|
3572
4069
|
const session = identity.session;
|
|
3573
4070
|
let workspaceDir = identity.workspaceDir;
|
|
3574
4071
|
let scratchDir = identity.scratchDir;
|
|
4072
|
+
if (
|
|
4073
|
+
isFileSystemToolAlias(toolName) &&
|
|
4074
|
+
identity.busy &&
|
|
4075
|
+
record !== undefined &&
|
|
4076
|
+
isMutatingFileSystemTool(toolName)
|
|
4077
|
+
) {
|
|
4078
|
+
throw new SessionBusyError(record.sessionId);
|
|
4079
|
+
}
|
|
4080
|
+
const native = await this.nativeFileSystemOutcome({
|
|
4081
|
+
toolName,
|
|
4082
|
+
input,
|
|
4083
|
+
callId,
|
|
4084
|
+
sessionId: record?.sessionId,
|
|
4085
|
+
continuationKey:
|
|
4086
|
+
record?.continuationKey ?? session.continuationKey ?? undefined,
|
|
4087
|
+
cwd: workspaceDir,
|
|
4088
|
+
dryRun: record?.dryRun === true,
|
|
4089
|
+
});
|
|
4090
|
+
if (native !== undefined) {
|
|
4091
|
+
return native;
|
|
4092
|
+
}
|
|
3575
4093
|
let tool = this.project.agent.tools.find((t) => t.name === toolName);
|
|
3576
4094
|
if (
|
|
3577
4095
|
tool === undefined &&
|
|
@@ -3673,7 +4191,10 @@ export class SessionEngine {
|
|
|
3673
4191
|
record !== undefined &&
|
|
3674
4192
|
identity.busy &&
|
|
3675
4193
|
this.materializedWorkspaces.has(record.sessionId);
|
|
3676
|
-
if (
|
|
4194
|
+
if (
|
|
4195
|
+
!this.hasRootOverride() &&
|
|
4196
|
+
(record === undefined || workspaceUnavailable || !turnMaterialized)
|
|
4197
|
+
) {
|
|
3677
4198
|
await materializeWorkspace({
|
|
3678
4199
|
agent: this.project.agent,
|
|
3679
4200
|
workspaceDir:
|
|
@@ -4011,7 +4532,10 @@ export class SessionEngine {
|
|
|
4011
4532
|
return;
|
|
4012
4533
|
}
|
|
4013
4534
|
|
|
4014
|
-
const sessionCtx = {
|
|
4535
|
+
const sessionCtx: SessionContext = {
|
|
4536
|
+
session: this.sessionInfo(record),
|
|
4537
|
+
host: this.hostForSession(record.sessionId),
|
|
4538
|
+
};
|
|
4015
4539
|
const channelEvents = this.channelEventHandlersFor(record.channelId);
|
|
4016
4540
|
if (channelEvents !== undefined) {
|
|
4017
4541
|
// Handlers are declared against the narrowed event for their key; the
|
|
@@ -4054,14 +4578,13 @@ export class SessionEngine {
|
|
|
4054
4578
|
}
|
|
4055
4579
|
try {
|
|
4056
4580
|
await handler(event, {
|
|
4581
|
+
...sessionCtx,
|
|
4057
4582
|
agent: { name: this.project.name },
|
|
4058
4583
|
channel: {
|
|
4059
4584
|
id: record.channelId,
|
|
4060
4585
|
continuationToken: record.continuationKey,
|
|
4061
4586
|
},
|
|
4062
|
-
session: this.sessionInfo(record),
|
|
4063
4587
|
stateRoot: this.stateRoot,
|
|
4064
|
-
host: this.hostForSession(record.sessionId),
|
|
4065
4588
|
artifacts: this.artifactsApi({
|
|
4066
4589
|
sessionId: record.sessionId,
|
|
4067
4590
|
turnId: event.turnId,
|
|
@@ -4078,12 +4601,12 @@ export class SessionEngine {
|
|
|
4078
4601
|
if (this.abCollector.enabled) {
|
|
4079
4602
|
await this.abCollector.onEvent(
|
|
4080
4603
|
event,
|
|
4081
|
-
|
|
4604
|
+
sessionCtx.session,
|
|
4082
4605
|
this.project.name
|
|
4083
4606
|
);
|
|
4084
4607
|
}
|
|
4085
4608
|
|
|
4086
|
-
this.otel?.onEvent(event,
|
|
4609
|
+
this.otel?.onEvent(event, sessionCtx.session);
|
|
4087
4610
|
}
|
|
4088
4611
|
|
|
4089
4612
|
private channelEventHandlersFor(
|
|
@@ -4633,9 +5156,8 @@ export class SessionEngine {
|
|
|
4633
5156
|
}
|
|
4634
5157
|
const record = await this.sessions.get(sessionId);
|
|
4635
5158
|
const sdkAgentId =
|
|
4636
|
-
(record?.sdkAgentId
|
|
4637
|
-
|
|
4638
|
-
: undefined) ?? cloudSdkAgentIdFromEvents(events);
|
|
5159
|
+
(record?.sdkAgentId?.startsWith("bc-") ? record.sdkAgentId : undefined) ??
|
|
5160
|
+
cloudSdkAgentIdFromEvents(events);
|
|
4639
5161
|
if (sdkAgentId === undefined) {
|
|
4640
5162
|
return;
|
|
4641
5163
|
}
|
|
@@ -5191,10 +5713,6 @@ function buildRunnerSubagents(agent: ResolvedAgent): RunnerSubagent[] {
|
|
|
5191
5713
|
}));
|
|
5192
5714
|
}
|
|
5193
5715
|
|
|
5194
|
-
function describeError(error: unknown): string {
|
|
5195
|
-
return error instanceof Error ? error.message : String(error);
|
|
5196
|
-
}
|
|
5197
|
-
|
|
5198
5716
|
function toolErrorResult(message: string): SDKCustomToolResult {
|
|
5199
5717
|
return {
|
|
5200
5718
|
content: [{ type: "text", text: message }],
|