@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
|
@@ -23,8 +23,9 @@ import { SLACK_CHANNEL_ID } from "../channels/slack/constants.js";
|
|
|
23
23
|
import { materializeSlackNudgeCarrier } from "../channels/slack/nudge-carrier.js";
|
|
24
24
|
import { SlackAskDedupeStore, SlackNudgeStore, } from "../channels/slack/nudge-store.js";
|
|
25
25
|
import { resolveDedicatedSlackHostBinding } from "../channels/slack/slack-channel.js";
|
|
26
|
-
import { AGENT_SERVE_USER_STORE_FILES_SOURCE_ID, agentStoreKeys, } from "../files.js";
|
|
26
|
+
import { AGENT_SERVE_USER_STORE_FILES_SOURCE_ID, agentStoreKeys, DEPLOYMENT_STORE_MOUNT_PATH, USER_STORE_MOUNT_PATH, } from "../files.js";
|
|
27
27
|
import { cursorHostedFiles, isCursorHostedFilesAvailable, isCursorUserStoreFilesAvailable, } from "../files-backends/cursor-hosted.js";
|
|
28
|
+
import { isFileSystemToolAlias, isMutatingFileSystemTool, localFileSystem, resolveFileSystemTools, resolveHostHarnessToolOptions, tempFs, unionFs, writeWorkspaceFilesToRoot, } from "../filesystem.js";
|
|
28
29
|
import { storageKeysForArchitecture } from "../storage.js";
|
|
29
30
|
import { DEFAULT_MODEL, DIRECT_TOOL_CALL_CHANNEL_ID, isCursorAccountTransport, isHostOauthConnectionTransport, isSymbolicConnectionTransport, } from "../types.js";
|
|
30
31
|
import { ABCollector } from "./ab-collector.js";
|
|
@@ -39,9 +40,12 @@ import { mergeCloudOptions, resolveSessionRuntime } from "./cloud-merge.js";
|
|
|
39
40
|
import { applyCloudUsageToEvents, cloudSdkAgentIdFromEvents, isUnpricedCompletedTurn, mapSdkTokenUsage, } from "./cloud-turn-cost.js";
|
|
40
41
|
import { applyAgentContinuationDefaults, channelContinuationIdentity, httpContinuationIdentity, } from "./continuation-channel.js";
|
|
41
42
|
import { continuationSource, resolveV2Key, V2EngineError, } from "./continuation-identity.js";
|
|
43
|
+
import { describeError } from "./describe-error.js";
|
|
42
44
|
import { isDevMode } from "./dev-mode.js";
|
|
43
45
|
import { EventLogStore } from "./event-log.js";
|
|
44
46
|
import { TurnEventMapper } from "./event-mapper.js";
|
|
47
|
+
import { applyWebScratchUpdate, ingestHostAgentToolsScratch, remapScratchPaths, } from "./filesystem/scratch.js";
|
|
48
|
+
import { fileSystemTool, hostFileToolsFromAuthored, rootFileToolsFromAuthored, synthesizeFileSystemTools, } from "./filesystem/tools.js";
|
|
45
49
|
import { selectFrameworkStorageDefinition } from "./framework-storage-selection.js";
|
|
46
50
|
import { createHostFilesApi } from "./host-files.js";
|
|
47
51
|
import { createHostKvApi } from "./host-kv.js";
|
|
@@ -55,6 +59,7 @@ import { McpOauthOnDemandHub } from "./mcp-oauth-on-demand.js";
|
|
|
55
59
|
import { shouldStartProcessMemoryTelemetry, startProcessMemoryTelemetry, } from "./process-memory-telemetry.js";
|
|
56
60
|
import { buildSessionContextBlock, SCHEDULE_CHANNEL_PREFIX, } from "./prompt-context.js";
|
|
57
61
|
import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections.js";
|
|
62
|
+
import { applyAuthoredResult } from "./result-output.js";
|
|
58
63
|
import { sessionExternalLinks } from "./session-links.js";
|
|
59
64
|
import { SessionStore } from "./session-store.js";
|
|
60
65
|
import { syncSkillsToStore } from "./skills-sync.js";
|
|
@@ -67,7 +72,8 @@ import { TurnGovernor } from "./turn-governor.js";
|
|
|
67
72
|
import { TurnLeaseStore } from "./turn-lease-store.js";
|
|
68
73
|
import { TurnOutbox } from "./turn-outbox.js";
|
|
69
74
|
import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
70
|
-
import { buildAgentsMdContent, buildCloudMemorySection, ensureOwnGitRoot, isNestedInGitRepo, materializeWorkspace, SERVER_TOOLS_MCP_SERVER_NAME,
|
|
75
|
+
import { buildAgentsMdContent, buildCloudMemorySection, buildCloudWorkspaceSection, ensureOwnGitRoot, isNestedInGitRepo, materializeWorkspace, SERVER_TOOLS_MCP_SERVER_NAME, } from "./workspace.js";
|
|
76
|
+
import { syncWorkspaceToStore } from "./workspace-sync.js";
|
|
71
77
|
export const HTTP_CHANNEL_ID = "http";
|
|
72
78
|
export { SCHEDULE_CHANNEL_PREFIX } from "./prompt-context.js";
|
|
73
79
|
export class SessionBusyError extends Error {
|
|
@@ -158,6 +164,8 @@ export class SessionEngine {
|
|
|
158
164
|
var _a, _b, _c, _d, _e;
|
|
159
165
|
/** In-flight lazy restores, deduped per channel + continuation key. */
|
|
160
166
|
this.restoreInFlight = new Map();
|
|
167
|
+
/** In-flight authored files → Agent Store syncs (see syncToCloudStore). */
|
|
168
|
+
this.cloudSyncs = new Map();
|
|
161
169
|
this.channelsById = new Map();
|
|
162
170
|
/** Sessions with a turn being admitted (before the run promise exists). */
|
|
163
171
|
this.pendingTurns = new Set();
|
|
@@ -213,6 +221,12 @@ export class SessionEngine {
|
|
|
213
221
|
this.cloudCostBackfillDone = new Set();
|
|
214
222
|
/** Deduped in-flight cloud cost backfills, keyed by session id. */
|
|
215
223
|
this.cloudCostBackfill = new Map();
|
|
224
|
+
/** Per-session FileSystem handle cache (not a tree snapshot). */
|
|
225
|
+
this.sessionRoots = new Map();
|
|
226
|
+
/** In-flight factory resolves, so the first turn and a racing callTool share one handle. */
|
|
227
|
+
this.sessionRootInflight = new Map();
|
|
228
|
+
/** Per-turn `unionFs({ "/": authored, "/tmp": tempFs() })`. Dropped at end of turn. */
|
|
229
|
+
this.turnRoots = new Map();
|
|
216
230
|
this.project = options.project;
|
|
217
231
|
applyAgentContinuationDefaults(this.project);
|
|
218
232
|
this.stateRoot = options.stateRoot;
|
|
@@ -353,9 +367,9 @@ export class SessionEngine {
|
|
|
353
367
|
};
|
|
354
368
|
}
|
|
355
369
|
/**
|
|
356
|
-
* Host services with `files` bound to one session, so a relative
|
|
357
|
-
*
|
|
358
|
-
*
|
|
370
|
+
* Host services with `files` and `otel` bound to one session, so a relative
|
|
371
|
+
* path resolves to that session's scope and can never read another
|
|
372
|
+
* session's. Unbound (no session) keeps `host.files` usable for
|
|
359
373
|
* `{ scope: "deployment" }` and fails loudly on session-scoped calls.
|
|
360
374
|
*/
|
|
361
375
|
hostForSession(sessionId) {
|
|
@@ -1247,6 +1261,224 @@ export class SessionEngine {
|
|
|
1247
1261
|
return this.interrupt(existing.sessionId);
|
|
1248
1262
|
});
|
|
1249
1263
|
}
|
|
1264
|
+
hasRootOverride() {
|
|
1265
|
+
return this.project.agent.root !== undefined;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* FileSystem for this turn or `callTool`. Authored `root` (static or
|
|
1269
|
+
* factory) is cached per session when `cache` is set; unscoped
|
|
1270
|
+
* `callTool` passes the invocation id and does not cache, so factories
|
|
1271
|
+
* cannot share one tree across callers. A static handle is used as
|
|
1272
|
+
* authored — every session sees that same object. Host-default agents
|
|
1273
|
+
* get `localFileSystem` against the harness cwd — same path verbs as
|
|
1274
|
+
* the Cursor SDK natives, always through the synthesized tools.
|
|
1275
|
+
*/
|
|
1276
|
+
resolveFileSystem(options) {
|
|
1277
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1278
|
+
const authored = this.project.agent.root;
|
|
1279
|
+
if (authored === undefined) {
|
|
1280
|
+
return localFileSystem({ cwd: options.cwd });
|
|
1281
|
+
}
|
|
1282
|
+
const authoredRoot = yield this.resolveAuthoredFileSystem(options);
|
|
1283
|
+
if (options.cache) {
|
|
1284
|
+
const existing = this.turnRoots.get(options.sessionId);
|
|
1285
|
+
if (existing !== undefined) {
|
|
1286
|
+
return existing.root;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
const root = unionFs({
|
|
1290
|
+
"/": authoredRoot,
|
|
1291
|
+
"/tmp": tempFs(),
|
|
1292
|
+
});
|
|
1293
|
+
if (options.cache && this.isTurnRunning(options.sessionId)) {
|
|
1294
|
+
this.turnRoots.set(options.sessionId, { root, cwd: options.cwd });
|
|
1295
|
+
}
|
|
1296
|
+
return root;
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
resolveAuthoredFileSystem(options) {
|
|
1300
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1301
|
+
const authored = this.project.agent.root;
|
|
1302
|
+
if (authored === undefined) {
|
|
1303
|
+
throw new Error("resolveAuthoredFileSystem requires an authored root");
|
|
1304
|
+
}
|
|
1305
|
+
if (options.cache) {
|
|
1306
|
+
const cached = this.sessionRoots.get(options.sessionId);
|
|
1307
|
+
if (cached !== undefined) {
|
|
1308
|
+
return cached;
|
|
1309
|
+
}
|
|
1310
|
+
const inflight = this.sessionRootInflight.get(options.sessionId);
|
|
1311
|
+
if (inflight !== undefined) {
|
|
1312
|
+
return inflight;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
const resolve = () => __awaiter(this, void 0, void 0, function* () {
|
|
1316
|
+
if (typeof authored !== "function") {
|
|
1317
|
+
return authored;
|
|
1318
|
+
}
|
|
1319
|
+
const host = this.hostForSession(options.cache ? options.sessionId : undefined);
|
|
1320
|
+
const ctx = Object.assign(Object.assign({ sessionId: options.sessionId, agentName: this.project.agent.name }, (options.continuationKey === undefined
|
|
1321
|
+
? {}
|
|
1322
|
+
: { continuationKey: options.continuationKey })), { host: { files: host.files, reminders: host.reminders } });
|
|
1323
|
+
return yield authored(ctx);
|
|
1324
|
+
});
|
|
1325
|
+
if (!options.cache) {
|
|
1326
|
+
return resolve();
|
|
1327
|
+
}
|
|
1328
|
+
const pending = resolve();
|
|
1329
|
+
this.sessionRootInflight.set(options.sessionId, pending);
|
|
1330
|
+
try {
|
|
1331
|
+
const resolved = yield pending;
|
|
1332
|
+
this.sessionRoots.set(options.sessionId, resolved);
|
|
1333
|
+
return resolved;
|
|
1334
|
+
}
|
|
1335
|
+
finally {
|
|
1336
|
+
this.sessionRootInflight.delete(options.sessionId);
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
dropTurnFileSystem(sessionId) {
|
|
1341
|
+
this.turnRoots.delete(sessionId);
|
|
1342
|
+
}
|
|
1343
|
+
prepareScratchToolInput(options) {
|
|
1344
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1345
|
+
if (options.sessionId === undefined) {
|
|
1346
|
+
return options.input;
|
|
1347
|
+
}
|
|
1348
|
+
const turn = this.turnRoots.get(options.sessionId);
|
|
1349
|
+
if (turn === undefined) {
|
|
1350
|
+
return options.input;
|
|
1351
|
+
}
|
|
1352
|
+
yield ingestHostAgentToolsScratch({
|
|
1353
|
+
cwd: turn.cwd,
|
|
1354
|
+
root: turn.root,
|
|
1355
|
+
});
|
|
1356
|
+
return remapScratchPaths(options.input, turn.cwd);
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
withTurnScratchTools(tools, sessionId) {
|
|
1360
|
+
const turn = this.turnRoots.get(sessionId);
|
|
1361
|
+
if (turn === undefined) {
|
|
1362
|
+
return tools;
|
|
1363
|
+
}
|
|
1364
|
+
return tools.map((tool) => {
|
|
1365
|
+
const execute = tool.definition.execute;
|
|
1366
|
+
if (typeof execute !== "function") {
|
|
1367
|
+
return tool;
|
|
1368
|
+
}
|
|
1369
|
+
return Object.assign(Object.assign({}, tool), { definition: Object.assign(Object.assign({}, tool.definition), { execute: (input, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
1370
|
+
const remapped = yield this.prepareScratchToolInput({
|
|
1371
|
+
sessionId,
|
|
1372
|
+
input: input !== null &&
|
|
1373
|
+
typeof input === "object" &&
|
|
1374
|
+
!Array.isArray(input)
|
|
1375
|
+
? input
|
|
1376
|
+
: {},
|
|
1377
|
+
});
|
|
1378
|
+
return execute(remapped, ctx);
|
|
1379
|
+
}) }) });
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
nativeFileSystemOutcome(options) {
|
|
1383
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1384
|
+
var _a;
|
|
1385
|
+
const { toolName, input, callId } = options;
|
|
1386
|
+
if (!isFileSystemToolAlias(toolName)) {
|
|
1387
|
+
return undefined;
|
|
1388
|
+
}
|
|
1389
|
+
// Same policy the authored callTool path asks: a dry-run write is
|
|
1390
|
+
// answered by the host. Native edit/delete used to return before
|
|
1391
|
+
// decideToolCall and persist through the FileSystem.
|
|
1392
|
+
const decision = decideToolCall({
|
|
1393
|
+
dryRun: options.dryRun === true,
|
|
1394
|
+
effect: isMutatingFileSystemTool(toolName) ? "write" : "read",
|
|
1395
|
+
input,
|
|
1396
|
+
});
|
|
1397
|
+
if (decision.kind === "answer") {
|
|
1398
|
+
return {
|
|
1399
|
+
callId,
|
|
1400
|
+
toolName,
|
|
1401
|
+
isError: false,
|
|
1402
|
+
result: decision.result,
|
|
1403
|
+
durationMs: 0,
|
|
1404
|
+
sessionId: options.sessionId,
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
const root = yield this.resolveFileSystem({
|
|
1408
|
+
sessionId: (_a = options.sessionId) !== null && _a !== void 0 ? _a : callId,
|
|
1409
|
+
continuationKey: options.continuationKey,
|
|
1410
|
+
cache: options.sessionId !== undefined,
|
|
1411
|
+
cwd: options.cwd,
|
|
1412
|
+
});
|
|
1413
|
+
const rawArgs = input !== null && typeof input === "object" && !Array.isArray(input)
|
|
1414
|
+
? input
|
|
1415
|
+
: {};
|
|
1416
|
+
const args = yield this.prepareScratchToolInput({
|
|
1417
|
+
sessionId: options.sessionId,
|
|
1418
|
+
input: rawArgs,
|
|
1419
|
+
});
|
|
1420
|
+
const tool = fileSystemTool(root, toolName, args);
|
|
1421
|
+
const execute = tool === null || tool === void 0 ? void 0 : tool.definition.execute;
|
|
1422
|
+
if (tool === undefined || typeof execute !== "function") {
|
|
1423
|
+
// A resolved root owns this native name. Falling through would let
|
|
1424
|
+
// an authored lookalike run, or surface UnknownToolError after we
|
|
1425
|
+
// already advertised the FileSystem tool.
|
|
1426
|
+
return {
|
|
1427
|
+
callId,
|
|
1428
|
+
toolName,
|
|
1429
|
+
isError: true,
|
|
1430
|
+
result: {
|
|
1431
|
+
status: "error",
|
|
1432
|
+
error: { message: `FileSystem cannot handle ${toolName}` },
|
|
1433
|
+
},
|
|
1434
|
+
durationMs: 0,
|
|
1435
|
+
sessionId: options.sessionId,
|
|
1436
|
+
errorMessage: `FileSystem cannot handle ${toolName}`,
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
const validation = validateToolInput(tool.definition.inputSchema, args);
|
|
1440
|
+
if (!validation.ok) {
|
|
1441
|
+
return {
|
|
1442
|
+
callId,
|
|
1443
|
+
toolName,
|
|
1444
|
+
isError: true,
|
|
1445
|
+
result: {
|
|
1446
|
+
status: "error",
|
|
1447
|
+
error: { message: validation.message },
|
|
1448
|
+
},
|
|
1449
|
+
durationMs: 0,
|
|
1450
|
+
sessionId: options.sessionId,
|
|
1451
|
+
errorMessage: validation.message,
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
try {
|
|
1455
|
+
const value = yield execute(validation.value, {
|
|
1456
|
+
toolCallId: callId,
|
|
1457
|
+
workspaceDir: options.cwd,
|
|
1458
|
+
});
|
|
1459
|
+
return {
|
|
1460
|
+
callId,
|
|
1461
|
+
toolName,
|
|
1462
|
+
isError: false,
|
|
1463
|
+
result: normalizeToolResult(value),
|
|
1464
|
+
durationMs: 0,
|
|
1465
|
+
sessionId: options.sessionId,
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
catch (error) {
|
|
1469
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1470
|
+
return {
|
|
1471
|
+
callId,
|
|
1472
|
+
toolName,
|
|
1473
|
+
isError: true,
|
|
1474
|
+
result: { status: "error", error: { message } },
|
|
1475
|
+
durationMs: 0,
|
|
1476
|
+
sessionId: options.sessionId,
|
|
1477
|
+
errorMessage: message,
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1250
1482
|
/**
|
|
1251
1483
|
* Local harness cwd for a session: per-send override, else the shared
|
|
1252
1484
|
* `agent.local.workspaceDir`, else `<agent.local.cwd>/<sessionId>`, else
|
|
@@ -1293,14 +1525,16 @@ export class SessionEngine {
|
|
|
1293
1525
|
const workspaceDir = (_a = agent.local) === null || _a === void 0 ? void 0 : _a.workspaceDir;
|
|
1294
1526
|
if (workspaceDir === undefined ||
|
|
1295
1527
|
agent.runtime !== "local" ||
|
|
1528
|
+
this.hasRootOverride() ||
|
|
1296
1529
|
this.runner.prewarm === undefined) {
|
|
1297
1530
|
return;
|
|
1298
1531
|
}
|
|
1299
1532
|
const startedAt = Date.now();
|
|
1300
1533
|
try {
|
|
1301
|
-
const
|
|
1534
|
+
const harness = resolveHostHarnessToolOptions(agent.allowedTools);
|
|
1535
|
+
const outcome = yield this.runner.prewarm(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ workspaceDir, runnerStateDir: join(this.stateRoot, "runner"), sandbox: ((_b = agent.local) === null || _b === void 0 ? void 0 : _b.sandbox) === true }, (harness.tools === undefined ? {} : { tools: harness.tools })), (harness.disallowedTools === undefined
|
|
1302
1536
|
? {}
|
|
1303
|
-
: {
|
|
1537
|
+
: { disallowedTools: harness.disallowedTools })), {
|
|
1304
1538
|
// No session yet, so auth'd connections are omitted rather than
|
|
1305
1539
|
// warmed without an identity; the per-send flag still has to match
|
|
1306
1540
|
// the turns' requests or the warmed executor is one no turn asks for.
|
|
@@ -1328,7 +1562,7 @@ export class SessionEngine {
|
|
|
1328
1562
|
}
|
|
1329
1563
|
executeTurn(record, turnId, message, isFirstTurn, signal) {
|
|
1330
1564
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1331
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1565
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1332
1566
|
const sessionId = record.sessionId;
|
|
1333
1567
|
const workspaceDir = this.scaffoldDir(record);
|
|
1334
1568
|
const harnessCwd = this.harnessCwd(record);
|
|
@@ -1375,22 +1609,24 @@ export class SessionEngine {
|
|
|
1375
1609
|
// cwd is overridden (e.g. a PR worktree). A/B variant instruction
|
|
1376
1610
|
// overlays are applied via agentForSession.
|
|
1377
1611
|
const agent = this.agentForSession(record);
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1612
|
+
if (!this.hasRootOverride()) {
|
|
1613
|
+
yield materializeWorkspace({
|
|
1614
|
+
agent,
|
|
1615
|
+
workspaceDir,
|
|
1616
|
+
seed: isFirstTurn,
|
|
1617
|
+
stateRoot: this.stateRoot,
|
|
1618
|
+
});
|
|
1619
|
+
this.materializedWorkspaces.add(sessionId);
|
|
1620
|
+
// Must precede the carrier: the harness resolves rules, skills,
|
|
1621
|
+
// `mcp.json` and hooks from its git root, so a workspace nested in an
|
|
1622
|
+
// outer repo would load that repo's hooks instead of the ones written
|
|
1623
|
+
// just below. Only for directories this session owns — a borrowed
|
|
1624
|
+
// checkout or worktree keeps its own root.
|
|
1625
|
+
if (!this.hasBorrowedWorkspace(record)) {
|
|
1626
|
+
yield ensureOwnGitRoot(harnessCwd);
|
|
1627
|
+
}
|
|
1628
|
+
yield this.materializeNudgeCarrier(record, harnessCwd);
|
|
1392
1629
|
}
|
|
1393
|
-
yield this.materializeNudgeCarrier(record, harnessCwd);
|
|
1394
1630
|
// Baseline before the agent can run, so a follow-up that arrives and
|
|
1395
1631
|
// drains before the first tool boundary still counts as an increase.
|
|
1396
1632
|
yield this.baselineDeliveredNudges(record);
|
|
@@ -1398,7 +1634,13 @@ export class SessionEngine {
|
|
|
1398
1634
|
const pendingImages = record.pendingImages;
|
|
1399
1635
|
if (pendingFiles !== undefined &&
|
|
1400
1636
|
Object.keys(pendingFiles).length > 0) {
|
|
1401
|
-
yield
|
|
1637
|
+
const root = yield this.resolveFileSystem({
|
|
1638
|
+
sessionId,
|
|
1639
|
+
continuationKey: (_a = record.continuationKey) !== null && _a !== void 0 ? _a : undefined,
|
|
1640
|
+
cache: true,
|
|
1641
|
+
cwd: harnessCwd,
|
|
1642
|
+
});
|
|
1643
|
+
yield writeWorkspaceFilesToRoot(root, pendingFiles);
|
|
1402
1644
|
}
|
|
1403
1645
|
if ((pendingFiles !== undefined &&
|
|
1404
1646
|
Object.keys(pendingFiles).length > 0) ||
|
|
@@ -1418,6 +1660,14 @@ export class SessionEngine {
|
|
|
1418
1660
|
(this.hasBorrowedWorkspace(record) ||
|
|
1419
1661
|
(yield isNestedInGitRepo(harnessCwd)));
|
|
1420
1662
|
const request = yield this.buildTurnRequest(record, agent, turnId, message, isFirstTurn, instructionsInvisibleToHarness, emit, (update) => __awaiter(this, void 0, void 0, function* () {
|
|
1663
|
+
const turn = this.turnRoots.get(sessionId);
|
|
1664
|
+
if (turn !== undefined) {
|
|
1665
|
+
update = yield applyWebScratchUpdate({
|
|
1666
|
+
cwd: turn.cwd,
|
|
1667
|
+
root: turn.root,
|
|
1668
|
+
update,
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1421
1671
|
mapper.handleUpdate(update);
|
|
1422
1672
|
// Yield so the HTTP NDJSON writer can flush tool start/result
|
|
1423
1673
|
// events while sibling parallel tools are still executing.
|
|
@@ -1435,7 +1685,7 @@ export class SessionEngine {
|
|
|
1435
1685
|
this.activeToolContexts.set(sessionId, { record, turnId, emit });
|
|
1436
1686
|
this.stubbedCallIds.set(sessionId, stubbed);
|
|
1437
1687
|
try {
|
|
1438
|
-
outcome = yield this.runner.runTurn(request);
|
|
1688
|
+
outcome = yield this.runTurnExecute(record, turnId, () => this.runner.runTurn(request));
|
|
1439
1689
|
}
|
|
1440
1690
|
finally {
|
|
1441
1691
|
this.activeToolContexts.delete(sessionId);
|
|
@@ -1449,6 +1699,7 @@ export class SessionEngine {
|
|
|
1449
1699
|
}
|
|
1450
1700
|
finally {
|
|
1451
1701
|
permit.release();
|
|
1702
|
+
this.dropTurnFileSystem(sessionId);
|
|
1452
1703
|
this.approvals.cancelSession(sessionId, "deny");
|
|
1453
1704
|
this.auths.cancelSession(sessionId, "deny");
|
|
1454
1705
|
yield this.clearPendingApprovals(sessionId);
|
|
@@ -1463,24 +1714,52 @@ export class SessionEngine {
|
|
|
1463
1714
|
const title = mapper.title;
|
|
1464
1715
|
yield this.updateRecord(sessionId, (current) => (Object.assign(Object.assign({}, current), { title })));
|
|
1465
1716
|
}
|
|
1466
|
-
const finalResult = (
|
|
1467
|
-
const finalUsage = (
|
|
1717
|
+
const finalResult = (_b = outcome.result) !== null && _b !== void 0 ? _b : mapper.finalText;
|
|
1718
|
+
const finalUsage = (_c = outcome.usage) !== null && _c !== void 0 ? _c : mapper.usage;
|
|
1468
1719
|
const finalCost = finalUsage === undefined
|
|
1469
1720
|
? undefined
|
|
1470
1721
|
: yield this.estimateTurnCost({
|
|
1471
|
-
model: (
|
|
1722
|
+
model: (_d = this.project.agent.model) !== null && _d !== void 0 ? _d : DEFAULT_MODEL,
|
|
1472
1723
|
usage: finalUsage,
|
|
1473
1724
|
agentId: record.sdkAgentId,
|
|
1474
|
-
conversationId: (
|
|
1725
|
+
conversationId: (_e = record.sdkAgentId) !== null && _e !== void 0 ? _e : sessionId,
|
|
1475
1726
|
});
|
|
1476
1727
|
if (finalCost !== undefined) {
|
|
1477
1728
|
outcome = Object.assign(Object.assign({}, outcome), { cost: finalCost });
|
|
1478
1729
|
}
|
|
1730
|
+
const authored = this.project.result;
|
|
1731
|
+
if (outcome.status === "finished" && authored !== undefined) {
|
|
1732
|
+
const settled = yield applyAuthoredResult({
|
|
1733
|
+
definition: authored,
|
|
1734
|
+
text: finalResult,
|
|
1735
|
+
dryRun: record.dryRun === true,
|
|
1736
|
+
ctx: {
|
|
1737
|
+
session: this.sessionInfo(record),
|
|
1738
|
+
host: this.hostForSession(sessionId),
|
|
1739
|
+
artifacts: this.artifactsApi({ sessionId, turnId }),
|
|
1740
|
+
stateRoot: this.stateRoot,
|
|
1741
|
+
workspaceDir: harnessCwd,
|
|
1742
|
+
},
|
|
1743
|
+
});
|
|
1744
|
+
if (!settled.ok) {
|
|
1745
|
+
outcome = {
|
|
1746
|
+
status: "error",
|
|
1747
|
+
result: finalResult,
|
|
1748
|
+
errorMessage: `turn output failed: ${settled.message}`,
|
|
1749
|
+
usage: finalUsage,
|
|
1750
|
+
cost: finalCost,
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1479
1754
|
if (outcome.status === "finished") {
|
|
1480
1755
|
yield this.appendEvent(sessionId, {
|
|
1481
1756
|
type: "turn.completed",
|
|
1482
1757
|
turnId,
|
|
1483
|
-
data:
|
|
1758
|
+
data: {
|
|
1759
|
+
result: finalResult,
|
|
1760
|
+
usage: finalUsage,
|
|
1761
|
+
cost: finalCost,
|
|
1762
|
+
},
|
|
1484
1763
|
});
|
|
1485
1764
|
}
|
|
1486
1765
|
else {
|
|
@@ -1491,21 +1770,21 @@ export class SessionEngine {
|
|
|
1491
1770
|
data: {
|
|
1492
1771
|
message: interrupted
|
|
1493
1772
|
? "turn interrupted"
|
|
1494
|
-
: ((
|
|
1773
|
+
: ((_f = outcome.errorMessage) !== null && _f !== void 0 ? _f : (outcome.status === "cancelled"
|
|
1495
1774
|
? "turn cancelled"
|
|
1496
1775
|
: "turn failed")),
|
|
1497
1776
|
},
|
|
1498
1777
|
});
|
|
1499
1778
|
}
|
|
1500
1779
|
const current = yield this.sessions.get(sessionId);
|
|
1501
|
-
const mode = (
|
|
1780
|
+
const mode = (_g = current === null || current === void 0 ? void 0 : current.mode) !== null && _g !== void 0 ? _g : record.mode;
|
|
1502
1781
|
if (mode === "task") {
|
|
1503
1782
|
yield this.appendEvent(sessionId, outcome.status === "finished"
|
|
1504
1783
|
? { type: "session.completed", turnId, data: {} }
|
|
1505
1784
|
: {
|
|
1506
1785
|
type: "session.failed",
|
|
1507
1786
|
turnId,
|
|
1508
|
-
data: { message: (
|
|
1787
|
+
data: { message: (_h = outcome.errorMessage) !== null && _h !== void 0 ? _h : "task failed" },
|
|
1509
1788
|
});
|
|
1510
1789
|
}
|
|
1511
1790
|
else {
|
|
@@ -1515,7 +1794,7 @@ export class SessionEngine {
|
|
|
1515
1794
|
data: {},
|
|
1516
1795
|
});
|
|
1517
1796
|
}
|
|
1518
|
-
return Object.assign(Object.assign(
|
|
1797
|
+
return Object.assign(Object.assign({}, outcome), { result: finalResult, usage: finalUsage });
|
|
1519
1798
|
});
|
|
1520
1799
|
}
|
|
1521
1800
|
/**
|
|
@@ -1525,75 +1804,89 @@ export class SessionEngine {
|
|
|
1525
1804
|
* first-turn S3 scan can discover them. False when the sync fails: the
|
|
1526
1805
|
* turn then runs without store skills rather than pointing discovery at
|
|
1527
1806
|
* paths that do not exist.
|
|
1528
|
-
|
|
1529
|
-
|
|
1807
|
+
*/
|
|
1808
|
+
ensureCloudSkillsSynced(store) {
|
|
1809
|
+
const skills = this.project.agent.skills;
|
|
1810
|
+
return this.syncToCloudStore("skills", store, skills.length > 0, () => syncSkillsToStore({
|
|
1811
|
+
sink: store.sink,
|
|
1812
|
+
agentName: this.project.name,
|
|
1813
|
+
skills,
|
|
1814
|
+
skillsPrefix: store.skillsPrefix,
|
|
1815
|
+
}));
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Sync `agent/sandbox/workspace/**` seeds onto the Agent Store at
|
|
1819
|
+
* `workspace/…` (hosted) or `agent-serve/<agent>/workspace/…`
|
|
1820
|
+
* (personal-key local+cloud) before the first cloud prompt, which names
|
|
1821
|
+
* the mounted directory (see buildCloudWorkspaceSection).
|
|
1822
|
+
*/
|
|
1823
|
+
ensureCloudWorkspaceSynced(store) {
|
|
1824
|
+
const seedFiles = this.project.agent.seedFiles;
|
|
1825
|
+
return this.syncToCloudStore("workspace", store, seedFiles.length > 0, () => syncWorkspaceToStore({
|
|
1826
|
+
sink: store.sink,
|
|
1827
|
+
seedFiles,
|
|
1828
|
+
workspacePrefix: store.workspacePrefix,
|
|
1829
|
+
}));
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* With files authored, every first cloud turn re-copies the authored
|
|
1530
1833
|
* bytes and the memo only dedupes concurrent first turns. The mount is
|
|
1531
1834
|
* writable from cloud sessions, so a once-per-process copy would let one
|
|
1532
1835
|
* session's edits masquerade as agent definition for every later session
|
|
1533
1836
|
* until the engine restarts; re-syncing keeps the store true to discovery
|
|
1534
1837
|
* the same way local materialization always rewrites skills. Without
|
|
1535
|
-
*
|
|
1536
|
-
* process is enough, success or not — a deployment without the files
|
|
1838
|
+
* authored files the sync is best-effort stale cleanup and one attempt
|
|
1839
|
+
* per process is enough, success or not — a deployment without the files
|
|
1537
1840
|
* surface must not fail and log on every new session for a feature it
|
|
1538
1841
|
* does not use.
|
|
1539
1842
|
*/
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
const target = this.cloudSkillsStore();
|
|
1545
|
-
if (target === undefined) {
|
|
1546
|
-
this.cloudSkillsSync = Promise.resolve(false);
|
|
1547
|
-
return this.cloudSkillsSync;
|
|
1843
|
+
syncToCloudStore(surface, store, authored, run) {
|
|
1844
|
+
const inFlight = this.cloudSyncs.get(surface);
|
|
1845
|
+
if (inFlight !== undefined) {
|
|
1846
|
+
return inFlight;
|
|
1548
1847
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
sink: target.sink,
|
|
1552
|
-
agentName: this.project.name,
|
|
1553
|
-
skills,
|
|
1554
|
-
skillsPrefix: target.skillsPrefix,
|
|
1555
|
-
}).then(() => true, (error) => {
|
|
1556
|
-
this.logger(`[skills] ${target.label} sync failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1848
|
+
let sync = run().then(() => true, (error) => {
|
|
1849
|
+
this.logger(`[${surface}] ${store.label} sync failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1557
1850
|
return false;
|
|
1558
1851
|
});
|
|
1559
|
-
if (
|
|
1852
|
+
if (authored) {
|
|
1560
1853
|
sync = sync.finally(() => {
|
|
1561
|
-
this.
|
|
1854
|
+
this.cloudSyncs.delete(surface);
|
|
1562
1855
|
});
|
|
1563
1856
|
}
|
|
1564
|
-
this.
|
|
1857
|
+
this.cloudSyncs.set(surface, sync);
|
|
1565
1858
|
return sync;
|
|
1566
1859
|
}
|
|
1567
1860
|
/**
|
|
1568
1861
|
* Hosted deployments own the deployment store. Local `serve`/`run` with
|
|
1569
1862
|
* a personal API key writes into the USER store under `agent-serve/`.
|
|
1570
1863
|
*/
|
|
1571
|
-
|
|
1864
|
+
cloudStore() {
|
|
1572
1865
|
const v2Hosting = resolveAgentV2Hosting({
|
|
1573
1866
|
architecture: this.project.agent.architecture,
|
|
1574
1867
|
});
|
|
1868
|
+
const deployment = {
|
|
1869
|
+
mountPath: DEPLOYMENT_STORE_MOUNT_PATH,
|
|
1870
|
+
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
1871
|
+
workspacePrefix: agentStoreKeys.workspacePrefix(),
|
|
1872
|
+
label: "deployment store",
|
|
1873
|
+
};
|
|
1575
1874
|
if (v2Hosting.kind === "cursor-managed") {
|
|
1576
|
-
return {
|
|
1577
|
-
sink: cursorHostedFiles({
|
|
1875
|
+
return Object.assign({ sink: cursorHostedFiles({
|
|
1578
1876
|
resolveStoreSourceId: () => v2Hosting.resolveStoreIds().deploymentStoreSourceId,
|
|
1579
|
-
}),
|
|
1580
|
-
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
1581
|
-
label: "deployment store",
|
|
1582
|
-
};
|
|
1877
|
+
}) }, deployment);
|
|
1583
1878
|
}
|
|
1584
1879
|
if (v2Hosting.kind === "not-v2" && isCursorHostedFilesAvailable()) {
|
|
1585
|
-
return {
|
|
1586
|
-
sink: cursorHostedFiles(),
|
|
1587
|
-
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
1588
|
-
label: "deployment store",
|
|
1589
|
-
};
|
|
1880
|
+
return Object.assign({ sink: cursorHostedFiles() }, deployment);
|
|
1590
1881
|
}
|
|
1591
1882
|
if (isCursorUserStoreFilesAvailable()) {
|
|
1592
1883
|
return {
|
|
1593
1884
|
sink: cursorHostedFiles({
|
|
1594
1885
|
storeSourceId: AGENT_SERVE_USER_STORE_FILES_SOURCE_ID,
|
|
1595
1886
|
}),
|
|
1887
|
+
mountPath: USER_STORE_MOUNT_PATH,
|
|
1596
1888
|
skillsPrefix: agentStoreKeys.userSkillsPrefix(this.project.name),
|
|
1889
|
+
workspacePrefix: agentStoreKeys.userWorkspacePrefix(this.project.name),
|
|
1597
1890
|
label: "user store",
|
|
1598
1891
|
};
|
|
1599
1892
|
}
|
|
@@ -1602,6 +1895,7 @@ export class SessionEngine {
|
|
|
1602
1895
|
buildTurnRequest(record, agent, turnId, prompt, isFirstTurn, instructionsInvisibleToHarness, emit, onUpdate, signal, images) {
|
|
1603
1896
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1604
1897
|
var _a, _b, _c;
|
|
1898
|
+
var _d;
|
|
1605
1899
|
// Per-session cloud attach (channel/tool handoff) forces cloud runtime
|
|
1606
1900
|
// even when the agent defaults to local for chat server tools.
|
|
1607
1901
|
const runtime = resolveSessionRuntime({
|
|
@@ -1612,6 +1906,15 @@ export class SessionEngine {
|
|
|
1612
1906
|
// allowlist, and a restriction that silently does not apply is worse
|
|
1613
1907
|
// than a refused turn. Non-local agents already fail discovery; this
|
|
1614
1908
|
// guards hybrid agents' per-send cloud sessions.
|
|
1909
|
+
//
|
|
1910
|
+
// Factory roots omit `allowedTools` at discovery (the live handle is
|
|
1911
|
+
// resolved per session). The allowlist guard below therefore never
|
|
1912
|
+
// fires for `defineAgent({ root: (ctx) => … })` with omitted `tools`,
|
|
1913
|
+
// and a per-send `cloud` attach would skip the virtual-root allowlist
|
|
1914
|
+
// and run unrestricted on a VM. Any authored root refuses non-local turns.
|
|
1915
|
+
if (runtime !== "local" && this.hasRootOverride()) {
|
|
1916
|
+
throw new Error(`Agent "${agent.name}" declares root, which cannot be served on ${runtime} turns. Refusing the session rather than running it against the host VM.`);
|
|
1917
|
+
}
|
|
1615
1918
|
if (runtime !== "local" && agent.allowedTools !== undefined) {
|
|
1616
1919
|
throw new Error(`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.`);
|
|
1617
1920
|
}
|
|
@@ -1632,6 +1935,38 @@ export class SessionEngine {
|
|
|
1632
1935
|
override: record.cloudOverride,
|
|
1633
1936
|
})
|
|
1634
1937
|
: undefined;
|
|
1938
|
+
const authoredRoot = this.hasRootOverride();
|
|
1939
|
+
const root = runtime === "local"
|
|
1940
|
+
? yield this.resolveFileSystem({
|
|
1941
|
+
sessionId: record.sessionId,
|
|
1942
|
+
continuationKey: (_d = record.continuationKey) !== null && _d !== void 0 ? _d : undefined,
|
|
1943
|
+
cache: true,
|
|
1944
|
+
cwd: this.harnessCwd(record),
|
|
1945
|
+
})
|
|
1946
|
+
: undefined;
|
|
1947
|
+
const harnessTools = runtime === "local" && root !== undefined
|
|
1948
|
+
? authoredRoot
|
|
1949
|
+
? {
|
|
1950
|
+
tools: resolveFileSystemTools({
|
|
1951
|
+
root,
|
|
1952
|
+
tools: agent.allowedTools,
|
|
1953
|
+
}),
|
|
1954
|
+
}
|
|
1955
|
+
: resolveHostHarnessToolOptions(agent.allowedTools)
|
|
1956
|
+
: undefined;
|
|
1957
|
+
const fileTools = root === undefined
|
|
1958
|
+
? []
|
|
1959
|
+
: synthesizeFileSystemTools(root, authoredRoot
|
|
1960
|
+
? rootFileToolsFromAuthored(agent.allowedTools)
|
|
1961
|
+
: hostFileToolsFromAuthored(agent.allowedTools));
|
|
1962
|
+
// Host-default keeps native SemanticSearch (the host index).
|
|
1963
|
+
// `localFileSystem.search` is empty, so synthesizing would
|
|
1964
|
+
// replace a working index with an empty custom tool.
|
|
1965
|
+
const synthesized = root === undefined
|
|
1966
|
+
? []
|
|
1967
|
+
: this.withTurnScratchTools(authoredRoot
|
|
1968
|
+
? fileTools
|
|
1969
|
+
: fileTools.filter((tool) => tool.name !== "SemanticSearch"), record.sessionId);
|
|
1635
1970
|
let turnPrompt = prompt;
|
|
1636
1971
|
if (isFirstTurn) {
|
|
1637
1972
|
const contextBlock = buildSessionContextBlock({
|
|
@@ -1646,13 +1981,14 @@ export class SessionEngine {
|
|
|
1646
1981
|
if (isFirstTurn) {
|
|
1647
1982
|
if (runtime === "cloud") {
|
|
1648
1983
|
// Cloud VMs have no materialized workspace: ship the full context,
|
|
1649
|
-
// including agent tool script bodies.
|
|
1650
|
-
//
|
|
1651
|
-
//
|
|
1652
|
-
//
|
|
1653
|
-
//
|
|
1654
|
-
//
|
|
1655
|
-
//
|
|
1984
|
+
// including agent tool script bodies. Authored skills and workspace
|
|
1985
|
+
// seeds land on the store mount (skills for native discovery, seeds
|
|
1986
|
+
// for the model's file tools), and on hosted deployments the shared
|
|
1987
|
+
// memory journal is on that mount too — say where. When the turn
|
|
1988
|
+
// carries the session-bound server-tool MCP endpoint, the preamble
|
|
1989
|
+
// catalogs server tools under that MCP server name *before* the
|
|
1990
|
+
// agent-tool "write the script if missing" recipe, so a model told
|
|
1991
|
+
// to "use <server tool>" calls MCP instead of inventing a .sh.
|
|
1656
1992
|
const preamble = buildAgentsMdContent(agent, {
|
|
1657
1993
|
includeScripts: true,
|
|
1658
1994
|
serverToolsMcpName: this.cloudServerToolsConnection === undefined
|
|
@@ -1660,17 +1996,39 @@ export class SessionEngine {
|
|
|
1660
1996
|
: SERVER_TOOLS_MCP_SERVER_NAME,
|
|
1661
1997
|
});
|
|
1662
1998
|
const hosted = isCursorHostedFilesAvailable();
|
|
1663
|
-
// Synced whenever a store is reachable, not just when skills
|
|
1664
|
-
// removing the last
|
|
1665
|
-
//
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1999
|
+
// Synced whenever a store is reachable, not just when skills or
|
|
2000
|
+
// seeds exist: removing the last one has to delete its store copies
|
|
2001
|
+
// too.
|
|
2002
|
+
const store = hosted || isCursorUserStoreFilesAvailable()
|
|
2003
|
+
? this.cloudStore()
|
|
2004
|
+
: undefined;
|
|
2005
|
+
let sections = "";
|
|
2006
|
+
if (store !== undefined) {
|
|
2007
|
+
const [, seedsSynced] = yield Promise.all([
|
|
2008
|
+
this.ensureCloudSkillsSynced(store),
|
|
2009
|
+
this.ensureCloudWorkspaceSynced(store),
|
|
2010
|
+
]);
|
|
2011
|
+
// Only name the mount when the bytes landed; a failed sync must
|
|
2012
|
+
// not send the model looking for files that are not there.
|
|
2013
|
+
if (seedsSynced && agent.seedFiles.length > 0) {
|
|
2014
|
+
const dir = `${store.mountPath}/${store.workspacePrefix}`;
|
|
2015
|
+
sections += `\n\n${buildCloudWorkspaceSection(dir)}`;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
if (hosted) {
|
|
2019
|
+
sections += `\n\n${buildCloudMemorySection(this.project.name)}`;
|
|
1669
2020
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
2021
|
+
turnPrompt = `${preamble}${sections}\n\n${turnPrompt}`;
|
|
2022
|
+
}
|
|
2023
|
+
else if (runtime === "local" && authoredRoot) {
|
|
2024
|
+
// Virtual roots skip materialize, so AGENTS.md never lands on disk.
|
|
2025
|
+
// Ship the same preamble the borrowed-cwd local path uses.
|
|
2026
|
+
const preamble = buildAgentsMdContent(Object.assign(Object.assign({}, agent), { tools: [...agent.tools, ...synthesized] }), { includeScripts: true });
|
|
2027
|
+
const workspaceInfo = `<user_info>\nWorkspace Path: /\n</user_info>`;
|
|
2028
|
+
turnPrompt =
|
|
2029
|
+
preamble === ""
|
|
2030
|
+
? `${workspaceInfo}\n\n${turnPrompt}`
|
|
2031
|
+
: `${workspaceInfo}\n\n${preamble}\n\n${turnPrompt}`;
|
|
1674
2032
|
}
|
|
1675
2033
|
else if (runtime === "local" && instructionsInvisibleToHarness) {
|
|
1676
2034
|
// Local workspace whose AGENTS.md the harness will not load. With a
|
|
@@ -1686,9 +2044,14 @@ export class SessionEngine {
|
|
|
1686
2044
|
}
|
|
1687
2045
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ sessionId: record.sessionId }, (record.sdkAgentId === undefined
|
|
1688
2046
|
? {}
|
|
1689
|
-
: { sdkAgentId: record.sdkAgentId })), { workspaceDir: this.harnessCwd(record), sandbox:
|
|
1690
|
-
|
|
1691
|
-
|
|
2047
|
+
: { sdkAgentId: record.sdkAgentId })), { workspaceDir: this.harnessCwd(record), sandbox: authoredRoot
|
|
2048
|
+
? false
|
|
2049
|
+
: ((_c = this.project.agent.local) === null || _c === void 0 ? void 0 : _c.sandbox) === true }), (runtime === "local" && harnessTools !== undefined
|
|
2050
|
+
? Object.assign(Object.assign({}, (harnessTools.tools === undefined
|
|
2051
|
+
? {}
|
|
2052
|
+
: { tools: harnessTools.tools })), (harnessTools.disallowedTools === undefined
|
|
2053
|
+
? {}
|
|
2054
|
+
: { disallowedTools: harnessTools.disallowedTools })) : {})), { runnerStateDir: join(this.stateRoot, "runner"), prompt: turnPrompt, isFirstTurn }), (images !== undefined && images.length > 0 ? { images } : {})), (agent.model === undefined ? {} : { model: agent.model })), { runtime, agentName: agent.name }), (mergedCloud === undefined ? {} : { cloud: mergedCloud })), {
|
|
1692
2055
|
// The hosted Grok Bot harness reads no workspace AGENTS.md: grokbot
|
|
1693
2056
|
// turns carry the composed instructions into the hosted session,
|
|
1694
2057
|
// which surfaces them in the Sand system prompt. The box never sees
|
|
@@ -1699,7 +2062,7 @@ export class SessionEngine {
|
|
|
1699
2062
|
: undefined }), (runtime === "cloud" && !isCursorHostedFilesAvailable()
|
|
1700
2063
|
? { agentServeAgent: this.project.name }
|
|
1701
2064
|
: {})), { customTools: runtime === "local"
|
|
1702
|
-
? yield this.buildCustomTools(record, agent, turnId, emit)
|
|
2065
|
+
? yield this.buildCustomTools(record, agent, turnId, emit, synthesized)
|
|
1703
2066
|
: {}, mcpServers: this.buildMcpServers(runtime, record.sessionId, yield this.evaluateConnectionAuth(record)) }), (runtime === "local" && this.hasAttachedAuthedConnections()
|
|
1704
2067
|
? { perSendMcpServers: true }
|
|
1705
2068
|
: {})), { subagents: buildRunnerSubagents(agent), onUpdate,
|
|
@@ -1922,8 +2285,8 @@ export class SessionEngine {
|
|
|
1922
2285
|
return evaluated;
|
|
1923
2286
|
});
|
|
1924
2287
|
}
|
|
1925
|
-
buildCustomTools(
|
|
1926
|
-
return __awaiter(this,
|
|
2288
|
+
buildCustomTools(record_1, agent_1, turnId_1, emit_1) {
|
|
2289
|
+
return __awaiter(this, arguments, void 0, function* (record, agent, turnId, emit, extraTools = []) {
|
|
1927
2290
|
const tools = {};
|
|
1928
2291
|
const register = (tool) => {
|
|
1929
2292
|
tools[tool.name] = Object.assign(Object.assign(Object.assign({ description: tool.description, inputSchema: tool.inputSchema }, (tool.outputSchema === undefined
|
|
@@ -1943,7 +2306,7 @@ export class SessionEngine {
|
|
|
1943
2306
|
});
|
|
1944
2307
|
}) });
|
|
1945
2308
|
};
|
|
1946
|
-
for (const tool of agent.tools) {
|
|
2309
|
+
for (const tool of [...agent.tools, ...extraTools]) {
|
|
1947
2310
|
if (tool.execution !== "server") {
|
|
1948
2311
|
continue;
|
|
1949
2312
|
}
|
|
@@ -2091,6 +2454,23 @@ export class SessionEngine {
|
|
|
2091
2454
|
}
|
|
2092
2455
|
});
|
|
2093
2456
|
}
|
|
2457
|
+
/**
|
|
2458
|
+
* Bind outbound inject (Factory / Cursor API `traceparent`) to the
|
|
2459
|
+
* turn span for the whole harness run. Host files / VFS RPCs happen
|
|
2460
|
+
* here, not under `runInCall`. No-op when OTel is off.
|
|
2461
|
+
*/
|
|
2462
|
+
runTurnExecute(record, turnId, fn) {
|
|
2463
|
+
const otel = this.otel;
|
|
2464
|
+
const run = () => Promise.resolve(fn());
|
|
2465
|
+
if (otel === undefined) {
|
|
2466
|
+
return run();
|
|
2467
|
+
}
|
|
2468
|
+
return otel.runInTurn({
|
|
2469
|
+
sessionId: record.sessionId,
|
|
2470
|
+
session: this.sessionInfo(record),
|
|
2471
|
+
turnId,
|
|
2472
|
+
}, run);
|
|
2473
|
+
}
|
|
2094
2474
|
/**
|
|
2095
2475
|
* Bind outbound inject (Factory / Cursor API `traceparent`) to the
|
|
2096
2476
|
* tool span. No-op when OTel is off.
|
|
@@ -2595,6 +2975,7 @@ export class SessionEngine {
|
|
|
2595
2975
|
callTool(toolName_1) {
|
|
2596
2976
|
return __awaiter(this, arguments, void 0, function* (toolName, input = {}, options = {}) {
|
|
2597
2977
|
var _a;
|
|
2978
|
+
var _b, _c;
|
|
2598
2979
|
const callId = newToolCallId(toolName);
|
|
2599
2980
|
// Identity resolves before the tool lookup: advertised connection tools
|
|
2600
2981
|
// only exist relative to a session (per-session auth), so finding them
|
|
@@ -2604,6 +2985,24 @@ export class SessionEngine {
|
|
|
2604
2985
|
const session = identity.session;
|
|
2605
2986
|
let workspaceDir = identity.workspaceDir;
|
|
2606
2987
|
let scratchDir = identity.scratchDir;
|
|
2988
|
+
if (isFileSystemToolAlias(toolName) &&
|
|
2989
|
+
identity.busy &&
|
|
2990
|
+
record !== undefined &&
|
|
2991
|
+
isMutatingFileSystemTool(toolName)) {
|
|
2992
|
+
throw new SessionBusyError(record.sessionId);
|
|
2993
|
+
}
|
|
2994
|
+
const native = yield this.nativeFileSystemOutcome({
|
|
2995
|
+
toolName,
|
|
2996
|
+
input,
|
|
2997
|
+
callId,
|
|
2998
|
+
sessionId: record === null || record === void 0 ? void 0 : record.sessionId,
|
|
2999
|
+
continuationKey: (_c = (_b = record === null || record === void 0 ? void 0 : record.continuationKey) !== null && _b !== void 0 ? _b : session.continuationKey) !== null && _c !== void 0 ? _c : undefined,
|
|
3000
|
+
cwd: workspaceDir,
|
|
3001
|
+
dryRun: (record === null || record === void 0 ? void 0 : record.dryRun) === true,
|
|
3002
|
+
});
|
|
3003
|
+
if (native !== undefined) {
|
|
3004
|
+
return native;
|
|
3005
|
+
}
|
|
2607
3006
|
let tool = this.project.agent.tools.find((t) => t.name === toolName);
|
|
2608
3007
|
if (tool === undefined &&
|
|
2609
3008
|
this.project.agent.connections.some((c) => c.advertiseTools === true)) {
|
|
@@ -2692,7 +3091,8 @@ export class SessionEngine {
|
|
|
2692
3091
|
const turnMaterialized = record !== undefined &&
|
|
2693
3092
|
identity.busy &&
|
|
2694
3093
|
this.materializedWorkspaces.has(record.sessionId);
|
|
2695
|
-
if (
|
|
3094
|
+
if (!this.hasRootOverride() &&
|
|
3095
|
+
(record === undefined || workspaceUnavailable || !turnMaterialized)) {
|
|
2696
3096
|
yield materializeWorkspace({
|
|
2697
3097
|
agent: this.project.agent,
|
|
2698
3098
|
workspaceDir: record === undefined || workspaceUnavailable
|
|
@@ -2946,7 +3346,10 @@ export class SessionEngine {
|
|
|
2946
3346
|
if (record === undefined) {
|
|
2947
3347
|
return;
|
|
2948
3348
|
}
|
|
2949
|
-
const sessionCtx = {
|
|
3349
|
+
const sessionCtx = {
|
|
3350
|
+
session: this.sessionInfo(record),
|
|
3351
|
+
host: this.hostForSession(record.sessionId),
|
|
3352
|
+
};
|
|
2950
3353
|
const channelEvents = this.channelEventHandlersFor(record.channelId);
|
|
2951
3354
|
if (channelEvents !== undefined) {
|
|
2952
3355
|
// Handlers are declared against the narrowed event for their key; the
|
|
@@ -2985,20 +3388,13 @@ export class SessionEngine {
|
|
|
2985
3388
|
continue;
|
|
2986
3389
|
}
|
|
2987
3390
|
try {
|
|
2988
|
-
yield handler(event, {
|
|
2989
|
-
agent: { name: this.project.name },
|
|
2990
|
-
channel: {
|
|
3391
|
+
yield handler(event, Object.assign(Object.assign({}, sessionCtx), { agent: { name: this.project.name }, channel: {
|
|
2991
3392
|
id: record.channelId,
|
|
2992
3393
|
continuationToken: record.continuationKey,
|
|
2993
|
-
},
|
|
2994
|
-
session: this.sessionInfo(record),
|
|
2995
|
-
stateRoot: this.stateRoot,
|
|
2996
|
-
host: this.hostForSession(record.sessionId),
|
|
2997
|
-
artifacts: this.artifactsApi({
|
|
3394
|
+
}, stateRoot: this.stateRoot, artifacts: this.artifactsApi({
|
|
2998
3395
|
sessionId: record.sessionId,
|
|
2999
3396
|
turnId: event.turnId,
|
|
3000
|
-
})
|
|
3001
|
-
});
|
|
3397
|
+
}) }));
|
|
3002
3398
|
}
|
|
3003
3399
|
catch (error) {
|
|
3004
3400
|
this.logger(`[agent-sdk] hook "${hook.name}" handler for ${event.type} threw: ${describeError(error)}`);
|
|
@@ -3006,9 +3402,9 @@ export class SessionEngine {
|
|
|
3006
3402
|
}
|
|
3007
3403
|
}
|
|
3008
3404
|
if (this.abCollector.enabled) {
|
|
3009
|
-
yield this.abCollector.onEvent(event,
|
|
3405
|
+
yield this.abCollector.onEvent(event, sessionCtx.session, this.project.name);
|
|
3010
3406
|
}
|
|
3011
|
-
(_a = this.otel) === null || _a === void 0 ? void 0 : _a.onEvent(event,
|
|
3407
|
+
(_a = this.otel) === null || _a === void 0 ? void 0 : _a.onEvent(event, sessionCtx.session);
|
|
3012
3408
|
});
|
|
3013
3409
|
}
|
|
3014
3410
|
channelEventHandlersFor(channelId) {
|
|
@@ -3475,7 +3871,8 @@ export class SessionEngine {
|
|
|
3475
3871
|
}
|
|
3476
3872
|
runCloudTurnCostBackfill(sessionId) {
|
|
3477
3873
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3478
|
-
var _a
|
|
3874
|
+
var _a;
|
|
3875
|
+
var _b, _c;
|
|
3479
3876
|
const log = yield this.logs.get(sessionId);
|
|
3480
3877
|
const events = yield log.snapshot(0);
|
|
3481
3878
|
if (!events.some((event) => isUnpricedCompletedTurn(event))) {
|
|
@@ -3486,9 +3883,7 @@ export class SessionEngine {
|
|
|
3486
3883
|
return;
|
|
3487
3884
|
}
|
|
3488
3885
|
const record = yield this.sessions.get(sessionId);
|
|
3489
|
-
const sdkAgentId = (
|
|
3490
|
-
? record.sdkAgentId
|
|
3491
|
-
: undefined)) !== null && _a !== void 0 ? _a : cloudSdkAgentIdFromEvents(events);
|
|
3886
|
+
const sdkAgentId = (_b = (((_a = record === null || record === void 0 ? void 0 : record.sdkAgentId) === null || _a === void 0 ? void 0 : _a.startsWith("bc-")) ? record.sdkAgentId : undefined)) !== null && _b !== void 0 ? _b : cloudSdkAgentIdFromEvents(events);
|
|
3492
3887
|
if (sdkAgentId === undefined) {
|
|
3493
3888
|
return;
|
|
3494
3889
|
}
|
|
@@ -3496,7 +3891,7 @@ export class SessionEngine {
|
|
|
3496
3891
|
if (billed === undefined) {
|
|
3497
3892
|
return;
|
|
3498
3893
|
}
|
|
3499
|
-
const model = (
|
|
3894
|
+
const model = (_c = this.project.agent.model) !== null && _c !== void 0 ? _c : DEFAULT_MODEL;
|
|
3500
3895
|
const patched = applyCloudUsageToEvents(events, billed, model);
|
|
3501
3896
|
if (patched === undefined) {
|
|
3502
3897
|
return;
|
|
@@ -3910,9 +4305,6 @@ function subagentPrompt(subagent) {
|
|
|
3910
4305
|
function buildRunnerSubagents(agent) {
|
|
3911
4306
|
return agent.subagents.map((subagent) => { var _a; return (Object.assign({ name: subagent.name, description: (_a = subagent.description) !== null && _a !== void 0 ? _a : subagent.name, prompt: subagentPrompt(subagent) }, (subagent.model === undefined ? {} : { model: subagent.model }))); });
|
|
3912
4307
|
}
|
|
3913
|
-
function describeError(error) {
|
|
3914
|
-
return error instanceof Error ? error.message : String(error);
|
|
3915
|
-
}
|
|
3916
4308
|
function toolErrorResult(message) {
|
|
3917
4309
|
return {
|
|
3918
4310
|
content: [{ type: "text", text: message }],
|