@cursor/july 0.1.100 → 0.1.102
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/README.md +27 -0
- package/dist/bin/agent-serve.js +3 -2
- package/dist/channels/deployments/deployments-channel.d.ts +41 -5
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
- package/dist/channels/deployments/deployments-channel.js +88 -8
- package/dist/channels/deployments/types.d.ts +4 -3
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/origin/defaults.d.ts +43 -0
- package/dist/channels/origin/defaults.d.ts.map +1 -0
- package/dist/channels/origin/defaults.js +111 -0
- package/dist/channels/origin/index.d.ts +2 -0
- package/dist/channels/origin/index.d.ts.map +1 -1
- package/dist/channels/origin/index.js +2 -0
- package/dist/channels/origin/origin-channel.d.ts +2 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +24 -3
- package/dist/channels/origin/state.d.ts +32 -0
- package/dist/channels/origin/state.d.ts.map +1 -0
- package/dist/channels/origin/state.js +23 -0
- package/dist/channels/origin/types.d.ts +23 -1
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/api.d.ts +1 -1
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +5 -2
- package/dist/channels/slack/assistant.d.ts +1 -1
- package/dist/channels/slack/assistant.d.ts.map +1 -1
- package/dist/channels/slack/code-fences.d.ts +17 -0
- package/dist/channels/slack/code-fences.d.ts.map +1 -0
- package/dist/channels/slack/code-fences.js +168 -0
- package/dist/channels/slack/dispatch.d.ts +3 -2
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +28 -8
- package/dist/channels/slack/inbound.d.ts +8 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +28 -0
- package/dist/channels/slack/index.d.ts +1 -0
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +1 -0
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +11 -4
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +2 -1
- package/dist/connections.d.ts +18 -2
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +18 -2
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.DZ1e0Ycq.js → app.CLA03RCz.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.FAqdWIXo.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.l8omwc6D.js → VPLocalSearchBox.ifxv-cJV.js} +1 -1
- package/dist/docs/assets/chunks/{theme.JVcD6gel.js → theme.DWCwM6p-.js} +2 -2
- package/dist/docs/assets/concepts.md.rPzW2HZN.js +1 -0
- package/dist/docs/assets/guides_cloud-agents.md.DumwWXba.js +9 -0
- package/dist/docs/assets/guides_cloud-agents.md.DumwWXba.lean.js +1 -0
- package/dist/docs/assets/{guides_cloud-runtime.md.CkYbjnAX.js → guides_cloud-runtime.md.BRirbRAN.js} +1 -1
- package/dist/docs/assets/index.md.Kiht7ell.js +5 -0
- package/dist/docs/assets/{index.md.Bb4k8kUm.lean.js → index.md.Kiht7ell.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.BiGoBAk2.js → reference_connections.md.Di6jJAXF.js} +12 -2
- package/dist/docs/assets/{reference_connections.md.BiGoBAk2.lean.js → reference_connections.md.Di6jJAXF.lean.js} +1 -1
- package/dist/docs/assets/reference_extensions.md.9WQMZe1l.js +56 -0
- package/dist/docs/assets/reference_extensions.md.9WQMZe1l.lean.js +1 -0
- package/dist/docs/assets/{reference_http-api.md.BEJx9XVj.js → reference_http-api.md.oySXBO8o.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md.Bv4KOtlB.js → reference_project-layout.md.CA6QP6Lw.js} +2 -2
- package/dist/docs/assets/{reference_project-layout.md.Bv4KOtlB.lean.js → reference_project-layout.md.CA6QP6Lw.lean.js} +1 -1
- package/dist/docs/assets/{reference_skills.md.BFW9retM.js → reference_skills.md.l2ezAcaN.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.CvAHsdSp.js → reference_tools.md.B1up2r9W.js} +1 -1
- package/dist/docs/assets/skills_framework-map.md.DDa4MeEW.js +1 -0
- package/dist/docs/assets/{skills_framework-map.md.BTi817yv.lean.js → skills_framework-map.md.DDa4MeEW.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 +3 -3
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/evals.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-agents.html +35 -0
- package/dist/docs/guides/cloud-agents.md +93 -0
- package/dist/docs/guides/cloud-runtime.html +6 -6
- package/dist/docs/guides/cloud-runtime.md +2 -0
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +5 -5
- 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 +5 -1
- package/dist/docs/llms-full.txt +353 -5
- package/dist/docs/llms.txt +2 -0
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +5 -5
- package/dist/docs/reference/cli.html +4 -4
- package/dist/docs/reference/connections.html +16 -6
- package/dist/docs/reference/connections.md +31 -0
- package/dist/docs/reference/extensions.html +82 -0
- package/dist/docs/reference/extensions.md +200 -0
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +6 -6
- package/dist/docs/reference/http-api.md +1 -1
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +6 -6
- package/dist/docs/reference/project-layout.md +3 -0
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +6 -6
- package/dist/docs/reference/skills.md +2 -0
- package/dist/docs/reference/subagents.html +5 -5
- package/dist/docs/reference/tools.html +6 -6
- package/dist/docs/reference/tools.md +2 -0
- 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 +1 -0
- 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 +4 -4
- 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 +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +4 -4
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/extensions/cursor-cloud-agents/extension.d.ts +57 -0
- package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/extension.js +66 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +78 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/backend.js +286 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +25 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.js +85 -0
- package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts +5 -0
- package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/inputs.js +4 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts +15 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.js +55 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts +8 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/transcript.js +15 -0
- package/dist/extensions/cursor-cloud-agents/skills/handoff.md +41 -0
- package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/cancel.js +26 -0
- package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/dump.js +54 -0
- package/dist/extensions/cursor-cloud-agents/tools/get.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/get.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/get.js +25 -0
- package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/launch.js +59 -0
- package/dist/extensions/cursor-cloud-agents/tools/list.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/list.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/list.js +36 -0
- package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/reply.js +35 -0
- package/dist/extensions.d.ts +73 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +112 -0
- package/dist/files-backends/cursor-hosted.d.ts +0 -8
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +1 -11
- package/dist/files.d.ts +5 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +22 -18
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/internal/advertise-tools.d.ts +4 -1
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +20 -1
- package/dist/internal/as-of.d.ts +18 -0
- package/dist/internal/as-of.d.ts.map +1 -1
- package/dist/internal/as-of.js +131 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +64 -19
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +3 -1
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +13 -15
- package/dist/internal/cursor/backend-client.d.ts +8 -1
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +25 -9
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts +16 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-deployment-secrets.js +61 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts +11 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
- package/dist/internal/cursor/hosted-store-secrets.js +15 -0
- package/dist/internal/cursor-deployment-relay.d.ts +15 -1
- package/dist/internal/cursor-deployment-relay.d.ts.map +1 -1
- package/dist/internal/cursor-deployment-relay.js +46 -7
- package/dist/internal/deploy-client.d.ts +23 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +54 -12
- package/dist/internal/discovery/ab.d.ts +9 -0
- package/dist/internal/discovery/ab.d.ts.map +1 -0
- package/dist/internal/discovery/ab.js +101 -0
- package/dist/internal/discovery/agent-config.d.ts +35 -0
- package/dist/internal/discovery/agent-config.d.ts.map +1 -0
- package/dist/internal/discovery/agent-config.js +173 -0
- package/dist/internal/discovery/agent.d.ts +11 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -0
- package/dist/internal/discovery/agent.js +306 -0
- package/dist/internal/discovery/channels.d.ts +10 -0
- package/dist/internal/discovery/channels.d.ts.map +1 -0
- package/dist/internal/discovery/channels.js +97 -0
- package/dist/internal/discovery/connections.d.ts +17 -0
- package/dist/internal/discovery/connections.d.ts.map +1 -0
- package/dist/internal/discovery/connections.js +436 -0
- package/dist/internal/discovery/context.d.ts +20 -0
- package/dist/internal/discovery/context.d.ts.map +1 -0
- package/dist/internal/discovery/context.js +30 -0
- package/dist/internal/discovery/cursor-plugin.d.ts +25 -0
- package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -0
- package/dist/internal/discovery/cursor-plugin.js +570 -0
- package/dist/internal/discovery/extensions.d.ts +19 -0
- package/dist/internal/discovery/extensions.d.ts.map +1 -0
- package/dist/internal/discovery/extensions.js +238 -0
- package/dist/internal/discovery/fs.d.ts +15 -0
- package/dist/internal/discovery/fs.d.ts.map +1 -0
- package/dist/internal/discovery/fs.js +115 -0
- package/dist/internal/discovery/hooks.d.ts +7 -0
- package/dist/internal/discovery/hooks.d.ts.map +1 -0
- package/dist/internal/discovery/hooks.js +48 -0
- package/dist/internal/discovery/info.d.ts +6 -0
- package/dist/internal/discovery/info.d.ts.map +1 -0
- package/dist/internal/discovery/info.js +141 -0
- package/dist/internal/discovery/instructions.d.ts +7 -0
- package/dist/internal/discovery/instructions.d.ts.map +1 -0
- package/dist/internal/discovery/instructions.js +95 -0
- package/dist/internal/discovery/modules.d.ts +20 -0
- package/dist/internal/discovery/modules.d.ts.map +1 -0
- package/dist/internal/discovery/modules.js +101 -0
- package/dist/internal/discovery/names.d.ts +12 -0
- package/dist/internal/discovery/names.d.ts.map +1 -0
- package/dist/internal/discovery/names.js +36 -0
- package/dist/internal/discovery/project.d.ts +53 -0
- package/dist/internal/discovery/project.d.ts.map +1 -0
- package/dist/internal/discovery/project.js +239 -0
- package/dist/internal/discovery/runtime.d.ts +34 -0
- package/dist/internal/discovery/runtime.d.ts.map +1 -0
- package/dist/internal/discovery/runtime.js +98 -0
- package/dist/internal/discovery/schedules.d.ts +7 -0
- package/dist/internal/discovery/schedules.d.ts.map +1 -0
- package/dist/internal/discovery/schedules.js +97 -0
- package/dist/internal/discovery/seed-files.d.ts +7 -0
- package/dist/internal/discovery/seed-files.d.ts.map +1 -0
- package/dist/internal/discovery/seed-files.js +41 -0
- package/dist/internal/discovery/services.d.ts +17 -0
- package/dist/internal/discovery/services.d.ts.map +1 -0
- package/dist/internal/discovery/services.js +104 -0
- package/dist/internal/discovery/skills.d.ts +16 -0
- package/dist/internal/discovery/skills.d.ts.map +1 -0
- package/dist/internal/discovery/skills.js +151 -0
- package/dist/internal/discovery/subagent.d.ts +13 -0
- package/dist/internal/discovery/subagent.d.ts.map +1 -0
- package/dist/internal/discovery/subagent.js +19 -0
- package/dist/internal/discovery/tools.d.ts +18 -0
- package/dist/internal/discovery/tools.d.ts.map +1 -0
- package/dist/internal/discovery/tools.js +159 -0
- package/dist/internal/discovery.d.ts +8 -62
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +8 -2210
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +5 -0
- package/dist/internal/framework-file-storage.d.ts +3 -3
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +38 -9
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +8 -7
- package/dist/internal/frontmatter.d.ts +11 -3
- package/dist/internal/frontmatter.d.ts.map +1 -1
- package/dist/internal/frontmatter.js +29 -3
- package/dist/internal/hosted-delivery.d.ts +3 -1
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +19 -32
- package/dist/internal/hosted-execution-diag.d.ts +5 -0
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
- package/dist/internal/hosted-execution-diag.js +5 -0
- package/dist/internal/hosted-execution-flush.d.ts +46 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -0
- package/dist/internal/hosted-execution-flush.js +81 -0
- package/dist/internal/mcp-endpoint.js +1 -0
- package/dist/internal/mcp-host.d.ts +2 -1
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +66 -29
- package/dist/internal/otel/collector.d.ts +13 -0
- package/dist/internal/otel/collector.d.ts.map +1 -1
- package/dist/internal/otel/collector.js +84 -17
- package/dist/internal/otel/http.d.ts.map +1 -1
- package/dist/internal/otel/http.js +2 -10
- package/dist/internal/otel/mcp.d.ts +16 -0
- package/dist/internal/otel/mcp.d.ts.map +1 -0
- package/dist/internal/otel/mcp.js +68 -0
- package/dist/internal/otel/propagation.d.ts +6 -0
- package/dist/internal/otel/propagation.d.ts.map +1 -0
- package/dist/internal/otel/propagation.js +14 -0
- package/dist/internal/otel/runtime.d.ts.map +1 -1
- package/dist/internal/otel/runtime.js +2 -0
- package/dist/internal/review-comments.d.ts +1 -1
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +4 -4
- package/dist/internal/server.d.ts +3 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +79 -104
- package/dist/internal/session-engine.d.ts +14 -7
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +113 -66
- package/dist/internal/session-run-log.d.ts +3 -1
- package/dist/internal/session-run-log.d.ts.map +1 -1
- package/dist/internal/session-run-log.js +14 -14
- package/dist/internal/start-log-store.d.ts +60 -0
- package/dist/internal/start-log-store.d.ts.map +1 -0
- package/dist/internal/start-log-store.js +149 -0
- package/dist/internal/storage-coordinator.d.ts +4 -1
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +15 -13
- package/dist/internal/tool-catalog.d.ts.map +1 -1
- package/dist/internal/tool-catalog.js +9 -6
- package/dist/internal/tool-policy.d.ts +8 -0
- package/dist/internal/tool-policy.d.ts.map +1 -1
- package/dist/internal/tool-policy.js +19 -7
- package/dist/internal/turn-cost.d.ts +14 -0
- package/dist/internal/turn-cost.d.ts.map +1 -1
- package/dist/internal/turn-cost.js +41 -9
- package/dist/internal/v2-hosting.d.ts +22 -0
- package/dist/internal/v2-hosting.d.ts.map +1 -0
- package/dist/internal/v2-hosting.js +23 -0
- package/dist/otel.d.ts +16 -0
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +26 -0
- package/dist/playground/assets/index-B6C9S9nG.css +1 -0
- package/dist/playground/assets/{index-DVs98vPL.js → index-ZqNoT8Ie.js} +45 -45
- package/dist/playground/index.html +2 -2
- package/dist/storage-protocol.d.ts +47 -22
- package/dist/storage-protocol.d.ts.map +1 -1
- package/dist/storage-protocol.js +90 -54
- package/dist/storage.d.ts +2 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/tools.d.ts +9 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +9 -0
- package/dist/types.d.ts +154 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +29 -1
- package/docs/README.md +5 -1
- package/docs/concepts.md +3 -3
- package/docs/guides/cloud-agents.md +98 -0
- package/docs/guides/cloud-runtime.md +2 -0
- package/docs/reference/connections.md +31 -0
- package/docs/reference/extensions.md +205 -0
- package/docs/reference/http-api.md +1 -1
- package/docs/reference/project-layout.md +3 -0
- package/docs/reference/skills.md +2 -0
- package/docs/reference/tools.md +2 -0
- package/package.json +18 -4
- package/skills/framework-map/SKILL.md +1 -0
- package/src/bin/agent-serve.ts +11 -2
- package/src/channels/deployments/deployments-channel.ts +117 -8
- package/src/channels/deployments/types.ts +4 -3
- package/src/channels/origin/defaults.ts +143 -0
- package/src/channels/origin/index.ts +2 -0
- package/src/channels/origin/origin-channel.ts +37 -1
- package/src/channels/origin/state.ts +54 -0
- package/src/channels/origin/types.ts +24 -0
- package/src/channels/slack/api.ts +6 -3
- package/src/channels/slack/assistant.ts +1 -1
- package/src/channels/slack/code-fences.ts +183 -0
- package/src/channels/slack/dispatch.ts +27 -2
- package/src/channels/slack/inbound.ts +37 -0
- package/src/channels/slack/index.ts +1 -0
- package/src/channels/slack/live-delivery.ts +16 -13
- package/src/channels/slack/manifest.ts +2 -1
- package/src/connections.ts +18 -1
- package/src/extensions/cursor-cloud-agents/extension.ts +120 -0
- package/src/extensions/cursor-cloud-agents/lib/backend.ts +395 -0
- package/src/extensions/cursor-cloud-agents/lib/fleet.ts +109 -0
- package/src/extensions/cursor-cloud-agents/lib/inputs.ts +5 -0
- package/src/extensions/cursor-cloud-agents/lib/repos.ts +81 -0
- package/src/extensions/cursor-cloud-agents/lib/transcript.ts +23 -0
- package/src/extensions/cursor-cloud-agents/skills/handoff.md +41 -0
- package/src/extensions/cursor-cloud-agents/tools/cancel.ts +19 -0
- package/src/extensions/cursor-cloud-agents/tools/dump.ts +51 -0
- package/src/extensions/cursor-cloud-agents/tools/get.ts +18 -0
- package/src/extensions/cursor-cloud-agents/tools/launch.ts +64 -0
- package/src/extensions/cursor-cloud-agents/tools/list.ts +31 -0
- package/src/extensions/cursor-cloud-agents/tools/reply.ts +34 -0
- package/src/extensions.ts +141 -0
- package/src/files-backends/cursor-hosted.ts +1 -17
- package/src/files.ts +43 -34
- package/src/index.ts +11 -0
- package/src/internal/advertise-tools.ts +37 -12
- package/src/internal/as-of.ts +163 -0
- package/src/internal/cli-deploy.ts +86 -23
- package/src/internal/continuation-identity.ts +3 -1
- package/src/internal/conversation-mirror.ts +23 -18
- package/src/internal/cursor/backend-client.ts +32 -10
- package/src/internal/cursor/hosted-deployment-secrets.ts +72 -0
- package/src/internal/cursor/hosted-store-secrets.ts +27 -0
- package/src/internal/cursor-deployment-relay.ts +65 -8
- package/src/internal/deploy-client.ts +73 -18
- package/src/internal/discovery/ab.ts +111 -0
- package/src/internal/discovery/agent-config.ts +222 -0
- package/src/internal/discovery/agent.ts +360 -0
- package/src/internal/discovery/channels.ts +103 -0
- package/src/internal/discovery/connections.ts +540 -0
- package/src/internal/discovery/context.ts +46 -0
- package/src/internal/discovery/cursor-plugin.ts +708 -0
- package/src/internal/discovery/extensions.ts +348 -0
- package/src/internal/discovery/fs.ts +108 -0
- package/src/internal/discovery/hooks.ts +45 -0
- package/src/internal/discovery/info.ts +179 -0
- package/src/internal/discovery/instructions.ts +113 -0
- package/src/internal/discovery/modules.ts +107 -0
- package/src/internal/discovery/names.ts +44 -0
- package/src/internal/discovery/project.ts +270 -0
- package/src/internal/discovery/runtime.ts +159 -0
- package/src/internal/discovery/schedules.ts +94 -0
- package/src/internal/discovery/seed-files.ts +37 -0
- package/src/internal/discovery/services.ts +124 -0
- package/src/internal/discovery/skills.ts +176 -0
- package/src/internal/discovery/subagent.ts +29 -0
- package/src/internal/discovery/tools.ts +182 -0
- package/src/internal/discovery.ts +20 -2724
- package/src/internal/distribution.ts +5 -0
- package/src/internal/framework-file-storage.ts +43 -9
- package/src/internal/framework-storage-selection.ts +9 -9
- package/src/internal/frontmatter.ts +36 -3
- package/src/internal/hosted-delivery.ts +38 -63
- package/src/internal/hosted-execution-diag.ts +6 -0
- package/src/internal/hosted-execution-flush.ts +142 -0
- package/src/internal/mcp-endpoint.ts +1 -0
- package/src/internal/mcp-host.ts +116 -37
- package/src/internal/otel/collector.ts +125 -25
- package/src/internal/otel/http.ts +2 -12
- package/src/internal/otel/mcp.ts +69 -0
- package/src/internal/otel/propagation.ts +17 -0
- package/src/internal/otel/runtime.ts +2 -0
- package/src/internal/review-comments.ts +5 -2
- package/src/internal/server.ts +81 -100
- package/src/internal/session-engine.ts +152 -39
- package/src/internal/session-run-log.ts +18 -16
- package/src/internal/start-log-store.ts +174 -0
- package/src/internal/storage-coordinator.ts +19 -16
- package/src/internal/tool-catalog.ts +9 -6
- package/src/internal/tool-policy.ts +39 -9
- package/src/internal/turn-cost.ts +47 -4
- package/src/internal/v2-hosting.ts +38 -0
- package/src/otel.ts +38 -0
- package/src/storage-protocol.ts +126 -79
- package/src/storage.ts +5 -0
- package/src/tools.ts +18 -0
- package/src/types.ts +213 -14
- package/dist/docs/assets/chunks/@localSearchIndexroot.j70vvPL4.js +0 -1
- package/dist/docs/assets/concepts.md.lwAgBIMI.js +0 -1
- package/dist/docs/assets/index.md.Bb4k8kUm.js +0 -5
- package/dist/docs/assets/skills_framework-map.md.BTi817yv.js +0 -1
- package/dist/playground/assets/index-BszoQDc6.css +0 -1
- /package/dist/docs/assets/{concepts.md.lwAgBIMI.lean.js → concepts.md.rPzW2HZN.lean.js} +0 -0
- /package/dist/docs/assets/{guides_cloud-runtime.md.CkYbjnAX.lean.js → guides_cloud-runtime.md.BRirbRAN.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.BEJx9XVj.lean.js → reference_http-api.md.oySXBO8o.lean.js} +0 -0
- /package/dist/docs/assets/{reference_skills.md.BFW9retM.lean.js → reference_skills.md.l2ezAcaN.lean.js} +0 -0
- /package/dist/docs/assets/{reference_tools.md.CvAHsdSp.lean.js → reference_tools.md.B1up2r9W.lean.js} +0 -0
|
@@ -14,21 +14,20 @@
|
|
|
14
14
|
* session key with `processDeath: true` and the real throw. Soft-fail on
|
|
15
15
|
* persist so a store outage never changes the hosted-execution HTTP reply.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Same flush moments as `hosted-execution.json` and the start.log tee —
|
|
18
|
+
* see `hosted-execution-flush.ts`. Keys:
|
|
19
|
+
* {@link agentSdkStorageKeys.sessionRun}.
|
|
18
20
|
*/
|
|
19
21
|
|
|
20
22
|
import type { FileSink } from "../files.js";
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
cursorHostedFiles,
|
|
24
|
-
} from "../files-backends/cursor-hosted.js";
|
|
25
|
-
import { storageKeys } from "../storage-protocol.js";
|
|
23
|
+
import { cursorHostedFiles } from "../files-backends/cursor-hosted.js";
|
|
24
|
+
import { agentSdkStorageKeys } from "../storage-protocol.js";
|
|
26
25
|
import type { AgentProject } from "../types.js";
|
|
27
26
|
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
28
|
-
import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
|
|
29
27
|
import { describeError } from "./describe-error.js";
|
|
30
28
|
import type { HostedExecutionDiagAbortReason } from "./hosted-execution-diag.js";
|
|
31
29
|
import type { LogRingEntry } from "./log-ring.js";
|
|
30
|
+
import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
32
31
|
|
|
33
32
|
export const SESSION_RUN_LOG_VERSION = 1;
|
|
34
33
|
/** Last N log-ring lines kept on each execution. */
|
|
@@ -441,7 +440,7 @@ export function createSessionRunLogStore(input: {
|
|
|
441
440
|
const readDocument = async (
|
|
442
441
|
sessionPublicId: string
|
|
443
442
|
): Promise<SessionRunLogDocument | undefined> => {
|
|
444
|
-
const key =
|
|
443
|
+
const key = agentSdkStorageKeys.sessionRun(agentName, sessionPublicId);
|
|
445
444
|
const body = await sink.get(key);
|
|
446
445
|
if (body === undefined) {
|
|
447
446
|
return undefined;
|
|
@@ -478,7 +477,10 @@ export function createSessionRunLogStore(input: {
|
|
|
478
477
|
updatedAt: fitted.writtenAt,
|
|
479
478
|
executions,
|
|
480
479
|
});
|
|
481
|
-
const key =
|
|
480
|
+
const key = agentSdkStorageKeys.sessionRun(
|
|
481
|
+
agentName,
|
|
482
|
+
document.sessionPublicId
|
|
483
|
+
);
|
|
482
484
|
try {
|
|
483
485
|
await sink.put(key, new TextEncoder().encode(JSON.stringify(document)));
|
|
484
486
|
} catch (error) {
|
|
@@ -557,17 +559,17 @@ export function selectSessionRunLogStore(input: {
|
|
|
557
559
|
env?: Record<string, string | undefined>;
|
|
558
560
|
snapshotLogs?: () => readonly LogRingEntry[];
|
|
559
561
|
}): SessionRunLogStore | undefined {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (
|
|
562
|
+
const hosting = resolveAgentV2Hosting({
|
|
563
|
+
architecture: input.project.agent.architecture,
|
|
564
|
+
env: input.env as NodeJS.ProcessEnv | undefined,
|
|
565
|
+
});
|
|
566
|
+
if (hosting.kind !== "cursor-managed") {
|
|
565
567
|
return undefined;
|
|
566
568
|
}
|
|
567
|
-
const envSnapshot = env as NodeJS.ProcessEnv;
|
|
568
569
|
return createSessionRunLogStore({
|
|
569
570
|
sink: cursorHostedFiles({
|
|
570
|
-
resolveStoreSourceId: () =>
|
|
571
|
+
resolveStoreSourceId: () =>
|
|
572
|
+
hosting.resolveStoreIds().frameworkStoreSourceId,
|
|
571
573
|
resolveApiKey: () => resolveApiKeySync()?.apiKey,
|
|
572
574
|
}),
|
|
573
575
|
agentName: input.project.name,
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable hosted `start.log` on the framework file store. **v2 only.**
|
|
3
|
+
*
|
|
4
|
+
* The engine tees stdout/stderr to a local file. That file is the v2
|
|
5
|
+
* customer log (errors, traces, debug). It is NOT written to S3 per line:
|
|
6
|
+
* callers snapshot the local buffer and PUT once. The Temporal host does
|
|
7
|
+
* a last catch-up at the end of the delivery so the object is complete
|
|
8
|
+
* after park/discard.
|
|
9
|
+
*
|
|
10
|
+
* Same flush moments as `hosted-execution.json` and session-runs —
|
|
11
|
+
* see `hosted-execution-flush.ts`. Keys: {@link agentSdkStorageKeys.log}.
|
|
12
|
+
* Values are raw UTF-8, not JSON.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { readFile } from "node:fs/promises";
|
|
16
|
+
import type { FileSink } from "../files.js";
|
|
17
|
+
import { cursorHostedFiles } from "../files-backends/cursor-hosted.js";
|
|
18
|
+
import { agentSdkStorageKeys } from "../storage-protocol.js";
|
|
19
|
+
import type { AgentProject } from "../types.js";
|
|
20
|
+
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
21
|
+
import { describeError } from "./describe-error.js";
|
|
22
|
+
import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Last N bytes flushed to the store. Matches the Temporal catch-up cap
|
|
26
|
+
* so guest snapshots and host catch-up stay interchangeable. The store
|
|
27
|
+
* allows 64 MiB; this keeps the dashboard snapshot bounded.
|
|
28
|
+
*/
|
|
29
|
+
export const START_LOG_STORE_MAX_BYTES: number = 2 * 1024 * 1024;
|
|
30
|
+
|
|
31
|
+
/** Same path the hosted start command tees. Overridable in tests. */
|
|
32
|
+
export const DEFAULT_ENGINE_START_LOG_PATH =
|
|
33
|
+
"/workspace/.agent-serve/start.log";
|
|
34
|
+
|
|
35
|
+
export interface StartLogStore {
|
|
36
|
+
persist(startLogId: string, contents: string): Promise<void>;
|
|
37
|
+
read(startLogId: string): Promise<string | undefined>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function decodeSinkBody(body: Uint8Array | { body: Uint8Array }): Uint8Array {
|
|
41
|
+
return body instanceof Uint8Array ? body : body.body;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function tailStartLogText(raw: string, maxBytes: number): string {
|
|
45
|
+
const encoded = new TextEncoder().encode(raw);
|
|
46
|
+
if (encoded.byteLength <= maxBytes) {
|
|
47
|
+
return raw;
|
|
48
|
+
}
|
|
49
|
+
return new TextDecoder().decode(
|
|
50
|
+
encoded.subarray(encoded.byteLength - maxBytes)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function resolveEngineStartLogPath(
|
|
55
|
+
env: NodeJS.ProcessEnv = process.env
|
|
56
|
+
): string {
|
|
57
|
+
const configured = env.AGENT_SERVE_ENGINE_START_LOG_PATH?.trim();
|
|
58
|
+
return configured !== undefined && configured.length > 0
|
|
59
|
+
? configured
|
|
60
|
+
: DEFAULT_ENGINE_START_LOG_PATH;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Read the local engine tee. Missing/empty is `undefined` (no store write).
|
|
65
|
+
* Soft-fail: a local read error must not change hosted-execution HTTP.
|
|
66
|
+
*/
|
|
67
|
+
export async function readLocalStartLogText(args?: {
|
|
68
|
+
path?: string;
|
|
69
|
+
maxBytes?: number;
|
|
70
|
+
}): Promise<string | undefined> {
|
|
71
|
+
const path = args?.path ?? resolveEngineStartLogPath();
|
|
72
|
+
const maxBytes = args?.maxBytes ?? START_LOG_STORE_MAX_BYTES;
|
|
73
|
+
try {
|
|
74
|
+
const raw = await readFile(path, "utf8");
|
|
75
|
+
if (raw.length === 0) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return tailStartLogText(raw, maxBytes);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (
|
|
81
|
+
error !== null &&
|
|
82
|
+
typeof error === "object" &&
|
|
83
|
+
"code" in error &&
|
|
84
|
+
(error as { code?: string }).code === "ENOENT"
|
|
85
|
+
) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function createStartLogStore(input: {
|
|
93
|
+
sink: FileSink;
|
|
94
|
+
agentName: string;
|
|
95
|
+
logger?: (line: string) => void;
|
|
96
|
+
}): StartLogStore {
|
|
97
|
+
const { sink, agentName } = input;
|
|
98
|
+
const logger = input.logger ?? (() => {});
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
async persist(startLogId, contents) {
|
|
102
|
+
const key = agentSdkStorageKeys.log(agentName, startLogId);
|
|
103
|
+
const body = tailStartLogText(contents, START_LOG_STORE_MAX_BYTES);
|
|
104
|
+
try {
|
|
105
|
+
await sink.put(key, new TextEncoder().encode(body));
|
|
106
|
+
} catch (error) {
|
|
107
|
+
logger(
|
|
108
|
+
`[agent-sdk] start-log: persist failed for ${startLogId} (${describeError(error)})`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
async read(startLogId) {
|
|
114
|
+
const key = agentSdkStorageKeys.log(agentName, startLogId);
|
|
115
|
+
try {
|
|
116
|
+
const body = await sink.get(key);
|
|
117
|
+
if (body === undefined) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
const text = new TextDecoder().decode(decodeSinkBody(body));
|
|
121
|
+
return text.length === 0 ? undefined : text;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
logger(
|
|
124
|
+
`[agent-sdk] start-log: read failed for ${startLogId} (${describeError(error)})`
|
|
125
|
+
);
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Same selection as the session-run log: architecture-v2 hosted engines.
|
|
134
|
+
*/
|
|
135
|
+
export function selectStartLogStore(input: {
|
|
136
|
+
project: AgentProject;
|
|
137
|
+
logger?: (line: string) => void;
|
|
138
|
+
env?: Record<string, string | undefined>;
|
|
139
|
+
}): StartLogStore | undefined {
|
|
140
|
+
const hosting = resolveAgentV2Hosting({
|
|
141
|
+
architecture: input.project.agent.architecture,
|
|
142
|
+
env: input.env as NodeJS.ProcessEnv | undefined,
|
|
143
|
+
});
|
|
144
|
+
if (hosting.kind !== "cursor-managed") {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
return createStartLogStore({
|
|
148
|
+
sink: cursorHostedFiles({
|
|
149
|
+
resolveStoreSourceId: () =>
|
|
150
|
+
hosting.resolveStoreIds().frameworkStoreSourceId,
|
|
151
|
+
resolveApiKey: () => resolveApiKeySync()?.apiKey,
|
|
152
|
+
}),
|
|
153
|
+
agentName: input.project.name,
|
|
154
|
+
logger: input.logger,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Snapshot the local tee into the store. No-op when the file is missing
|
|
160
|
+
* or empty. Soft-fail inside {@link StartLogStore.persist}.
|
|
161
|
+
*/
|
|
162
|
+
export async function flushLocalStartLog(args: {
|
|
163
|
+
store: StartLogStore;
|
|
164
|
+
startLogId: string;
|
|
165
|
+
path?: string;
|
|
166
|
+
}): Promise<void> {
|
|
167
|
+
const contents = await readLocalStartLogText(
|
|
168
|
+
args.path === undefined ? undefined : { path: args.path }
|
|
169
|
+
);
|
|
170
|
+
if (contents === undefined) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
await args.store.persist(args.startLogId, contents);
|
|
174
|
+
}
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
type StorageContext,
|
|
32
32
|
type StorageDefinition,
|
|
33
33
|
type StorageEntry,
|
|
34
|
+
type StorageKeys,
|
|
34
35
|
storageKeys,
|
|
35
36
|
} from "../storage.js";
|
|
36
37
|
import { isCursorHostedStorage } from "../storage-backends/cursor-hosted.js";
|
|
@@ -79,7 +80,7 @@ const AB_SNAPSHOT_MIN_INTERVAL_MS = 60_000;
|
|
|
79
80
|
|
|
80
81
|
/** One queued sink call (KV put/delete or a dedicated-table write). */
|
|
81
82
|
interface StorageOp {
|
|
82
|
-
/** Human-readable op label for failure logs, e.g. `put(
|
|
83
|
+
/** Human-readable op label for failure logs, e.g. `put({root}/...)`. */
|
|
83
84
|
label: string;
|
|
84
85
|
run: (ctx: StorageContext) => void | Promise<void>;
|
|
85
86
|
}
|
|
@@ -89,6 +90,8 @@ export interface StorageCoordinatorOptions {
|
|
|
89
90
|
agentName: string;
|
|
90
91
|
projectRoot: string;
|
|
91
92
|
logger: (line: string) => void;
|
|
93
|
+
/** Defaults to the architecture-v1 key contract. */
|
|
94
|
+
keys?: StorageKeys;
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
interface SessionBuffer {
|
|
@@ -116,6 +119,7 @@ export class StorageCoordinator
|
|
|
116
119
|
readonly policy: ResolvedStoragePolicy;
|
|
117
120
|
|
|
118
121
|
private readonly definition: StorageDefinition;
|
|
122
|
+
private readonly keys: StorageKeys;
|
|
119
123
|
private readonly agentName: string;
|
|
120
124
|
private readonly projectRoot: string;
|
|
121
125
|
private readonly logger: (line: string) => void;
|
|
@@ -137,6 +141,7 @@ export class StorageCoordinator
|
|
|
137
141
|
|
|
138
142
|
constructor(options: StorageCoordinatorOptions) {
|
|
139
143
|
this.definition = options.definition;
|
|
144
|
+
this.keys = options.keys ?? storageKeys;
|
|
140
145
|
this.policy = resolveStoragePolicy(options.definition.policy);
|
|
141
146
|
this.agentName = options.agentName;
|
|
142
147
|
this.projectRoot = options.projectRoot;
|
|
@@ -215,7 +220,7 @@ export class StorageCoordinator
|
|
|
215
220
|
if (first !== undefined) {
|
|
216
221
|
ops.push(
|
|
217
222
|
this.putOp(
|
|
218
|
-
|
|
223
|
+
this.keys.sessionEvents(this.agentName, sessionId, first.index),
|
|
219
224
|
buffer.events as unknown as JsonValue
|
|
220
225
|
)
|
|
221
226
|
);
|
|
@@ -223,7 +228,7 @@ export class StorageCoordinator
|
|
|
223
228
|
if (buffer.record !== undefined) {
|
|
224
229
|
ops.push(
|
|
225
230
|
this.putOp(
|
|
226
|
-
|
|
231
|
+
this.keys.session(this.agentName, sessionId),
|
|
227
232
|
buffer.record as unknown as JsonValue
|
|
228
233
|
)
|
|
229
234
|
);
|
|
@@ -249,14 +254,14 @@ export class StorageCoordinator
|
|
|
249
254
|
if (previous != null) {
|
|
250
255
|
ops.push(
|
|
251
256
|
this.deleteOp(
|
|
252
|
-
|
|
257
|
+
this.keys.continuation(this.agentName, record.channelId, previous)
|
|
253
258
|
)
|
|
254
259
|
);
|
|
255
260
|
}
|
|
256
261
|
if (next != null) {
|
|
257
262
|
ops.push(
|
|
258
263
|
this.putOp(
|
|
259
|
-
|
|
264
|
+
this.keys.continuation(this.agentName, record.channelId, next),
|
|
260
265
|
{ sessionId: record.sessionId }
|
|
261
266
|
)
|
|
262
267
|
);
|
|
@@ -303,9 +308,7 @@ export class StorageCoordinator
|
|
|
303
308
|
* serve start.
|
|
304
309
|
*/
|
|
305
310
|
async listSessions(): Promise<SessionRecord[]> {
|
|
306
|
-
const entries = await this.tryList(
|
|
307
|
-
storageKeys.sessionPrefix(this.agentName)
|
|
308
|
-
);
|
|
311
|
+
const entries = await this.tryList(this.keys.sessionPrefix(this.agentName));
|
|
309
312
|
return entries
|
|
310
313
|
.map((entry) => entry.value as unknown as SessionRecord)
|
|
311
314
|
.filter((record) => record != null);
|
|
@@ -322,7 +325,7 @@ export class StorageCoordinator
|
|
|
322
325
|
throw new Error("storage sink has no list");
|
|
323
326
|
}
|
|
324
327
|
const entries = await list(
|
|
325
|
-
|
|
328
|
+
this.keys.sessionPrefix(this.agentName),
|
|
326
329
|
this.context("restore")
|
|
327
330
|
);
|
|
328
331
|
if (!Array.isArray(entries)) {
|
|
@@ -345,7 +348,7 @@ export class StorageCoordinator
|
|
|
345
348
|
return undefined;
|
|
346
349
|
}
|
|
347
350
|
const entries = await listNewest(
|
|
348
|
-
|
|
351
|
+
this.keys.sessionPrefix(this.agentName),
|
|
349
352
|
limit,
|
|
350
353
|
this.context("restore")
|
|
351
354
|
);
|
|
@@ -362,7 +365,7 @@ export class StorageCoordinator
|
|
|
362
365
|
*/
|
|
363
366
|
async listSessionEvents(sessionId: string): Promise<SessionEvent[]> {
|
|
364
367
|
const entries = await this.tryList(
|
|
365
|
-
|
|
368
|
+
this.keys.sessionEventsPrefix(this.agentName, sessionId)
|
|
366
369
|
);
|
|
367
370
|
const events: SessionEvent[] = [];
|
|
368
371
|
for (const entry of entries) {
|
|
@@ -389,7 +392,7 @@ export class StorageCoordinator
|
|
|
389
392
|
}
|
|
390
393
|
const ctx = this.context("restore");
|
|
391
394
|
const record = (await get(
|
|
392
|
-
|
|
395
|
+
this.keys.session(this.agentName, sessionId),
|
|
393
396
|
ctx
|
|
394
397
|
)) as SessionRecord | null | undefined;
|
|
395
398
|
if (record == null) {
|
|
@@ -422,7 +425,7 @@ export class StorageCoordinator
|
|
|
422
425
|
}
|
|
423
426
|
const ctx = this.context("restore");
|
|
424
427
|
const pointer = await get(
|
|
425
|
-
|
|
428
|
+
this.keys.continuation(this.agentName, channelId, continuationKey),
|
|
426
429
|
ctx
|
|
427
430
|
);
|
|
428
431
|
if (pointer == null) {
|
|
@@ -482,7 +485,7 @@ export class StorageCoordinator
|
|
|
482
485
|
if (get === undefined) {
|
|
483
486
|
throw new Error("storage get is not configured");
|
|
484
487
|
}
|
|
485
|
-
const key =
|
|
488
|
+
const key = this.keys.kv(this.agentName, authorKey);
|
|
486
489
|
// Preserve stored JSON `null` (distinct from a missing key).
|
|
487
490
|
return await get(key, this.context("restore"));
|
|
488
491
|
}
|
|
@@ -492,13 +495,13 @@ export class StorageCoordinator
|
|
|
492
495
|
* at-most-once delivery queue) so callers observe durable success/failure.
|
|
493
496
|
*/
|
|
494
497
|
async kvPut(authorKey: string, value: JsonValue): Promise<void> {
|
|
495
|
-
const key =
|
|
498
|
+
const key = this.keys.kv(this.agentName, authorKey);
|
|
496
499
|
await this.definition.put(key, value, this.context("policy"));
|
|
497
500
|
}
|
|
498
501
|
|
|
499
502
|
/** Awaited author KV delete. No-op when the sink omits `delete`. */
|
|
500
503
|
async kvDelete(authorKey: string): Promise<void> {
|
|
501
|
-
const key =
|
|
504
|
+
const key = this.keys.kv(this.agentName, authorKey);
|
|
502
505
|
await this.definition.delete?.(key, this.context("policy"));
|
|
503
506
|
}
|
|
504
507
|
|
|
@@ -23,13 +23,16 @@ import type {
|
|
|
23
23
|
* presentation concern is not worth the authoring surface).
|
|
24
24
|
*/
|
|
25
25
|
const WELL_KNOWN_TOOL_TITLES: Readonly<Record<string, string>> = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
Delete: "Delete a file",
|
|
27
|
+
Diff: "Show change diffs",
|
|
28
|
+
Glob: "Find files by pattern",
|
|
29
|
+
Grep: "Search file contents",
|
|
30
|
+
LS: "List a directory",
|
|
31
|
+
Read: "Read a file",
|
|
32
|
+
StrReplace: "Replace text in a file",
|
|
33
|
+
Write: "Write a file",
|
|
34
|
+
script: "Run a TypeScript program",
|
|
31
35
|
search: "Search with a typed query",
|
|
32
|
-
write: "Write a file",
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
function catalogTitle(tool: DiscoveredTool): string | undefined {
|
|
@@ -16,7 +16,11 @@ import type {
|
|
|
16
16
|
ToolEffectDeclaration,
|
|
17
17
|
ToolExecuteResult,
|
|
18
18
|
} from "../types.js";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
forwardTimeArgument,
|
|
21
|
+
missingTimeWindow,
|
|
22
|
+
timeArgViolation,
|
|
23
|
+
} from "./as-of.js";
|
|
20
24
|
|
|
21
25
|
/** What the host does with one tool call. */
|
|
22
26
|
export type ToolDecision =
|
|
@@ -64,6 +68,14 @@ export interface ToolCallFacts {
|
|
|
64
68
|
asOf?: string;
|
|
65
69
|
/** The tool's declared time-bound argument names, if it made them. */
|
|
66
70
|
timeArgs?: readonly string[];
|
|
71
|
+
/**
|
|
72
|
+
* String-typed time-window property names a vendor tool's own input schema
|
|
73
|
+
* declares (`from`/`to`/`since`/...). In a frozen session a call that omits
|
|
74
|
+
* one is refused: the vendor fills an omitted window with a live default
|
|
75
|
+
* the argument walker can never see. Advertised/bridged MCP tools only —
|
|
76
|
+
* authored tools declare {@link timeArgs} instead.
|
|
77
|
+
*/
|
|
78
|
+
timeWindow?: readonly string[];
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
/**
|
|
@@ -159,14 +171,32 @@ function unclassifiedRefusal(toolName: string): string {
|
|
|
159
171
|
export function decideToolCall(facts: ToolCallFacts): ToolDecision {
|
|
160
172
|
// Before the dry-run split: a frozen session bounds its reads whether or
|
|
161
173
|
// not its writes are stubbed.
|
|
162
|
-
if (
|
|
163
|
-
facts.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
if (facts.asOf !== undefined) {
|
|
175
|
+
if (facts.timeArgs !== undefined && facts.timeArgs.length > 0) {
|
|
176
|
+
const violation = timeArgViolation(
|
|
177
|
+
facts.input,
|
|
178
|
+
facts.timeArgs,
|
|
179
|
+
facts.asOf
|
|
180
|
+
);
|
|
181
|
+
if (violation !== undefined) {
|
|
182
|
+
return { kind: "unbounded", message: violation };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const forward = forwardTimeArgument(facts.input, facts.asOf);
|
|
186
|
+
if (forward !== undefined) {
|
|
187
|
+
return { kind: "unbounded", message: forward };
|
|
188
|
+
}
|
|
189
|
+
// Present values are checked above; absent ones are the vendor's live
|
|
190
|
+
// default window, which no walker can see. Require them explicitly.
|
|
191
|
+
if (facts.timeWindow !== undefined) {
|
|
192
|
+
const omitted = missingTimeWindow(
|
|
193
|
+
facts.input,
|
|
194
|
+
facts.timeWindow,
|
|
195
|
+
facts.asOf
|
|
196
|
+
);
|
|
197
|
+
if (omitted !== undefined) {
|
|
198
|
+
return { kind: "unbounded", message: omitted };
|
|
199
|
+
}
|
|
170
200
|
}
|
|
171
201
|
}
|
|
172
202
|
if (!facts.dryRun) {
|
|
@@ -28,6 +28,45 @@ export function modelSettingId(model: ModelSetting): string {
|
|
|
28
28
|
return typeof model === "string" ? model : model.id;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* This estimate-cost client treats OpenAI-compat usage as **provider-gross**
|
|
33
|
+
* (local playground: `prompt_tokens` includes `cachedPromptTokens`). Catalog
|
|
34
|
+
* `costForBaseTier` assumes Anthropic / billing-style disjoint nets and ADDs
|
|
35
|
+
* `cacheRead × cachedRate` on top of `input × inputRate`, so we send
|
|
36
|
+
* `input − cache` for Grok / xAI / GPT / o-series.
|
|
37
|
+
*
|
|
38
|
+
* Non-OpenAI-compat models are left alone. `input < cache` is only a
|
|
39
|
+
* defensive clamp (avoid a negative uncached count), not a detector for
|
|
40
|
+
* billed / openaiProxy-shaped tokens. Cloud catalog fallback with already-
|
|
41
|
+
* netted OpenAI-compat usage is out of scope here.
|
|
42
|
+
*/
|
|
43
|
+
export function isOpenAiCompatGrossCacheModel(model: ModelSetting): boolean {
|
|
44
|
+
const id = modelSettingId(model).toLowerCase();
|
|
45
|
+
return (
|
|
46
|
+
id.includes("grok") ||
|
|
47
|
+
id.includes("xai") ||
|
|
48
|
+
id.includes("gpt") ||
|
|
49
|
+
/(^|[-_/])o[1-9]/.test(id)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function toCatalogDisjointUsage(
|
|
54
|
+
usage: TurnUsage,
|
|
55
|
+
model?: ModelSetting
|
|
56
|
+
): TurnUsage {
|
|
57
|
+
if (model === undefined || !isOpenAiCompatGrossCacheModel(model)) {
|
|
58
|
+
return usage;
|
|
59
|
+
}
|
|
60
|
+
const cachedTokens = usage.cacheReadTokens + usage.cacheWriteTokens;
|
|
61
|
+
if (cachedTokens === 0 || usage.inputTokens < cachedTokens) {
|
|
62
|
+
return usage;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
...usage,
|
|
66
|
+
inputTokens: usage.inputTokens - cachedTokens,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
31
70
|
export function roundCostUsd(usd: number): number {
|
|
32
71
|
return Math.round(usd * 1e6) / 1e6;
|
|
33
72
|
}
|
|
@@ -67,6 +106,10 @@ export async function estimateTurnCostFromApi(
|
|
|
67
106
|
return undefined;
|
|
68
107
|
}
|
|
69
108
|
const model = modelSettingId(input.model);
|
|
109
|
+
const catalogUsage =
|
|
110
|
+
input.usage === undefined
|
|
111
|
+
? undefined
|
|
112
|
+
: toCatalogDisjointUsage(input.usage, input.model);
|
|
70
113
|
const response = await fetch(
|
|
71
114
|
`${cursorExternalApiUrl()}/v1/models/estimate-cost`,
|
|
72
115
|
{
|
|
@@ -77,10 +120,10 @@ export async function estimateTurnCostFromApi(
|
|
|
77
120
|
},
|
|
78
121
|
body: JSON.stringify({
|
|
79
122
|
model,
|
|
80
|
-
inputTokens:
|
|
81
|
-
outputTokens:
|
|
82
|
-
cacheReadTokens:
|
|
83
|
-
cacheWriteTokens:
|
|
123
|
+
inputTokens: catalogUsage?.inputTokens,
|
|
124
|
+
outputTokens: catalogUsage?.outputTokens,
|
|
125
|
+
cacheReadTokens: catalogUsage?.cacheReadTokens,
|
|
126
|
+
cacheWriteTokens: catalogUsage?.cacheWriteTokens,
|
|
84
127
|
agentId: input.agentId,
|
|
85
128
|
conversationId: input.conversationId,
|
|
86
129
|
runId: input.runId,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AgentArchitecture } from "../types.js";
|
|
2
|
+
import {
|
|
3
|
+
type CursorManagedV2StoreIds,
|
|
4
|
+
requireCursorManagedV2StoreIdsSync,
|
|
5
|
+
} from "./cursor/hosted-store-secrets.js";
|
|
6
|
+
import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
|
|
7
|
+
|
|
8
|
+
export type AgentV2Hosting =
|
|
9
|
+
| { kind: "not-v2" }
|
|
10
|
+
| { kind: "self-hosted" }
|
|
11
|
+
| {
|
|
12
|
+
kind: "cursor-managed";
|
|
13
|
+
resolveStoreIds: () => CursorManagedV2StoreIds;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Close the architecture/hosting inputs into a compiler-owned union.
|
|
18
|
+
*
|
|
19
|
+
* Managed freeze processes exist before task bind, so store resolution stays
|
|
20
|
+
* lazy. Consumers can branch once on `kind`; managed storage operations then
|
|
21
|
+
* receive a resolver whose successful result always contains both ids.
|
|
22
|
+
*/
|
|
23
|
+
export function resolveAgentV2Hosting(input: {
|
|
24
|
+
architecture: AgentArchitecture | undefined;
|
|
25
|
+
env?: NodeJS.ProcessEnv;
|
|
26
|
+
}): AgentV2Hosting {
|
|
27
|
+
if (input.architecture !== "v2") {
|
|
28
|
+
return { kind: "not-v2" };
|
|
29
|
+
}
|
|
30
|
+
const env = input.env ?? process.env;
|
|
31
|
+
if (env[AGENT_SERVE_GENERATION_ENV_VAR] === undefined) {
|
|
32
|
+
return { kind: "self-hosted" };
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
kind: "cursor-managed",
|
|
36
|
+
resolveStoreIds: () => requireCursorManagedV2StoreIdsSync(env),
|
|
37
|
+
};
|
|
38
|
+
}
|
package/src/otel.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { context, trace } from "@opentelemetry/api";
|
|
15
16
|
import { brandDefinition } from "./internal/brand.js";
|
|
16
17
|
|
|
17
18
|
export type OtelSignal = "traces" | "metrics" | "logs";
|
|
@@ -153,3 +154,40 @@ function assertSampleRatio(traces: OtelConfig["traces"]): void {
|
|
|
153
154
|
throw new Error("defineOtel: traces.sampleRatio must be in [0, 1]");
|
|
154
155
|
}
|
|
155
156
|
}
|
|
157
|
+
|
|
158
|
+
export const TRACEPARENT_HEADER = "traceparent";
|
|
159
|
+
/** Cursor backend prefers this; `remoteSpanContextFromRequest` falls back to W3C. */
|
|
160
|
+
export const BACKEND_TRACEPARENT_HEADER = "backend-traceparent";
|
|
161
|
+
|
|
162
|
+
export function formatTraceparent(spanContext: {
|
|
163
|
+
traceId: string;
|
|
164
|
+
spanId: string;
|
|
165
|
+
traceFlags: number;
|
|
166
|
+
}): string | undefined {
|
|
167
|
+
if (!trace.isSpanContextValid(spanContext)) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
return `00-${spanContext.traceId}-${
|
|
171
|
+
spanContext.spanId
|
|
172
|
+
}-${spanContext.traceFlags.toString(16).padStart(2, "0")}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Copy the active span onto outbound headers as W3C `traceparent` and
|
|
177
|
+
* Cursor `backend-traceparent`. No-op when no valid span is active.
|
|
178
|
+
*/
|
|
179
|
+
export function injectActiveTraceContext(headers: {
|
|
180
|
+
get(name: string): string | null;
|
|
181
|
+
set(name: string, value: string): void;
|
|
182
|
+
}): void {
|
|
183
|
+
const span = trace.getSpan(context.active());
|
|
184
|
+
if (span === undefined) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const traceparent = formatTraceparent(span.spanContext());
|
|
188
|
+
if (traceparent === undefined) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
headers.set(TRACEPARENT_HEADER, traceparent);
|
|
192
|
+
headers.set(BACKEND_TRACEPARENT_HEADER, traceparent);
|
|
193
|
+
}
|