@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
|
@@ -25,6 +25,7 @@ import { SlackAskDedupeStore, SlackNudgeStore, } from "../channels/slack/nudge-s
|
|
|
25
25
|
import { resolveDedicatedSlackHostBinding } from "../channels/slack/slack-channel.js";
|
|
26
26
|
import { AGENT_SERVE_USER_STORE_FILES_SOURCE_ID, agentStoreKeys, } from "../files.js";
|
|
27
27
|
import { cursorHostedFiles, isCursorHostedFilesAvailable, isCursorUserStoreFilesAvailable, } from "../files-backends/cursor-hosted.js";
|
|
28
|
+
import { storageKeysForArchitecture } from "../storage.js";
|
|
28
29
|
import { DEFAULT_MODEL, DIRECT_TOOL_CALL_CHANNEL_ID, isCursorAccountTransport, isHostOauthConnectionTransport, isSymbolicConnectionTransport, } from "../types.js";
|
|
29
30
|
import { ABCollector } from "./ab-collector.js";
|
|
30
31
|
import { foldABStream } from "./ab-fold.js";
|
|
@@ -32,7 +33,7 @@ import { buildABSnapshot } from "./ab-snapshot.js";
|
|
|
32
33
|
import { resolveAdvertisedTools, } from "./advertise-tools.js";
|
|
33
34
|
import { ApprovalGate } from "./approval-gate.js";
|
|
34
35
|
import { ArtifactsStore } from "./artifacts-store.js";
|
|
35
|
-
import { assertTimeArgs, normalizeAsOf, sessionClock } from "./as-of.js";
|
|
36
|
+
import { assertTimeArgs, normalizeAsOf, schemaTimeWindowKeys, sessionClock, } from "./as-of.js";
|
|
36
37
|
import { SessionAuthError, samePrincipal } from "./auth.js";
|
|
37
38
|
import { mergeCloudOptions, resolveSessionRuntime } from "./cloud-merge.js";
|
|
38
39
|
import { applyCloudUsageToEvents, cloudSdkAgentIdFromEvents, isUnpricedCompletedTurn, mapSdkTokenUsage, } from "./cloud-turn-cost.js";
|
|
@@ -65,6 +66,7 @@ import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
|
|
|
65
66
|
import { TurnGovernor } from "./turn-governor.js";
|
|
66
67
|
import { TurnLeaseStore } from "./turn-lease-store.js";
|
|
67
68
|
import { TurnOutbox } from "./turn-outbox.js";
|
|
69
|
+
import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
68
70
|
import { buildAgentsMdContent, buildCloudMemorySection, ensureOwnGitRoot, isNestedInGitRepo, materializeWorkspace, SERVER_TOOLS_MCP_SERVER_NAME, writeWorkspaceFiles, } from "./workspace.js";
|
|
69
71
|
export const HTTP_CHANNEL_ID = "http";
|
|
70
72
|
export { SCHEDULE_CHANNEL_PREFIX } from "./prompt-context.js";
|
|
@@ -246,16 +248,27 @@ export class SessionEngine {
|
|
|
246
248
|
agentName: options.project.name,
|
|
247
249
|
projectRoot: options.project.rootDir,
|
|
248
250
|
logger: this.logger,
|
|
251
|
+
keys: storageKeysForArchitecture(options.project.agent.architecture),
|
|
249
252
|
});
|
|
250
253
|
this.kvApi = createHostKvApi(Object.assign({ agentName: options.project.name, stateRoot: options.stateRoot }, (this.storage === undefined ? {} : { storage: this.storage })));
|
|
254
|
+
const v2Hosting = resolveAgentV2Hosting({
|
|
255
|
+
architecture: options.project.agent.architecture,
|
|
256
|
+
});
|
|
257
|
+
const managedV2Files = v2Hosting.kind === "cursor-managed"
|
|
258
|
+
? () => cursorHostedFiles({
|
|
259
|
+
resolveStoreSourceId: () => v2Hosting.resolveStoreIds().deploymentStoreSourceId,
|
|
260
|
+
})
|
|
261
|
+
: undefined;
|
|
251
262
|
this.filesApi = createHostFilesApi({
|
|
252
263
|
agentName: options.project.name,
|
|
253
264
|
stateRoot: options.stateRoot,
|
|
265
|
+
sink: managedV2Files === null || managedV2Files === void 0 ? void 0 : managedV2Files(),
|
|
254
266
|
});
|
|
255
267
|
this.artifactsStore = new ArtifactsStore({
|
|
256
268
|
stateRoot: options.stateRoot,
|
|
257
269
|
agentName: options.project.name,
|
|
258
270
|
config: options.project.artifacts,
|
|
271
|
+
sink: managedV2Files === null || managedV2Files === void 0 ? void 0 : managedV2Files(),
|
|
259
272
|
});
|
|
260
273
|
this.abCollector = new ABCollector(options.project.abs, this.logger, (sessionId) => __awaiter(this, void 0, void 0, function* () { return (yield this.logs.get(sessionId)).snapshot(0); }),
|
|
261
274
|
// Samples flow to the defineStorage `abs` table (no-op without one).
|
|
@@ -300,14 +313,18 @@ export class SessionEngine {
|
|
|
300
313
|
setResolvedConnections(connections) {
|
|
301
314
|
this.resolvedConnections = connections;
|
|
302
315
|
for (const connection of connections) {
|
|
303
|
-
this.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
});
|
|
316
|
+
const authored = this.authoredConnection(connection.name);
|
|
317
|
+
this.mcpHost.addConnection(Object.assign(Object.assign({}, (authored !== null && authored !== void 0 ? authored : { name: connection.name })), { name: connection.name, transport: {
|
|
318
|
+
url: connection.localUrl,
|
|
319
|
+
headers: connection.headers,
|
|
320
|
+
} }));
|
|
309
321
|
}
|
|
310
322
|
}
|
|
323
|
+
authoredConnection(name) {
|
|
324
|
+
var _a;
|
|
325
|
+
var _b;
|
|
326
|
+
return ((_b = this.project.agent.connections.find((item) => item.name === name)) !== null && _b !== void 0 ? _b : (_a = this.project.agent.hostConnections) === null || _a === void 0 ? void 0 : _a.find((item) => item.name === name));
|
|
327
|
+
}
|
|
311
328
|
setCloudServerToolsConnection(connection) {
|
|
312
329
|
this.cloudServerToolsConnection = connection;
|
|
313
330
|
}
|
|
@@ -1552,7 +1569,19 @@ export class SessionEngine {
|
|
|
1552
1569
|
* a personal API key writes into the USER store under `agent-serve/`.
|
|
1553
1570
|
*/
|
|
1554
1571
|
cloudSkillsStore() {
|
|
1555
|
-
|
|
1572
|
+
const v2Hosting = resolveAgentV2Hosting({
|
|
1573
|
+
architecture: this.project.agent.architecture,
|
|
1574
|
+
});
|
|
1575
|
+
if (v2Hosting.kind === "cursor-managed") {
|
|
1576
|
+
return {
|
|
1577
|
+
sink: cursorHostedFiles({
|
|
1578
|
+
resolveStoreSourceId: () => v2Hosting.resolveStoreIds().deploymentStoreSourceId,
|
|
1579
|
+
}),
|
|
1580
|
+
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
1581
|
+
label: "deployment store",
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
if (v2Hosting.kind === "not-v2" && isCursorHostedFilesAvailable()) {
|
|
1556
1585
|
return {
|
|
1557
1586
|
sink: cursorHostedFiles(),
|
|
1558
1587
|
skillsPrefix: agentStoreKeys.skillsPrefix(),
|
|
@@ -1990,32 +2019,23 @@ export class SessionEngine {
|
|
|
1990
2019
|
return toolErrorResult(`Invalid input for tool "${args.tool.name}": ${validation.message}`);
|
|
1991
2020
|
}
|
|
1992
2021
|
const toolCallId = (_b = args.toolCallId) !== null && _b !== void 0 ? _b : newToolCallId(args.tool.name);
|
|
1993
|
-
const toolCtx = {
|
|
1994
|
-
toolCallId,
|
|
1995
|
-
session: this.sessionInfo(args.record),
|
|
1996
|
-
workspaceDir: this.harnessCwd(args.record),
|
|
1997
|
-
stateRoot: this.stateRoot,
|
|
1998
|
-
host: this.hostForSession(args.record.sessionId),
|
|
1999
|
-
artifacts: this.artifactsApi({
|
|
2022
|
+
const toolCtx = Object.assign({ toolCallId, session: this.sessionInfo(args.record), workspaceDir: this.harnessCwd(args.record), stateRoot: this.stateRoot, host: this.hostForSession(args.record.sessionId), artifacts: this.artifactsApi({
|
|
2000
2023
|
sessionId: args.record.sessionId,
|
|
2001
2024
|
turnId: args.turnId,
|
|
2002
|
-
}),
|
|
2003
|
-
send: (channelId, message, sendOptions = {}) => { var _a; return this.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: (_a = sendOptions.auth) !== null && _a !== void 0 ? _a : args.record.auth })); },
|
|
2004
|
-
getSession: (channelId, sessionId) => this.getChannelSession(channelId, sessionId),
|
|
2005
|
-
emit: args.emit,
|
|
2006
|
-
now: sessionClock(args.record.asOf),
|
|
2007
|
-
};
|
|
2025
|
+
}), send: (channelId, message, sendOptions = {}) => { var _a; return this.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: (_a = sendOptions.auth) !== null && _a !== void 0 ? _a : args.record.auth })); }, getSession: (channelId, sessionId) => this.getChannelSession(channelId, sessionId), emit: args.emit, now: sessionClock(args.record.asOf) }, (args.record.asOf === undefined ? {} : { asOf: args.record.asOf }));
|
|
2008
2026
|
try {
|
|
2009
2027
|
// Before the approval gate: a dry run is unattended, so parking a write
|
|
2010
2028
|
// for a human would hang the turn rather than answer it.
|
|
2011
|
-
const decision = decideToolCall(Object.assign(Object.assign({ dryRun: args.record.dryRun === true, effect: args.tool.definition.effect }, (args.tool.advertised === true
|
|
2029
|
+
const decision = decideToolCall(Object.assign(Object.assign(Object.assign({ dryRun: args.record.dryRun === true, effect: args.tool.definition.effect }, (args.tool.advertised === true
|
|
2012
2030
|
? {
|
|
2013
2031
|
mcpTool: {
|
|
2014
2032
|
name: args.tool.name,
|
|
2015
2033
|
annotations: args.tool.annotations,
|
|
2016
2034
|
},
|
|
2017
2035
|
}
|
|
2018
|
-
: {})), { dryRunResult: args.tool.definition.dryRunResult, input: validation.value, asOf: args.record.asOf, timeArgs: args.tool.definition.timeArgs })
|
|
2036
|
+
: {})), { dryRunResult: args.tool.definition.dryRunResult, input: validation.value, asOf: args.record.asOf, timeArgs: args.tool.definition.timeArgs }), (args.tool.advertised === true && args.record.asOf !== undefined
|
|
2037
|
+
? { timeWindow: schemaTimeWindowKeys(args.tool.inputSchema) }
|
|
2038
|
+
: {})));
|
|
2019
2039
|
if (decision.kind === "answer") {
|
|
2020
2040
|
(_a = this.stubbedCallIds.get(args.record.sessionId)) === null || _a === void 0 ? void 0 : _a.add(toolCallId);
|
|
2021
2041
|
this.logger(`[session] tool ${args.tool.name} answered by host (${toolCallId})`);
|
|
@@ -2050,13 +2070,18 @@ export class SessionEngine {
|
|
|
2050
2070
|
}
|
|
2051
2071
|
const started = Date.now();
|
|
2052
2072
|
this.logger(`[session] tool ${args.tool.name} start`);
|
|
2053
|
-
const result = yield
|
|
2073
|
+
const result = yield this.runToolExecute({
|
|
2074
|
+
record: args.record,
|
|
2075
|
+
turnId: args.turnId,
|
|
2076
|
+
callId: toolCallId,
|
|
2077
|
+
toolName: args.tool.name,
|
|
2078
|
+
}, () => mcpAuthAls.run({
|
|
2054
2079
|
sessionId: args.record.sessionId,
|
|
2055
2080
|
turnId: args.turnId,
|
|
2056
2081
|
callId: toolCallId,
|
|
2057
2082
|
toolName: args.tool.name,
|
|
2058
2083
|
emit: args.emit,
|
|
2059
|
-
}, () => execute(validation.value, toolCtx));
|
|
2084
|
+
}, () => execute(validation.value, toolCtx)));
|
|
2060
2085
|
this.logger(`[session] tool ${args.tool.name} done (${Date.now() - started}ms)`);
|
|
2061
2086
|
return normalizeToolResult(result);
|
|
2062
2087
|
}
|
|
@@ -2066,6 +2091,24 @@ export class SessionEngine {
|
|
|
2066
2091
|
}
|
|
2067
2092
|
});
|
|
2068
2093
|
}
|
|
2094
|
+
/**
|
|
2095
|
+
* Bind outbound inject (Factory / Cursor API `traceparent`) to the
|
|
2096
|
+
* tool span. No-op when OTel is off.
|
|
2097
|
+
*/
|
|
2098
|
+
runToolExecute(args, fn) {
|
|
2099
|
+
const otel = this.otel;
|
|
2100
|
+
const run = () => Promise.resolve(fn());
|
|
2101
|
+
if (otel === undefined) {
|
|
2102
|
+
return run();
|
|
2103
|
+
}
|
|
2104
|
+
return otel.runInCall({
|
|
2105
|
+
sessionId: args.record.sessionId,
|
|
2106
|
+
session: this.sessionInfo(args.record),
|
|
2107
|
+
turnId: args.turnId,
|
|
2108
|
+
callId: args.callId,
|
|
2109
|
+
toolName: args.toolName,
|
|
2110
|
+
}, run);
|
|
2111
|
+
}
|
|
2069
2112
|
/**
|
|
2070
2113
|
* Park a server-tool call until a human approves or denies. Emits
|
|
2071
2114
|
* `action.approval_requested` / `action.approval_resolved` on the
|
|
@@ -2258,11 +2301,6 @@ export class SessionEngine {
|
|
|
2258
2301
|
yield this.oauthHub.persistFor(connection, authored.transport.url);
|
|
2259
2302
|
});
|
|
2260
2303
|
}
|
|
2261
|
-
authoredConnection(name) {
|
|
2262
|
-
var _a;
|
|
2263
|
-
var _b;
|
|
2264
|
-
return ((_b = this.project.agent.connections.find((entry) => entry.name === name)) !== null && _b !== void 0 ? _b : (_a = this.project.agent.hostConnections) === null || _a === void 0 ? void 0 : _a.find((entry) => entry.name === name));
|
|
2265
|
-
}
|
|
2266
2304
|
mintAuthUrl(connection, sessionId) {
|
|
2267
2305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2268
2306
|
const authored = this.authoredConnection(connection);
|
|
@@ -2679,9 +2717,11 @@ export class SessionEngine {
|
|
|
2679
2717
|
// A separate body from the model path, so it asks the same policy: a
|
|
2680
2718
|
// session-bound `POST /v1/tools/:name`, `call --session`, or
|
|
2681
2719
|
// `handle.callTool` performs a write just as readily.
|
|
2682
|
-
const decision = decideToolCall(Object.assign(Object.assign({ dryRun: (record === null || record === void 0 ? void 0 : record.dryRun) === true, effect: tool.definition.effect }, (tool.advertised === true
|
|
2720
|
+
const decision = decideToolCall(Object.assign(Object.assign(Object.assign({ dryRun: (record === null || record === void 0 ? void 0 : record.dryRun) === true, effect: tool.definition.effect }, (tool.advertised === true
|
|
2683
2721
|
? { mcpTool: { name: tool.name, annotations: tool.annotations } }
|
|
2684
|
-
: {})), { dryRunResult: tool.definition.dryRunResult, input: validation.value, asOf: record === null || record === void 0 ? void 0 : record.asOf, timeArgs: tool.definition.timeArgs }))
|
|
2722
|
+
: {})), { dryRunResult: tool.definition.dryRunResult, input: validation.value, asOf: record === null || record === void 0 ? void 0 : record.asOf, timeArgs: tool.definition.timeArgs }), (tool.advertised === true && (record === null || record === void 0 ? void 0 : record.asOf) !== undefined
|
|
2723
|
+
? { timeWindow: schemaTimeWindowKeys(tool.inputSchema) }
|
|
2724
|
+
: {})));
|
|
2685
2725
|
const started = Date.now();
|
|
2686
2726
|
this.logger(`[session] tool ${toolName} start (direct ${callId})`);
|
|
2687
2727
|
let result;
|
|
@@ -2714,35 +2754,34 @@ export class SessionEngine {
|
|
|
2714
2754
|
isError = false;
|
|
2715
2755
|
}
|
|
2716
2756
|
else {
|
|
2717
|
-
const run = () => execute(validation.value, {
|
|
2718
|
-
|
|
2719
|
-
session,
|
|
2720
|
-
workspaceDir,
|
|
2721
|
-
stateRoot: this.stateRoot,
|
|
2722
|
-
host: this.hostForSession(record === null || record === void 0 ? void 0 : record.sessionId),
|
|
2757
|
+
const run = () => execute(validation.value, Object.assign({ toolCallId: callId, session,
|
|
2758
|
+
workspaceDir, stateRoot: this.stateRoot, host: this.hostForSession(record === null || record === void 0 ? void 0 : record.sessionId),
|
|
2723
2759
|
// Scratch calls have no real session; their facade stays unbound.
|
|
2724
2760
|
artifacts: record === undefined
|
|
2725
2761
|
? this.artifactsApi()
|
|
2726
2762
|
: this.artifactsApi({
|
|
2727
2763
|
sessionId: record.sessionId,
|
|
2728
2764
|
turnId: callId,
|
|
2729
|
-
}),
|
|
2730
|
-
send: (channelId, message, sendOptions = {}) => this.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: sendOptions.auth !== undefined
|
|
2765
|
+
}), send: (channelId, message, sendOptions = {}) => this.send(channelId, message, Object.assign(Object.assign({}, sendOptions), { auth: sendOptions.auth !== undefined
|
|
2731
2766
|
? sendOptions.auth
|
|
2732
|
-
: session.auth })),
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
now: sessionClock(record === null || record === void 0 ? void 0 : record.asOf),
|
|
2736
|
-
});
|
|
2737
|
-
result = normalizeToolResult(record !== undefined && emit !== undefined
|
|
2738
|
-
? yield mcpAuthAls.run({
|
|
2767
|
+
: session.auth })), getSession: (channelId, sessionId) => this.getChannelSession(channelId, sessionId), emit, now: sessionClock(record === null || record === void 0 ? void 0 : record.asOf) }, ((record === null || record === void 0 ? void 0 : record.asOf) === undefined ? {} : { asOf: record.asOf })));
|
|
2768
|
+
const executeBody = record !== undefined && emit !== undefined
|
|
2769
|
+
? () => mcpAuthAls.run({
|
|
2739
2770
|
sessionId: record.sessionId,
|
|
2740
2771
|
turnId: callId,
|
|
2741
2772
|
callId,
|
|
2742
2773
|
toolName,
|
|
2743
2774
|
emit,
|
|
2744
2775
|
}, run)
|
|
2745
|
-
:
|
|
2776
|
+
: run;
|
|
2777
|
+
result = normalizeToolResult(record !== undefined
|
|
2778
|
+
? yield this.runToolExecute({
|
|
2779
|
+
record,
|
|
2780
|
+
turnId: callId,
|
|
2781
|
+
callId,
|
|
2782
|
+
toolName,
|
|
2783
|
+
}, executeBody)
|
|
2784
|
+
: yield executeBody());
|
|
2746
2785
|
isError = isErrorEnvelope(result);
|
|
2747
2786
|
}
|
|
2748
2787
|
}
|
|
@@ -2789,23 +2828,34 @@ export class SessionEngine {
|
|
|
2789
2828
|
});
|
|
2790
2829
|
}
|
|
2791
2830
|
/**
|
|
2792
|
-
* Whether
|
|
2831
|
+
* Whether the host answers a bridged MCP call, for the cloud host bridge —
|
|
2793
2832
|
* the one tool path that does not reach {@link executeServerTool}, because
|
|
2794
2833
|
* it forwards to `host.mcp` instead of invoking a tool body.
|
|
2795
2834
|
*
|
|
2796
|
-
* A
|
|
2797
|
-
*
|
|
2798
|
-
*
|
|
2799
|
-
*
|
|
2835
|
+
* A frozen session refuses forward-looking time args here even when it is
|
|
2836
|
+
* not a dry run. A bridged tool carries no `defineTool`, so it declares no
|
|
2837
|
+
* effect, and the policy reads an undeclared tool as a write. In a dry run
|
|
2838
|
+
* that answers bridged reads too; resolving effects from a server's own
|
|
2839
|
+
* listing is the next unit's work.
|
|
2800
2840
|
*/
|
|
2801
2841
|
bridgedCallAnswer(args) {
|
|
2802
2842
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2803
2843
|
// Read off the in-flight turn's context rather than the session store:
|
|
2804
2844
|
// the bridge already refuses a call with no active turn, so the record is
|
|
2805
|
-
// in memory.
|
|
2806
|
-
// which is every session today — the listing below is only paid inside a
|
|
2807
|
-
// dry run.
|
|
2845
|
+
// in memory. The listing below is only paid inside a dry run.
|
|
2808
2846
|
const context = this.activeToolContexts.get(args.sessionId);
|
|
2847
|
+
if ((context === null || context === void 0 ? void 0 : context.record.asOf) !== undefined) {
|
|
2848
|
+
const decision = decideToolCall({
|
|
2849
|
+
dryRun: false,
|
|
2850
|
+
effect: undefined,
|
|
2851
|
+
input: args.input,
|
|
2852
|
+
asOf: context.record.asOf,
|
|
2853
|
+
});
|
|
2854
|
+
if (decision.kind === "unbounded") {
|
|
2855
|
+
this.logger(`[session] bridged tool ${args.toolName} refused, unbounded_time (${args.sessionId})`);
|
|
2856
|
+
return { answered: true, result: toolErrorResult(decision.message) };
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2809
2859
|
if ((context === null || context === void 0 ? void 0 : context.record.dryRun) !== true) {
|
|
2810
2860
|
return { answered: false };
|
|
2811
2861
|
}
|
|
@@ -2813,12 +2863,10 @@ export class SessionEngine {
|
|
|
2813
2863
|
// server's own listing annotations; a tool the listing cannot classify
|
|
2814
2864
|
// refuses rather than being stubbed. A failed listing classifies nothing,
|
|
2815
2865
|
// which lands on the same refusal — never on a run.
|
|
2816
|
-
const
|
|
2817
|
-
const decision = decideToolCall({
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
mcpTool: { name: args.toolName, annotations },
|
|
2821
|
-
});
|
|
2866
|
+
const info = yield this.bridgedToolInfo(args.connectionName, args.toolName);
|
|
2867
|
+
const decision = decideToolCall(Object.assign({ dryRun: true, effect: undefined, mcpTool: { name: args.toolName, annotations: info === null || info === void 0 ? void 0 : info.annotations }, input: args.input, asOf: context.record.asOf }, (context.record.asOf !== undefined
|
|
2868
|
+
? { timeWindow: schemaTimeWindowKeys(info === null || info === void 0 ? void 0 : info.inputSchema) }
|
|
2869
|
+
: {})));
|
|
2822
2870
|
if (decision.kind === "run") {
|
|
2823
2871
|
return { answered: false };
|
|
2824
2872
|
}
|
|
@@ -2847,14 +2895,13 @@ export class SessionEngine {
|
|
|
2847
2895
|
* undefined when the tool is unlisted, unannotated, or the listing fails —
|
|
2848
2896
|
* all of which the policy reads as unclassified, the refusing state.
|
|
2849
2897
|
*/
|
|
2850
|
-
|
|
2898
|
+
bridgedToolInfo(connectionName, toolName) {
|
|
2851
2899
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2852
|
-
var _a;
|
|
2853
2900
|
try {
|
|
2854
2901
|
const listed = yield this.host.mcp.listTools(connectionName);
|
|
2855
|
-
return
|
|
2902
|
+
return listed.find((tool) => tool.name === toolName);
|
|
2856
2903
|
}
|
|
2857
|
-
catch (
|
|
2904
|
+
catch (_a) {
|
|
2858
2905
|
return undefined;
|
|
2859
2906
|
}
|
|
2860
2907
|
});
|
|
@@ -14,7 +14,9 @@
|
|
|
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
|
import type { FileSink } from "../files.js";
|
|
20
22
|
import type { AgentProject } from "../types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-run-log.d.ts","sourceRoot":"","sources":["../../src/internal/session-run-log.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"session-run-log.d.ts","sourceRoot":"","sources":["../../src/internal/session-run-log.ts"],"names":[],"mappings":"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"}
|
|
@@ -14,7 +14,9 @@
|
|
|
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
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
20
22
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -25,11 +27,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
28
|
});
|
|
27
29
|
};
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
+
import { cursorHostedFiles } from "../files-backends/cursor-hosted.js";
|
|
31
|
+
import { agentSdkStorageKeys } from "../storage-protocol.js";
|
|
30
32
|
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
31
|
-
import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
|
|
32
33
|
import { describeError } from "./describe-error.js";
|
|
34
|
+
import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
33
35
|
export const SESSION_RUN_LOG_VERSION = 1;
|
|
34
36
|
/** Last N log-ring lines kept on each execution. */
|
|
35
37
|
export const SESSION_RUN_LOG_MAX_ENTRIES = 200;
|
|
@@ -249,7 +251,7 @@ export function createSessionRunLogStore(input) {
|
|
|
249
251
|
const logger = (_a = input.logger) !== null && _a !== void 0 ? _a : (() => { });
|
|
250
252
|
let active;
|
|
251
253
|
const readDocument = (sessionPublicId) => __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
const key =
|
|
254
|
+
const key = agentSdkStorageKeys.sessionRun(agentName, sessionPublicId);
|
|
253
255
|
const body = yield sink.get(key);
|
|
254
256
|
if (body === undefined) {
|
|
255
257
|
return undefined;
|
|
@@ -280,7 +282,7 @@ export function createSessionRunLogStore(input) {
|
|
|
280
282
|
updatedAt: fitted.writtenAt,
|
|
281
283
|
executions,
|
|
282
284
|
});
|
|
283
|
-
const key =
|
|
285
|
+
const key = agentSdkStorageKeys.sessionRun(agentName, document.sessionPublicId);
|
|
284
286
|
try {
|
|
285
287
|
yield sink.put(key, new TextEncoder().encode(JSON.stringify(document)));
|
|
286
288
|
}
|
|
@@ -340,17 +342,15 @@ export function createSessionRunLogStore(input) {
|
|
|
340
342
|
* local disk / today's behavior.
|
|
341
343
|
*/
|
|
342
344
|
export function selectSessionRunLogStore(input) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (env[AGENT_SERVE_GENERATION_ENV_VAR] === undefined) {
|
|
345
|
+
const hosting = resolveAgentV2Hosting({
|
|
346
|
+
architecture: input.project.agent.architecture,
|
|
347
|
+
env: input.env,
|
|
348
|
+
});
|
|
349
|
+
if (hosting.kind !== "cursor-managed") {
|
|
349
350
|
return undefined;
|
|
350
351
|
}
|
|
351
|
-
const envSnapshot = env;
|
|
352
352
|
return createSessionRunLogStore(Object.assign({ sink: cursorHostedFiles({
|
|
353
|
-
resolveStoreSourceId: () =>
|
|
353
|
+
resolveStoreSourceId: () => hosting.resolveStoreIds().frameworkStoreSourceId,
|
|
354
354
|
resolveApiKey: () => { var _a; return (_a = resolveApiKeySync()) === null || _a === void 0 ? void 0 : _a.apiKey; },
|
|
355
355
|
}), agentName: input.project.name, logger: input.logger }, (input.snapshotLogs === undefined
|
|
356
356
|
? {}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
import type { FileSink } from "../files.js";
|
|
15
|
+
import type { AgentProject } from "../types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Last N bytes flushed to the store. Matches the Temporal catch-up cap
|
|
18
|
+
* so guest snapshots and host catch-up stay interchangeable. The store
|
|
19
|
+
* allows 64 MiB; this keeps the dashboard snapshot bounded.
|
|
20
|
+
*/
|
|
21
|
+
export declare const START_LOG_STORE_MAX_BYTES: number;
|
|
22
|
+
/** Same path the hosted start command tees. Overridable in tests. */
|
|
23
|
+
export declare const DEFAULT_ENGINE_START_LOG_PATH = "/workspace/.agent-serve/start.log";
|
|
24
|
+
export interface StartLogStore {
|
|
25
|
+
persist(startLogId: string, contents: string): Promise<void>;
|
|
26
|
+
read(startLogId: string): Promise<string | undefined>;
|
|
27
|
+
}
|
|
28
|
+
export declare function tailStartLogText(raw: string, maxBytes: number): string;
|
|
29
|
+
export declare function resolveEngineStartLogPath(env?: NodeJS.ProcessEnv): string;
|
|
30
|
+
/**
|
|
31
|
+
* Read the local engine tee. Missing/empty is `undefined` (no store write).
|
|
32
|
+
* Soft-fail: a local read error must not change hosted-execution HTTP.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readLocalStartLogText(args?: {
|
|
35
|
+
path?: string;
|
|
36
|
+
maxBytes?: number;
|
|
37
|
+
}): Promise<string | undefined>;
|
|
38
|
+
export declare function createStartLogStore(input: {
|
|
39
|
+
sink: FileSink;
|
|
40
|
+
agentName: string;
|
|
41
|
+
logger?: (line: string) => void;
|
|
42
|
+
}): StartLogStore;
|
|
43
|
+
/**
|
|
44
|
+
* Same selection as the session-run log: architecture-v2 hosted engines.
|
|
45
|
+
*/
|
|
46
|
+
export declare function selectStartLogStore(input: {
|
|
47
|
+
project: AgentProject;
|
|
48
|
+
logger?: (line: string) => void;
|
|
49
|
+
env?: Record<string, string | undefined>;
|
|
50
|
+
}): StartLogStore | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Snapshot the local tee into the store. No-op when the file is missing
|
|
53
|
+
* or empty. Soft-fail inside {@link StartLogStore.persist}.
|
|
54
|
+
*/
|
|
55
|
+
export declare function flushLocalStartLog(args: {
|
|
56
|
+
store: StartLogStore;
|
|
57
|
+
startLogId: string;
|
|
58
|
+
path?: string;
|
|
59
|
+
}): Promise<void>;
|
|
60
|
+
//# sourceMappingURL=start-log-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-log-store.d.ts","sourceRoot":"","sources":["../../src/internal/start-log-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAwB,CAAC;AAEjE,qEAAqE;AACrE,eAAO,MAAM,6BAA6B,sCACL,CAAC;AAEtC,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvD;AAMD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQtE;AAED,wBAAgB,yBAAyB,CACvC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAKR;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,CAAC,EAAE;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoB9B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,GAAG,aAAa,CAkChB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C,GAAG,aAAa,GAAG,SAAS,CAiB5B;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
import { readFile } from "node:fs/promises";
|
|
24
|
+
import { cursorHostedFiles } from "../files-backends/cursor-hosted.js";
|
|
25
|
+
import { agentSdkStorageKeys } from "../storage-protocol.js";
|
|
26
|
+
import { resolveApiKeySync } from "./cursor/credentials.js";
|
|
27
|
+
import { describeError } from "./describe-error.js";
|
|
28
|
+
import { resolveAgentV2Hosting } from "./v2-hosting.js";
|
|
29
|
+
/**
|
|
30
|
+
* Last N bytes flushed to the store. Matches the Temporal catch-up cap
|
|
31
|
+
* so guest snapshots and host catch-up stay interchangeable. The store
|
|
32
|
+
* allows 64 MiB; this keeps the dashboard snapshot bounded.
|
|
33
|
+
*/
|
|
34
|
+
export const START_LOG_STORE_MAX_BYTES = 2 * 1024 * 1024;
|
|
35
|
+
/** Same path the hosted start command tees. Overridable in tests. */
|
|
36
|
+
export const DEFAULT_ENGINE_START_LOG_PATH = "/workspace/.agent-serve/start.log";
|
|
37
|
+
function decodeSinkBody(body) {
|
|
38
|
+
return body instanceof Uint8Array ? body : body.body;
|
|
39
|
+
}
|
|
40
|
+
export function tailStartLogText(raw, maxBytes) {
|
|
41
|
+
const encoded = new TextEncoder().encode(raw);
|
|
42
|
+
if (encoded.byteLength <= maxBytes) {
|
|
43
|
+
return raw;
|
|
44
|
+
}
|
|
45
|
+
return new TextDecoder().decode(encoded.subarray(encoded.byteLength - maxBytes));
|
|
46
|
+
}
|
|
47
|
+
export function resolveEngineStartLogPath(env = process.env) {
|
|
48
|
+
var _a;
|
|
49
|
+
const configured = (_a = env.AGENT_SERVE_ENGINE_START_LOG_PATH) === null || _a === void 0 ? void 0 : _a.trim();
|
|
50
|
+
return configured !== undefined && configured.length > 0
|
|
51
|
+
? configured
|
|
52
|
+
: DEFAULT_ENGINE_START_LOG_PATH;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Read the local engine tee. Missing/empty is `undefined` (no store write).
|
|
56
|
+
* Soft-fail: a local read error must not change hosted-execution HTTP.
|
|
57
|
+
*/
|
|
58
|
+
export function readLocalStartLogText(args) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const path = (_a = args === null || args === void 0 ? void 0 : args.path) !== null && _a !== void 0 ? _a : resolveEngineStartLogPath();
|
|
62
|
+
const maxBytes = (_b = args === null || args === void 0 ? void 0 : args.maxBytes) !== null && _b !== void 0 ? _b : START_LOG_STORE_MAX_BYTES;
|
|
63
|
+
try {
|
|
64
|
+
const raw = yield readFile(path, "utf8");
|
|
65
|
+
if (raw.length === 0) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
return tailStartLogText(raw, maxBytes);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error !== null &&
|
|
72
|
+
typeof error === "object" &&
|
|
73
|
+
"code" in error &&
|
|
74
|
+
error.code === "ENOENT") {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function createStartLogStore(input) {
|
|
82
|
+
var _a;
|
|
83
|
+
const { sink, agentName } = input;
|
|
84
|
+
const logger = (_a = input.logger) !== null && _a !== void 0 ? _a : (() => { });
|
|
85
|
+
return {
|
|
86
|
+
persist(startLogId, contents) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const key = agentSdkStorageKeys.log(agentName, startLogId);
|
|
89
|
+
const body = tailStartLogText(contents, START_LOG_STORE_MAX_BYTES);
|
|
90
|
+
try {
|
|
91
|
+
yield sink.put(key, new TextEncoder().encode(body));
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
logger(`[agent-sdk] start-log: persist failed for ${startLogId} (${describeError(error)})`);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
read(startLogId) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const key = agentSdkStorageKeys.log(agentName, startLogId);
|
|
101
|
+
try {
|
|
102
|
+
const body = yield sink.get(key);
|
|
103
|
+
if (body === undefined) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
const text = new TextDecoder().decode(decodeSinkBody(body));
|
|
107
|
+
return text.length === 0 ? undefined : text;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
logger(`[agent-sdk] start-log: read failed for ${startLogId} (${describeError(error)})`);
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Same selection as the session-run log: architecture-v2 hosted engines.
|
|
119
|
+
*/
|
|
120
|
+
export function selectStartLogStore(input) {
|
|
121
|
+
const hosting = resolveAgentV2Hosting({
|
|
122
|
+
architecture: input.project.agent.architecture,
|
|
123
|
+
env: input.env,
|
|
124
|
+
});
|
|
125
|
+
if (hosting.kind !== "cursor-managed") {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
return createStartLogStore({
|
|
129
|
+
sink: cursorHostedFiles({
|
|
130
|
+
resolveStoreSourceId: () => hosting.resolveStoreIds().frameworkStoreSourceId,
|
|
131
|
+
resolveApiKey: () => { var _a; return (_a = resolveApiKeySync()) === null || _a === void 0 ? void 0 : _a.apiKey; },
|
|
132
|
+
}),
|
|
133
|
+
agentName: input.project.name,
|
|
134
|
+
logger: input.logger,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Snapshot the local tee into the store. No-op when the file is missing
|
|
139
|
+
* or empty. Soft-fail inside {@link StartLogStore.persist}.
|
|
140
|
+
*/
|
|
141
|
+
export function flushLocalStartLog(args) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const contents = yield readLocalStartLogText(args.path === undefined ? undefined : { path: args.path });
|
|
144
|
+
if (contents === undefined) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
yield args.store.persist(args.startLogId, contents);
|
|
148
|
+
});
|
|
149
|
+
}
|