@cursor/bdk 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +341 -0
- package/LICENSE.md +3 -0
- package/README.md +1190 -0
- package/dist/artifacts.d.ts +34 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +51 -0
- package/dist/bin/agent-sdk.js +2 -0
- package/dist/bin/agent-serve.d.ts +19 -0
- package/dist/bin/agent-serve.d.ts.map +1 -0
- package/dist/bin/agent-serve.js +1578 -0
- package/dist/channels/bitbucket/api.d.ts +217 -0
- package/dist/channels/bitbucket/api.d.ts.map +1 -0
- package/dist/channels/bitbucket/api.js +664 -0
- package/dist/channels/bitbucket/binding.d.ts +75 -0
- package/dist/channels/bitbucket/binding.d.ts.map +1 -0
- package/dist/channels/bitbucket/binding.js +277 -0
- package/dist/channels/bitbucket/bitbucket-channel.d.ts +33 -0
- package/dist/channels/bitbucket/bitbucket-channel.d.ts.map +1 -0
- package/dist/channels/bitbucket/bitbucket-channel.js +120 -0
- package/dist/channels/bitbucket/bitbucket-webhook.d.ts +61 -0
- package/dist/channels/bitbucket/bitbucket-webhook.d.ts.map +1 -0
- package/dist/channels/bitbucket/bitbucket-webhook.js +384 -0
- package/dist/channels/bitbucket/checks.d.ts +67 -0
- package/dist/channels/bitbucket/checks.d.ts.map +1 -0
- package/dist/channels/bitbucket/checks.js +102 -0
- package/dist/channels/bitbucket/cursor-account.d.ts +37 -0
- package/dist/channels/bitbucket/cursor-account.d.ts.map +1 -0
- package/dist/channels/bitbucket/cursor-account.js +65 -0
- package/dist/channels/bitbucket/defaults.d.ts +26 -0
- package/dist/channels/bitbucket/defaults.d.ts.map +1 -0
- package/dist/channels/bitbucket/defaults.js +67 -0
- package/dist/channels/bitbucket/events.d.ts +22 -0
- package/dist/channels/bitbucket/events.d.ts.map +1 -0
- package/dist/channels/bitbucket/events.js +60 -0
- package/dist/channels/bitbucket/index.d.ts +34 -0
- package/dist/channels/bitbucket/index.d.ts.map +1 -0
- package/dist/channels/bitbucket/index.js +33 -0
- package/dist/channels/bitbucket/replay.d.ts +63 -0
- package/dist/channels/bitbucket/replay.d.ts.map +1 -0
- package/dist/channels/bitbucket/replay.js +302 -0
- package/dist/channels/bitbucket/state.d.ts +35 -0
- package/dist/channels/bitbucket/state.d.ts.map +1 -0
- package/dist/channels/bitbucket/state.js +21 -0
- package/dist/channels/bitbucket/types.d.ts +227 -0
- package/dist/channels/bitbucket/types.d.ts.map +1 -0
- package/dist/channels/bitbucket/types.js +1 -0
- package/dist/channels/change-monitors/change-monitors-channel.d.ts +5 -0
- package/dist/channels/change-monitors/change-monitors-channel.d.ts.map +1 -0
- package/dist/channels/change-monitors/change-monitors-channel.js +45 -0
- package/dist/channels/change-monitors/index.d.ts +4 -0
- package/dist/channels/change-monitors/index.d.ts.map +1 -0
- package/dist/channels/change-monitors/index.js +2 -0
- package/dist/channels/change-monitors/types.d.ts +42 -0
- package/dist/channels/change-monitors/types.d.ts.map +1 -0
- package/dist/channels/change-monitors/types.js +1 -0
- package/dist/channels/checks.d.ts +121 -0
- package/dist/channels/checks.d.ts.map +1 -0
- package/dist/channels/checks.js +86 -0
- package/dist/channels/deployments/deployments-channel.d.ts +95 -0
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -0
- package/dist/channels/deployments/deployments-channel.js +196 -0
- package/dist/channels/deployments/index.d.ts +25 -0
- package/dist/channels/deployments/index.d.ts.map +1 -0
- package/dist/channels/deployments/index.js +24 -0
- package/dist/channels/deployments/types.d.ts +83 -0
- package/dist/channels/deployments/types.d.ts.map +1 -0
- package/dist/channels/deployments/types.js +7 -0
- package/dist/channels/github/api.d.ts +133 -0
- package/dist/channels/github/api.d.ts.map +1 -0
- package/dist/channels/github/api.js +320 -0
- package/dist/channels/github/auth.d.ts +67 -0
- package/dist/channels/github/auth.d.ts.map +1 -0
- package/dist/channels/github/auth.js +233 -0
- package/dist/channels/github/binding.d.ts +86 -0
- package/dist/channels/github/binding.d.ts.map +1 -0
- package/dist/channels/github/binding.js +114 -0
- package/dist/channels/github/checks.d.ts +64 -0
- package/dist/channels/github/checks.d.ts.map +1 -0
- package/dist/channels/github/checks.js +98 -0
- package/dist/channels/github/cursor-account.d.ts +102 -0
- package/dist/channels/github/cursor-account.d.ts.map +1 -0
- package/dist/channels/github/cursor-account.js +194 -0
- package/dist/channels/github/defaults.d.ts +23 -0
- package/dist/channels/github/defaults.d.ts.map +1 -0
- package/dist/channels/github/defaults.js +157 -0
- package/dist/channels/github/events.d.ts +18 -0
- package/dist/channels/github/events.d.ts.map +1 -0
- package/dist/channels/github/events.js +56 -0
- package/dist/channels/github/forward.d.ts +139 -0
- package/dist/channels/github/forward.d.ts.map +1 -0
- package/dist/channels/github/forward.js +267 -0
- package/dist/channels/github/github-channel.d.ts +146 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -0
- package/dist/channels/github/github-channel.js +1804 -0
- package/dist/channels/github/index.d.ts +54 -0
- package/dist/channels/github/index.d.ts.map +1 -0
- package/dist/channels/github/index.js +53 -0
- package/dist/channels/github/progress.d.ts +84 -0
- package/dist/channels/github/progress.d.ts.map +1 -0
- package/dist/channels/github/progress.js +236 -0
- package/dist/channels/github/replay.d.ts +115 -0
- package/dist/channels/github/replay.d.ts.map +1 -0
- package/dist/channels/github/replay.js +278 -0
- package/dist/channels/github/state.d.ts +47 -0
- package/dist/channels/github/state.d.ts.map +1 -0
- package/dist/channels/github/state.js +53 -0
- package/dist/channels/github/types.d.ts +491 -0
- package/dist/channels/github/types.d.ts.map +1 -0
- package/dist/channels/github/types.js +1 -0
- package/dist/channels/gitlab/api.d.ts +118 -0
- package/dist/channels/gitlab/api.d.ts.map +1 -0
- package/dist/channels/gitlab/api.js +234 -0
- package/dist/channels/gitlab/binding.d.ts +63 -0
- package/dist/channels/gitlab/binding.d.ts.map +1 -0
- package/dist/channels/gitlab/binding.js +147 -0
- package/dist/channels/gitlab/checks.d.ts +110 -0
- package/dist/channels/gitlab/checks.d.ts.map +1 -0
- package/dist/channels/gitlab/checks.js +122 -0
- package/dist/channels/gitlab/cursor-account.d.ts +36 -0
- package/dist/channels/gitlab/cursor-account.d.ts.map +1 -0
- package/dist/channels/gitlab/cursor-account.js +64 -0
- package/dist/channels/gitlab/defaults.d.ts +25 -0
- package/dist/channels/gitlab/defaults.d.ts.map +1 -0
- package/dist/channels/gitlab/defaults.js +55 -0
- package/dist/channels/gitlab/events.d.ts +12 -0
- package/dist/channels/gitlab/events.d.ts.map +1 -0
- package/dist/channels/gitlab/events.js +26 -0
- package/dist/channels/gitlab/gitlab-channel.d.ts +33 -0
- package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -0
- package/dist/channels/gitlab/gitlab-channel.js +120 -0
- package/dist/channels/gitlab/gitlab-webhook.d.ts +45 -0
- package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -0
- package/dist/channels/gitlab/gitlab-webhook.js +388 -0
- package/dist/channels/gitlab/index.d.ts +31 -0
- package/dist/channels/gitlab/index.d.ts.map +1 -0
- package/dist/channels/gitlab/index.js +30 -0
- package/dist/channels/gitlab/replay.d.ts +105 -0
- package/dist/channels/gitlab/replay.d.ts.map +1 -0
- package/dist/channels/gitlab/replay.js +199 -0
- package/dist/channels/gitlab/state.d.ts +33 -0
- package/dist/channels/gitlab/state.d.ts.map +1 -0
- package/dist/channels/gitlab/state.js +23 -0
- package/dist/channels/gitlab/types.d.ts +211 -0
- package/dist/channels/gitlab/types.d.ts.map +1 -0
- package/dist/channels/gitlab/types.js +1 -0
- package/dist/channels/issues/index.d.ts +4 -0
- package/dist/channels/issues/index.d.ts.map +1 -0
- package/dist/channels/issues/index.js +2 -0
- package/dist/channels/issues/issues-channel.d.ts +5 -0
- package/dist/channels/issues/issues-channel.d.ts.map +1 -0
- package/dist/channels/issues/issues-channel.js +35 -0
- package/dist/channels/issues/types.d.ts +33 -0
- package/dist/channels/issues/types.d.ts.map +1 -0
- package/dist/channels/issues/types.js +1 -0
- package/dist/channels/origin/api.d.ts +157 -0
- package/dist/channels/origin/api.d.ts.map +1 -0
- package/dist/channels/origin/api.js +379 -0
- package/dist/channels/origin/binding.d.ts +57 -0
- package/dist/channels/origin/binding.d.ts.map +1 -0
- package/dist/channels/origin/binding.js +57 -0
- package/dist/channels/origin/checks.d.ts +119 -0
- package/dist/channels/origin/checks.d.ts.map +1 -0
- package/dist/channels/origin/checks.js +145 -0
- package/dist/channels/origin/cursor-account.d.ts +24 -0
- package/dist/channels/origin/cursor-account.d.ts.map +1 -0
- package/dist/channels/origin/cursor-account.js +35 -0
- 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 +109 -0
- package/dist/channels/origin/events.d.ts +10 -0
- package/dist/channels/origin/events.d.ts.map +1 -0
- package/dist/channels/origin/events.js +25 -0
- package/dist/channels/origin/index.d.ts +35 -0
- package/dist/channels/origin/index.d.ts.map +1 -0
- package/dist/channels/origin/index.js +34 -0
- package/dist/channels/origin/origin-channel.d.ts +72 -0
- package/dist/channels/origin/origin-channel.d.ts.map +1 -0
- package/dist/channels/origin/origin-channel.js +634 -0
- package/dist/channels/origin/origin-webhook.d.ts +69 -0
- package/dist/channels/origin/origin-webhook.d.ts.map +1 -0
- package/dist/channels/origin/origin-webhook.js +231 -0
- package/dist/channels/origin/reactions.d.ts +56 -0
- package/dist/channels/origin/reactions.d.ts.map +1 -0
- package/dist/channels/origin/reactions.js +58 -0
- 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 +257 -0
- package/dist/channels/origin/types.d.ts.map +1 -0
- package/dist/channels/origin/types.js +1 -0
- package/dist/channels/slack/agentic-delivery.d.ts +23 -0
- package/dist/channels/slack/agentic-delivery.d.ts.map +1 -0
- package/dist/channels/slack/agentic-delivery.js +566 -0
- package/dist/channels/slack/agentic-posted.d.ts +30 -0
- package/dist/channels/slack/agentic-posted.d.ts.map +1 -0
- package/dist/channels/slack/agentic-posted.js +102 -0
- package/dist/channels/slack/agentic-signals.d.ts +48 -0
- package/dist/channels/slack/agentic-signals.d.ts.map +1 -0
- package/dist/channels/slack/agentic-signals.js +199 -0
- package/dist/channels/slack/api.d.ts +171 -0
- package/dist/channels/slack/api.d.ts.map +1 -0
- package/dist/channels/slack/api.js +613 -0
- package/dist/channels/slack/approvals.d.ts +48 -0
- package/dist/channels/slack/approvals.d.ts.map +1 -0
- package/dist/channels/slack/approvals.js +233 -0
- package/dist/channels/slack/assistant.d.ts +23 -0
- package/dist/channels/slack/assistant.d.ts.map +1 -0
- package/dist/channels/slack/assistant.js +67 -0
- package/dist/channels/slack/attachments.d.ts +82 -0
- package/dist/channels/slack/attachments.d.ts.map +1 -0
- package/dist/channels/slack/attachments.js +503 -0
- package/dist/channels/slack/auth.d.ts +46 -0
- package/dist/channels/slack/auth.d.ts.map +1 -0
- package/dist/channels/slack/auth.js +95 -0
- package/dist/channels/slack/blocks.d.ts +61 -0
- package/dist/channels/slack/blocks.d.ts.map +1 -0
- package/dist/channels/slack/blocks.js +90 -0
- package/dist/channels/slack/bot-mentions.d.ts +108 -0
- package/dist/channels/slack/bot-mentions.d.ts.map +1 -0
- package/dist/channels/slack/bot-mentions.js +257 -0
- package/dist/channels/slack/channel-watch.d.ts +76 -0
- package/dist/channels/slack/channel-watch.d.ts.map +1 -0
- package/dist/channels/slack/channel-watch.js +264 -0
- package/dist/channels/slack/cli-project.d.ts +19 -0
- package/dist/channels/slack/cli-project.d.ts.map +1 -0
- package/dist/channels/slack/cli-project.js +228 -0
- 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 +166 -0
- package/dist/channels/slack/constants.d.ts +25 -0
- package/dist/channels/slack/constants.d.ts.map +1 -0
- package/dist/channels/slack/constants.js +35 -0
- package/dist/channels/slack/credentials.d.ts +35 -0
- package/dist/channels/slack/credentials.d.ts.map +1 -0
- package/dist/channels/slack/credentials.js +88 -0
- package/dist/channels/slack/defaults.d.ts +50 -0
- package/dist/channels/slack/defaults.d.ts.map +1 -0
- package/dist/channels/slack/defaults.js +630 -0
- package/dist/channels/slack/dispatch.d.ts +141 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -0
- package/dist/channels/slack/dispatch.js +730 -0
- package/dist/channels/slack/doctor.d.ts +40 -0
- package/dist/channels/slack/doctor.d.ts.map +1 -0
- package/dist/channels/slack/doctor.js +291 -0
- package/dist/channels/slack/eval-directive.d.ts +59 -0
- package/dist/channels/slack/eval-directive.d.ts.map +1 -0
- package/dist/channels/slack/eval-directive.js +269 -0
- package/dist/channels/slack/event-id-dedupe.d.ts +10 -0
- package/dist/channels/slack/event-id-dedupe.d.ts.map +1 -0
- package/dist/channels/slack/event-id-dedupe.js +23 -0
- package/dist/channels/slack/external-policy.d.ts +28 -0
- package/dist/channels/slack/external-policy.d.ts.map +1 -0
- package/dist/channels/slack/external-policy.js +64 -0
- package/dist/channels/slack/footer.d.ts +33 -0
- package/dist/channels/slack/footer.d.ts.map +1 -0
- package/dist/channels/slack/footer.js +85 -0
- package/dist/channels/slack/inbound.d.ts +98 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -0
- package/dist/channels/slack/inbound.js +314 -0
- package/dist/channels/slack/index.d.ts +53 -0
- package/dist/channels/slack/index.d.ts.map +1 -0
- package/dist/channels/slack/index.js +52 -0
- package/dist/channels/slack/init.d.ts +45 -0
- package/dist/channels/slack/init.d.ts.map +1 -0
- package/dist/channels/slack/init.js +126 -0
- package/dist/channels/slack/interactive.d.ts +65 -0
- package/dist/channels/slack/interactive.d.ts.map +1 -0
- package/dist/channels/slack/interactive.js +310 -0
- package/dist/channels/slack/links.d.ts +10 -0
- package/dist/channels/slack/links.d.ts.map +1 -0
- package/dist/channels/slack/links.js +19 -0
- package/dist/channels/slack/live-delivery.d.ts +77 -0
- package/dist/channels/slack/live-delivery.d.ts.map +1 -0
- package/dist/channels/slack/live-delivery.js +399 -0
- package/dist/channels/slack/log.d.ts +25 -0
- package/dist/channels/slack/log.d.ts.map +1 -0
- package/dist/channels/slack/log.js +44 -0
- package/dist/channels/slack/manifest.d.ts +80 -0
- package/dist/channels/slack/manifest.d.ts.map +1 -0
- package/dist/channels/slack/manifest.js +159 -0
- package/dist/channels/slack/message-body.d.ts +13 -0
- package/dist/channels/slack/message-body.d.ts.map +1 -0
- package/dist/channels/slack/message-body.js +74 -0
- package/dist/channels/slack/nudge-carrier.d.ts +21 -0
- package/dist/channels/slack/nudge-carrier.d.ts.map +1 -0
- package/dist/channels/slack/nudge-carrier.js +213 -0
- package/dist/channels/slack/nudge-store.d.ts +77 -0
- package/dist/channels/slack/nudge-store.d.ts.map +1 -0
- package/dist/channels/slack/nudge-store.js +315 -0
- package/dist/channels/slack/paint-start.d.ts +22 -0
- package/dist/channels/slack/paint-start.d.ts.map +1 -0
- package/dist/channels/slack/paint-start.js +91 -0
- package/dist/channels/slack/placeholder.d.ts +62 -0
- package/dist/channels/slack/placeholder.d.ts.map +1 -0
- package/dist/channels/slack/placeholder.js +266 -0
- package/dist/channels/slack/pr-ref.d.ts +24 -0
- package/dist/channels/slack/pr-ref.d.ts.map +1 -0
- package/dist/channels/slack/pr-ref.js +55 -0
- package/dist/channels/slack/progress-delivery.d.ts +28 -0
- package/dist/channels/slack/progress-delivery.d.ts.map +1 -0
- package/dist/channels/slack/progress-delivery.js +122 -0
- package/dist/channels/slack/reasoning-card.d.ts +38 -0
- package/dist/channels/slack/reasoning-card.d.ts.map +1 -0
- package/dist/channels/slack/reasoning-card.js +103 -0
- package/dist/channels/slack/reasoning-chip.d.ts +8 -0
- package/dist/channels/slack/reasoning-chip.d.ts.map +1 -0
- package/dist/channels/slack/reasoning-chip.js +30 -0
- package/dist/channels/slack/recording-sink.d.ts +29 -0
- package/dist/channels/slack/recording-sink.d.ts.map +1 -0
- package/dist/channels/slack/recording-sink.js +140 -0
- package/dist/channels/slack/redact.d.ts +2 -0
- package/dist/channels/slack/redact.d.ts.map +1 -0
- package/dist/channels/slack/redact.js +5 -0
- package/dist/channels/slack/reply-options.d.ts +47 -0
- package/dist/channels/slack/reply-options.d.ts.map +1 -0
- package/dist/channels/slack/reply-options.js +193 -0
- package/dist/channels/slack/setup.d.ts +33 -0
- package/dist/channels/slack/setup.d.ts.map +1 -0
- package/dist/channels/slack/setup.js +101 -0
- package/dist/channels/slack/slack-channel.d.ts +43 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -0
- package/dist/channels/slack/slack-channel.js +534 -0
- package/dist/channels/slack/socket-mode.d.ts +26 -0
- package/dist/channels/slack/socket-mode.d.ts.map +1 -0
- package/dist/channels/slack/socket-mode.js +114 -0
- package/dist/channels/slack/stop.d.ts +14 -0
- package/dist/channels/slack/stop.d.ts.map +1 -0
- package/dist/channels/slack/stop.js +22 -0
- package/dist/channels/slack/stream.d.ts +38 -0
- package/dist/channels/slack/stream.d.ts.map +1 -0
- package/dist/channels/slack/stream.js +30 -0
- package/dist/channels/slack/thread-context.d.ts +79 -0
- package/dist/channels/slack/thread-context.d.ts.map +1 -0
- package/dist/channels/slack/thread-context.js +396 -0
- package/dist/channels/slack/tool-approval-events.d.ts +38 -0
- package/dist/channels/slack/tool-approval-events.d.ts.map +1 -0
- package/dist/channels/slack/tool-approval-events.js +224 -0
- package/dist/channels/slack/tool-cards.d.ts +22 -0
- package/dist/channels/slack/tool-cards.d.ts.map +1 -0
- package/dist/channels/slack/tool-cards.js +172 -0
- package/dist/channels/slack/tool-chip.d.ts +9 -0
- package/dist/channels/slack/tool-chip.d.ts.map +1 -0
- package/dist/channels/slack/tool-chip.js +23 -0
- package/dist/channels/slack/types.d.ts +751 -0
- package/dist/channels/slack/types.d.ts.map +1 -0
- package/dist/channels/slack/types.js +4 -0
- package/dist/channels/slack/upload.d.ts +13 -0
- package/dist/channels/slack/upload.d.ts.map +1 -0
- package/dist/channels/slack/upload.js +135 -0
- package/dist/channels.d.ts +175 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +417 -0
- package/dist/connections.d.ts +131 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +131 -0
- package/dist/dashboard-session-url.d.ts +15 -0
- package/dist/dashboard-session-url.d.ts.map +1 -0
- package/dist/dashboard-session-url.js +25 -0
- package/dist/docs/404.html +24 -0
- package/dist/docs/architecture.svg +59 -0
- package/dist/docs/assets/app.JVQvbRO-.js +309 -0
- package/dist/docs/assets/building-with-agents.md.-fcjCmJU.js +9 -0
- package/dist/docs/assets/building-with-agents.md.-fcjCmJU.lean.js +1 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.Caw9W1pM.js +1 -0
- package/dist/docs/assets/chunks/VPLocalSearchBox.BkhY63uW.js +9 -0
- package/dist/docs/assets/chunks/arc.Cc1unYd3.js +1 -0
- package/dist/docs/assets/chunks/architectureDiagram-Q4EWVU46.CAY_TPVz.js +36 -0
- package/dist/docs/assets/chunks/baseUniq.my2VD3Xm.js +1 -0
- package/dist/docs/assets/chunks/blockDiagram-DXYQGD6D.CQXAOmqd.js +132 -0
- package/dist/docs/assets/chunks/c4Diagram-AHTNJAMY.D0AsQFSX.js +10 -0
- package/dist/docs/assets/chunks/channel.Sapo9HJZ.js +1 -0
- package/dist/docs/assets/chunks/chunk-4BX2VUAB.DZjhgNls.js +1 -0
- package/dist/docs/assets/chunks/chunk-4TB4RGXK.qdcp_qbo.js +206 -0
- package/dist/docs/assets/chunks/chunk-55IACEB6.BHXoZhJ-.js +1 -0
- package/dist/docs/assets/chunks/chunk-EDXVE4YY.Cds_Vwj3.js +1 -0
- package/dist/docs/assets/chunks/chunk-FMBD7UC4.CSl0HknT.js +15 -0
- package/dist/docs/assets/chunks/chunk-OYMX7WX6.DJMvAt5N.js +231 -0
- package/dist/docs/assets/chunks/chunk-QZHKN3VN.BYQzBK9D.js +1 -0
- package/dist/docs/assets/chunks/chunk-YZCP3GAM.BAvw7N4o.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.NPiy3Hz7.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.NPiy3Hz7.js +1 -0
- package/dist/docs/assets/chunks/clone.zl2qolPE.js +1 -0
- package/dist/docs/assets/chunks/cose-bilkent-S5V4N54A.Buf3seya.js +1 -0
- package/dist/docs/assets/chunks/cytoscape.esm.BQk4lpUV.js +331 -0
- package/dist/docs/assets/chunks/dagre-KV5264BT.DMGGa3uA.js +4 -0
- package/dist/docs/assets/chunks/defaultLocale.C4B-KCzX.js +1 -0
- package/dist/docs/assets/chunks/diagram-5BDNPKRD.DDjnwRmY.js +10 -0
- package/dist/docs/assets/chunks/diagram-G4DWMVQ6.RwyrIr8Q.js +24 -0
- package/dist/docs/assets/chunks/diagram-MMDJMWI5.DRvQV16Z.js +43 -0
- package/dist/docs/assets/chunks/diagram-TYMM5635.Dw8W9BTk.js +24 -0
- package/dist/docs/assets/chunks/erDiagram-SMLLAGMA.DQT1Hnwf.js +85 -0
- package/dist/docs/assets/chunks/flowDiagram-DWJPFMVM.6_Aky-ut.js +162 -0
- package/dist/docs/assets/chunks/framework.BNw1pucY.js +19 -0
- package/dist/docs/assets/chunks/ganttDiagram-T4ZO3ILL.DHIwqnqN.js +292 -0
- package/dist/docs/assets/chunks/gitGraphDiagram-UUTBAWPF.CGd_eJbn.js +106 -0
- package/dist/docs/assets/chunks/graph.ChMEylkh.js +1 -0
- package/dist/docs/assets/chunks/infoDiagram-42DDH7IO.Cd4gMyAz.js +2 -0
- package/dist/docs/assets/chunks/init.Gi6I4Gst.js +1 -0
- package/dist/docs/assets/chunks/ishikawaDiagram-UXIWVN3A.D1uw7MXq.js +70 -0
- package/dist/docs/assets/chunks/journeyDiagram-VCZTEJTY.AWLXtelc.js +139 -0
- package/dist/docs/assets/chunks/kanban-definition-6JOO6SKY.CagPhAn5.js +89 -0
- package/dist/docs/assets/chunks/katex.DkKDou_j.js +257 -0
- package/dist/docs/assets/chunks/layout.ClTBBkE_.js +1 -0
- package/dist/docs/assets/chunks/linear.SwS2rOLA.js +1 -0
- package/dist/docs/assets/chunks/min.By_x-Btb.js +1 -0
- package/dist/docs/assets/chunks/mindmap-definition-QFDTVHPH.By_RAMaP.js +96 -0
- package/dist/docs/assets/chunks/ordinal.DBvzRdQf.js +1 -0
- package/dist/docs/assets/chunks/pieDiagram-DEJITSTG.DfAl9sy4.js +30 -0
- package/dist/docs/assets/chunks/quadrantDiagram-34T5L4WZ.CNuqFRBj.js +7 -0
- package/dist/docs/assets/chunks/requirementDiagram-MS252O5E.DJ5CmTCl.js +84 -0
- package/dist/docs/assets/chunks/sankeyDiagram-XADWPNL6.D-T_AKJj.js +10 -0
- package/dist/docs/assets/chunks/sequenceDiagram-FGHM5R23.BRn9WcrR.js +157 -0
- package/dist/docs/assets/chunks/stateDiagram-FHFEXIEX.F12urmm7.js +1 -0
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2._auCa3fR.js +1 -0
- package/dist/docs/assets/chunks/theme.zK3OJa_C.js +2 -0
- package/dist/docs/assets/chunks/timeline-definition-GMOUNBTQ.B7GiQBeC.js +120 -0
- package/dist/docs/assets/chunks/vennDiagram-DHZGUBPP.D0niwuY_.js +34 -0
- package/dist/docs/assets/chunks/virtual_mermaid-config.DDnGl6nM.js +1 -0
- package/dist/docs/assets/chunks/wardley-RL74JXVD.1zhHNRsx.js +162 -0
- package/dist/docs/assets/chunks/wardleyDiagram-NUSXRM2D.DKaqpT7K.js +20 -0
- package/dist/docs/assets/chunks/xychartDiagram-5P7HB3ND.e8BPicch.js +7 -0
- package/dist/docs/assets/deployment.md.nGo1yIsa.js +32 -0
- package/dist/docs/assets/deployment.md.nGo1yIsa.lean.js +1 -0
- package/dist/docs/assets/evals.md.CCAtNcuL.js +72 -0
- package/dist/docs/assets/evals.md.CCAtNcuL.lean.js +1 -0
- package/dist/docs/assets/guides_agent-to-agent.md.CGkicXeB.js +41 -0
- package/dist/docs/assets/guides_agent-to-agent.md.CGkicXeB.lean.js +1 -0
- package/dist/docs/assets/guides_bitbucket.md.Cb3LPKt3.js +145 -0
- package/dist/docs/assets/guides_bitbucket.md.Cb3LPKt3.lean.js +1 -0
- package/dist/docs/assets/guides_cloud-agents.md.BuEkDCwo.js +10 -0
- package/dist/docs/assets/guides_cloud-agents.md.BuEkDCwo.lean.js +1 -0
- package/dist/docs/assets/guides_convert-automation.md.Ci-Y2iD5.js +43 -0
- package/dist/docs/assets/guides_convert-automation.md.Ci-Y2iD5.lean.js +1 -0
- package/dist/docs/assets/guides_github.md.C2_DSWlE.js +156 -0
- package/dist/docs/assets/guides_github.md.C2_DSWlE.lean.js +1 -0
- package/dist/docs/assets/guides_gitlab.md.BM27P43u.js +153 -0
- package/dist/docs/assets/guides_gitlab.md.BM27P43u.lean.js +1 -0
- package/dist/docs/assets/guides_grokbot-agents.md.yxVbSlKA.js +16 -0
- package/dist/docs/assets/guides_grokbot-agents.md.yxVbSlKA.lean.js +1 -0
- package/dist/docs/assets/guides_hooks.md.BWoiNaMq.js +50 -0
- package/dist/docs/assets/guides_hooks.md.BWoiNaMq.lean.js +1 -0
- package/dist/docs/assets/guides_improve.md.COtL-6ft.js +22 -0
- package/dist/docs/assets/guides_improve.md.COtL-6ft.lean.js +1 -0
- package/dist/docs/assets/guides_jev.md.BNDm14Gy.js +151 -0
- package/dist/docs/assets/guides_jev.md.BNDm14Gy.lean.js +1 -0
- package/dist/docs/assets/guides_mcp-oauth.md.Cu6mhZ_3.js +50 -0
- package/dist/docs/assets/guides_mcp-oauth.md.Cu6mhZ_3.lean.js +1 -0
- package/dist/docs/assets/guides_opentelemetry.md.DLlIB5rv.js +35 -0
- package/dist/docs/assets/guides_opentelemetry.md.DLlIB5rv.lean.js +1 -0
- package/dist/docs/assets/guides_slack.md.ZbHQETOT.js +70 -0
- package/dist/docs/assets/guides_slack.md.ZbHQETOT.lean.js +1 -0
- package/dist/docs/assets/guides_webhooks.md.D0furjw0.js +92 -0
- package/dist/docs/assets/guides_webhooks.md.D0furjw0.lean.js +1 -0
- package/dist/docs/assets/hillclimbing.md.Biy0m-Qb.js +7 -0
- package/dist/docs/assets/hillclimbing.md.Biy0m-Qb.lean.js +1 -0
- package/dist/docs/assets/index.md.CVc_oOA3.js +27 -0
- package/dist/docs/assets/index.md.CVc_oOA3.lean.js +1 -0
- package/dist/docs/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/dist/docs/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/dist/docs/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/dist/docs/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/dist/docs/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/dist/docs/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/dist/docs/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/dist/docs/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/dist/docs/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/dist/docs/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/dist/docs/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/dist/docs/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/dist/docs/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/dist/docs/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/dist/docs/assets/quickstart.md.wG4shE1f.js +168 -0
- package/dist/docs/assets/quickstart.md.wG4shE1f.lean.js +1 -0
- package/dist/docs/assets/reference_agent-config.md.DzGI777n.js +32 -0
- package/dist/docs/assets/reference_agent-config.md.DzGI777n.lean.js +1 -0
- package/dist/docs/assets/reference_artifacts.md.IFFC5Zln.js +18 -0
- package/dist/docs/assets/reference_artifacts.md.IFFC5Zln.lean.js +1 -0
- package/dist/docs/assets/reference_channels.md.mbNtKCiR.js +23 -0
- package/dist/docs/assets/reference_channels.md.mbNtKCiR.lean.js +1 -0
- package/dist/docs/assets/reference_cli.md.BK2QUH67.js +97 -0
- package/dist/docs/assets/reference_cli.md.BK2QUH67.lean.js +1 -0
- package/dist/docs/assets/reference_connections.md._XpKiOaF.js +63 -0
- package/dist/docs/assets/reference_connections.md._XpKiOaF.lean.js +1 -0
- package/dist/docs/assets/reference_evals.md.DqNyHMA6.js +56 -0
- package/dist/docs/assets/reference_evals.md.DqNyHMA6.lean.js +1 -0
- package/dist/docs/assets/reference_extensions.md.CPPrkWlJ.js +58 -0
- package/dist/docs/assets/reference_extensions.md.CPPrkWlJ.lean.js +1 -0
- package/dist/docs/assets/reference_hooks.md.Dg3dEugd.js +45 -0
- package/dist/docs/assets/reference_hooks.md.Dg3dEugd.lean.js +1 -0
- package/dist/docs/assets/reference_http-api.md.BZOvhCqY.js +11 -0
- package/dist/docs/assets/reference_http-api.md.BZOvhCqY.lean.js +1 -0
- package/dist/docs/assets/reference_instructions.md.Bdwscs4G.js +14 -0
- package/dist/docs/assets/reference_instructions.md.Bdwscs4G.lean.js +1 -0
- package/dist/docs/assets/reference_playground.md.BdQzRJc2.js +1 -0
- package/dist/docs/assets/reference_playground.md.BdQzRJc2.lean.js +1 -0
- package/dist/docs/assets/reference_project-layout.md.CpLQ9j4K.js +25 -0
- package/dist/docs/assets/reference_project-layout.md.CpLQ9j4K.lean.js +1 -0
- package/dist/docs/assets/reference_prompt.md.BQZB4eaV.js +9 -0
- package/dist/docs/assets/reference_prompt.md.BQZB4eaV.lean.js +1 -0
- package/dist/docs/assets/reference_schedules.md.BVU5EFbz.js +47 -0
- package/dist/docs/assets/reference_schedules.md.BVU5EFbz.lean.js +1 -0
- package/dist/docs/assets/reference_sessions.md.BtpTjZmh.js +1 -0
- package/dist/docs/assets/reference_sessions.md.BtpTjZmh.lean.js +1 -0
- package/dist/docs/assets/reference_skills.md.Cy00QMKS.js +15 -0
- package/dist/docs/assets/reference_skills.md.Cy00QMKS.lean.js +1 -0
- package/dist/docs/assets/reference_subagents.md.B8oyeXOI.js +10 -0
- package/dist/docs/assets/reference_subagents.md.B8oyeXOI.lean.js +1 -0
- package/dist/docs/assets/reference_tools.md.hg2Wi5Bq.js +90 -0
- package/dist/docs/assets/reference_tools.md.hg2Wi5Bq.lean.js +1 -0
- package/dist/docs/assets/style.C130MVnH.css +1 -0
- package/dist/docs/assets/templates_agentic-owners.md.BykUiZ8j.js +14 -0
- package/dist/docs/assets/templates_agentic-owners.md.BykUiZ8j.lean.js +1 -0
- package/dist/docs/assets/templates_security-reviewer.md.DXMmKl_o.js +2 -0
- package/dist/docs/assets/templates_security-reviewer.md.DXMmKl_o.lean.js +1 -0
- package/dist/docs/assets/templates_thermo-quality-review.md.Dg1p1MsG.js +3 -0
- package/dist/docs/assets/templates_thermo-quality-review.md.Dg1p1MsG.lean.js +1 -0
- package/dist/docs/assets/templates_thermo-review.md.Dlylkowj.js +3 -0
- package/dist/docs/assets/templates_thermo-review.md.Dlylkowj.lean.js +1 -0
- package/dist/docs/assets/templates_triage.md.CvJyx81N.js +9 -0
- package/dist/docs/assets/templates_triage.md.CvJyx81N.lean.js +1 -0
- package/dist/docs/assets/troubleshooting.md.BzZSu1Gz.js +1 -0
- package/dist/docs/assets/troubleshooting.md.BzZSu1Gz.lean.js +1 -0
- package/dist/docs/building-with-agents.html +68 -0
- package/dist/docs/building-with-agents.md +135 -0
- package/dist/docs/deployment.html +91 -0
- package/dist/docs/deployment.md +211 -0
- package/dist/docs/evals.html +131 -0
- package/dist/docs/evals.md +257 -0
- package/dist/docs/guides/agent-to-agent.html +100 -0
- package/dist/docs/guides/agent-to-agent.md +152 -0
- package/dist/docs/guides/bitbucket.html +204 -0
- package/dist/docs/guides/bitbucket.md +288 -0
- package/dist/docs/guides/cloud-agents.html +69 -0
- package/dist/docs/guides/cloud-agents.md +90 -0
- package/dist/docs/guides/convert-automation.html +102 -0
- package/dist/docs/guides/convert-automation.md +183 -0
- package/dist/docs/guides/github.html +215 -0
- package/dist/docs/guides/github.md +326 -0
- package/dist/docs/guides/gitlab.html +212 -0
- package/dist/docs/guides/gitlab.md +294 -0
- package/dist/docs/guides/grokbot-agents.html +75 -0
- package/dist/docs/guides/grokbot-agents.md +142 -0
- package/dist/docs/guides/hooks.html +109 -0
- package/dist/docs/guides/hooks.md +114 -0
- package/dist/docs/guides/improve.html +81 -0
- package/dist/docs/guides/improve.md +134 -0
- package/dist/docs/guides/jev.html +210 -0
- package/dist/docs/guides/jev.md +294 -0
- package/dist/docs/guides/mcp-oauth.html +109 -0
- package/dist/docs/guides/mcp-oauth.md +162 -0
- package/dist/docs/guides/opentelemetry.html +94 -0
- package/dist/docs/guides/opentelemetry.md +153 -0
- package/dist/docs/guides/slack.html +129 -0
- package/dist/docs/guides/slack.md +273 -0
- package/dist/docs/guides/webhooks.html +151 -0
- package/dist/docs/guides/webhooks.md +236 -0
- package/dist/docs/hashmap.json +1 -0
- package/dist/docs/hillclimbing.html +66 -0
- package/dist/docs/hillclimbing.md +137 -0
- package/dist/docs/index.html +86 -0
- package/dist/docs/index.md +114 -0
- package/dist/docs/llms-full.txt +8439 -0
- package/dist/docs/llms.txt +62 -0
- package/dist/docs/quickstart.html +227 -0
- package/dist/docs/quickstart.md +306 -0
- package/dist/docs/reference/agent-config.html +91 -0
- package/dist/docs/reference/agent-config.md +188 -0
- package/dist/docs/reference/artifacts.html +77 -0
- package/dist/docs/reference/artifacts.md +116 -0
- package/dist/docs/reference/channels.html +82 -0
- package/dist/docs/reference/channels.md +198 -0
- package/dist/docs/reference/cli.html +156 -0
- package/dist/docs/reference/cli.md +904 -0
- package/dist/docs/reference/connections.html +122 -0
- package/dist/docs/reference/connections.md +272 -0
- package/dist/docs/reference/evals.html +115 -0
- package/dist/docs/reference/evals.md +287 -0
- package/dist/docs/reference/extensions.html +117 -0
- package/dist/docs/reference/extensions.md +193 -0
- package/dist/docs/reference/hooks.html +104 -0
- package/dist/docs/reference/hooks.md +190 -0
- package/dist/docs/reference/http-api.html +70 -0
- package/dist/docs/reference/http-api.md +231 -0
- package/dist/docs/reference/instructions.html +73 -0
- package/dist/docs/reference/instructions.md +63 -0
- package/dist/docs/reference/playground.html +60 -0
- package/dist/docs/reference/playground.md +42 -0
- package/dist/docs/reference/project-layout.html +84 -0
- package/dist/docs/reference/project-layout.md +115 -0
- package/dist/docs/reference/prompt.html +68 -0
- package/dist/docs/reference/prompt.md +50 -0
- package/dist/docs/reference/schedules.html +106 -0
- package/dist/docs/reference/schedules.md +170 -0
- package/dist/docs/reference/sessions.html +60 -0
- package/dist/docs/reference/sessions.md +160 -0
- package/dist/docs/reference/skills.html +74 -0
- package/dist/docs/reference/skills.md +75 -0
- package/dist/docs/reference/subagents.html +69 -0
- package/dist/docs/reference/subagents.md +62 -0
- package/dist/docs/reference/tools.html +149 -0
- package/dist/docs/reference/tools.md +324 -0
- package/dist/docs/templates/agentic-owners.html +73 -0
- package/dist/docs/templates/agentic-owners.md +95 -0
- package/dist/docs/templates/security-reviewer.html +61 -0
- package/dist/docs/templates/security-reviewer.md +85 -0
- package/dist/docs/templates/thermo-quality-review.html +62 -0
- package/dist/docs/templates/thermo-quality-review.md +78 -0
- package/dist/docs/templates/thermo-review.html +62 -0
- package/dist/docs/templates/thermo-review.md +77 -0
- package/dist/docs/templates/triage.html +68 -0
- package/dist/docs/templates/triage.md +97 -0
- package/dist/docs/troubleshooting.html +60 -0
- package/dist/docs/troubleshooting.md +143 -0
- package/dist/docs/vp-icons.css +0 -0
- package/dist/evals/assertions.d.ts +199 -0
- package/dist/evals/assertions.d.ts.map +1 -0
- package/dist/evals/assertions.js +459 -0
- package/dist/evals/expect.d.ts +95 -0
- package/dist/evals/expect.d.ts.map +1 -0
- package/dist/evals/expect.js +187 -0
- package/dist/evals/judge.d.ts +133 -0
- package/dist/evals/judge.d.ts.map +1 -0
- package/dist/evals/judge.js +224 -0
- package/dist/evals/loaders.d.ts +51 -0
- package/dist/evals/loaders.d.ts.map +1 -0
- package/dist/evals/loaders.js +124 -0
- package/dist/evals/matchers.d.ts +95 -0
- package/dist/evals/matchers.d.ts.map +1 -0
- package/dist/evals/matchers.js +142 -0
- package/dist/evals/reporters.d.ts +70 -0
- package/dist/evals/reporters.d.ts.map +1 -0
- package/dist/evals/reporters.js +220 -0
- package/dist/evals/results.d.ts +103 -0
- package/dist/evals/results.d.ts.map +1 -0
- package/dist/evals/results.js +27 -0
- package/dist/evals/run-facts.d.ts +77 -0
- package/dist/evals/run-facts.d.ts.map +1 -0
- package/dist/evals/run-facts.js +214 -0
- package/dist/evals.d.ts +446 -0
- package/dist/evals.d.ts.map +1 -0
- package/dist/evals.js +292 -0
- 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 +280 -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 +81 -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 +53 -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 +37 -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/improve/extension.d.ts +48 -0
- package/dist/extensions/improve/extension.d.ts.map +1 -0
- package/dist/extensions/improve/extension.js +43 -0
- package/dist/extensions/improve/skills/yourself.d.ts +4 -0
- package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
- package/dist/extensions/improve/skills/yourself.js +43 -0
- package/dist/extensions/jev/extension.d.ts +43 -0
- package/dist/extensions/jev/extension.d.ts.map +1 -0
- package/dist/extensions/jev/extension.js +47 -0
- package/dist/extensions/jev/lib/evaluate.d.ts +101 -0
- package/dist/extensions/jev/lib/evaluate.d.ts.map +1 -0
- package/dist/extensions/jev/lib/evaluate.js +167 -0
- package/dist/extensions/jev/skills/gated-write.md +25 -0
- package/dist/extensions/jev/skills/questions.md +33 -0
- package/dist/extensions/jev/tools/evaluate.d.ts +4 -0
- package/dist/extensions/jev/tools/evaluate.d.ts.map +1 -0
- package/dist/extensions/jev/tools/evaluate.js +83 -0
- package/dist/extensions/slack-communication/extension.d.ts +28 -0
- package/dist/extensions/slack-communication/extension.d.ts.map +1 -0
- package/dist/extensions/slack-communication/extension.js +32 -0
- package/dist/extensions/slack-communication/skills/slack-voice.d.ts +5 -0
- package/dist/extensions/slack-communication/skills/slack-voice.d.ts.map +1 -0
- package/dist/extensions/slack-communication/skills/slack-voice.js +52 -0
- package/dist/extensions/slack-communication/tools/delete-message.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/delete-message.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/delete-message.js +29 -0
- package/dist/extensions/slack-communication/tools/edit-message.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/edit-message.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/edit-message.js +37 -0
- package/dist/extensions/slack-communication/tools/post-card.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/post-card.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/post-card.js +25 -0
- package/dist/extensions/slack-communication/tools/post-file.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/post-file.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/post-file.js +75 -0
- package/dist/extensions/slack-communication/tools/post-update.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/post-update.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/post-update.js +36 -0
- package/dist/extensions/slack-communication/tools/react.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/react.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/react.js +27 -0
- package/dist/extensions/slack-communication/tools/set-status.d.ts +4 -0
- package/dist/extensions/slack-communication/tools/set-status.d.ts.map +1 -0
- package/dist/extensions/slack-communication/tools/set-status.js +18 -0
- package/dist/extensions.d.ts +85 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +140 -0
- package/dist/files-backends/agent-store-presigned-url.d.ts +3 -0
- package/dist/files-backends/agent-store-presigned-url.d.ts.map +1 -0
- package/dist/files-backends/agent-store-presigned-url.js +223 -0
- package/dist/files-backends/cursor-hosted.d.ts +126 -0
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -0
- package/dist/files-backends/cursor-hosted.js +978 -0
- package/dist/files-backends/local-fs.d.ts +33 -0
- package/dist/files-backends/local-fs.d.ts.map +1 -0
- package/dist/files-backends/local-fs.js +195 -0
- package/dist/files.d.ts +225 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +152 -0
- package/dist/filesystem.d.ts +484 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +1698 -0
- package/dist/hooks.d.ts +25 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +25 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/internal/advertise-tools.d.ts +95 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -0
- package/dist/internal/advertise-tools.js +265 -0
- package/dist/internal/approval-gate.d.ts +33 -0
- package/dist/internal/approval-gate.d.ts.map +1 -0
- package/dist/internal/approval-gate.js +80 -0
- package/dist/internal/artifacts-store.d.ts +125 -0
- package/dist/internal/artifacts-store.d.ts.map +1 -0
- package/dist/internal/artifacts-store.js +737 -0
- package/dist/internal/as-of.d.ts +37 -0
- package/dist/internal/as-of.d.ts.map +1 -0
- package/dist/internal/as-of.js +207 -0
- package/dist/internal/auth.d.ts +12 -0
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +34 -0
- package/dist/internal/authored-alias-hooks.d.ts +42 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -0
- package/dist/internal/authored-alias-hooks.js +93 -0
- package/dist/internal/authored-loaders.d.ts +50 -0
- package/dist/internal/authored-loaders.d.ts.map +1 -0
- package/dist/internal/authored-loaders.js +182 -0
- package/dist/internal/bounded-int.d.ts +11 -0
- package/dist/internal/bounded-int.d.ts.map +1 -0
- package/dist/internal/bounded-int.js +13 -0
- package/dist/internal/bounded.d.ts +7 -0
- package/dist/internal/bounded.d.ts.map +1 -0
- package/dist/internal/bounded.js +32 -0
- package/dist/internal/brand.d.ts +6 -0
- package/dist/internal/brand.d.ts.map +1 -0
- package/dist/internal/brand.js +17 -0
- package/dist/internal/browser-origin-guard.d.ts +19 -0
- package/dist/internal/browser-origin-guard.d.ts.map +1 -0
- package/dist/internal/browser-origin-guard.js +51 -0
- package/dist/internal/builtin-tools/artifacts.d.ts +10 -0
- package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -0
- package/dist/internal/builtin-tools/artifacts.js +66 -0
- package/dist/internal/builtin-tools/index.d.ts +17 -0
- package/dist/internal/builtin-tools/index.d.ts.map +1 -0
- package/dist/internal/builtin-tools/index.js +40 -0
- package/dist/internal/builtin-tools/reminders.d.ts +9 -0
- package/dist/internal/builtin-tools/reminders.d.ts.map +1 -0
- package/dist/internal/builtin-tools/reminders.js +134 -0
- package/dist/internal/channel-dispatch.d.ts +43 -0
- package/dist/internal/channel-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-dispatch.js +75 -0
- package/dist/internal/channel-route-dispatch.d.ts +13 -0
- package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-route-dispatch.js +62 -0
- package/dist/internal/channel-state.d.ts +17 -0
- package/dist/internal/channel-state.d.ts.map +1 -0
- package/dist/internal/channel-state.js +69 -0
- package/dist/internal/chat-client.d.ts +45 -0
- package/dist/internal/chat-client.d.ts.map +1 -0
- package/dist/internal/chat-client.js +478 -0
- package/dist/internal/cli-ax.d.ts +233 -0
- package/dist/internal/cli-ax.d.ts.map +1 -0
- package/dist/internal/cli-ax.js +1864 -0
- package/dist/internal/cli-bitbucket.d.ts +33 -0
- package/dist/internal/cli-bitbucket.d.ts.map +1 -0
- package/dist/internal/cli-bitbucket.js +360 -0
- package/dist/internal/cli-convert-automation.d.ts +39 -0
- package/dist/internal/cli-convert-automation.d.ts.map +1 -0
- package/dist/internal/cli-convert-automation.js +281 -0
- package/dist/internal/cli-cursor.d.ts +38 -0
- package/dist/internal/cli-cursor.d.ts.map +1 -0
- package/dist/internal/cli-cursor.js +226 -0
- package/dist/internal/cli-deploy.d.ts +164 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -0
- package/dist/internal/cli-deploy.js +1930 -0
- package/dist/internal/cli-docs.d.ts +34 -0
- package/dist/internal/cli-docs.d.ts.map +1 -0
- package/dist/internal/cli-docs.js +173 -0
- package/dist/internal/cli-github.d.ts +47 -0
- package/dist/internal/cli-github.d.ts.map +1 -0
- package/dist/internal/cli-github.js +639 -0
- package/dist/internal/cli-gitlab.d.ts +37 -0
- package/dist/internal/cli-gitlab.d.ts.map +1 -0
- package/dist/internal/cli-gitlab.js +379 -0
- package/dist/internal/cli-images.d.ts +68 -0
- package/dist/internal/cli-images.d.ts.map +1 -0
- package/dist/internal/cli-images.js +604 -0
- package/dist/internal/cli-manifest.d.ts +19 -0
- package/dist/internal/cli-manifest.d.ts.map +1 -0
- package/dist/internal/cli-manifest.js +49 -0
- package/dist/internal/cli-mcp-oauth.d.ts +51 -0
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -0
- package/dist/internal/cli-mcp-oauth.js +318 -0
- package/dist/internal/cli-mcp.d.ts +75 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -0
- package/dist/internal/cli-mcp.js +684 -0
- package/dist/internal/cli-skills.d.ts +21 -0
- package/dist/internal/cli-skills.d.ts.map +1 -0
- package/dist/internal/cli-skills.js +77 -0
- package/dist/internal/cli-slack-manual.d.ts +42 -0
- package/dist/internal/cli-slack-manual.d.ts.map +1 -0
- package/dist/internal/cli-slack-manual.js +325 -0
- package/dist/internal/cli-slack.d.ts +59 -0
- package/dist/internal/cli-slack.d.ts.map +1 -0
- package/dist/internal/cli-slack.js +695 -0
- package/dist/internal/cloud-merge.d.ts +25 -0
- package/dist/internal/cloud-merge.d.ts.map +1 -0
- package/dist/internal/cloud-merge.js +36 -0
- package/dist/internal/cloud-turn-cost.d.ts +42 -0
- package/dist/internal/cloud-turn-cost.d.ts.map +1 -0
- package/dist/internal/cloud-turn-cost.js +113 -0
- package/dist/internal/continuation-channel.d.ts +48 -0
- package/dist/internal/continuation-channel.d.ts.map +1 -0
- package/dist/internal/continuation-channel.js +154 -0
- package/dist/internal/continuation-identity.d.ts +113 -0
- package/dist/internal/continuation-identity.d.ts.map +1 -0
- package/dist/internal/continuation-identity.js +749 -0
- package/dist/internal/conversation-mirror.d.ts +85 -0
- package/dist/internal/conversation-mirror.d.ts.map +1 -0
- package/dist/internal/conversation-mirror.js +342 -0
- package/dist/internal/convert-automation/convert-workflow.d.ts +10 -0
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -0
- package/dist/internal/convert-automation/convert-workflow.js +998 -0
- package/dist/internal/convert-automation/slug.d.ts +9 -0
- package/dist/internal/convert-automation/slug.d.ts.map +1 -0
- package/dist/internal/convert-automation/slug.js +28 -0
- package/dist/internal/convert-automation/types.d.ts +202 -0
- package/dist/internal/convert-automation/types.d.ts.map +1 -0
- package/dist/internal/convert-automation/types.js +13 -0
- package/dist/internal/cron.d.ts +17 -0
- package/dist/internal/cron.d.ts.map +1 -0
- package/dist/internal/cron.js +60 -0
- package/dist/internal/cursor/account-mcp.d.ts +135 -0
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -0
- package/dist/internal/cursor/account-mcp.js +510 -0
- package/dist/internal/cursor/backend-client.d.ts +224 -0
- package/dist/internal/cursor/backend-client.d.ts.map +1 -0
- package/dist/internal/cursor/backend-client.js +720 -0
- package/dist/internal/cursor/bound-secret-file.d.ts +56 -0
- package/dist/internal/cursor/bound-secret-file.d.ts.map +1 -0
- package/dist/internal/cursor/bound-secret-file.js +88 -0
- package/dist/internal/cursor/credentials.d.ts +195 -0
- package/dist/internal/cursor/credentials.d.ts.map +1 -0
- package/dist/internal/cursor/credentials.js +475 -0
- package/dist/internal/cursor/cursor-api-transport.d.ts +37 -0
- package/dist/internal/cursor/cursor-api-transport.d.ts.map +1 -0
- package/dist/internal/cursor/cursor-api-transport.js +44 -0
- package/dist/internal/cursor/github-credentials.d.ts +44 -0
- package/dist/internal/cursor/github-credentials.d.ts.map +1 -0
- package/dist/internal/cursor/github-credentials.js +191 -0
- package/dist/internal/cursor/hosted-bound-secrets.d.ts +41 -0
- package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-bound-secrets.js +54 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts +30 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-deployment-secrets.js +81 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts +63 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-store-secrets.js +112 -0
- package/dist/internal/cursor/session-token.d.ts +45 -0
- package/dist/internal/cursor/session-token.d.ts.map +1 -0
- package/dist/internal/cursor/session-token.js +97 -0
- package/dist/internal/cursor/store-api-client.d.ts +82 -0
- package/dist/internal/cursor/store-api-client.d.ts.map +1 -0
- package/dist/internal/cursor/store-api-client.js +226 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts +66 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -0
- package/dist/internal/cursor-account-mcp-auth.js +241 -0
- package/dist/internal/cursor-agent-template.d.ts +9 -0
- package/dist/internal/cursor-agent-template.d.ts.map +1 -0
- package/dist/internal/cursor-agent-template.js +43 -0
- package/dist/internal/cursor-deployment-relay.d.ts +95 -0
- package/dist/internal/cursor-deployment-relay.d.ts.map +1 -0
- package/dist/internal/cursor-deployment-relay.js +233 -0
- package/dist/internal/cursor-event-relay.d.ts +243 -0
- package/dist/internal/cursor-event-relay.d.ts.map +1 -0
- package/dist/internal/cursor-event-relay.js +424 -0
- package/dist/internal/cursor-relay-core.d.ts +160 -0
- package/dist/internal/cursor-relay-core.d.ts.map +1 -0
- package/dist/internal/cursor-relay-core.js +470 -0
- package/dist/internal/deferred-channel-session.d.ts +20 -0
- package/dist/internal/deferred-channel-session.d.ts.map +1 -0
- package/dist/internal/deferred-channel-session.js +62 -0
- package/dist/internal/deploy-client.d.ts +576 -0
- package/dist/internal/deploy-client.d.ts.map +1 -0
- package/dist/internal/deploy-client.js +987 -0
- package/dist/internal/deploy-manifest.d.ts +135 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -0
- package/dist/internal/deploy-manifest.js +231 -0
- package/dist/internal/deploy-source.d.ts +38 -0
- package/dist/internal/deploy-source.d.ts.map +1 -0
- package/dist/internal/deploy-source.js +136 -0
- package/dist/internal/describe-error.d.ts +4 -0
- package/dist/internal/describe-error.d.ts.map +1 -0
- package/dist/internal/describe-error.js +29 -0
- package/dist/internal/dev-mode.d.ts +13 -0
- package/dist/internal/dev-mode.d.ts.map +1 -0
- package/dist/internal/dev-mode.js +17 -0
- package/dist/internal/discovery/agent-config.d.ts +48 -0
- package/dist/internal/discovery/agent-config.d.ts.map +1 -0
- package/dist/internal/discovery/agent-config.js +224 -0
- package/dist/internal/discovery/agent.d.ts +16 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -0
- package/dist/internal/discovery/agent.js +326 -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 +13 -0
- package/dist/internal/discovery/connections.d.ts.map +1 -0
- package/dist/internal/discovery/connections.js +429 -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 +549 -0
- package/dist/internal/discovery/extension-overlay.d.ts +31 -0
- package/dist/internal/discovery/extension-overlay.d.ts.map +1 -0
- package/dist/internal/discovery/extension-overlay.js +173 -0
- package/dist/internal/discovery/extensions.d.ts +27 -0
- package/dist/internal/discovery/extensions.d.ts.map +1 -0
- package/dist/internal/discovery/extensions.js +352 -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 +61 -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 +168 -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 +104 -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 +37 -0
- package/dist/internal/discovery/project.d.ts +51 -0
- package/dist/internal/discovery/project.d.ts.map +1 -0
- package/dist/internal/discovery/project.js +290 -0
- package/dist/internal/discovery/reminders.d.ts +7 -0
- package/dist/internal/discovery/reminders.d.ts.map +1 -0
- package/dist/internal/discovery/reminders.js +65 -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 +97 -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 +118 -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 +26 -0
- package/dist/internal/discovery/services.d.ts.map +1 -0
- package/dist/internal/discovery/services.js +138 -0
- package/dist/internal/discovery/skills.d.ts +11 -0
- package/dist/internal/discovery/skills.d.ts.map +1 -0
- package/dist/internal/discovery/skills.js +156 -0
- package/dist/internal/discovery/subagent.d.ts +16 -0
- package/dist/internal/discovery/subagent.d.ts.map +1 -0
- package/dist/internal/discovery/subagent.js +129 -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 +155 -0
- package/dist/internal/discovery.d.ts +15 -0
- package/dist/internal/discovery.d.ts.map +1 -0
- package/dist/internal/discovery.js +13 -0
- package/dist/internal/distribution.d.ts +65 -0
- package/dist/internal/distribution.d.ts.map +1 -0
- package/dist/internal/distribution.js +102 -0
- package/dist/internal/docs-site.d.ts +41 -0
- package/dist/internal/docs-site.d.ts.map +1 -0
- package/dist/internal/docs-site.js +234 -0
- package/dist/internal/duration.d.ts +8 -0
- package/dist/internal/duration.d.ts.map +1 -0
- package/dist/internal/duration.js +35 -0
- package/dist/internal/env-file.d.ts +19 -0
- package/dist/internal/env-file.d.ts.map +1 -0
- package/dist/internal/env-file.js +90 -0
- package/dist/internal/eval-judge-model.d.ts +59 -0
- package/dist/internal/eval-judge-model.d.ts.map +1 -0
- package/dist/internal/eval-judge-model.js +129 -0
- package/dist/internal/eval-run-store.d.ts +119 -0
- package/dist/internal/eval-run-store.d.ts.map +1 -0
- package/dist/internal/eval-run-store.js +468 -0
- package/dist/internal/eval-runner.d.ts +98 -0
- package/dist/internal/eval-runner.d.ts.map +1 -0
- package/dist/internal/eval-runner.js +615 -0
- package/dist/internal/evals-client.d.ts +104 -0
- package/dist/internal/evals-client.d.ts.map +1 -0
- package/dist/internal/evals-client.js +303 -0
- package/dist/internal/event-log.d.ts +94 -0
- package/dist/internal/event-log.d.ts.map +1 -0
- package/dist/internal/event-log.js +347 -0
- package/dist/internal/event-mapper.d.ts +123 -0
- package/dist/internal/event-mapper.d.ts.map +1 -0
- package/dist/internal/event-mapper.js +370 -0
- package/dist/internal/expected-delivery-failure.d.ts +3 -0
- package/dist/internal/expected-delivery-failure.d.ts.map +1 -0
- package/dist/internal/expected-delivery-failure.js +28 -0
- package/dist/internal/factory-resource-channel.d.ts +33 -0
- package/dist/internal/factory-resource-channel.d.ts.map +1 -0
- package/dist/internal/factory-resource-channel.js +77 -0
- package/dist/internal/filesystem/errors.d.ts +64 -0
- package/dist/internal/filesystem/errors.d.ts.map +1 -0
- package/dist/internal/filesystem/errors.js +172 -0
- package/dist/internal/filesystem/format.d.ts +28 -0
- package/dist/internal/filesystem/format.d.ts.map +1 -0
- package/dist/internal/filesystem/format.js +212 -0
- package/dist/internal/filesystem/merge.d.ts +34 -0
- package/dist/internal/filesystem/merge.d.ts.map +1 -0
- package/dist/internal/filesystem/merge.js +196 -0
- package/dist/internal/filesystem/nearest.d.ts +14 -0
- package/dist/internal/filesystem/nearest.d.ts.map +1 -0
- package/dist/internal/filesystem/nearest.js +101 -0
- package/dist/internal/filesystem/scratch.d.ts +59 -0
- package/dist/internal/filesystem/scratch.d.ts.map +1 -0
- package/dist/internal/filesystem/scratch.js +204 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts +29 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts.map +1 -0
- package/dist/internal/filesystem/sdk-schemas.js +153 -0
- package/dist/internal/filesystem/tools.d.ts +42 -0
- package/dist/internal/filesystem/tools.d.ts.map +1 -0
- package/dist/internal/filesystem/tools.js +631 -0
- package/dist/internal/filesystem/walk.d.ts +77 -0
- package/dist/internal/filesystem/walk.d.ts.map +1 -0
- package/dist/internal/filesystem/walk.js +350 -0
- package/dist/internal/framework-file-storage.d.ts +75 -0
- package/dist/internal/framework-file-storage.d.ts.map +1 -0
- package/dist/internal/framework-file-storage.js +338 -0
- package/dist/internal/framework-storage-selection.d.ts +66 -0
- package/dist/internal/framework-storage-selection.d.ts.map +1 -0
- package/dist/internal/framework-storage-selection.js +123 -0
- package/dist/internal/frontmatter.d.ts +20 -0
- package/dist/internal/frontmatter.d.ts.map +1 -0
- package/dist/internal/frontmatter.js +87 -0
- package/dist/internal/github-fanout.d.ts +32 -0
- package/dist/internal/github-fanout.d.ts.map +1 -0
- package/dist/internal/github-fanout.js +120 -0
- package/dist/internal/guest-network.d.ts +98 -0
- package/dist/internal/guest-network.d.ts.map +1 -0
- package/dist/internal/guest-network.js +326 -0
- package/dist/internal/handleAgentServeTrigger.d.ts +91 -0
- package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -0
- package/dist/internal/handleAgentServeTrigger.js +199 -0
- package/dist/internal/host-files.d.ts +29 -0
- package/dist/internal/host-files.d.ts.map +1 -0
- package/dist/internal/host-files.js +274 -0
- package/dist/internal/host-kv.d.ts +21 -0
- package/dist/internal/host-kv.d.ts.map +1 -0
- package/dist/internal/host-kv.js +77 -0
- package/dist/internal/host-otel.d.ts +25 -0
- package/dist/internal/host-otel.d.ts.map +1 -0
- package/dist/internal/host-otel.js +162 -0
- package/dist/internal/host-platforms.d.ts +58 -0
- package/dist/internal/host-platforms.d.ts.map +1 -0
- package/dist/internal/host-platforms.js +126 -0
- package/dist/internal/hosted-admission-adapter.d.ts +36 -0
- package/dist/internal/hosted-admission-adapter.d.ts.map +1 -0
- package/dist/internal/hosted-admission-adapter.js +7 -0
- package/dist/internal/hosted-admission-context.d.ts +20 -0
- package/dist/internal/hosted-admission-context.d.ts.map +1 -0
- package/dist/internal/hosted-admission-context.js +31 -0
- package/dist/internal/hosted-catch-protocol.d.ts +51 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-catch-protocol.js +87 -0
- package/dist/internal/hosted-catch.d.ts +40 -0
- package/dist/internal/hosted-catch.d.ts.map +1 -0
- package/dist/internal/hosted-catch.js +146 -0
- package/dist/internal/hosted-delivery-protocol.d.ts +199 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-delivery-protocol.js +516 -0
- package/dist/internal/hosted-delivery.d.ts +110 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -0
- package/dist/internal/hosted-delivery.js +768 -0
- package/dist/internal/hosted-execution-diag.d.ts +75 -0
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -0
- package/dist/internal/hosted-execution-diag.js +220 -0
- package/dist/internal/hosted-execution-flush.d.ts +50 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -0
- package/dist/internal/hosted-execution-flush.js +71 -0
- package/dist/internal/hosted-execution-latency.d.ts +80 -0
- package/dist/internal/hosted-execution-latency.d.ts.map +1 -0
- package/dist/internal/hosted-execution-latency.js +218 -0
- package/dist/internal/hosted-managed-automation.d.ts +30 -0
- package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
- package/dist/internal/hosted-managed-automation.js +83 -0
- package/dist/internal/hosting.d.ts +53 -0
- package/dist/internal/hosting.d.ts.map +1 -0
- package/dist/internal/hosting.js +93 -0
- package/dist/internal/http-channel-define.d.ts +11 -0
- package/dist/internal/http-channel-define.d.ts.map +1 -0
- package/dist/internal/http-channel-define.js +18 -0
- package/dist/internal/http-channel.d.ts +54 -0
- package/dist/internal/http-channel.d.ts.map +1 -0
- package/dist/internal/http-channel.js +534 -0
- package/dist/internal/http-control-plane-session.d.ts +34 -0
- package/dist/internal/http-control-plane-session.d.ts.map +1 -0
- package/dist/internal/http-control-plane-session.js +93 -0
- package/dist/internal/ids.d.ts +19 -0
- package/dist/internal/ids.d.ts.map +1 -0
- package/dist/internal/ids.js +34 -0
- package/dist/internal/incoming-headers-to-fetch.d.ts +10 -0
- package/dist/internal/incoming-headers-to-fetch.d.ts.map +1 -0
- package/dist/internal/incoming-headers-to-fetch.js +41 -0
- package/dist/internal/init-interview.d.ts +67 -0
- package/dist/internal/init-interview.d.ts.map +1 -0
- package/dist/internal/init-interview.js +295 -0
- package/dist/internal/init-project.d.ts +175 -0
- package/dist/internal/init-project.d.ts.map +1 -0
- package/dist/internal/init-project.js +531 -0
- package/dist/internal/init-scaffold.d.ts +9 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -0
- package/dist/internal/init-scaffold.js +172 -0
- package/dist/internal/inline-stdio-define-stub.d.ts +3 -0
- package/dist/internal/inline-stdio-define-stub.d.ts.map +1 -0
- package/dist/internal/inline-stdio-define-stub.js +4 -0
- package/dist/internal/inline-stdio-mcp.d.ts +34 -0
- package/dist/internal/inline-stdio-mcp.d.ts.map +1 -0
- package/dist/internal/inline-stdio-mcp.js +176 -0
- package/dist/internal/install-cursor-skills.d.ts +164 -0
- package/dist/internal/install-cursor-skills.d.ts.map +1 -0
- package/dist/internal/install-cursor-skills.js +498 -0
- package/dist/internal/is-record.d.ts +2 -0
- package/dist/internal/is-record.d.ts.map +1 -0
- package/dist/internal/is-record.js +3 -0
- package/dist/internal/json-schema.d.ts +25 -0
- package/dist/internal/json-schema.d.ts.map +1 -0
- package/dist/internal/json-schema.js +76 -0
- package/dist/internal/legacy-command-guard.d.ts +22 -0
- package/dist/internal/legacy-command-guard.d.ts.map +1 -0
- package/dist/internal/legacy-command-guard.js +51 -0
- package/dist/internal/listen-port.d.ts +22 -0
- package/dist/internal/listen-port.d.ts.map +1 -0
- package/dist/internal/listen-port.js +77 -0
- package/dist/internal/local-control-plane.d.ts +59 -0
- package/dist/internal/local-control-plane.d.ts.map +1 -0
- package/dist/internal/local-control-plane.js +351 -0
- package/dist/internal/local-env.d.ts +10 -0
- package/dist/internal/local-env.d.ts.map +1 -0
- package/dist/internal/local-env.js +55 -0
- package/dist/internal/local-ingress.d.ts +35 -0
- package/dist/internal/local-ingress.d.ts.map +1 -0
- package/dist/internal/local-ingress.js +44 -0
- package/dist/internal/log-ring.d.ts +23 -0
- package/dist/internal/log-ring.d.ts.map +1 -0
- package/dist/internal/log-ring.js +42 -0
- package/dist/internal/logs-client.d.ts +79 -0
- package/dist/internal/logs-client.d.ts.map +1 -0
- package/dist/internal/logs-client.js +350 -0
- package/dist/internal/map-pool.d.ts +11 -0
- package/dist/internal/map-pool.d.ts.map +1 -0
- package/dist/internal/map-pool.js +48 -0
- package/dist/internal/mcp-endpoint.d.ts +72 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -0
- package/dist/internal/mcp-endpoint.js +530 -0
- package/dist/internal/mcp-host.d.ts +84 -0
- package/dist/internal/mcp-host.d.ts.map +1 -0
- package/dist/internal/mcp-host.js +391 -0
- package/dist/internal/mcp-oauth-on-demand.d.ts +68 -0
- package/dist/internal/mcp-oauth-on-demand.d.ts.map +1 -0
- package/dist/internal/mcp-oauth-on-demand.js +287 -0
- package/dist/internal/mcp-oauth-persist.d.ts +42 -0
- package/dist/internal/mcp-oauth-persist.d.ts.map +1 -0
- package/dist/internal/mcp-oauth-persist.js +90 -0
- package/dist/internal/mcp-oauth.d.ts +118 -0
- package/dist/internal/mcp-oauth.d.ts.map +1 -0
- package/dist/internal/mcp-oauth.js +450 -0
- package/dist/internal/net.d.ts +5 -0
- package/dist/internal/net.d.ts.map +1 -0
- package/dist/internal/net.js +28 -0
- package/dist/internal/open-browser.d.ts +5 -0
- package/dist/internal/open-browser.d.ts.map +1 -0
- package/dist/internal/open-browser.js +34 -0
- package/dist/internal/otel/attrs.d.ts +7 -0
- package/dist/internal/otel/attrs.d.ts.map +1 -0
- package/dist/internal/otel/attrs.js +13 -0
- package/dist/internal/otel/collector.d.ts +43 -0
- package/dist/internal/otel/collector.d.ts.map +1 -0
- package/dist/internal/otel/collector.js +650 -0
- package/dist/internal/otel/config.d.ts +40 -0
- package/dist/internal/otel/config.d.ts.map +1 -0
- package/dist/internal/otel/config.js +231 -0
- package/dist/internal/otel/http.d.ts +13 -0
- package/dist/internal/otel/http.d.ts.map +1 -0
- package/dist/internal/otel/http.js +95 -0
- 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 +55 -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 +46 -0
- package/dist/internal/otel/runtime.d.ts.map +1 -0
- package/dist/internal/otel/runtime.js +333 -0
- package/dist/internal/package-inline-stdio.d.ts +12 -0
- package/dist/internal/package-inline-stdio.d.ts.map +1 -0
- package/dist/internal/package-inline-stdio.js +99 -0
- package/dist/internal/peer-connections.d.ts +44 -0
- package/dist/internal/peer-connections.d.ts.map +1 -0
- package/dist/internal/peer-connections.js +67 -0
- package/dist/internal/platform-schedule-sync.d.ts +17 -0
- package/dist/internal/platform-schedule-sync.d.ts.map +1 -0
- package/dist/internal/platform-schedule-sync.js +70 -0
- package/dist/internal/platform-timers.d.ts +35 -0
- package/dist/internal/platform-timers.d.ts.map +1 -0
- package/dist/internal/platform-timers.js +277 -0
- package/dist/internal/playground/static.d.ts +52 -0
- package/dist/internal/playground/static.d.ts.map +1 -0
- package/dist/internal/playground/static.js +231 -0
- package/dist/internal/playground/toolchain.d.ts +57 -0
- package/dist/internal/playground/toolchain.d.ts.map +1 -0
- package/dist/internal/playground/toolchain.js +229 -0
- package/dist/internal/playground-proxy.d.ts +69 -0
- package/dist/internal/playground-proxy.d.ts.map +1 -0
- package/dist/internal/playground-proxy.js +474 -0
- package/dist/internal/process-memory-telemetry.d.ts +89 -0
- package/dist/internal/process-memory-telemetry.d.ts.map +1 -0
- package/dist/internal/process-memory-telemetry.js +244 -0
- package/dist/internal/project-layout.d.ts +7 -0
- package/dist/internal/project-layout.d.ts.map +1 -0
- package/dist/internal/project-layout.js +24 -0
- package/dist/internal/prompt-context.d.ts +38 -0
- package/dist/internal/prompt-context.d.ts.map +1 -0
- package/dist/internal/prompt-context.js +89 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts +189 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -0
- package/dist/internal/reminder-control-plane-protocol.js +246 -0
- package/dist/internal/reminder-runner.d.ts +208 -0
- package/dist/internal/reminder-runner.d.ts.map +1 -0
- package/dist/internal/reminder-runner.js +1231 -0
- package/dist/internal/reminder-schedule.d.ts +25 -0
- package/dist/internal/reminder-schedule.d.ts.map +1 -0
- package/dist/internal/reminder-schedule.js +82 -0
- package/dist/internal/reminder-store.d.ts +78 -0
- package/dist/internal/reminder-store.d.ts.map +1 -0
- package/dist/internal/reminder-store.js +126 -0
- package/dist/internal/request-error-status.d.ts +14 -0
- package/dist/internal/request-error-status.d.ts.map +1 -0
- package/dist/internal/request-error-status.js +76 -0
- package/dist/internal/request-headers.d.ts +11 -0
- package/dist/internal/request-headers.d.ts.map +1 -0
- package/dist/internal/request-headers.js +14 -0
- package/dist/internal/resolve-prod-target.d.ts +84 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -0
- package/dist/internal/resolve-prod-target.js +259 -0
- package/dist/internal/resolved-connections.d.ts +62 -0
- package/dist/internal/resolved-connections.d.ts.map +1 -0
- package/dist/internal/resolved-connections.js +93 -0
- package/dist/internal/router.d.ts +33 -0
- package/dist/internal/router.d.ts.map +1 -0
- package/dist/internal/router.js +93 -0
- package/dist/internal/run-client.d.ts +68 -0
- package/dist/internal/run-client.d.ts.map +1 -0
- package/dist/internal/run-client.js +239 -0
- package/dist/internal/runtime-dispatch-runner.d.ts +24 -0
- package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -0
- package/dist/internal/runtime-dispatch-runner.js +54 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts +20 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts.map +1 -0
- package/dist/internal/sanitize-mcp-tool-name.js +28 -0
- package/dist/internal/schedule-runner.d.ts +31 -0
- package/dist/internal/schedule-runner.d.ts.map +1 -0
- package/dist/internal/schedule-runner.js +127 -0
- package/dist/internal/scm/pr-url.d.ts +56 -0
- package/dist/internal/scm/pr-url.d.ts.map +1 -0
- package/dist/internal/scm/pr-url.js +152 -0
- package/dist/internal/sdk-runner.d.ts +190 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -0
- package/dist/internal/sdk-runner.js +714 -0
- package/dist/internal/serve-restart.d.ts +42 -0
- package/dist/internal/serve-restart.d.ts.map +1 -0
- package/dist/internal/serve-restart.js +85 -0
- package/dist/internal/server.d.ts +34 -0
- package/dist/internal/server.d.ts.map +1 -0
- package/dist/internal/server.js +2464 -0
- package/dist/internal/session-cost.d.ts +50 -0
- package/dist/internal/session-cost.d.ts.map +1 -0
- package/dist/internal/session-cost.js +157 -0
- package/dist/internal/session-engine.d.ts +912 -0
- package/dist/internal/session-engine.d.ts.map +1 -0
- package/dist/internal/session-engine.js +4493 -0
- package/dist/internal/session-links.d.ts +14 -0
- package/dist/internal/session-links.d.ts.map +1 -0
- package/dist/internal/session-links.js +67 -0
- package/dist/internal/session-run-log.d.ts +122 -0
- package/dist/internal/session-run-log.d.ts.map +1 -0
- package/dist/internal/session-run-log.js +345 -0
- package/dist/internal/session-store.d.ts +73 -0
- package/dist/internal/session-store.d.ts.map +1 -0
- package/dist/internal/session-store.js +310 -0
- package/dist/internal/session-urls.d.ts +10 -0
- package/dist/internal/session-urls.d.ts.map +1 -0
- package/dist/internal/session-urls.js +25 -0
- package/dist/internal/sessions-client.d.ts +50 -0
- package/dist/internal/sessions-client.d.ts.map +1 -0
- package/dist/internal/sessions-client.js +207 -0
- package/dist/internal/skill-catalog.d.ts +28 -0
- package/dist/internal/skill-catalog.d.ts.map +1 -0
- package/dist/internal/skill-catalog.js +41 -0
- package/dist/internal/skills-sync.d.ts +24 -0
- package/dist/internal/skills-sync.d.ts.map +1 -0
- package/dist/internal/skills-sync.js +56 -0
- package/dist/internal/slack-provision-client.d.ts +198 -0
- package/dist/internal/slack-provision-client.d.ts.map +1 -0
- package/dist/internal/slack-provision-client.js +346 -0
- package/dist/internal/slack-thread-key.d.ts +7 -0
- package/dist/internal/slack-thread-key.d.ts.map +1 -0
- package/dist/internal/slack-thread-key.js +10 -0
- package/dist/internal/sleep.d.ts +2 -0
- package/dist/internal/sleep.d.ts.map +1 -0
- package/dist/internal/sleep.js +3 -0
- package/dist/internal/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/steering.d.ts +15 -0
- package/dist/internal/steering.d.ts.map +1 -0
- package/dist/internal/steering.js +18 -0
- package/dist/internal/storage-coordinator.d.ts +203 -0
- package/dist/internal/storage-coordinator.d.ts.map +1 -0
- package/dist/internal/storage-coordinator.js +705 -0
- package/dist/internal/storage-roles.d.ts +78 -0
- package/dist/internal/storage-roles.d.ts.map +1 -0
- package/dist/internal/storage-roles.js +24 -0
- package/dist/internal/storage.d.ts +2 -0
- package/dist/internal/storage.d.ts.map +1 -0
- package/dist/internal/storage.js +1 -0
- package/dist/internal/store-api-protocol.d.ts +134 -0
- package/dist/internal/store-api-protocol.d.ts.map +1 -0
- package/dist/internal/store-api-protocol.js +124 -0
- package/dist/internal/store-mirror.d.ts +29 -0
- package/dist/internal/store-mirror.d.ts.map +1 -0
- package/dist/internal/store-mirror.js +70 -0
- package/dist/internal/stream-progress.d.ts +14 -0
- package/dist/internal/stream-progress.d.ts.map +1 -0
- package/dist/internal/stream-progress.js +229 -0
- package/dist/internal/terminal-style.d.ts +40 -0
- package/dist/internal/terminal-style.d.ts.map +1 -0
- package/dist/internal/terminal-style.js +94 -0
- package/dist/internal/testing/factory-resource-fixtures.d.ts +48 -0
- package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/factory-resource-fixtures.js +41 -0
- package/dist/internal/testing/scm-continuation-fixtures.d.ts +33 -0
- package/dist/internal/testing/scm-continuation-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/scm-continuation-fixtures.js +253 -0
- package/dist/internal/tool-catalog.d.ts +31 -0
- package/dist/internal/tool-catalog.d.ts.map +1 -0
- package/dist/internal/tool-catalog.js +70 -0
- package/dist/internal/tool-policy.d.ts +110 -0
- package/dist/internal/tool-policy.d.ts.map +1 -0
- package/dist/internal/tool-policy.js +138 -0
- package/dist/internal/tool-result.d.ts +20 -0
- package/dist/internal/tool-result.d.ts.map +1 -0
- package/dist/internal/tool-result.js +45 -0
- package/dist/internal/trajectory.d.ts +69 -0
- package/dist/internal/trajectory.d.ts.map +1 -0
- package/dist/internal/trajectory.js +351 -0
- package/dist/internal/turn-cost.d.ts +41 -0
- package/dist/internal/turn-cost.d.ts.map +1 -0
- package/dist/internal/turn-cost.js +109 -0
- package/dist/internal/turn-governor.d.ts +54 -0
- package/dist/internal/turn-governor.d.ts.map +1 -0
- package/dist/internal/turn-governor.js +111 -0
- package/dist/internal/turn-lease-store.d.ts +44 -0
- package/dist/internal/turn-lease-store.d.ts.map +1 -0
- package/dist/internal/turn-lease-store.js +139 -0
- package/dist/internal/turn-outbox.d.ts +24 -0
- package/dist/internal/turn-outbox.d.ts.map +1 -0
- package/dist/internal/turn-outbox.js +80 -0
- package/dist/internal/update-check.d.ts +93 -0
- package/dist/internal/update-check.d.ts.map +1 -0
- package/dist/internal/update-check.js +427 -0
- package/dist/internal/v2-hosting.d.ts +31 -0
- package/dist/internal/v2-hosting.d.ts.map +1 -0
- package/dist/internal/v2-hosting.js +33 -0
- package/dist/internal/workspace-sync.d.ts +47 -0
- package/dist/internal/workspace-sync.d.ts.map +1 -0
- package/dist/internal/workspace-sync.js +104 -0
- package/dist/internal/workspace.d.ts +151 -0
- package/dist/internal/workspace.d.ts.map +1 -0
- package/dist/internal/workspace.js +455 -0
- package/dist/kv/memory-kv.d.ts +24 -0
- package/dist/kv/memory-kv.d.ts.map +1 -0
- package/dist/kv/memory-kv.js +104 -0
- package/dist/kv.d.ts +18 -0
- package/dist/kv.d.ts.map +1 -0
- package/dist/kv.js +16 -0
- package/dist/memory.d.ts +138 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +401 -0
- package/dist/otel-public.d.ts +7 -0
- package/dist/otel-public.d.ts.map +1 -0
- package/dist/otel-public.js +5 -0
- package/dist/otel.d.ts +131 -0
- package/dist/otel.d.ts.map +1 -0
- package/dist/otel.js +186 -0
- package/dist/playground/assets/cursor-icons-16-4RnoYH3n.woff2 +0 -0
- package/dist/playground/assets/index-BMV_IcEE.css +1 -0
- package/dist/playground/assets/index-FFdUqTt_.js +71 -0
- package/dist/playground/index.html +17 -0
- package/dist/prompt.d.ts +39 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +70 -0
- package/dist/reminders.d.ts +42 -0
- package/dist/reminders.d.ts.map +1 -0
- package/dist/reminders.js +45 -0
- package/dist/schedules.d.ts +23 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/schedules.js +26 -0
- package/dist/skills.d.ts +22 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +22 -0
- package/dist/storage-backends/cursor-hosted-v2.d.ts +82 -0
- package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -0
- package/dist/storage-backends/cursor-hosted-v2.js +171 -0
- package/dist/storage-backends/cursor-hosted.d.ts +107 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -0
- package/dist/storage-backends/cursor-hosted.js +278 -0
- package/dist/storage-backends/file-kv.d.ts +42 -0
- package/dist/storage-backends/file-kv.d.ts.map +1 -0
- package/dist/storage-backends/file-kv.js +254 -0
- package/dist/storage-protocol.d.ts +142 -0
- package/dist/storage-protocol.d.ts.map +1 -0
- package/dist/storage-protocol.js +201 -0
- package/dist/storage.d.ts +254 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +154 -0
- package/dist/tools.d.ts +132 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +77 -0
- package/dist/types.d.ts +3375 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +189 -0
- package/docs/README.md +119 -0
- package/docs/building-with-agents.md +140 -0
- package/docs/deployment.md +216 -0
- package/docs/evals.md +262 -0
- package/docs/guides/agent-to-agent.md +157 -0
- package/docs/guides/bitbucket.md +293 -0
- package/docs/guides/cloud-agents.md +95 -0
- package/docs/guides/convert-automation.md +188 -0
- package/docs/guides/github.md +331 -0
- package/docs/guides/gitlab.md +299 -0
- package/docs/guides/grokbot-agents.md +147 -0
- package/docs/guides/hooks.md +119 -0
- package/docs/guides/improve.md +139 -0
- package/docs/guides/jev.md +299 -0
- package/docs/guides/mcp-oauth.md +167 -0
- package/docs/guides/opentelemetry.md +158 -0
- package/docs/guides/slack.md +278 -0
- package/docs/guides/webhooks.md +241 -0
- package/docs/hillclimbing.md +142 -0
- package/docs/quickstart.md +311 -0
- package/docs/reference/agent-config.md +193 -0
- package/docs/reference/artifacts.md +121 -0
- package/docs/reference/channels.md +203 -0
- package/docs/reference/cli.md +909 -0
- package/docs/reference/connections.md +277 -0
- package/docs/reference/evals.md +292 -0
- package/docs/reference/extensions.md +198 -0
- package/docs/reference/hooks.md +195 -0
- package/docs/reference/http-api.md +236 -0
- package/docs/reference/instructions.md +68 -0
- package/docs/reference/playground.md +47 -0
- package/docs/reference/project-layout.md +120 -0
- package/docs/reference/prompt.md +55 -0
- package/docs/reference/schedules.md +175 -0
- package/docs/reference/sessions.md +165 -0
- package/docs/reference/skills.md +80 -0
- package/docs/reference/subagents.md +67 -0
- package/docs/reference/tools.md +329 -0
- package/docs/templates/agentic-owners.md +100 -0
- package/docs/templates/security-reviewer.md +90 -0
- package/docs/templates/thermo-quality-review.md +83 -0
- package/docs/templates/thermo-review.md +82 -0
- package/docs/templates/triage.md +102 -0
- package/docs/troubleshooting.md +148 -0
- package/package.json +384 -0
- package/scripts/install-cursor-skills.mjs +29 -0
- package/skills/create-agent/SKILL.md +170 -0
- package/skills/debug/SKILL.md +43 -0
- package/skills/deploy/SKILL.md +169 -0
- package/skills/evals/SKILL.md +145 -0
- package/skills/framework-map/SKILL.md +125 -0
- package/skills/github/SKILL.md +110 -0
- package/skills/hillclimb/SKILL.md +63 -0
- package/skills/mcp-auth/SKILL.md +84 -0
- package/skills/otel/SKILL.md +50 -0
- package/skills/setup-slack/SKILL.md +149 -0
- package/src/artifacts.ts +65 -0
- package/src/bin/agent-serve.ts +1833 -0
- package/src/channels/bitbucket/api.ts +891 -0
- package/src/channels/bitbucket/binding.ts +417 -0
- package/src/channels/bitbucket/bitbucket-channel.ts +162 -0
- package/src/channels/bitbucket/bitbucket-webhook.ts +519 -0
- package/src/channels/bitbucket/checks.ts +146 -0
- package/src/channels/bitbucket/cursor-account.ts +106 -0
- package/src/channels/bitbucket/defaults.ts +100 -0
- package/src/channels/bitbucket/events.ts +74 -0
- package/src/channels/bitbucket/index.ts +51 -0
- package/src/channels/bitbucket/replay.ts +421 -0
- package/src/channels/bitbucket/state.ts +59 -0
- package/src/channels/bitbucket/types.ts +261 -0
- package/src/channels/change-monitors/change-monitors-channel.ts +63 -0
- package/src/channels/change-monitors/index.ts +8 -0
- package/src/channels/change-monitors/types.ts +42 -0
- package/src/channels/checks.ts +185 -0
- package/src/channels/deployments/deployments-channel.ts +224 -0
- package/src/channels/deployments/index.ts +25 -0
- package/src/channels/deployments/types.ts +92 -0
- package/src/channels/github/api.ts +526 -0
- package/src/channels/github/auth.ts +254 -0
- package/src/channels/github/binding.ts +233 -0
- package/src/channels/github/checks.ts +145 -0
- package/src/channels/github/cursor-account.ts +303 -0
- package/src/channels/github/defaults.ts +168 -0
- package/src/channels/github/events.ts +67 -0
- package/src/channels/github/forward.ts +359 -0
- package/src/channels/github/github-channel.ts +2334 -0
- package/src/channels/github/index.ts +54 -0
- package/src/channels/github/progress.ts +365 -0
- package/src/channels/github/replay.ts +372 -0
- package/src/channels/github/state.ts +124 -0
- package/src/channels/github/types.ts +590 -0
- package/src/channels/gitlab/api.ts +329 -0
- package/src/channels/gitlab/binding.ts +231 -0
- package/src/channels/gitlab/checks.ts +228 -0
- package/src/channels/gitlab/cursor-account.ts +105 -0
- package/src/channels/gitlab/defaults.ts +80 -0
- package/src/channels/gitlab/events.ts +37 -0
- package/src/channels/gitlab/gitlab-channel.ts +160 -0
- package/src/channels/gitlab/gitlab-webhook.ts +509 -0
- package/src/channels/gitlab/index.ts +44 -0
- package/src/channels/gitlab/replay.ts +328 -0
- package/src/channels/gitlab/state.ts +55 -0
- package/src/channels/gitlab/types.ts +247 -0
- package/src/channels/issues/index.ts +9 -0
- package/src/channels/issues/issues-channel.ts +45 -0
- package/src/channels/issues/types.ts +38 -0
- package/src/channels/origin/api.ts +507 -0
- package/src/channels/origin/binding.ts +114 -0
- package/src/channels/origin/checks.ts +250 -0
- package/src/channels/origin/cursor-account.ts +58 -0
- package/src/channels/origin/defaults.ts +140 -0
- package/src/channels/origin/events.ts +35 -0
- package/src/channels/origin/index.ts +35 -0
- package/src/channels/origin/origin-channel.ts +815 -0
- package/src/channels/origin/origin-webhook.ts +296 -0
- package/src/channels/origin/reactions.ts +72 -0
- package/src/channels/origin/state.ts +54 -0
- package/src/channels/origin/types.ts +295 -0
- package/src/channels/slack/agentic-delivery.ts +634 -0
- package/src/channels/slack/agentic-posted.ts +135 -0
- package/src/channels/slack/agentic-signals.ts +231 -0
- package/src/channels/slack/api.ts +761 -0
- package/src/channels/slack/approvals.ts +279 -0
- package/src/channels/slack/assistant.ts +76 -0
- package/src/channels/slack/attachments.ts +596 -0
- package/src/channels/slack/auth.ts +127 -0
- package/src/channels/slack/blocks.ts +131 -0
- package/src/channels/slack/bot-mentions.ts +318 -0
- package/src/channels/slack/channel-watch.ts +314 -0
- package/src/channels/slack/cli-project.ts +249 -0
- package/src/channels/slack/code-fences.ts +171 -0
- package/src/channels/slack/constants.ts +38 -0
- package/src/channels/slack/credentials.ts +88 -0
- package/src/channels/slack/defaults.ts +714 -0
- package/src/channels/slack/dispatch.ts +1060 -0
- package/src/channels/slack/doctor.ts +338 -0
- package/src/channels/slack/eval-directive.ts +306 -0
- package/src/channels/slack/event-id-dedupe.ts +30 -0
- package/src/channels/slack/external-policy.ts +75 -0
- package/src/channels/slack/footer.ts +106 -0
- package/src/channels/slack/inbound.ts +416 -0
- package/src/channels/slack/index.ts +53 -0
- package/src/channels/slack/init.ts +169 -0
- package/src/channels/slack/interactive.ts +406 -0
- package/src/channels/slack/links.ts +23 -0
- package/src/channels/slack/live-delivery.ts +489 -0
- package/src/channels/slack/log.ts +70 -0
- package/src/channels/slack/manifest.ts +239 -0
- package/src/channels/slack/message-body.ts +82 -0
- package/src/channels/slack/nudge-carrier.ts +224 -0
- package/src/channels/slack/nudge-store.ts +334 -0
- package/src/channels/slack/paint-start.ts +93 -0
- package/src/channels/slack/placeholder.ts +358 -0
- package/src/channels/slack/pr-ref.ts +74 -0
- package/src/channels/slack/progress-delivery.ts +138 -0
- package/src/channels/slack/reasoning-card.ts +125 -0
- package/src/channels/slack/reasoning-chip.ts +41 -0
- package/src/channels/slack/recording-sink.ts +167 -0
- package/src/channels/slack/redact.ts +6 -0
- package/src/channels/slack/reply-options.ts +279 -0
- package/src/channels/slack/setup.ts +125 -0
- package/src/channels/slack/slack-channel.ts +744 -0
- package/src/channels/slack/socket-mode.ts +140 -0
- package/src/channels/slack/stop.ts +25 -0
- package/src/channels/slack/stream.ts +66 -0
- package/src/channels/slack/thread-context.ts +485 -0
- package/src/channels/slack/tool-approval-events.ts +233 -0
- package/src/channels/slack/tool-cards.ts +198 -0
- package/src/channels/slack/tool-chip.ts +34 -0
- package/src/channels/slack/types.ts +782 -0
- package/src/channels/slack/upload.ts +137 -0
- package/src/channels.ts +543 -0
- package/src/connections.ts +153 -0
- package/src/dashboard-session-url.ts +30 -0
- package/src/evals/assertions.ts +688 -0
- package/src/evals/expect.ts +250 -0
- package/src/evals/judge.ts +329 -0
- package/src/evals/loaders.ts +111 -0
- package/src/evals/matchers.ts +223 -0
- package/src/evals/reporters.ts +257 -0
- package/src/evals/results.ts +130 -0
- package/src/evals/run-facts.ts +306 -0
- package/src/evals.ts +709 -0
- package/src/extensions/cursor-cloud-agents/extension.ts +114 -0
- package/src/extensions/cursor-cloud-agents/lib/backend.ts +386 -0
- package/src/extensions/cursor-cloud-agents/lib/fleet.ts +98 -0
- package/src/extensions/cursor-cloud-agents/lib/inputs.ts +5 -0
- package/src/extensions/cursor-cloud-agents/lib/repos.ts +68 -0
- package/src/extensions/cursor-cloud-agents/lib/transcript.ts +19 -0
- package/src/extensions/cursor-cloud-agents/skills/handoff.md +37 -0
- package/src/extensions/cursor-cloud-agents/tools/cancel.ts +19 -0
- package/src/extensions/cursor-cloud-agents/tools/dump.ts +47 -0
- package/src/extensions/cursor-cloud-agents/tools/get.ts +18 -0
- package/src/extensions/cursor-cloud-agents/tools/launch.ts +60 -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/improve/extension.ts +69 -0
- package/src/extensions/improve/skills/yourself.ts +50 -0
- package/src/extensions/jev/extension.ts +95 -0
- package/src/extensions/jev/lib/evaluate.ts +266 -0
- package/src/extensions/jev/skills/gated-write.md +25 -0
- package/src/extensions/jev/skills/questions.md +33 -0
- package/src/extensions/jev/tools/evaluate.ts +82 -0
- package/src/extensions/slack-communication/evals/harness.ts +705 -0
- package/src/extensions/slack-communication/evals/slack-communication.eval.ts +830 -0
- package/src/extensions/slack-communication/evals/slack-placeholder.eval.ts +172 -0
- package/src/extensions/slack-communication/extension.ts +44 -0
- package/src/extensions/slack-communication/skills/slack-voice.ts +56 -0
- package/src/extensions/slack-communication/tools/delete-message.ts +33 -0
- package/src/extensions/slack-communication/tools/edit-message.ts +42 -0
- package/src/extensions/slack-communication/tools/post-card.ts +28 -0
- package/src/extensions/slack-communication/tools/post-file.ts +82 -0
- package/src/extensions/slack-communication/tools/post-update.ts +40 -0
- package/src/extensions/slack-communication/tools/react.ts +30 -0
- package/src/extensions/slack-communication/tools/set-status.ts +21 -0
- package/src/extensions.ts +179 -0
- package/src/files-backends/agent-store-presigned-url.ts +11 -0
- package/src/files-backends/cursor-hosted.ts +1212 -0
- package/src/files-backends/local-fs.ts +163 -0
- package/src/files.ts +293 -0
- package/src/filesystem.ts +2005 -0
- package/src/hooks.ts +30 -0
- package/src/index.ts +259 -0
- package/src/internal/advertise-tools.ts +370 -0
- package/src/internal/approval-gate.ts +103 -0
- package/src/internal/artifacts-store.ts +825 -0
- package/src/internal/as-of.ts +257 -0
- package/src/internal/auth.ts +46 -0
- package/src/internal/authored-alias-hooks.ts +138 -0
- package/src/internal/authored-loaders.ts +188 -0
- package/src/internal/bounded-int.ts +24 -0
- package/src/internal/bounded.ts +25 -0
- package/src/internal/brand.ts +28 -0
- package/src/internal/browser-origin-guard.ts +67 -0
- package/src/internal/builtin-tools/artifacts.ts +62 -0
- package/src/internal/builtin-tools/index.ts +53 -0
- package/src/internal/builtin-tools/reminders.ts +145 -0
- package/src/internal/channel-dispatch.ts +129 -0
- package/src/internal/channel-route-dispatch.ts +58 -0
- package/src/internal/channel-state.ts +83 -0
- package/src/internal/chat-client.ts +594 -0
- package/src/internal/cli-ax.ts +2273 -0
- package/src/internal/cli-bitbucket.ts +438 -0
- package/src/internal/cli-convert-automation.ts +335 -0
- package/src/internal/cli-cursor.ts +282 -0
- package/src/internal/cli-deploy.ts +2486 -0
- package/src/internal/cli-docs.ts +192 -0
- package/src/internal/cli-github.ts +806 -0
- package/src/internal/cli-gitlab.ts +452 -0
- package/src/internal/cli-images.ts +672 -0
- package/src/internal/cli-manifest.ts +56 -0
- package/src/internal/cli-mcp-oauth.ts +395 -0
- package/src/internal/cli-mcp.ts +808 -0
- package/src/internal/cli-skills.ts +99 -0
- package/src/internal/cli-slack-manual.ts +418 -0
- package/src/internal/cli-slack.ts +874 -0
- package/src/internal/cloud-merge.ts +51 -0
- package/src/internal/cloud-turn-cost.ts +159 -0
- package/src/internal/continuation-channel.ts +233 -0
- package/src/internal/continuation-identity.ts +935 -0
- package/src/internal/conversation-mirror.ts +423 -0
- package/src/internal/convert-automation/convert-workflow.ts +1377 -0
- package/src/internal/convert-automation/slug.ts +29 -0
- package/src/internal/convert-automation/types.ts +212 -0
- package/src/internal/cron.ts +76 -0
- package/src/internal/cursor/account-mcp.ts +692 -0
- package/src/internal/cursor/backend-client.ts +978 -0
- package/src/internal/cursor/bound-secret-file.ts +101 -0
- package/src/internal/cursor/credentials.ts +560 -0
- package/src/internal/cursor/cursor-api-transport.ts +65 -0
- package/src/internal/cursor/github-credentials.ts +228 -0
- package/src/internal/cursor/hosted-bound-secrets.ts +71 -0
- package/src/internal/cursor/hosted-deployment-secrets.ts +100 -0
- package/src/internal/cursor/hosted-store-secrets.ts +152 -0
- package/src/internal/cursor/session-token.ts +111 -0
- package/src/internal/cursor/store-api-client.ts +323 -0
- package/src/internal/cursor-account-mcp-auth.ts +303 -0
- package/src/internal/cursor-agent-template.ts +50 -0
- package/src/internal/cursor-deployment-relay.ts +315 -0
- package/src/internal/cursor-event-relay.ts +675 -0
- package/src/internal/cursor-relay-core.ts +563 -0
- package/src/internal/deferred-channel-session.ts +61 -0
- package/src/internal/deploy-client.ts +1504 -0
- package/src/internal/deploy-manifest.ts +361 -0
- package/src/internal/deploy-source.ts +144 -0
- package/src/internal/describe-error.ts +32 -0
- package/src/internal/dev-mode.ts +20 -0
- package/src/internal/discovery/agent-config.ts +288 -0
- package/src/internal/discovery/agent.ts +381 -0
- package/src/internal/discovery/channels.ts +100 -0
- package/src/internal/discovery/connections.ts +505 -0
- package/src/internal/discovery/context.ts +38 -0
- package/src/internal/discovery/cursor-plugin.ts +628 -0
- package/src/internal/discovery/extension-overlay.ts +247 -0
- package/src/internal/discovery/extensions.ts +490 -0
- package/src/internal/discovery/fs.ts +103 -0
- package/src/internal/discovery/hooks.ts +63 -0
- package/src/internal/discovery/info.ts +174 -0
- package/src/internal/discovery/instructions.ts +98 -0
- package/src/internal/discovery/modules.ts +107 -0
- package/src/internal/discovery/names.ts +45 -0
- package/src/internal/discovery/project.ts +319 -0
- package/src/internal/discovery/reminders.ts +65 -0
- package/src/internal/discovery/runtime.ts +158 -0
- package/src/internal/discovery/schedules.ts +120 -0
- package/src/internal/discovery/seed-files.ts +34 -0
- package/src/internal/discovery/services.ts +151 -0
- package/src/internal/discovery/skills.ts +174 -0
- package/src/internal/discovery/subagent.ts +138 -0
- package/src/internal/discovery/tools.ts +170 -0
- package/src/internal/discovery.ts +27 -0
- package/src/internal/distribution.ts +126 -0
- package/src/internal/docs-site.ts +248 -0
- package/src/internal/duration.ts +37 -0
- package/src/internal/env-file.ts +83 -0
- package/src/internal/eval-judge-model.ts +142 -0
- package/src/internal/eval-run-store.ts +585 -0
- package/src/internal/eval-runner.ts +823 -0
- package/src/internal/evals-client.ts +475 -0
- package/src/internal/event-log.ts +342 -0
- package/src/internal/event-mapper.ts +480 -0
- package/src/internal/expected-delivery-failure.ts +34 -0
- package/src/internal/factory-resource-channel.ts +103 -0
- package/src/internal/filesystem/errors.ts +207 -0
- package/src/internal/filesystem/format.ts +253 -0
- package/src/internal/filesystem/merge.ts +192 -0
- package/src/internal/filesystem/nearest.ts +112 -0
- package/src/internal/filesystem/scratch.ts +239 -0
- package/src/internal/filesystem/sdk-schemas.ts +204 -0
- package/src/internal/filesystem/tools.ts +804 -0
- package/src/internal/filesystem/walk.ts +366 -0
- package/src/internal/fixtures/units-server.ts +52 -0
- package/src/internal/framework-file-storage.ts +357 -0
- package/src/internal/framework-storage-selection.ts +156 -0
- package/src/internal/frontmatter.ts +108 -0
- package/src/internal/github-fanout.ts +144 -0
- package/src/internal/guest-network.ts +391 -0
- package/src/internal/handleAgentServeTrigger.ts +286 -0
- package/src/internal/host-files.ts +341 -0
- package/src/internal/host-kv.ts +81 -0
- package/src/internal/host-otel.ts +231 -0
- package/src/internal/host-platforms.ts +170 -0
- package/src/internal/hosted-admission-adapter.ts +47 -0
- package/src/internal/hosted-admission-context.ts +37 -0
- package/src/internal/hosted-catch-protocol.ts +112 -0
- package/src/internal/hosted-catch.ts +179 -0
- package/src/internal/hosted-delivery-protocol.ts +787 -0
- package/src/internal/hosted-delivery.ts +1152 -0
- package/src/internal/hosted-execution-diag.ts +291 -0
- package/src/internal/hosted-execution-flush.ts +136 -0
- package/src/internal/hosted-execution-latency.ts +301 -0
- package/src/internal/hosted-managed-automation.ts +116 -0
- package/src/internal/hosting.ts +107 -0
- package/src/internal/http-channel-define.ts +25 -0
- package/src/internal/http-channel.ts +669 -0
- package/src/internal/http-control-plane-session.ts +110 -0
- package/src/internal/ids.ts +39 -0
- package/src/internal/incoming-headers-to-fetch.ts +45 -0
- package/src/internal/init-interview.ts +360 -0
- package/src/internal/init-project.ts +711 -0
- package/src/internal/init-scaffold.ts +182 -0
- package/src/internal/inline-stdio-define-stub.ts +4 -0
- package/src/internal/inline-stdio-mcp.ts +230 -0
- package/src/internal/install-cursor-skills.ts +601 -0
- package/src/internal/is-record.ts +3 -0
- package/src/internal/json-schema.ts +95 -0
- package/src/internal/legacy-command-guard.ts +54 -0
- package/src/internal/listen-port.ts +85 -0
- package/src/internal/local-control-plane.ts +442 -0
- package/src/internal/local-env.ts +59 -0
- package/src/internal/local-ingress.ts +90 -0
- package/src/internal/log-ring.ts +59 -0
- package/src/internal/logs-client.ts +477 -0
- package/src/internal/map-pool.ts +39 -0
- package/src/internal/mcp-endpoint.ts +747 -0
- package/src/internal/mcp-host.ts +481 -0
- package/src/internal/mcp-oauth-on-demand.ts +337 -0
- package/src/internal/mcp-oauth-persist.ts +118 -0
- package/src/internal/mcp-oauth.ts +549 -0
- package/src/internal/net.ts +29 -0
- package/src/internal/open-browser.ts +41 -0
- package/src/internal/otel/attrs.ts +16 -0
- package/src/internal/otel/collector.ts +937 -0
- package/src/internal/otel/config.ts +287 -0
- package/src/internal/otel/http.ts +122 -0
- package/src/internal/otel/mcp.ts +56 -0
- package/src/internal/otel/propagation.ts +17 -0
- package/src/internal/otel/runtime.ts +441 -0
- package/src/internal/package-inline-stdio.ts +114 -0
- package/src/internal/peer-connections.ts +96 -0
- package/src/internal/platform-schedule-sync.ts +75 -0
- package/src/internal/platform-timers.ts +365 -0
- package/src/internal/playground/static.ts +278 -0
- package/src/internal/playground/toolchain.ts +270 -0
- package/src/internal/playground-proxy.ts +564 -0
- package/src/internal/process-memory-telemetry.ts +334 -0
- package/src/internal/project-layout.ts +31 -0
- package/src/internal/prompt-context.ts +116 -0
- package/src/internal/reminder-control-plane-protocol.ts +482 -0
- package/src/internal/reminder-runner.ts +1559 -0
- package/src/internal/reminder-schedule.ts +104 -0
- package/src/internal/reminder-store.ts +176 -0
- package/src/internal/request-error-status.ts +95 -0
- package/src/internal/request-headers.ts +21 -0
- package/src/internal/resolve-prod-target.ts +334 -0
- package/src/internal/resolved-connections.ts +190 -0
- package/src/internal/router.ts +143 -0
- package/src/internal/run-client.ts +354 -0
- package/src/internal/runtime-dispatch-runner.ts +50 -0
- package/src/internal/sanitize-mcp-tool-name.ts +31 -0
- package/src/internal/schedule-runner.ts +154 -0
- package/src/internal/scm/pr-url.ts +245 -0
- package/src/internal/sdk-runner.ts +948 -0
- package/src/internal/serve-restart.ts +113 -0
- package/src/internal/server.ts +3135 -0
- package/src/internal/session-cost.ts +208 -0
- package/src/internal/session-engine.ts +5602 -0
- package/src/internal/session-links.ts +84 -0
- package/src/internal/session-run-log.ts +535 -0
- package/src/internal/session-store.ts +307 -0
- package/src/internal/session-urls.ts +32 -0
- package/src/internal/sessions-client.ts +239 -0
- package/src/internal/skill-catalog.ts +66 -0
- package/src/internal/skills-sync.ts +55 -0
- package/src/internal/slack-provision-client.ts +544 -0
- package/src/internal/slack-thread-key.ts +11 -0
- package/src/internal/sleep.ts +3 -0
- package/src/internal/start-log-store.ts +164 -0
- package/src/internal/steering.ts +17 -0
- package/src/internal/storage-coordinator.ts +800 -0
- package/src/internal/storage-roles.ts +86 -0
- package/src/internal/storage.ts +1 -0
- package/src/internal/store-api-protocol.ts +205 -0
- package/src/internal/store-mirror.ts +73 -0
- package/src/internal/stream-progress.ts +294 -0
- package/src/internal/terminal-style.ts +133 -0
- package/src/internal/testing/factory-resource-fixtures.ts +84 -0
- package/src/internal/testing/scm-continuation-fixtures.ts +285 -0
- package/src/internal/tool-catalog.ts +104 -0
- package/src/internal/tool-policy.ts +222 -0
- package/src/internal/tool-result.ts +50 -0
- package/src/internal/trajectory.ts +418 -0
- package/src/internal/turn-cost.ts +136 -0
- package/src/internal/turn-governor.ts +145 -0
- package/src/internal/turn-lease-store.ts +144 -0
- package/src/internal/turn-outbox.ts +77 -0
- package/src/internal/update-check.ts +517 -0
- package/src/internal/v2-hosting.ts +52 -0
- package/src/internal/workspace-sync.ts +114 -0
- package/src/internal/workspace.ts +505 -0
- package/src/kv/memory-kv.ts +94 -0
- package/src/kv.ts +18 -0
- package/src/memory.ts +487 -0
- package/src/otel-public.ts +24 -0
- package/src/otel.ts +320 -0
- package/src/prompt.ts +80 -0
- package/src/reminders.ts +65 -0
- package/src/schedules.ts +31 -0
- package/src/skills.ts +27 -0
- package/src/storage-backends/cursor-hosted-v2.ts +204 -0
- package/src/storage-backends/cursor-hosted.ts +388 -0
- package/src/storage-backends/file-kv.ts +276 -0
- package/src/storage-protocol.ts +261 -0
- package/src/storage.ts +408 -0
- package/src/tools.ts +166 -0
- package/src/types.ts +3725 -0
- package/templates/agentic-owners/README.md +76 -0
- package/templates/agentic-owners/bot/agent.ts +8 -0
- package/templates/agentic-owners/bot/channels/github.ts +63 -0
- package/templates/agentic-owners/bot/instructions.md +34 -0
- package/templates/agentic-owners/bot/lib/config.ts +5 -0
- package/templates/agentic-owners/bot/lib/github.ts +217 -0
- package/templates/agentic-owners/bot/lib/owners/README.md +50 -0
- package/templates/agentic-owners/bot/lib/owners/constants.ts +22 -0
- package/templates/agentic-owners/bot/lib/owners/decision.ts +454 -0
- package/templates/agentic-owners/bot/lib/owners/handles.ts +54 -0
- package/templates/agentic-owners/bot/lib/owners/match.ts +219 -0
- package/templates/agentic-owners/bot/lib/owners/matching.ts +78 -0
- package/templates/agentic-owners/bot/lib/owners/parse.ts +565 -0
- package/templates/agentic-owners/bot/lib/owners/policyMode.ts +57 -0
- package/templates/agentic-owners/bot/lib/owners/prompt.ts +64 -0
- package/templates/agentic-owners/bot/lib/owners/prompts/base-review.md +105 -0
- package/templates/agentic-owners/bot/lib/owners/types.ts +50 -0
- package/templates/agentic-owners/bot/lib/review.ts +722 -0
- package/templates/agentic-owners/bot/tools/record_review.ts +62 -0
- package/templates/agentic-owners/evals/evals.config.ts +5 -0
- package/templates/agentic-owners/evals/owners.eval.ts +111 -0
- package/templates/agentic-owners/package.json +20 -0
- package/templates/agentic-owners/tsconfig.json +12 -0
- package/templates/agents-md/README.md +42 -0
- package/templates/agents-md/bot/agent.ts +8 -0
- package/templates/agents-md/bot/channels/github.ts +10 -0
- package/templates/agents-md/bot/channels/queue.ts +28 -0
- package/templates/agents-md/bot/channels/slack.ts +9 -0
- package/templates/agents-md/bot/instructions.md +39 -0
- package/templates/agents-md/bot/lib/collect.ts +415 -0
- package/templates/agents-md/bot/lib/config.ts +8 -0
- package/templates/agents-md/bot/lib/paths.ts +49 -0
- package/templates/agents-md/bot/schedules/weekly.ts +17 -0
- package/templates/agents-md/bot/tools/apply_agents.ts +218 -0
- package/templates/agents-md/evals/agents.eval.ts +135 -0
- package/templates/agents-md/evals/evals.config.ts +5 -0
- package/templates/agents-md/init.json +38 -0
- package/templates/agents-md/package.json +18 -0
- package/templates/agents-md/tsconfig.json +12 -0
- package/templates/code-wiki/README.md +37 -0
- package/templates/code-wiki/bot/agent.ts +8 -0
- package/templates/code-wiki/bot/channels/github.ts +125 -0
- package/templates/code-wiki/bot/instructions.md +39 -0
- package/templates/code-wiki/bot/lib/repos.ts +5 -0
- package/templates/code-wiki/bot/lib/wiki.ts +22 -0
- package/templates/code-wiki/bot/tools/apply_wiki.ts +210 -0
- package/templates/code-wiki/evals/evals.config.ts +5 -0
- package/templates/code-wiki/evals/wiki.eval.ts +124 -0
- package/templates/code-wiki/init.json +25 -0
- package/templates/code-wiki/package.json +18 -0
- package/templates/code-wiki/tsconfig.json +12 -0
- package/templates/demo/README.md +40 -0
- package/templates/demo/bot/agent.ts +8 -0
- package/templates/demo/bot/channels/github.ts +48 -0
- package/templates/demo/bot/channels/queue.ts +34 -0
- package/templates/demo/bot/instructions.md +8 -0
- package/templates/demo/bot/lib/collect.ts +66 -0
- package/templates/demo/bot/lib/repos.ts +5 -0
- package/templates/demo/bot/tools/record_demo.ts +37 -0
- package/templates/demo/evals/demo.eval.ts +29 -0
- package/templates/demo/evals/evals.config.ts +5 -0
- package/templates/demo/init.json +25 -0
- package/templates/demo/package.json +18 -0
- package/templates/demo/tsconfig.json +12 -0
- package/templates/grokbot-agents/README.md +29 -0
- package/templates/grokbot-agents/bot/agent.ts +6 -0
- package/templates/grokbot-agents/bot/extensions/grokbot.ts +5 -0
- package/templates/grokbot-agents/bot/instructions.md +7 -0
- package/templates/grokbot-agents/evals/evals.config.ts +5 -0
- package/templates/grokbot-agents/evals/grokbot-agents.eval.ts +18 -0
- package/templates/grokbot-agents/init.json +18 -0
- package/templates/grokbot-agents/package.json +17 -0
- package/templates/grokbot-agents/tsconfig.json +12 -0
- package/templates/pr-autofixer/bot/agent.ts +11 -0
- package/templates/pr-autofixer/bot/channels/drive.ts +37 -0
- package/templates/pr-autofixer/bot/channels/github.ts +155 -0
- package/templates/pr-autofixer/bot/channels/slack.ts +16 -0
- package/templates/pr-autofixer/bot/hooks/bind-agent.ts +19 -0
- package/templates/pr-autofixer/bot/instructions.md +83 -0
- package/templates/pr-autofixer/bot/lib/affinity.ts +24 -0
- package/templates/pr-autofixer/bot/lib/drive-schemas.ts +18 -0
- package/templates/pr-autofixer/bot/lib/drive.ts +73 -0
- package/templates/pr-autofixer/bot/lib/merge-watch.ts +116 -0
- package/templates/pr-autofixer/bot/lib/pr-state.ts +40 -0
- package/templates/pr-autofixer/bot/lib/repos.ts +18 -0
- package/templates/pr-autofixer/bot/lib/start-drive.ts +113 -0
- package/templates/pr-autofixer/bot/lib/webhook-buffer.ts +215 -0
- package/templates/pr-autofixer/bot/lib/webhook-routing.ts +231 -0
- package/templates/pr-autofixer/bot/tools/drive_pr.ts +22 -0
- package/templates/pr-autofixer/evals/coordinator.eval.ts +16 -0
- package/templates/pr-autofixer/evals/evals.config.ts +5 -0
- package/templates/pr-autofixer/init.json +25 -0
- package/templates/pr-autofixer/package.json +18 -0
- package/templates/pr-autofixer/tsconfig.json +12 -0
- package/templates/security-help/README.md +40 -0
- package/templates/security-help/bot/agent.ts +17 -0
- package/templates/security-help/bot/channels/github.ts +13 -0
- package/templates/security-help/bot/channels/slack.ts +84 -0
- package/templates/security-help/bot/instructions.md +19 -0
- package/templates/security-help/bot/lib/pr-first-pass.ts +40 -0
- package/templates/security-help/bot/lib/repos.ts +5 -0
- package/templates/security-help/bot/skills/access-request.md +10 -0
- package/templates/security-help/bot/skills/faq.md +31 -0
- package/templates/security-help/bot/skills/security-playbooks.md +12 -0
- package/templates/security-help/bot/skills/security-pr-first-pass.md +12 -0
- package/templates/security-help/evals/evals.config.ts +5 -0
- package/templates/security-help/evals/security-help.eval.ts +51 -0
- package/templates/security-help/init.json +31 -0
- package/templates/security-help/package.json +17 -0
- package/templates/security-help/tsconfig.json +12 -0
- package/templates/security-reviewer/README.md +34 -0
- package/templates/security-reviewer/bot/agent.ts +8 -0
- package/templates/security-reviewer/bot/channels/github.ts +43 -0
- package/templates/security-reviewer/bot/instructions.md +22 -0
- package/templates/security-reviewer/bot/lib/repos.ts +5 -0
- package/templates/security-reviewer/bot/tools/post_findings.ts +68 -0
- package/templates/security-reviewer/evals/evals.config.ts +5 -0
- package/templates/security-reviewer/evals/review.eval.ts +50 -0
- package/templates/security-reviewer/init.json +25 -0
- package/templates/security-reviewer/package.json +18 -0
- package/templates/security-reviewer/tsconfig.json +12 -0
- package/templates/thermo-quality-review/README.md +38 -0
- package/templates/thermo-quality-review/bot/agent.ts +8 -0
- package/templates/thermo-quality-review/bot/channels/github.ts +39 -0
- package/templates/thermo-quality-review/bot/instructions.md +43 -0
- package/templates/thermo-quality-review/bot/tools/post_findings.ts +67 -0
- package/templates/thermo-quality-review/evals/evals.config.ts +5 -0
- package/templates/thermo-quality-review/evals/review.eval.ts +59 -0
- package/templates/thermo-quality-review/package.json +18 -0
- package/templates/thermo-quality-review/tsconfig.json +12 -0
- package/templates/thermo-review/README.md +38 -0
- package/templates/thermo-review/bot/agent.ts +8 -0
- package/templates/thermo-review/bot/channels/github.ts +39 -0
- package/templates/thermo-review/bot/instructions.md +40 -0
- package/templates/thermo-review/bot/tools/post_findings.ts +67 -0
- package/templates/thermo-review/evals/evals.config.ts +5 -0
- package/templates/thermo-review/evals/review.eval.ts +50 -0
- package/templates/thermo-review/package.json +18 -0
- package/templates/thermo-review/tsconfig.json +12 -0
- package/templates/triage/README.md +50 -0
- package/templates/triage/bot/agent.ts +8 -0
- package/templates/triage/bot/channels/queue.ts +40 -0
- package/templates/triage/bot/channels/webhook.ts +44 -0
- package/templates/triage/bot/hooks/memory.ts +3 -0
- package/templates/triage/bot/instructions.md +38 -0
- package/templates/triage/bot/lib/actuate.ts +703 -0
- package/templates/triage/bot/lib/parse-queue-event.ts +166 -0
- package/templates/triage/bot/lib/tracker.ts +5 -0
- package/templates/triage/bot/lib/types.ts +48 -0
- package/templates/triage/bot/lib/verify-webhook.ts +79 -0
- package/templates/triage/bot/skills/triage-rubric.md +44 -0
- package/templates/triage/bot/tools/record_triage.ts +29 -0
- package/templates/triage/evals/evals.config.ts +5 -0
- package/templates/triage/evals/triage.eval.ts +64 -0
- package/templates/triage/overlays/jira/README.md +24 -0
- package/templates/triage/overlays/jira/bot/lib/tracker.ts +8 -0
- package/templates/triage/overlays/jira/bot/mcp-connections/tracker.ts +6 -0
- package/templates/triage/overlays/linear/README.md +24 -0
- package/templates/triage/overlays/linear/bot/lib/tracker.ts +8 -0
- package/templates/triage/overlays/linear/bot/mcp-connections/tracker.ts +6 -0
- package/templates/triage/package.json +18 -0
- package/templates/triage/tsconfig.json +12 -0
|
@@ -0,0 +1,2005 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import type { ToolName } from "@cursor/sdk";
|
|
5
|
+
import { minimatch } from "minimatch";
|
|
6
|
+
import { FileConflictError } from "./files.js";
|
|
7
|
+
import {
|
|
8
|
+
EditError,
|
|
9
|
+
FileNotFoundError,
|
|
10
|
+
InvalidGrepPatternError,
|
|
11
|
+
isFileNotFoundError,
|
|
12
|
+
isInvalidGrepPatternError,
|
|
13
|
+
NoMountError,
|
|
14
|
+
PathError,
|
|
15
|
+
ReadOnlyMountError,
|
|
16
|
+
remapPathError,
|
|
17
|
+
WriteFailedError,
|
|
18
|
+
} from "./internal/filesystem/errors.js";
|
|
19
|
+
import { MEMORY_DIR_NAME } from "./memory.js";
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
DeleteNotSupportedError,
|
|
23
|
+
EditError,
|
|
24
|
+
FileNotFoundError,
|
|
25
|
+
InvalidGrepPatternError,
|
|
26
|
+
isFileNotFoundError,
|
|
27
|
+
isInvalidGrepPatternError,
|
|
28
|
+
NoMountError,
|
|
29
|
+
PathError,
|
|
30
|
+
ReadOnlyMountError,
|
|
31
|
+
WriteFailedError,
|
|
32
|
+
} from "./internal/filesystem/errors.js";
|
|
33
|
+
|
|
34
|
+
import { mergeSorted } from "./internal/filesystem/merge.js";
|
|
35
|
+
import {
|
|
36
|
+
isExcludedPath,
|
|
37
|
+
listFilesFromPaths,
|
|
38
|
+
mergeSortedByPath,
|
|
39
|
+
statFromFilePaths,
|
|
40
|
+
} from "./internal/filesystem/walk.js";
|
|
41
|
+
import type { HostFilesApi, HostFilesScope } from "./types.js";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Status envelope used by walk helpers such as `lsFromList`.
|
|
45
|
+
* FileSystem methods throw; they do not return this.
|
|
46
|
+
* `@cursor/bdk` does not export it.
|
|
47
|
+
*/
|
|
48
|
+
export type FileSystemResult<T> =
|
|
49
|
+
| { status: "success"; value: T }
|
|
50
|
+
| { status: "error"; error: { message: string } };
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* One file in a `list` / `glob` stream.
|
|
54
|
+
*
|
|
55
|
+
* `path` is an absolute posix path (`/src/a.ts`). No trailing slash
|
|
56
|
+
* except `/`. `size` is optional byte length of the file contents.
|
|
57
|
+
*/
|
|
58
|
+
export interface DirEntry {
|
|
59
|
+
path: string;
|
|
60
|
+
size?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Existence probe. `directory` means this path is a prefix of at
|
|
65
|
+
* least one file (virtual trees infer directories) or a real
|
|
66
|
+
* directory on disk. `missing` is a value, not an error.
|
|
67
|
+
*/
|
|
68
|
+
export type FileInfo = { kind: "file" } | { kind: "directory" } | { kind: "missing" };
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Native Grep `output_mode` envelope. Not a FileSystem method
|
|
72
|
+
* result. The `grep` verb yields {@link GrepResult}; synthesis
|
|
73
|
+
* shapes this union after draining the stream.
|
|
74
|
+
*/
|
|
75
|
+
export type GrepUnionResult =
|
|
76
|
+
| {
|
|
77
|
+
type: "content";
|
|
78
|
+
output: {
|
|
79
|
+
matches: Array<{
|
|
80
|
+
file: string;
|
|
81
|
+
lineNumber?: number;
|
|
82
|
+
line: string;
|
|
83
|
+
beforeContext?: string[];
|
|
84
|
+
afterContext?: string[];
|
|
85
|
+
}>;
|
|
86
|
+
totalMatches: number;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
| { type: "files"; output: { files: string[]; count: number } }
|
|
90
|
+
| {
|
|
91
|
+
type: "count";
|
|
92
|
+
output: {
|
|
93
|
+
counts: Array<{ file: string; count: number }>;
|
|
94
|
+
total: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* One content hit from `grep`. `path` is absolute posix.
|
|
100
|
+
* `lineNumber` is 1-indexed. `line` is the full matching line,
|
|
101
|
+
* without the trailing newline.
|
|
102
|
+
*/
|
|
103
|
+
export interface GrepResult {
|
|
104
|
+
path: string;
|
|
105
|
+
lineNumber: number;
|
|
106
|
+
line: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Optional filters for {@link FileSystem.list}.
|
|
111
|
+
*
|
|
112
|
+
* `excludes` are ignore globs in the same language as native LS
|
|
113
|
+
* `ignore`: a slash-free pattern matches at any depth, and a
|
|
114
|
+
* directory match drops that tree. Implementations that can push
|
|
115
|
+
* them to a backend should; others filter the yielded files.
|
|
116
|
+
* Native LS still applies `ignore` after `list` so a mount that
|
|
117
|
+
* ignores this argument still honors it.
|
|
118
|
+
*/
|
|
119
|
+
export interface ListOptions {
|
|
120
|
+
excludes?: readonly string[];
|
|
121
|
+
/**
|
|
122
|
+
* Optional result cap, lexicographic. Omitted means no
|
|
123
|
+
* FileSystem-level cap. `0` yields nothing.
|
|
124
|
+
*/
|
|
125
|
+
limit?: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Optional filters for {@link FileSystem.glob}.
|
|
130
|
+
*
|
|
131
|
+
* `limit` is the same lexicographic cap as {@link ListOptions.limit}.
|
|
132
|
+
*/
|
|
133
|
+
export interface GlobOptions {
|
|
134
|
+
limit?: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Default scan cap for synthesized LS / Glob and for Origin
|
|
139
|
+
* `ListRepoPaths` from `/repo`. Smaller than Origin's 10k default
|
|
140
|
+
* so a recursive listing does not materialize a huge response.
|
|
141
|
+
*/
|
|
142
|
+
export const FILE_SYSTEM_SCAN_LIMIT = 1_000;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Content-search query. No `output_mode` or `offset` (those
|
|
146
|
+
* belong to the native Grep tool).
|
|
147
|
+
*
|
|
148
|
+
* `pattern` is a JavaScript regular expression source. Invalid
|
|
149
|
+
* source must throw {@link InvalidGrepPatternError} with message
|
|
150
|
+
* `invalid grep pattern: ${pattern}`. `path` omitted / `""` /
|
|
151
|
+
* `"/"` searches the whole tree; a file path searches that file
|
|
152
|
+
* only. A slash-free `glob` (`*.ts`) matches the basename at any
|
|
153
|
+
* depth under `path`.
|
|
154
|
+
*
|
|
155
|
+
* `excludes` are optional ignore globs (same language as
|
|
156
|
+
* {@link ListOptions.excludes}). Implementations that can push
|
|
157
|
+
* them to a backend should; others skip matching files. Native
|
|
158
|
+
* Grep has no ignore field; this is FileSystem-only pushdown.
|
|
159
|
+
*
|
|
160
|
+
* `maxResults` is optional predicate pushdown: stop after this
|
|
161
|
+
* many hits so a remote or large tree does not materialize a
|
|
162
|
+
* full scan. Native Grep still applies `head_limit` / `offset`
|
|
163
|
+
* after the merge. Omitted means no FileSystem-level cap.
|
|
164
|
+
*/
|
|
165
|
+
export interface GrepQuery {
|
|
166
|
+
pattern: string;
|
|
167
|
+
path?: string;
|
|
168
|
+
glob?: string;
|
|
169
|
+
excludes?: readonly string[];
|
|
170
|
+
caseInsensitive?: boolean;
|
|
171
|
+
maxResults?: number;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* One semantic hit from `search`. `path` is absolute posix.
|
|
176
|
+
* `score` is higher-is-better. Trees without an index yield
|
|
177
|
+
* nothing; they do not invent lexical stand-ins.
|
|
178
|
+
*/
|
|
179
|
+
export interface SearchResult {
|
|
180
|
+
path: string;
|
|
181
|
+
snippet: string;
|
|
182
|
+
score: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Semantic-search query. `targetDirectories` limits the scan
|
|
187
|
+
* when an index exists; omitted means the whole tree.
|
|
188
|
+
*
|
|
189
|
+
* `maxResults` is optional predicate pushdown: stop after this
|
|
190
|
+
* many hits so an index does not retrieve a large recall set.
|
|
191
|
+
* Native SemanticSearch still applies `numResults` after the
|
|
192
|
+
* merge. Omitted means no FileSystem-level cap.
|
|
193
|
+
*/
|
|
194
|
+
export interface SearchQuery {
|
|
195
|
+
query: string;
|
|
196
|
+
targetDirectories?: string[];
|
|
197
|
+
maxResults?: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Exact, non-overlapping str-replace. `oldText` / `newText` are
|
|
202
|
+
* literal strings, not regex. Splice must keep `$`, `$&`, `$1`
|
|
203
|
+
* in `newText` as written (`String.prototype.replace` must not
|
|
204
|
+
* be used).
|
|
205
|
+
*/
|
|
206
|
+
export interface EditQuery {
|
|
207
|
+
path: string;
|
|
208
|
+
oldText: string;
|
|
209
|
+
newText: string;
|
|
210
|
+
replaceAll?: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* StrReplace success. `occurrencesModified` is the number of
|
|
215
|
+
* non-overlapping replacements (1 unless `replaceAll`).
|
|
216
|
+
*/
|
|
217
|
+
export interface EditResult {
|
|
218
|
+
occurrencesModified: number;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Path verbs for the tree the agent runs on.
|
|
223
|
+
*
|
|
224
|
+
* Every method is required. Trees without an index implement
|
|
225
|
+
* `search` as an empty iterator. Methods do not fall back to the
|
|
226
|
+
* host tree. Diagnostics are not a FileSystem concern.
|
|
227
|
+
*
|
|
228
|
+
* Paths are a single posix namespace rooted at `/`. Query paths
|
|
229
|
+
* and yielded paths are absolute (`/src/a.ts`). No trailing
|
|
230
|
+
* slash except `/`. `""`, `"/"`, and an omitted `prefix` / `dir`
|
|
231
|
+
* / `path` (where optional) mean the root. Prefix tests are
|
|
232
|
+
* path-segment: `/agent` matches `/agent/skills`, not
|
|
233
|
+
* `/agent-tools`.
|
|
234
|
+
*
|
|
235
|
+
* Async iterators are already sorted. `unionFs` k-way merges
|
|
236
|
+
* them and does not re-sort a source.
|
|
237
|
+
*
|
|
238
|
+
* - `list` / `glob`: lexicographic by `path`. Paths are unique.
|
|
239
|
+
* - `grep`: by `path`, then `lineNumber` ascending. Keep every hit.
|
|
240
|
+
* - `search`: by `score` descending, then `path` ascending.
|
|
241
|
+
*
|
|
242
|
+
* Native-tool pagination (`head_limit`, `offset`, `output_mode`,
|
|
243
|
+
* `numResults`) stays on the synthesized tools. `grep` /
|
|
244
|
+
* `search` take optional `maxResults` as predicate pushdown so
|
|
245
|
+
* a tree can stop retrieving once the tool's cap is known.
|
|
246
|
+
* Native `LS` is built from `list` + `stat`; there is no `ls`
|
|
247
|
+
* method.
|
|
248
|
+
*
|
|
249
|
+
* Errors (authors must follow these, not invent parallel
|
|
250
|
+
* spellings):
|
|
251
|
+
*
|
|
252
|
+
* - `list` / `stat` / `glob` must not throw for a missing path.
|
|
253
|
+
* Missing is an empty iterator or `{ kind: "missing" }`.
|
|
254
|
+
* - `read` / `write` / `delete` throw {@link PathError}
|
|
255
|
+
* for recoverable failures. `error.message` is the string the
|
|
256
|
+
* synthesized native tool shows the model. `error.path` is the
|
|
257
|
+
* absolute posix path the composer remaps.
|
|
258
|
+
* - `grep` throws for an invalid regex (and a missing host
|
|
259
|
+
* search root). A missing virtual path yields nothing.
|
|
260
|
+
* - `search` yields nothing when there is no index. An index
|
|
261
|
+
* failure may throw.
|
|
262
|
+
* - Missing-file message on `read` / `delete` is
|
|
263
|
+
* `not found: ${path}` (normalized absolute posix).
|
|
264
|
+
*/
|
|
265
|
+
export interface FileSystem {
|
|
266
|
+
/**
|
|
267
|
+
* Recursive file scan under `prefix`. Files only; directories
|
|
268
|
+
* are inferred from path prefixes. A file is not under itself,
|
|
269
|
+
* so listing a file path is empty. Empty is not "missing"
|
|
270
|
+
* (`stat` answers that). Yields lexicographic unique
|
|
271
|
+
* {@link DirEntry} rows. Omitted / `""` / `"/"` means the root.
|
|
272
|
+
*
|
|
273
|
+
* Errors: none. A missing or file-path prefix yields an empty
|
|
274
|
+
* iterator. Do not throw.
|
|
275
|
+
*
|
|
276
|
+
* `options.excludes` / `options.limit` are optional pushdown.
|
|
277
|
+
* See {@link ListOptions}.
|
|
278
|
+
*/
|
|
279
|
+
list(prefix?: string, options?: ListOptions): AsyncIterable<DirEntry>;
|
|
280
|
+
/**
|
|
281
|
+
* Existence probe: exact file, a prefix that has files, or
|
|
282
|
+
* missing. Does not throw. Native LS lists first and calls
|
|
283
|
+
* this only when the iterator is empty.
|
|
284
|
+
*
|
|
285
|
+
* Errors: none. Unknown paths are `{ kind: "missing" }`.
|
|
286
|
+
*/
|
|
287
|
+
stat(path: string): Promise<FileInfo>;
|
|
288
|
+
/**
|
|
289
|
+
* Same scan as `list`, filtered by `pattern` relative to
|
|
290
|
+
* `dir`. Yields lexicographic unique {@link DirEntry} rows.
|
|
291
|
+
* `dir` omitted / `""` / `"/"` means the tree root. Matching
|
|
292
|
+
* is relative to `dir`, not basename-anywhere (`*.ts` under
|
|
293
|
+
* `/src` is `/src/a.ts`, not `/src/nested/c.ts`).
|
|
294
|
+
*
|
|
295
|
+
* Errors: none. A missing `dir` or a pattern that matches
|
|
296
|
+
* nothing yields an empty iterator. Do not throw for a bad
|
|
297
|
+
* glob (it matches nothing).
|
|
298
|
+
*
|
|
299
|
+
* `options.limit` is optional result-cap pushdown. See
|
|
300
|
+
* {@link GlobOptions}.
|
|
301
|
+
*/
|
|
302
|
+
glob(pattern: string, dir?: string, options?: GlobOptions): AsyncIterable<DirEntry>;
|
|
303
|
+
/**
|
|
304
|
+
* Read the whole file. Text files return a string. Image
|
|
305
|
+
* bytes (`jpeg` / `png` / `gif` / `webp`) return a
|
|
306
|
+
* `Uint8Array` so native Read can base64 them into an image
|
|
307
|
+
* content part. Native Read applies `offset` / `limit` and
|
|
308
|
+
* numbers lines on text only.
|
|
309
|
+
*
|
|
310
|
+
* Errors (throw `Error`):
|
|
311
|
+
* - Missing file, or a virtual directory with no file inode:
|
|
312
|
+
* `not found: ${path}`.
|
|
313
|
+
* - Host I/O (EISDIR, EACCES, …): the OS message, or the same
|
|
314
|
+
* `not found: ${path}` fallback.
|
|
315
|
+
* - `unionFs` with no mount: `no mount for path: ${path}`.
|
|
316
|
+
*/
|
|
317
|
+
read(path: string): Promise<string | Uint8Array>;
|
|
318
|
+
/**
|
|
319
|
+
* Content matches. No output-mode or offset. Honor
|
|
320
|
+
* `maxResults` when set. Yields {@link GrepResult} ordered
|
|
321
|
+
* by path, then line number.
|
|
322
|
+
*
|
|
323
|
+
* Errors (throw `Error`):
|
|
324
|
+
* - Invalid `pattern`: `invalid grep pattern: ${pattern}`.
|
|
325
|
+
* - Host search root does not exist: the OS message, or
|
|
326
|
+
* `not found: ${searchRoot}`. Native Grep turns the throw
|
|
327
|
+
* into `{ status: "error" }`.
|
|
328
|
+
*
|
|
329
|
+
* A missing virtual `path` yields nothing (not an error).
|
|
330
|
+
*/
|
|
331
|
+
grep(query: GrepQuery): AsyncIterable<GrepResult>;
|
|
332
|
+
/**
|
|
333
|
+
* Create or overwrite a file. Parents are created as needed.
|
|
334
|
+
* Native Write formats `Wrote contents to ${path}` from the
|
|
335
|
+
* path. The Write tool maps native `fileText` onto `contents`.
|
|
336
|
+
*
|
|
337
|
+
* Errors (throw `Error`):
|
|
338
|
+
* - Host I/O: the OS message, or `write failed: ${path}`.
|
|
339
|
+
* - `unionFs` with no mount: `no mount for path: ${path}`.
|
|
340
|
+
* - A read-only mount may use `read-only mount` or
|
|
341
|
+
* `read-only mount: ${path}`.
|
|
342
|
+
*
|
|
343
|
+
* Missing parents are not an error; create them. There is no
|
|
344
|
+
* `not found` for `write`.
|
|
345
|
+
*/
|
|
346
|
+
write(path: string, contents: string): Promise<void>;
|
|
347
|
+
/**
|
|
348
|
+
* Remove one file. Directories are not deleted; listing them
|
|
349
|
+
* is empty and they have no inode of their own on a virtual
|
|
350
|
+
* tree.
|
|
351
|
+
*
|
|
352
|
+
* Errors (throw `Error`):
|
|
353
|
+
* - Missing file, or a virtual directory: `not found: ${path}`.
|
|
354
|
+
* - Host I/O: the OS message, or `not found: ${path}`.
|
|
355
|
+
* - `unionFs` with no mount: `no mount for path: ${path}`.
|
|
356
|
+
*/
|
|
357
|
+
delete(path: string): Promise<void>;
|
|
358
|
+
/**
|
|
359
|
+
* Semantic hits. Trees without an index yield nothing (do
|
|
360
|
+
* not register the host index). Honor `maxResults` when set.
|
|
361
|
+
* Ordered by score descending, then path.
|
|
362
|
+
*
|
|
363
|
+
* Errors: none for a tree without an index (empty iterator).
|
|
364
|
+
* An index that fails mid-scan may throw; native
|
|
365
|
+
* SemanticSearch turns that into `{ status: "error" }` with
|
|
366
|
+
* the thrown message or `search failed`.
|
|
367
|
+
*/
|
|
368
|
+
search(query: SearchQuery): AsyncIterable<SearchResult>;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export const FILE_SYSTEM_TOOL_NAMES = [
|
|
372
|
+
"Read",
|
|
373
|
+
"LS",
|
|
374
|
+
"Glob",
|
|
375
|
+
"Grep",
|
|
376
|
+
"Write",
|
|
377
|
+
"StrReplace",
|
|
378
|
+
"Delete",
|
|
379
|
+
"SemanticSearch",
|
|
380
|
+
] as const;
|
|
381
|
+
|
|
382
|
+
export type FileSystemToolName = (typeof FILE_SYSTEM_TOOL_NAMES)[number];
|
|
383
|
+
|
|
384
|
+
const FILE_SYSTEM_TOOL_NAME_SET = new Set<string>(FILE_SYSTEM_TOOL_NAMES);
|
|
385
|
+
|
|
386
|
+
const FILE_SYSTEM_TOOL_ALIASES: Readonly<Record<string, FileSystemToolName>> = {
|
|
387
|
+
read: "Read",
|
|
388
|
+
Read: "Read",
|
|
389
|
+
ls: "LS",
|
|
390
|
+
LS: "LS",
|
|
391
|
+
glob: "Glob",
|
|
392
|
+
Glob: "Glob",
|
|
393
|
+
grep: "Grep",
|
|
394
|
+
Grep: "Grep",
|
|
395
|
+
write: "Write",
|
|
396
|
+
Write: "Write",
|
|
397
|
+
edit: "StrReplace",
|
|
398
|
+
StrReplace: "StrReplace",
|
|
399
|
+
delete: "Delete",
|
|
400
|
+
Delete: "Delete",
|
|
401
|
+
semSearch: "SemanticSearch",
|
|
402
|
+
SemanticSearch: "SemanticSearch",
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export function canonicalizeFileSystemToolName(name: string): FileSystemToolName | undefined {
|
|
406
|
+
return FILE_SYSTEM_TOOL_ALIASES[name];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export function isFileSystemToolName(name: string): name is FileSystemToolName {
|
|
410
|
+
return FILE_SYSTEM_TOOL_NAME_SET.has(name);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export function isFileSystemToolAlias(name: string): boolean {
|
|
414
|
+
return canonicalizeFileSystemToolName(name) !== undefined;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** Direct `callTool` names that mutate the tree and must wait on a busy turn. */
|
|
418
|
+
export function isMutatingFileSystemTool(name: string): boolean {
|
|
419
|
+
const canonical = canonicalizeFileSystemToolName(name);
|
|
420
|
+
return canonical === "Write" || canonical === "StrReplace" || canonical === "Delete";
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export function isFileSystemMethodPresent(root: FileSystem, method: keyof FileSystem): boolean {
|
|
424
|
+
return typeof root[method] === "function";
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const ADVERTISED_FILE_SYSTEM_TOOL_NAMES: FileSystemToolName[] = [
|
|
428
|
+
"Read",
|
|
429
|
+
"LS",
|
|
430
|
+
"Glob",
|
|
431
|
+
"Grep",
|
|
432
|
+
"Write",
|
|
433
|
+
"StrReplace",
|
|
434
|
+
"Delete",
|
|
435
|
+
"SemanticSearch",
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
export function fileSystemToolNames(_root?: FileSystem): FileSystemToolName[] {
|
|
439
|
+
return [...ADVERTISED_FILE_SYSTEM_TOOL_NAMES];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function fileSystemMethodForTool(name: FileSystemToolName): keyof FileSystem | undefined {
|
|
443
|
+
switch (name) {
|
|
444
|
+
case "Read":
|
|
445
|
+
return "read";
|
|
446
|
+
case "LS":
|
|
447
|
+
return "list";
|
|
448
|
+
case "Glob":
|
|
449
|
+
return "glob";
|
|
450
|
+
case "Grep":
|
|
451
|
+
return "grep";
|
|
452
|
+
case "Write":
|
|
453
|
+
case "StrReplace":
|
|
454
|
+
return "write";
|
|
455
|
+
case "Delete":
|
|
456
|
+
return "delete";
|
|
457
|
+
case "SemanticSearch":
|
|
458
|
+
return "search";
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function fileSystemSatisfiesFileTool(root: FileSystem, name: string): boolean {
|
|
463
|
+
const canonical = canonicalizeFileSystemToolName(name);
|
|
464
|
+
if (canonical === undefined) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
const method = fileSystemMethodForTool(canonical);
|
|
468
|
+
return method !== undefined && isFileSystemMethodPresent(root, method);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export class FileSystemConfigError extends Error {
|
|
472
|
+
constructor(message: string) {
|
|
473
|
+
super(message);
|
|
474
|
+
this.name = "FileSystemConfigError";
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function allowlistHas(tools: readonly ToolName[], ...names: string[]): boolean {
|
|
479
|
+
return tools.some(name => names.includes(name));
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export function resolveRootHarnessAllowlist(tools?: readonly ToolName[]): ToolName[] {
|
|
483
|
+
if (tools === undefined) {
|
|
484
|
+
// File verbs are synthesized, including SemanticSearch from
|
|
485
|
+
// `search`. Web tools are safe under the `/tmp` scratch
|
|
486
|
+
// overlay. Todos are harness conversation state. Do not
|
|
487
|
+
// unlock shell or task.
|
|
488
|
+
return ["webSearch", "webFetch", "updateTodos", "readTodos", "mcp"];
|
|
489
|
+
}
|
|
490
|
+
if (allowlistHas(tools, "shell", "Shell")) {
|
|
491
|
+
throw new FileSystemConfigError(
|
|
492
|
+
'`root` cannot be combined with `tools` containing `"shell"`. ' +
|
|
493
|
+
"Shell is not a FileSystem method and must not bind the host shell onto a virtual tree.",
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
if (allowlistHas(tools, "task", "Task")) {
|
|
497
|
+
throw new FileSystemConfigError(
|
|
498
|
+
"`root` cannot list `task`: a child keeps the host toolset and " +
|
|
499
|
+
"would read the real workspace. Sharing `root` with subagents " +
|
|
500
|
+
"needs a Cursor SDK inherit, not an overridden Task tool.",
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
if (allowlistHas(tools, "readLints", "ReadLints")) {
|
|
504
|
+
throw new FileSystemConfigError(
|
|
505
|
+
"`root` cannot list `readLints`: FileSystem has no diagnostics " +
|
|
506
|
+
"verb, so the host language service would run against the real workspace.",
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
const extras = tools.filter(name => !isFileSystemToolAlias(name));
|
|
510
|
+
return withMcpGrant(extras);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export function resolveFileSystemTools(options: {
|
|
514
|
+
root: FileSystem;
|
|
515
|
+
tools?: readonly ToolName[];
|
|
516
|
+
}): ToolName[] {
|
|
517
|
+
const harness = resolveRootHarnessAllowlist(options.tools);
|
|
518
|
+
if (options.tools === undefined) {
|
|
519
|
+
return harness;
|
|
520
|
+
}
|
|
521
|
+
const implemented = fileSystemToolNames(options.root);
|
|
522
|
+
const missing: string[] = [];
|
|
523
|
+
for (const name of options.tools) {
|
|
524
|
+
if (!fileSystemSatisfiesFileTool(options.root, name)) {
|
|
525
|
+
missing.push(name);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (missing.length > 0) {
|
|
529
|
+
throw new FileSystemConfigError(
|
|
530
|
+
`\`tools\` names FileSystem method(s) that are not implemented: ${missing.join(", ")}. ` +
|
|
531
|
+
`Implemented file tools: ${implemented.length > 0 ? implemented.join(", ") : "(none)"}.`,
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
return harness;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export function withMcpGrant(tools: readonly ToolName[]): ToolName[] {
|
|
538
|
+
return tools.includes("mcp") ? [...tools] : [...tools, "mcp"];
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Native Cursor SDK file tools replaced by synthesized FileSystem tools
|
|
543
|
+
* on every local turn. SDK allowlist names (`edit`, not `Write`).
|
|
544
|
+
*/
|
|
545
|
+
export const REPLACED_NATIVE_FILE_TOOLS: ToolName[] = [
|
|
546
|
+
"read",
|
|
547
|
+
"ls",
|
|
548
|
+
"grep",
|
|
549
|
+
"glob",
|
|
550
|
+
"edit",
|
|
551
|
+
"delete",
|
|
552
|
+
];
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Host-default harness options: keep shell / webSearch / sandbox, but
|
|
556
|
+
* hide the native file tools the synthesized FileSystem now owns.
|
|
557
|
+
*
|
|
558
|
+
* Omitted `tools` leaves the SDK default set and only excludes the
|
|
559
|
+
* replaced natives. `[]` stays empty. A non-empty allowlist drops file
|
|
560
|
+
* aliases (those ride synthesized tools) and grants `mcp`.
|
|
561
|
+
*/
|
|
562
|
+
export function resolveHostHarnessToolOptions(tools?: readonly ToolName[]): {
|
|
563
|
+
tools?: ToolName[];
|
|
564
|
+
disallowedTools?: ToolName[];
|
|
565
|
+
} {
|
|
566
|
+
if (tools === undefined) {
|
|
567
|
+
return { disallowedTools: [...REPLACED_NATIVE_FILE_TOOLS] };
|
|
568
|
+
}
|
|
569
|
+
if (tools.length === 0) {
|
|
570
|
+
return { tools: [] };
|
|
571
|
+
}
|
|
572
|
+
return {
|
|
573
|
+
tools: withMcpGrant(tools.filter(name => !isReplacedHostFileAlias(name))),
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** File aliases host-default synthesizes. Native `semSearch` stays. */
|
|
578
|
+
function isReplacedHostFileAlias(name: string): boolean {
|
|
579
|
+
const canonical = canonicalizeFileSystemToolName(name);
|
|
580
|
+
return canonical !== undefined && canonical !== "SemanticSearch";
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export type GrepOutputMode = "content" | "files_with_matches" | "count";
|
|
584
|
+
|
|
585
|
+
/** Decode a {@link FileSystem.read} result as UTF-8 text. */
|
|
586
|
+
export function fileSystemText(content: string | Uint8Array): string {
|
|
587
|
+
return typeof content === "string" ? content : Buffer.from(content).toString("utf8");
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Native Read image formats. Magic bytes first, then extension.
|
|
592
|
+
* Returns undefined for text (and for any other binary).
|
|
593
|
+
*/
|
|
594
|
+
export function detectImageMimeType(bytes: Uint8Array, filePath?: string): string | undefined {
|
|
595
|
+
if (bytes.length >= 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) {
|
|
596
|
+
return "image/jpeg";
|
|
597
|
+
}
|
|
598
|
+
if (
|
|
599
|
+
bytes.length >= 8 &&
|
|
600
|
+
bytes[0] === 0x89 &&
|
|
601
|
+
bytes[1] === 0x50 &&
|
|
602
|
+
bytes[2] === 0x4e &&
|
|
603
|
+
bytes[3] === 0x47
|
|
604
|
+
) {
|
|
605
|
+
return "image/png";
|
|
606
|
+
}
|
|
607
|
+
if (bytes.length >= 6 && bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46) {
|
|
608
|
+
return "image/gif";
|
|
609
|
+
}
|
|
610
|
+
if (
|
|
611
|
+
bytes.length >= 12 &&
|
|
612
|
+
bytes[0] === 0x52 &&
|
|
613
|
+
bytes[1] === 0x49 &&
|
|
614
|
+
bytes[2] === 0x46 &&
|
|
615
|
+
bytes[3] === 0x46 &&
|
|
616
|
+
bytes[8] === 0x57 &&
|
|
617
|
+
bytes[9] === 0x45 &&
|
|
618
|
+
bytes[10] === 0x42 &&
|
|
619
|
+
bytes[11] === 0x50
|
|
620
|
+
) {
|
|
621
|
+
return "image/webp";
|
|
622
|
+
}
|
|
623
|
+
if (filePath === undefined) {
|
|
624
|
+
return undefined;
|
|
625
|
+
}
|
|
626
|
+
const lower = filePath.toLowerCase();
|
|
627
|
+
if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) {
|
|
628
|
+
return "image/jpeg";
|
|
629
|
+
}
|
|
630
|
+
if (lower.endsWith(".png")) {
|
|
631
|
+
return "image/png";
|
|
632
|
+
}
|
|
633
|
+
if (lower.endsWith(".gif")) {
|
|
634
|
+
return "image/gif";
|
|
635
|
+
}
|
|
636
|
+
if (lower.endsWith(".webp")) {
|
|
637
|
+
return "image/webp";
|
|
638
|
+
}
|
|
639
|
+
return undefined;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export function fileSystemImage(
|
|
643
|
+
content: string | Uint8Array,
|
|
644
|
+
path: string,
|
|
645
|
+
): { mimeType: string; bytes: Uint8Array } | undefined {
|
|
646
|
+
if (!(content instanceof Uint8Array)) {
|
|
647
|
+
return undefined;
|
|
648
|
+
}
|
|
649
|
+
const mimeType = detectImageMimeType(content, path);
|
|
650
|
+
if (mimeType === undefined) {
|
|
651
|
+
return undefined;
|
|
652
|
+
}
|
|
653
|
+
return { mimeType, bytes: content };
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function compileGrepPattern(pattern: string, caseInsensitive?: boolean, path = "/"): RegExp {
|
|
657
|
+
try {
|
|
658
|
+
return new RegExp(pattern, caseInsensitive === true ? "i" : undefined);
|
|
659
|
+
} catch {
|
|
660
|
+
throw new InvalidGrepPatternError(pattern, path);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function* grepFileContent(args: {
|
|
665
|
+
path: string;
|
|
666
|
+
content: string;
|
|
667
|
+
regex: RegExp;
|
|
668
|
+
}): Generator<GrepResult> {
|
|
669
|
+
const lines = args.content.split("\n");
|
|
670
|
+
for (let i = 0; i < lines.length; i++) {
|
|
671
|
+
const line = lines[i]!;
|
|
672
|
+
if (args.regex.test(line)) {
|
|
673
|
+
yield { path: args.path, lineNumber: i + 1, line };
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function normalizeMaxResults(maxResults: number | undefined): number | undefined {
|
|
679
|
+
if (maxResults === undefined || !Number.isFinite(maxResults)) {
|
|
680
|
+
return undefined;
|
|
681
|
+
}
|
|
682
|
+
return Math.max(0, Math.floor(maxResults));
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
async function* limitResults<T>(
|
|
686
|
+
source: AsyncIterable<T>,
|
|
687
|
+
maxResults: number | undefined,
|
|
688
|
+
): AsyncGenerator<T> {
|
|
689
|
+
const cap = normalizeMaxResults(maxResults);
|
|
690
|
+
if (cap === 0) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
let n = 0;
|
|
694
|
+
for await (const item of source) {
|
|
695
|
+
yield item;
|
|
696
|
+
n++;
|
|
697
|
+
if (cap !== undefined && n >= cap) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function grepPushdownLimit(
|
|
704
|
+
query: GrepQuery,
|
|
705
|
+
opts: { outputMode: GrepOutputMode; headLimit?: number; offset: number },
|
|
706
|
+
): number | undefined {
|
|
707
|
+
// Count and files_with_matches paginate after grouping by file.
|
|
708
|
+
// A line-level cap would hide later files once one file fills the window.
|
|
709
|
+
if (opts.outputMode === "count" || opts.outputMode === "files_with_matches") {
|
|
710
|
+
return query.maxResults;
|
|
711
|
+
}
|
|
712
|
+
const headLimit = opts.headLimit !== undefined && opts.headLimit > 0 ? opts.headLimit : undefined;
|
|
713
|
+
if (headLimit === undefined) {
|
|
714
|
+
return query.maxResults;
|
|
715
|
+
}
|
|
716
|
+
const toolCap = opts.offset + headLimit;
|
|
717
|
+
return query.maxResults === undefined ? toolCap : Math.min(query.maxResults, toolCap);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function compareGrepResult(left: GrepResult, right: GrepResult): number {
|
|
721
|
+
return left.path < right.path
|
|
722
|
+
? -1
|
|
723
|
+
: left.path > right.path
|
|
724
|
+
? 1
|
|
725
|
+
: left.lineNumber - right.lineNumber;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function compareSearchResult(left: SearchResult, right: SearchResult): number {
|
|
729
|
+
if (right.score !== left.score) {
|
|
730
|
+
return right.score - left.score;
|
|
731
|
+
}
|
|
732
|
+
return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export async function collectGrepMatches(
|
|
736
|
+
root: FileSystem,
|
|
737
|
+
query: GrepQuery,
|
|
738
|
+
opts: { outputMode: GrepOutputMode; headLimit?: number; offset?: number },
|
|
739
|
+
): Promise<GrepResult[]> {
|
|
740
|
+
const matches: GrepResult[] = [];
|
|
741
|
+
const offset = opts.offset !== undefined && opts.offset > 0 ? opts.offset : 0;
|
|
742
|
+
const headLimit = opts.headLimit !== undefined && opts.headLimit > 0 ? opts.headLimit : undefined;
|
|
743
|
+
const skippedFiles = new Set<string>();
|
|
744
|
+
const acceptedFiles = new Set<string>();
|
|
745
|
+
let skippedItems = 0;
|
|
746
|
+
let takenItems = 0;
|
|
747
|
+
const pushdown = grepPushdownLimit(query, {
|
|
748
|
+
outputMode: opts.outputMode,
|
|
749
|
+
offset,
|
|
750
|
+
...(opts.headLimit === undefined ? {} : { headLimit: opts.headLimit }),
|
|
751
|
+
});
|
|
752
|
+
const grepQuery = pushdown === undefined ? query : { ...query, maxResults: pushdown };
|
|
753
|
+
for await (const match of root.grep(grepQuery)) {
|
|
754
|
+
if (opts.outputMode === "content") {
|
|
755
|
+
if (skippedItems < offset) {
|
|
756
|
+
skippedItems++;
|
|
757
|
+
continue;
|
|
758
|
+
}
|
|
759
|
+
matches.push(match);
|
|
760
|
+
takenItems++;
|
|
761
|
+
if (headLimit !== undefined && takenItems >= headLimit) {
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
continue;
|
|
765
|
+
}
|
|
766
|
+
if (skippedFiles.has(match.path)) {
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
if (!acceptedFiles.has(match.path)) {
|
|
770
|
+
if (skippedItems < offset) {
|
|
771
|
+
skippedFiles.add(match.path);
|
|
772
|
+
skippedItems++;
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
if (headLimit !== undefined && takenItems >= headLimit) {
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
acceptedFiles.add(match.path);
|
|
779
|
+
takenItems++;
|
|
780
|
+
}
|
|
781
|
+
matches.push(match);
|
|
782
|
+
}
|
|
783
|
+
return matches;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export type GrepContentHit = GrepResult & {
|
|
787
|
+
beforeContext?: string[];
|
|
788
|
+
afterContext?: string[];
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
export function shapeGrepUnion(
|
|
792
|
+
matches: GrepContentHit[],
|
|
793
|
+
outputMode: GrepOutputMode,
|
|
794
|
+
): GrepUnionResult {
|
|
795
|
+
if (outputMode === "files_with_matches") {
|
|
796
|
+
const files = [...new Set(matches.map(match => match.path))];
|
|
797
|
+
return { type: "files", output: { files, count: files.length } };
|
|
798
|
+
}
|
|
799
|
+
if (outputMode === "count") {
|
|
800
|
+
const counts = new Map<string, number>();
|
|
801
|
+
for (const match of matches) {
|
|
802
|
+
counts.set(match.path, (counts.get(match.path) ?? 0) + 1);
|
|
803
|
+
}
|
|
804
|
+
return {
|
|
805
|
+
type: "count",
|
|
806
|
+
output: {
|
|
807
|
+
counts: [...counts].map(([file, count]) => ({ file, count })),
|
|
808
|
+
total: matches.length,
|
|
809
|
+
},
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
return {
|
|
813
|
+
type: "content",
|
|
814
|
+
output: {
|
|
815
|
+
matches: matches.map(match => ({
|
|
816
|
+
file: match.path,
|
|
817
|
+
lineNumber: match.lineNumber,
|
|
818
|
+
line: match.line,
|
|
819
|
+
...(match.beforeContext === undefined ? {} : { beforeContext: match.beforeContext }),
|
|
820
|
+
...(match.afterContext === undefined ? {} : { afterContext: match.afterContext }),
|
|
821
|
+
})),
|
|
822
|
+
totalMatches: matches.length,
|
|
823
|
+
},
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export function normalizeFsPath(input: string): string {
|
|
828
|
+
const slashes = input.replace(/\\/g, "/");
|
|
829
|
+
if (slashes === "") {
|
|
830
|
+
return "/";
|
|
831
|
+
}
|
|
832
|
+
const withSlash = slashes.startsWith("/") ? slashes : `/${slashes}`;
|
|
833
|
+
const resolved = path.posix.normalize(withSlash);
|
|
834
|
+
if (resolved.length > 1 && resolved.endsWith("/")) {
|
|
835
|
+
return resolved.slice(0, -1);
|
|
836
|
+
}
|
|
837
|
+
return resolved === "." || resolved === "" ? "/" : resolved;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/** Path-segment prefix: `/agent` matches `/agent/skills`, not `/agent-tools`. */
|
|
841
|
+
export function pathHasSegmentPrefix(args: { path: string; prefix: string }): boolean {
|
|
842
|
+
const p = normalizeFsPath(args.path);
|
|
843
|
+
const pre = normalizeFsPath(args.prefix);
|
|
844
|
+
if (pre === "/") {
|
|
845
|
+
return true;
|
|
846
|
+
}
|
|
847
|
+
return p === pre || p.startsWith(`${pre}/`);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
function matchGlob(relativePath: string, globPattern: string): boolean {
|
|
851
|
+
return minimatch(relativePath, globPattern, { dot: true, nocase: false });
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
function pathMatchesGlob(
|
|
855
|
+
filePath: string,
|
|
856
|
+
dir: string,
|
|
857
|
+
globPattern: string,
|
|
858
|
+
options: { matchBasename?: boolean } = {},
|
|
859
|
+
): boolean {
|
|
860
|
+
const posixFile = filePath.replace(/\\/g, "/");
|
|
861
|
+
const posixDir = dir.replace(/\\/g, "/");
|
|
862
|
+
const relative =
|
|
863
|
+
posixDir === "/" || posixFile.startsWith(`${posixDir}/`)
|
|
864
|
+
? posixDir === "/"
|
|
865
|
+
? posixFile.replace(/^\//, "")
|
|
866
|
+
: posixFile.slice(posixDir.length + 1)
|
|
867
|
+
: posixFile.replace(/^\//, "");
|
|
868
|
+
if (matchGlob(relative, globPattern) || matchGlob(posixFile.replace(/^\//, ""), globPattern)) {
|
|
869
|
+
return true;
|
|
870
|
+
}
|
|
871
|
+
// Native grep `--glob '*.ts'` matches the basename at any depth.
|
|
872
|
+
// Glob `*.ts` stays relative to `targetDirectory` and does not.
|
|
873
|
+
if (options.matchBasename === true && !globPattern.includes("/")) {
|
|
874
|
+
const slash = relative.lastIndexOf("/");
|
|
875
|
+
const base = slash === -1 ? relative : relative.slice(slash + 1);
|
|
876
|
+
return matchGlob(base, globPattern);
|
|
877
|
+
}
|
|
878
|
+
return false;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Resolve a per-send `workspaceFiles` key onto the virtual `/` namespace.
|
|
883
|
+
* Refuses paths that escape the root, and the reserved `memory` name.
|
|
884
|
+
* Host-default workspaces symlink `memory/` to durable agent state, so a
|
|
885
|
+
* seed under that name would write through the link.
|
|
886
|
+
*/
|
|
887
|
+
export function virtualWorkspaceWritePath(relativePath: string): string {
|
|
888
|
+
if (relativePath.includes("\0")) {
|
|
889
|
+
throw new FileSystemConfigError(`Refusing to write outside the virtual root: ${relativePath}`);
|
|
890
|
+
}
|
|
891
|
+
const posix = relativePath.replaceAll("\\", "/");
|
|
892
|
+
const base = "/virtual-root";
|
|
893
|
+
const target = path.posix.normalize(path.posix.join(base, posix));
|
|
894
|
+
if (target !== base && !target.startsWith(`${base}/`)) {
|
|
895
|
+
throw new FileSystemConfigError(`Refusing to write outside the virtual root: ${relativePath}`);
|
|
896
|
+
}
|
|
897
|
+
const sliced = target.slice(base.length);
|
|
898
|
+
const dest = sliced === "" ? "/" : sliced;
|
|
899
|
+
if (
|
|
900
|
+
pathHasSegmentPrefix({
|
|
901
|
+
path: dest,
|
|
902
|
+
prefix: `/${MEMORY_DIR_NAME}`,
|
|
903
|
+
})
|
|
904
|
+
) {
|
|
905
|
+
throw new FileSystemConfigError(
|
|
906
|
+
`"${MEMORY_DIR_NAME}" is reserved for shared session memory; refusing to write ${relativePath}`,
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
return dest;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
export async function writeWorkspaceFilesToRoot(
|
|
913
|
+
root: FileSystem,
|
|
914
|
+
files: Record<string, string | { encoding: "base64"; data: string; mimeType?: string }>,
|
|
915
|
+
): Promise<void> {
|
|
916
|
+
for (const [relativePath, contents] of Object.entries(files)) {
|
|
917
|
+
// Refuse escapes, then write the sanitized relative dest so
|
|
918
|
+
// `localFileSystem` joins against cwd and `tempFs` still normalizes
|
|
919
|
+
// `a.txt` → `/a.txt`. Never forward an absolute host path.
|
|
920
|
+
const dest = virtualWorkspaceWritePath(relativePath);
|
|
921
|
+
const relativeDest = dest.replace(/^\//, "");
|
|
922
|
+
if (relativeDest === "") {
|
|
923
|
+
throw new FileSystemConfigError(`Refusing to write the virtual root: ${relativePath}`);
|
|
924
|
+
}
|
|
925
|
+
const fileText =
|
|
926
|
+
typeof contents === "string"
|
|
927
|
+
? contents
|
|
928
|
+
: Buffer.from(contents.data, "base64").toString("utf8");
|
|
929
|
+
try {
|
|
930
|
+
await root.write(relativeDest, fileText);
|
|
931
|
+
} catch (error) {
|
|
932
|
+
throw new FileSystemConfigError(
|
|
933
|
+
`workspaceFiles failed to write ${relativePath}: ${
|
|
934
|
+
error instanceof Error ? error.message : "write failed"
|
|
935
|
+
}`,
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
function replaceLiteral(args: {
|
|
942
|
+
existing: string;
|
|
943
|
+
oldText: string;
|
|
944
|
+
newText: string;
|
|
945
|
+
replaceAll: boolean;
|
|
946
|
+
}): string {
|
|
947
|
+
if (args.replaceAll) {
|
|
948
|
+
return args.existing.split(args.oldText).join(args.newText);
|
|
949
|
+
}
|
|
950
|
+
const index = args.existing.indexOf(args.oldText);
|
|
951
|
+
if (index === -1) {
|
|
952
|
+
return args.existing;
|
|
953
|
+
}
|
|
954
|
+
return (
|
|
955
|
+
args.existing.slice(0, index) + args.newText + args.existing.slice(index + args.oldText.length)
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
function countNonOverlapping(haystack: string, needle: string): number {
|
|
960
|
+
let count = 0;
|
|
961
|
+
let from = 0;
|
|
962
|
+
while (from <= haystack.length - needle.length) {
|
|
963
|
+
const index = haystack.indexOf(needle, from);
|
|
964
|
+
if (index === -1) {
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
count++;
|
|
968
|
+
from = index + needle.length;
|
|
969
|
+
}
|
|
970
|
+
return count;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Exact, non-overlapping str-replace. Uniqueness is the FileSystem
|
|
975
|
+
* contract: more than one match fails unless `replaceAll`.
|
|
976
|
+
*/
|
|
977
|
+
function applyExactEdit(args: {
|
|
978
|
+
existing: string;
|
|
979
|
+
oldText: string;
|
|
980
|
+
newText: string;
|
|
981
|
+
replaceAll: boolean;
|
|
982
|
+
path: string;
|
|
983
|
+
}): { contents: string; occurrencesModified: number } {
|
|
984
|
+
if (args.oldText === "") {
|
|
985
|
+
throw new EditError(args.path, "oldText is empty");
|
|
986
|
+
}
|
|
987
|
+
if (args.oldText === args.newText) {
|
|
988
|
+
throw new EditError(args.path, "oldText and newText are exactly the same");
|
|
989
|
+
}
|
|
990
|
+
const occurrences = countNonOverlapping(args.existing, args.oldText);
|
|
991
|
+
if (occurrences === 0) {
|
|
992
|
+
throw new EditError(args.path, "The string to replace was not found in the file");
|
|
993
|
+
}
|
|
994
|
+
if (occurrences > 1 && !args.replaceAll) {
|
|
995
|
+
throw new EditError(
|
|
996
|
+
args.path,
|
|
997
|
+
"The string to replace was found multiple times in the file. Use replace_all to replace all occurrences, or include more context to only edit one occurrence.",
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
return {
|
|
1001
|
+
contents: replaceLiteral({
|
|
1002
|
+
existing: args.existing,
|
|
1003
|
+
oldText: args.oldText,
|
|
1004
|
+
newText: args.newText,
|
|
1005
|
+
replaceAll: args.replaceAll,
|
|
1006
|
+
}),
|
|
1007
|
+
occurrencesModified: occurrences,
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Exact str-replace as `read` + apply + `write`. Uniqueness is
|
|
1013
|
+
* this helper's contract; FileSystem implementations do not
|
|
1014
|
+
* implement edit. Native StrReplace calls this.
|
|
1015
|
+
*/
|
|
1016
|
+
export async function strReplaceOnFileSystem(
|
|
1017
|
+
root: Pick<FileSystem, "read" | "write">,
|
|
1018
|
+
query: EditQuery,
|
|
1019
|
+
): Promise<EditResult> {
|
|
1020
|
+
const existing = await root.read(query.path);
|
|
1021
|
+
if (typeof existing !== "string") {
|
|
1022
|
+
throw new EditError(query.path, `${query.path} is not text`);
|
|
1023
|
+
}
|
|
1024
|
+
const applied = applyExactEdit({
|
|
1025
|
+
existing,
|
|
1026
|
+
oldText: query.oldText,
|
|
1027
|
+
newText: query.newText,
|
|
1028
|
+
replaceAll: query.replaceAll === true,
|
|
1029
|
+
path: query.path,
|
|
1030
|
+
});
|
|
1031
|
+
await root.write(query.path, applied.contents);
|
|
1032
|
+
return { occurrencesModified: applied.occurrencesModified };
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/** Native Read offset/limit: 1-indexed, negative offset counts from the end. */
|
|
1036
|
+
export function sliceReadContent(content: string, offset?: number, limit?: number): string {
|
|
1037
|
+
if (offset === undefined && limit === undefined) {
|
|
1038
|
+
return content;
|
|
1039
|
+
}
|
|
1040
|
+
const lines = content === "" ? [] : content.split("\n");
|
|
1041
|
+
const total = lines.length;
|
|
1042
|
+
const effectiveOffset = offset ?? 1;
|
|
1043
|
+
const effectiveLimit = limit ?? (effectiveOffset < 0 ? Math.abs(effectiveOffset) : total);
|
|
1044
|
+
const startIndex =
|
|
1045
|
+
effectiveOffset < 0 ? Math.max(0, total + effectiveOffset) : Math.max(0, effectiveOffset - 1);
|
|
1046
|
+
const endIndex = Math.min(total, startIndex + effectiveLimit);
|
|
1047
|
+
return lines.slice(startIndex, endIndex).join("\n");
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
async function* emptySearch(_query: SearchQuery): AsyncGenerator<SearchResult> {}
|
|
1051
|
+
|
|
1052
|
+
async function* emptyStream(): AsyncGenerator<never> {}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* A FileSystem with no files. Use as an overlay leaf or a missing
|
|
1056
|
+
* catalog so a miss stays {@link FileNotFoundError} instead of
|
|
1057
|
+
* {@link NoMountError}. Writes and deletes throw
|
|
1058
|
+
* {@link ReadOnlyMountError} — an empty tree is never a sink.
|
|
1059
|
+
*/
|
|
1060
|
+
export function emptyFs(): FileSystem {
|
|
1061
|
+
return {
|
|
1062
|
+
list: () => emptyStream(),
|
|
1063
|
+
glob: () => emptyStream(),
|
|
1064
|
+
async *grep(query) {
|
|
1065
|
+
compileGrepPattern(
|
|
1066
|
+
query.pattern,
|
|
1067
|
+
query.caseInsensitive,
|
|
1068
|
+
query.path === undefined || query.path === "" ? "/" : normalizeFsPath(query.path),
|
|
1069
|
+
);
|
|
1070
|
+
yield* emptyStream();
|
|
1071
|
+
},
|
|
1072
|
+
search: emptySearch,
|
|
1073
|
+
async stat(path) {
|
|
1074
|
+
return statFromFilePaths([], path);
|
|
1075
|
+
},
|
|
1076
|
+
async read(path) {
|
|
1077
|
+
throw new FileNotFoundError(normalizeFsPath(path));
|
|
1078
|
+
},
|
|
1079
|
+
async write(path) {
|
|
1080
|
+
throw new ReadOnlyMountError(normalizeFsPath(path));
|
|
1081
|
+
},
|
|
1082
|
+
async delete(path) {
|
|
1083
|
+
throw new ReadOnlyMountError(normalizeFsPath(path));
|
|
1084
|
+
},
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* In-memory FileSystem for tests and fixtures. Keys are absolute
|
|
1090
|
+
* posix paths (`/a.txt`) and are normalized on ingest. Honors the
|
|
1091
|
+
* {@link FileSystem} order and path contracts.
|
|
1092
|
+
* `search` is empty. Creates `/agent-tools` on first scratch
|
|
1093
|
+
* write the same way any other path is created.
|
|
1094
|
+
*/
|
|
1095
|
+
export function tempFs(files: Record<string, string | Uint8Array> = {}): FileSystem {
|
|
1096
|
+
const store = new Map<string, string | Uint8Array>();
|
|
1097
|
+
for (const [path, content] of Object.entries(files)) {
|
|
1098
|
+
store.set(normalizeFsPath(path), content);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
const listed = {
|
|
1102
|
+
list(prefix?: string, options?: ListOptions) {
|
|
1103
|
+
return listFilesFromPaths(
|
|
1104
|
+
[...store.entries()].map(([filePath, content]) => ({
|
|
1105
|
+
path: filePath,
|
|
1106
|
+
size: typeof content === "string" ? content.length : content.byteLength,
|
|
1107
|
+
})),
|
|
1108
|
+
prefix,
|
|
1109
|
+
options,
|
|
1110
|
+
);
|
|
1111
|
+
},
|
|
1112
|
+
async stat(path: string) {
|
|
1113
|
+
return statFromFilePaths(store.keys(), path);
|
|
1114
|
+
},
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
return {
|
|
1118
|
+
list(prefix, options) {
|
|
1119
|
+
return listed.list(prefix, options);
|
|
1120
|
+
},
|
|
1121
|
+
async stat(path) {
|
|
1122
|
+
return listed.stat(path);
|
|
1123
|
+
},
|
|
1124
|
+
async read(inputPath) {
|
|
1125
|
+
const path = normalizeFsPath(inputPath);
|
|
1126
|
+
const content = store.get(path);
|
|
1127
|
+
if (content === undefined) {
|
|
1128
|
+
throw new FileNotFoundError(path);
|
|
1129
|
+
}
|
|
1130
|
+
return content;
|
|
1131
|
+
},
|
|
1132
|
+
async *grep(query) {
|
|
1133
|
+
yield* limitResults(uncapped(), query.maxResults);
|
|
1134
|
+
async function* uncapped() {
|
|
1135
|
+
const regex = compileGrepPattern(
|
|
1136
|
+
query.pattern,
|
|
1137
|
+
query.caseInsensitive,
|
|
1138
|
+
query.path === undefined || query.path === "" ? "/" : normalizeFsPath(query.path),
|
|
1139
|
+
);
|
|
1140
|
+
const scope =
|
|
1141
|
+
query.path === undefined || query.path === "" ? "/" : normalizeFsPath(query.path);
|
|
1142
|
+
const exact = store.get(scope);
|
|
1143
|
+
if (scope !== "/" && exact !== undefined) {
|
|
1144
|
+
if (
|
|
1145
|
+
query.glob !== undefined &&
|
|
1146
|
+
!pathMatchesGlob(scope, scope, query.glob, {
|
|
1147
|
+
matchBasename: true,
|
|
1148
|
+
})
|
|
1149
|
+
) {
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
if (isExcludedPath(scope, query.excludes)) {
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
yield* grepFileContent({
|
|
1156
|
+
path: scope,
|
|
1157
|
+
content: fileSystemText(exact),
|
|
1158
|
+
regex,
|
|
1159
|
+
});
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
for await (const entry of listed.list(
|
|
1163
|
+
scope === "/" ? undefined : scope,
|
|
1164
|
+
query.excludes === undefined ? undefined : { excludes: query.excludes },
|
|
1165
|
+
)) {
|
|
1166
|
+
if (
|
|
1167
|
+
query.glob !== undefined &&
|
|
1168
|
+
!pathMatchesGlob(entry.path, scope, query.glob, {
|
|
1169
|
+
matchBasename: true,
|
|
1170
|
+
})
|
|
1171
|
+
) {
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
const content = store.get(entry.path);
|
|
1175
|
+
if (content === undefined) {
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
yield* grepFileContent({
|
|
1179
|
+
path: entry.path,
|
|
1180
|
+
content: fileSystemText(content),
|
|
1181
|
+
regex,
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
async *glob(pattern, dir, options) {
|
|
1187
|
+
const scope = dir === undefined || dir === "" ? "/" : normalizeFsPath(dir);
|
|
1188
|
+
yield* globFromList(listed.list(scope === "/" ? undefined : scope), {
|
|
1189
|
+
pattern,
|
|
1190
|
+
dir: scope,
|
|
1191
|
+
...(options?.limit === undefined ? {} : { limit: options.limit }),
|
|
1192
|
+
});
|
|
1193
|
+
},
|
|
1194
|
+
async write(inputPath, contents) {
|
|
1195
|
+
store.set(normalizeFsPath(inputPath), contents);
|
|
1196
|
+
},
|
|
1197
|
+
async delete(inputPath) {
|
|
1198
|
+
const path = normalizeFsPath(inputPath);
|
|
1199
|
+
if (!store.has(path)) {
|
|
1200
|
+
throw new FileNotFoundError(path);
|
|
1201
|
+
}
|
|
1202
|
+
store.delete(path);
|
|
1203
|
+
},
|
|
1204
|
+
search: emptySearch,
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
function fsErrorMessage(error: unknown, fallback: string): string {
|
|
1209
|
+
return error instanceof Error ? error.message : fallback;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
function throwLocalReadError(error: unknown, filePath: string): never {
|
|
1213
|
+
throw new FileNotFoundError(filePath, fsErrorMessage(error, `not found: ${filePath}`));
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
function skipWalkDir(name: string): boolean {
|
|
1217
|
+
return name === ".git" || name === "node_modules";
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
async function walkLocalFiles(rootDir: string): Promise<string[]> {
|
|
1221
|
+
const found: string[] = [];
|
|
1222
|
+
const stack = [rootDir];
|
|
1223
|
+
while (stack.length > 0) {
|
|
1224
|
+
const current = stack.pop();
|
|
1225
|
+
if (current === undefined) {
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
let entries: Array<{
|
|
1229
|
+
name: string;
|
|
1230
|
+
isDirectory(): boolean;
|
|
1231
|
+
isFile(): boolean;
|
|
1232
|
+
}>;
|
|
1233
|
+
try {
|
|
1234
|
+
entries = await readdir(current, { withFileTypes: true });
|
|
1235
|
+
} catch {
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
for (const entry of entries) {
|
|
1239
|
+
const full = path.join(current, entry.name);
|
|
1240
|
+
// Same as the pre-root host walk and native LS/Glob/Grep: Dirent
|
|
1241
|
+
// isDirectory/isFile do not follow links, so workspace `memory/`
|
|
1242
|
+
// and other symlinks are not enumerated. Exact-path read/stat still
|
|
1243
|
+
// follow.
|
|
1244
|
+
if (entry.isDirectory()) {
|
|
1245
|
+
if (!skipWalkDir(entry.name)) {
|
|
1246
|
+
stack.push(full);
|
|
1247
|
+
}
|
|
1248
|
+
} else if (entry.isFile()) {
|
|
1249
|
+
found.push(full);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
found.sort((left, right) => left.localeCompare(right));
|
|
1254
|
+
return found;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
async function* listLocalFiles(rootDir: string): AsyncGenerator<DirEntry> {
|
|
1258
|
+
for (const filePath of await walkLocalFiles(rootDir)) {
|
|
1259
|
+
yield { path: filePath };
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Host-disk FileSystem. Relative paths resolve against `cwd`; absolute
|
|
1265
|
+
* paths are used as-is — the same contract as Cursor SDK native file
|
|
1266
|
+
* tools. `search` yields empty results (no host index).
|
|
1267
|
+
*
|
|
1268
|
+
* Internal. Not part of the public Agent SDK surface.
|
|
1269
|
+
*/
|
|
1270
|
+
export function localFileSystem(options: { cwd: string }): FileSystem {
|
|
1271
|
+
const cwd = path.resolve(options.cwd);
|
|
1272
|
+
|
|
1273
|
+
const resolvePath = (input: string): string =>
|
|
1274
|
+
path.isAbsolute(input) ? path.resolve(input) : path.resolve(cwd, input);
|
|
1275
|
+
|
|
1276
|
+
return {
|
|
1277
|
+
async *list(prefix, options) {
|
|
1278
|
+
yield* limitResults(uncapped(), options?.limit);
|
|
1279
|
+
async function* uncapped() {
|
|
1280
|
+
const dirPath =
|
|
1281
|
+
prefix === undefined || prefix === "" || prefix === "." ? cwd : resolvePath(prefix);
|
|
1282
|
+
for await (const entry of listLocalFiles(dirPath)) {
|
|
1283
|
+
if (!isExcludedPath(entry.path, options?.excludes)) {
|
|
1284
|
+
yield entry;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
async stat(probePath) {
|
|
1290
|
+
const filePath = resolvePath(probePath);
|
|
1291
|
+
try {
|
|
1292
|
+
const info = await stat(filePath);
|
|
1293
|
+
return { kind: info.isDirectory() ? "directory" : "file" } as const;
|
|
1294
|
+
} catch {
|
|
1295
|
+
return { kind: "missing" } as const;
|
|
1296
|
+
}
|
|
1297
|
+
},
|
|
1298
|
+
async read(inputPath) {
|
|
1299
|
+
const filePath = resolvePath(inputPath);
|
|
1300
|
+
try {
|
|
1301
|
+
const bytes = await readFile(filePath);
|
|
1302
|
+
if (detectImageMimeType(bytes, filePath) !== undefined) {
|
|
1303
|
+
return new Uint8Array(bytes);
|
|
1304
|
+
}
|
|
1305
|
+
return bytes.toString("utf8");
|
|
1306
|
+
} catch (error) {
|
|
1307
|
+
throwLocalReadError(error, filePath);
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
async *grep(query) {
|
|
1311
|
+
yield* limitResults(uncapped(), query.maxResults);
|
|
1312
|
+
async function* uncapped() {
|
|
1313
|
+
const searchRoot = resolvePath(query.path ?? cwd);
|
|
1314
|
+
const regex = compileGrepPattern(query.pattern, query.caseInsensitive, searchRoot);
|
|
1315
|
+
let filesToSearch: string[];
|
|
1316
|
+
try {
|
|
1317
|
+
const info = await stat(searchRoot);
|
|
1318
|
+
filesToSearch = info.isFile() ? [searchRoot] : await walkLocalFiles(searchRoot);
|
|
1319
|
+
} catch (error) {
|
|
1320
|
+
throwLocalReadError(error, searchRoot);
|
|
1321
|
+
}
|
|
1322
|
+
for (const filePath of filesToSearch) {
|
|
1323
|
+
if (
|
|
1324
|
+
query.glob !== undefined &&
|
|
1325
|
+
!pathMatchesGlob(filePath, searchRoot, query.glob, {
|
|
1326
|
+
matchBasename: true,
|
|
1327
|
+
})
|
|
1328
|
+
) {
|
|
1329
|
+
continue;
|
|
1330
|
+
}
|
|
1331
|
+
if (isExcludedPath(filePath, query.excludes)) {
|
|
1332
|
+
continue;
|
|
1333
|
+
}
|
|
1334
|
+
let content: string;
|
|
1335
|
+
try {
|
|
1336
|
+
content = await readFile(filePath, "utf8");
|
|
1337
|
+
} catch {
|
|
1338
|
+
continue;
|
|
1339
|
+
}
|
|
1340
|
+
yield* grepFileContent({ path: filePath, content, regex });
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
},
|
|
1344
|
+
async *glob(pattern, dir, options) {
|
|
1345
|
+
const dirPath = dir === undefined || dir === "" || dir === "." ? cwd : resolvePath(dir);
|
|
1346
|
+
yield* globFromList(listLocalFiles(dirPath), {
|
|
1347
|
+
pattern,
|
|
1348
|
+
dir: dirPath,
|
|
1349
|
+
...(options?.limit === undefined ? {} : { limit: options.limit }),
|
|
1350
|
+
});
|
|
1351
|
+
},
|
|
1352
|
+
async write(inputPath, contents) {
|
|
1353
|
+
const filePath = resolvePath(inputPath);
|
|
1354
|
+
try {
|
|
1355
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
1356
|
+
await writeFile(filePath, contents, "utf8");
|
|
1357
|
+
} catch (error) {
|
|
1358
|
+
throw new WriteFailedError(filePath, fsErrorMessage(error, `write failed: ${filePath}`));
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
async delete(inputPath) {
|
|
1362
|
+
const filePath = resolvePath(inputPath);
|
|
1363
|
+
try {
|
|
1364
|
+
await rm(filePath);
|
|
1365
|
+
} catch (error) {
|
|
1366
|
+
throwLocalReadError(error, filePath);
|
|
1367
|
+
}
|
|
1368
|
+
},
|
|
1369
|
+
search: emptySearch,
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
interface MountEntry {
|
|
1374
|
+
prefix: string;
|
|
1375
|
+
fs: FileSystem;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
function longestMount(path: string, mounts: MountEntry[]): MountEntry | undefined {
|
|
1379
|
+
let best: MountEntry | undefined;
|
|
1380
|
+
for (const mount of mounts) {
|
|
1381
|
+
if (!pathHasSegmentPrefix({ path, prefix: mount.prefix })) {
|
|
1382
|
+
continue;
|
|
1383
|
+
}
|
|
1384
|
+
if (best === undefined || mount.prefix.length > best.prefix.length) {
|
|
1385
|
+
best = mount;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
return best;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/** Namespace path → child path. `/host/a.md` on `/host` is `/a.md`. */
|
|
1392
|
+
function toChildPath(path: string, prefix: string): string {
|
|
1393
|
+
if (prefix === "/") {
|
|
1394
|
+
return path;
|
|
1395
|
+
}
|
|
1396
|
+
if (path === prefix) {
|
|
1397
|
+
return "/";
|
|
1398
|
+
}
|
|
1399
|
+
if (path.startsWith(`${prefix}/`)) {
|
|
1400
|
+
return path.slice(prefix.length);
|
|
1401
|
+
}
|
|
1402
|
+
return path;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/** Child path → namespace path. `/a.md` on `/host` is `/host/a.md`. */
|
|
1406
|
+
function toParentPath(path: string, prefix: string): string {
|
|
1407
|
+
if (prefix === "/") {
|
|
1408
|
+
return path;
|
|
1409
|
+
}
|
|
1410
|
+
if (path === "/" || path === "") {
|
|
1411
|
+
return prefix;
|
|
1412
|
+
}
|
|
1413
|
+
return path.startsWith("/") ? `${prefix}${path}` : `${prefix}/${path}`;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
async function* mapMountEntries(
|
|
1417
|
+
source: AsyncIterable<DirEntry>,
|
|
1418
|
+
prefix: string,
|
|
1419
|
+
): AsyncIterable<DirEntry> {
|
|
1420
|
+
try {
|
|
1421
|
+
for await (const entry of source) {
|
|
1422
|
+
yield { ...entry, path: toParentPath(entry.path, prefix) };
|
|
1423
|
+
}
|
|
1424
|
+
} catch (error) {
|
|
1425
|
+
throw remapPathError(error, prefix);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
async function* mapMountGrep(
|
|
1430
|
+
source: AsyncIterable<GrepResult>,
|
|
1431
|
+
prefix: string,
|
|
1432
|
+
): AsyncIterable<GrepResult> {
|
|
1433
|
+
try {
|
|
1434
|
+
for await (const hit of source) {
|
|
1435
|
+
yield { ...hit, path: toParentPath(hit.path, prefix) };
|
|
1436
|
+
}
|
|
1437
|
+
} catch (error) {
|
|
1438
|
+
throw remapPathError(error, prefix);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
async function* mapMountSearch(
|
|
1443
|
+
source: AsyncIterable<SearchResult>,
|
|
1444
|
+
prefix: string,
|
|
1445
|
+
): AsyncIterable<SearchResult> {
|
|
1446
|
+
try {
|
|
1447
|
+
for await (const hit of source) {
|
|
1448
|
+
yield { ...hit, path: toParentPath(hit.path, prefix) };
|
|
1449
|
+
}
|
|
1450
|
+
} catch (error) {
|
|
1451
|
+
throw remapPathError(error, prefix);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
function childSearchQuery(query: SearchQuery, prefix: string): SearchQuery | undefined {
|
|
1456
|
+
if (query.targetDirectories === undefined || query.targetDirectories.length === 0) {
|
|
1457
|
+
return query;
|
|
1458
|
+
}
|
|
1459
|
+
const dirs: string[] = [];
|
|
1460
|
+
for (const dir of query.targetDirectories) {
|
|
1461
|
+
const normalized = normalizeFsPath(dir);
|
|
1462
|
+
// `/` is every mount, the same way grep at `/` fans out.
|
|
1463
|
+
if (normalized === "/") {
|
|
1464
|
+
return { ...query, targetDirectories: undefined };
|
|
1465
|
+
}
|
|
1466
|
+
if (!pathHasSegmentPrefix({ path: normalized, prefix })) {
|
|
1467
|
+
continue;
|
|
1468
|
+
}
|
|
1469
|
+
const child = toChildPath(normalized, prefix);
|
|
1470
|
+
if (child === "/") {
|
|
1471
|
+
return { ...query, targetDirectories: undefined };
|
|
1472
|
+
}
|
|
1473
|
+
dirs.push(child);
|
|
1474
|
+
}
|
|
1475
|
+
if (dirs.length === 0) {
|
|
1476
|
+
return undefined;
|
|
1477
|
+
}
|
|
1478
|
+
return { ...query, targetDirectories: dirs };
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* Longest-prefix compose, path-segment match. Every verb is
|
|
1483
|
+
* defined. Does not synthesize `shell`. `/agent` is not a
|
|
1484
|
+
* prefix of `/agent-tools`.
|
|
1485
|
+
*
|
|
1486
|
+
* The record keys are mount points. Each child is a FileSystem
|
|
1487
|
+
* rooted at `/`. `unionFs` strips the prefix on the way in and
|
|
1488
|
+
* re-prefixes yields (and error paths) on the way out:
|
|
1489
|
+
* `unionFs({ "/host": hostFs(...) })` — the child never sees
|
|
1490
|
+
* `/host`.
|
|
1491
|
+
*
|
|
1492
|
+
* A path with no mount:
|
|
1493
|
+
* - `read` / `write` / `delete`: throw
|
|
1494
|
+
* `no mount for path: ${path}`
|
|
1495
|
+
* - `list` / `glob` / `grep`: empty iterator
|
|
1496
|
+
* - `stat`: `{ kind: "missing" }` (`/` and exact mount prefixes
|
|
1497
|
+
* are `{ kind: "directory" }`)
|
|
1498
|
+
*
|
|
1499
|
+
* Root `list` / `glob` / `grep` / `search` k-way merge already
|
|
1500
|
+
* sorted sources. List and glob use `unique` so an earlier
|
|
1501
|
+
* mount shadows a later one; grep and search keep every hit.
|
|
1502
|
+
*/
|
|
1503
|
+
export function unionFs(mounts: Record<string, FileSystem>): FileSystem {
|
|
1504
|
+
const entries: MountEntry[] = Object.entries(mounts).map(([prefix, fs]) => ({
|
|
1505
|
+
prefix: normalizeFsPath(prefix),
|
|
1506
|
+
fs,
|
|
1507
|
+
}));
|
|
1508
|
+
entries.sort((a, b) => b.prefix.length - a.prefix.length);
|
|
1509
|
+
|
|
1510
|
+
const noMount = (path: string): never => {
|
|
1511
|
+
throw new NoMountError(path);
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1514
|
+
const forward = async <T>(
|
|
1515
|
+
path: string,
|
|
1516
|
+
run: (fs: FileSystem, childPath: string) => Promise<T>,
|
|
1517
|
+
): Promise<T> => {
|
|
1518
|
+
const mount = longestMount(path, entries);
|
|
1519
|
+
if (mount === undefined) {
|
|
1520
|
+
return noMount(path);
|
|
1521
|
+
}
|
|
1522
|
+
const childPath = toChildPath(path, mount.prefix);
|
|
1523
|
+
try {
|
|
1524
|
+
return await run(mount.fs, childPath);
|
|
1525
|
+
} catch (error) {
|
|
1526
|
+
throw remapPathError(error, mount.prefix);
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
const isRootPath = (value: string | undefined): boolean =>
|
|
1531
|
+
value === undefined || value === "" || value === "/";
|
|
1532
|
+
|
|
1533
|
+
return {
|
|
1534
|
+
async *list(prefix, options) {
|
|
1535
|
+
yield* limitResults(uncapped(), options?.limit);
|
|
1536
|
+
async function* uncapped() {
|
|
1537
|
+
if (isRootPath(prefix)) {
|
|
1538
|
+
yield* mergeSortedByPath(
|
|
1539
|
+
entries.map(mount => mapMountEntries(mount.fs.list(undefined, options), mount.prefix)),
|
|
1540
|
+
{ unique: true },
|
|
1541
|
+
);
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
const path = normalizeFsPath(prefix ?? "/");
|
|
1545
|
+
const mount = longestMount(path, entries);
|
|
1546
|
+
if (mount === undefined) {
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
const childPath = toChildPath(path, mount.prefix);
|
|
1550
|
+
yield* mapMountEntries(
|
|
1551
|
+
mount.fs.list(childPath === "/" ? undefined : childPath, options),
|
|
1552
|
+
mount.prefix,
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
async stat(path) {
|
|
1557
|
+
const normalized = normalizeFsPath(path);
|
|
1558
|
+
if (normalized === "/") {
|
|
1559
|
+
return { kind: "directory" } as const;
|
|
1560
|
+
}
|
|
1561
|
+
if (entries.some(entry => entry.prefix === normalized)) {
|
|
1562
|
+
return { kind: "directory" } as const;
|
|
1563
|
+
}
|
|
1564
|
+
const mount = longestMount(normalized, entries);
|
|
1565
|
+
if (mount === undefined) {
|
|
1566
|
+
return { kind: "missing" } as const;
|
|
1567
|
+
}
|
|
1568
|
+
return mount.fs.stat(toChildPath(normalized, mount.prefix));
|
|
1569
|
+
},
|
|
1570
|
+
async read(path) {
|
|
1571
|
+
const normalized = normalizeFsPath(path);
|
|
1572
|
+
return forward(normalized, (fs, childPath) => fs.read(childPath));
|
|
1573
|
+
},
|
|
1574
|
+
async write(path, contents) {
|
|
1575
|
+
const normalized = normalizeFsPath(path);
|
|
1576
|
+
return forward(normalized, (fs, childPath) => fs.write(childPath, contents));
|
|
1577
|
+
},
|
|
1578
|
+
async delete(path) {
|
|
1579
|
+
const normalized = normalizeFsPath(path);
|
|
1580
|
+
return forward(normalized, (fs, childPath) => fs.delete(childPath));
|
|
1581
|
+
},
|
|
1582
|
+
async *grep(query) {
|
|
1583
|
+
yield* limitResults(uncapped(), query.maxResults);
|
|
1584
|
+
async function* uncapped() {
|
|
1585
|
+
const scope =
|
|
1586
|
+
query.path === undefined || query.path === "" ? "/" : normalizeFsPath(query.path);
|
|
1587
|
+
if (scope === "/") {
|
|
1588
|
+
yield* mergeSorted(
|
|
1589
|
+
entries.map(mount =>
|
|
1590
|
+
mapMountGrep(mount.fs.grep({ ...query, path: undefined }), mount.prefix),
|
|
1591
|
+
),
|
|
1592
|
+
{ compare: compareGrepResult },
|
|
1593
|
+
);
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
const mount = longestMount(scope, entries);
|
|
1597
|
+
if (mount === undefined) {
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
const childPath = toChildPath(scope, mount.prefix);
|
|
1601
|
+
yield* mapMountGrep(
|
|
1602
|
+
mount.fs.grep({
|
|
1603
|
+
...query,
|
|
1604
|
+
path: childPath === "/" ? undefined : childPath,
|
|
1605
|
+
}),
|
|
1606
|
+
mount.prefix,
|
|
1607
|
+
);
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1610
|
+
async *search(query) {
|
|
1611
|
+
yield* limitResults(uncapped(), query.maxResults);
|
|
1612
|
+
async function* uncapped() {
|
|
1613
|
+
const sources: AsyncIterable<SearchResult>[] = [];
|
|
1614
|
+
for (const mount of entries) {
|
|
1615
|
+
const childQuery = childSearchQuery(query, mount.prefix);
|
|
1616
|
+
if (childQuery === undefined) {
|
|
1617
|
+
continue;
|
|
1618
|
+
}
|
|
1619
|
+
sources.push(mapMountSearch(mount.fs.search(childQuery), mount.prefix));
|
|
1620
|
+
}
|
|
1621
|
+
yield* mergeSorted(sources, { compare: compareSearchResult });
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
async *glob(pattern, dir, options) {
|
|
1625
|
+
yield* limitResults(uncapped(), options?.limit);
|
|
1626
|
+
async function* uncapped() {
|
|
1627
|
+
const scope = dir === undefined || dir === "" ? "/" : normalizeFsPath(dir);
|
|
1628
|
+
if (scope === "/") {
|
|
1629
|
+
yield* mergeSortedByPath(
|
|
1630
|
+
entries.map(mount =>
|
|
1631
|
+
mapMountEntries(mount.fs.glob(pattern, undefined, options), mount.prefix),
|
|
1632
|
+
),
|
|
1633
|
+
{ unique: true },
|
|
1634
|
+
);
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
const mount = longestMount(scope, entries);
|
|
1638
|
+
if (mount === undefined) {
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
const childPath = toChildPath(scope, mount.prefix);
|
|
1642
|
+
yield* mapMountEntries(
|
|
1643
|
+
mount.fs.glob(pattern, childPath === "/" ? undefined : childPath, options),
|
|
1644
|
+
mount.prefix,
|
|
1645
|
+
);
|
|
1646
|
+
}
|
|
1647
|
+
},
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
async function collectLayerPaths(layer: FileSystem): Promise<string[]> {
|
|
1652
|
+
const paths: string[] = [];
|
|
1653
|
+
try {
|
|
1654
|
+
for await (const entry of layer.list()) {
|
|
1655
|
+
paths.push(entry.path);
|
|
1656
|
+
}
|
|
1657
|
+
} catch {
|
|
1658
|
+
// A layer that cannot list also cannot own paths.
|
|
1659
|
+
}
|
|
1660
|
+
return paths;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* Same-root overlay: earlier layers win. Read-only.
|
|
1665
|
+
*
|
|
1666
|
+
* A downed layer costs its own files, not the overlay. Mutations
|
|
1667
|
+
* throw `read-only mount` / `read-only mount: ${path}`. Empty
|
|
1668
|
+
* `layers` throws `overlayFs needs at least one layer.`
|
|
1669
|
+
*/
|
|
1670
|
+
export function overlayFs(layers: readonly FileSystem[]): FileSystem {
|
|
1671
|
+
if (layers.length === 0) {
|
|
1672
|
+
throw new Error("overlayFs needs at least one layer.");
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
const walkLayers = async <T>(
|
|
1676
|
+
collect: (layer: FileSystem) => AsyncIterable<T> | Promise<AsyncIterable<T>>,
|
|
1677
|
+
): Promise<{ streams: T[][]; failure: unknown; served: boolean }> => {
|
|
1678
|
+
const streams: T[][] = [];
|
|
1679
|
+
let failure: unknown;
|
|
1680
|
+
let served = false;
|
|
1681
|
+
for (const layer of layers) {
|
|
1682
|
+
const collected: T[] = [];
|
|
1683
|
+
try {
|
|
1684
|
+
for await (const entry of await collect(layer)) {
|
|
1685
|
+
collected.push(entry);
|
|
1686
|
+
}
|
|
1687
|
+
} catch (error) {
|
|
1688
|
+
failure ??= error;
|
|
1689
|
+
continue;
|
|
1690
|
+
}
|
|
1691
|
+
served = true;
|
|
1692
|
+
streams.push(collected);
|
|
1693
|
+
}
|
|
1694
|
+
return { streams, failure, served };
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
const collectOverlayHits = async <T extends { path: string }>(
|
|
1698
|
+
queryFn: (layer: FileSystem) => AsyncIterable<T>,
|
|
1699
|
+
rethrow?: (error: unknown) => boolean,
|
|
1700
|
+
): Promise<T[][]> => {
|
|
1701
|
+
const streams: T[][] = [];
|
|
1702
|
+
const shadowed = new Set<string>();
|
|
1703
|
+
let failure: unknown;
|
|
1704
|
+
let served = false;
|
|
1705
|
+
for (const layer of layers) {
|
|
1706
|
+
const collected: T[] = [];
|
|
1707
|
+
try {
|
|
1708
|
+
for await (const hit of queryFn(layer)) {
|
|
1709
|
+
if (!shadowed.has(hit.path)) {
|
|
1710
|
+
collected.push(hit);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
served = true;
|
|
1714
|
+
} catch (error) {
|
|
1715
|
+
if (rethrow?.(error) === true) {
|
|
1716
|
+
throw error;
|
|
1717
|
+
}
|
|
1718
|
+
failure ??= error;
|
|
1719
|
+
continue;
|
|
1720
|
+
}
|
|
1721
|
+
streams.push(collected);
|
|
1722
|
+
for (const path of await collectLayerPaths(layer)) {
|
|
1723
|
+
shadowed.add(path);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
if (!served && failure !== undefined) {
|
|
1727
|
+
throw failure;
|
|
1728
|
+
}
|
|
1729
|
+
return streams;
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1732
|
+
return {
|
|
1733
|
+
async *list(prefix, options) {
|
|
1734
|
+
const { streams, failure, served } = await walkLayers(layer => layer.list(prefix, options));
|
|
1735
|
+
if (!served && failure !== undefined) {
|
|
1736
|
+
throw failure;
|
|
1737
|
+
}
|
|
1738
|
+
yield* limitResults(mergeSortedByPath(streams, { unique: true }), options?.limit);
|
|
1739
|
+
},
|
|
1740
|
+
async stat(path) {
|
|
1741
|
+
let failure: unknown;
|
|
1742
|
+
let sawMissing = false;
|
|
1743
|
+
for (const layer of layers) {
|
|
1744
|
+
try {
|
|
1745
|
+
const info = await layer.stat(path);
|
|
1746
|
+
if (info.kind !== "missing") {
|
|
1747
|
+
return info;
|
|
1748
|
+
}
|
|
1749
|
+
sawMissing = true;
|
|
1750
|
+
} catch (error) {
|
|
1751
|
+
failure ??= error;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
if (!sawMissing && failure !== undefined) {
|
|
1755
|
+
throw failure;
|
|
1756
|
+
}
|
|
1757
|
+
return { kind: "missing" } as const;
|
|
1758
|
+
},
|
|
1759
|
+
async *glob(pattern, dir, options) {
|
|
1760
|
+
const { streams, failure, served } = await walkLayers(layer =>
|
|
1761
|
+
layer.glob(pattern, dir, options),
|
|
1762
|
+
);
|
|
1763
|
+
if (!served && failure !== undefined) {
|
|
1764
|
+
throw failure;
|
|
1765
|
+
}
|
|
1766
|
+
yield* limitResults(mergeSortedByPath(streams, { unique: true }), options?.limit);
|
|
1767
|
+
},
|
|
1768
|
+
async read(path) {
|
|
1769
|
+
let failure: unknown;
|
|
1770
|
+
for (const layer of layers) {
|
|
1771
|
+
try {
|
|
1772
|
+
return await layer.read(path);
|
|
1773
|
+
} catch (error) {
|
|
1774
|
+
if (isFileNotFoundError(error)) {
|
|
1775
|
+
continue;
|
|
1776
|
+
}
|
|
1777
|
+
failure ??= error;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
if (failure !== undefined) {
|
|
1781
|
+
throw failure;
|
|
1782
|
+
}
|
|
1783
|
+
throw new FileNotFoundError(path);
|
|
1784
|
+
},
|
|
1785
|
+
async *grep(query) {
|
|
1786
|
+
const { maxResults, ...uncappedQuery } = query;
|
|
1787
|
+
yield* limitResults(
|
|
1788
|
+
mergeSorted(
|
|
1789
|
+
await collectOverlayHits(
|
|
1790
|
+
layer => layer.grep(uncappedQuery),
|
|
1791
|
+
error => isInvalidGrepPatternError(error),
|
|
1792
|
+
),
|
|
1793
|
+
{ compare: compareGrepResult },
|
|
1794
|
+
),
|
|
1795
|
+
maxResults,
|
|
1796
|
+
);
|
|
1797
|
+
},
|
|
1798
|
+
async write(path) {
|
|
1799
|
+
throw new ReadOnlyMountError(path);
|
|
1800
|
+
},
|
|
1801
|
+
async delete(path) {
|
|
1802
|
+
throw new ReadOnlyMountError(path);
|
|
1803
|
+
},
|
|
1804
|
+
async *search(query) {
|
|
1805
|
+
const { maxResults, ...uncappedQuery } = query;
|
|
1806
|
+
yield* limitResults(
|
|
1807
|
+
mergeSorted(await collectOverlayHits(layer => layer.search(uncappedQuery)), {
|
|
1808
|
+
compare: compareSearchResult,
|
|
1809
|
+
}),
|
|
1810
|
+
maxResults,
|
|
1811
|
+
);
|
|
1812
|
+
},
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
function hostKey(path: string): string {
|
|
1817
|
+
const normalized = normalizeFsPath(path);
|
|
1818
|
+
return normalized === "/" ? "" : normalized.slice(1);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
function isHostConflict(error: unknown): boolean {
|
|
1822
|
+
return (
|
|
1823
|
+
error instanceof FileConflictError ||
|
|
1824
|
+
(error instanceof Error &&
|
|
1825
|
+
(error.name === "FileConflictError" || error.message.includes("lost a race")))
|
|
1826
|
+
);
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
/**
|
|
1830
|
+
* `HostFilesApi` as a FileSystem rooted at `/`.
|
|
1831
|
+
*
|
|
1832
|
+
* Mount it with `unionFs({ "/host": hostFs(files, scope) })`. The
|
|
1833
|
+
* child never sees `/host` — `unionFs` owns the prefix. `scope` is
|
|
1834
|
+
* the HostFiles partition, not a path prefix. `search` is empty
|
|
1835
|
+
* (HostFiles is not an index).
|
|
1836
|
+
*/
|
|
1837
|
+
export function hostFs(files: HostFilesApi, scope: HostFilesScope): FileSystem {
|
|
1838
|
+
const callOptions = { scope };
|
|
1839
|
+
const readEtags = new Map<string, string>();
|
|
1840
|
+
|
|
1841
|
+
const listed = {
|
|
1842
|
+
async *list(prefix?: string, options?: ListOptions) {
|
|
1843
|
+
const entries = await files.list(undefined, callOptions);
|
|
1844
|
+
yield* listFilesFromPaths(
|
|
1845
|
+
entries.map(entry => ({
|
|
1846
|
+
path: normalizeFsPath(entry.path),
|
|
1847
|
+
size: entry.size,
|
|
1848
|
+
})),
|
|
1849
|
+
prefix,
|
|
1850
|
+
options,
|
|
1851
|
+
);
|
|
1852
|
+
},
|
|
1853
|
+
async stat(path: string) {
|
|
1854
|
+
const entries = await files.list(undefined, callOptions);
|
|
1855
|
+
return statFromFilePaths(
|
|
1856
|
+
entries.map(entry => normalizeFsPath(entry.path)),
|
|
1857
|
+
path,
|
|
1858
|
+
);
|
|
1859
|
+
},
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1862
|
+
const readText = async (inputPath: string): Promise<string> => {
|
|
1863
|
+
const path = normalizeFsPath(inputPath);
|
|
1864
|
+
const key = hostKey(path);
|
|
1865
|
+
if (key === "") {
|
|
1866
|
+
throw new FileNotFoundError(path);
|
|
1867
|
+
}
|
|
1868
|
+
const [content, stat] = await Promise.all([
|
|
1869
|
+
files.read(key, callOptions),
|
|
1870
|
+
files.stat(key, callOptions),
|
|
1871
|
+
]);
|
|
1872
|
+
if (content === undefined) {
|
|
1873
|
+
throw new FileNotFoundError(path);
|
|
1874
|
+
}
|
|
1875
|
+
if (stat?.etag !== undefined) {
|
|
1876
|
+
readEtags.set(key, stat.etag);
|
|
1877
|
+
}
|
|
1878
|
+
return content;
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
const writeHost = async (inputPath: string, contents: string): Promise<void> => {
|
|
1882
|
+
const path = normalizeFsPath(inputPath);
|
|
1883
|
+
const key = hostKey(path);
|
|
1884
|
+
if (key === "") {
|
|
1885
|
+
throw new FileNotFoundError(path);
|
|
1886
|
+
}
|
|
1887
|
+
try {
|
|
1888
|
+
if (files.capabilities.conflictDetection) {
|
|
1889
|
+
const etag = readEtags.get(key);
|
|
1890
|
+
await files.write(key, contents, {
|
|
1891
|
+
...callOptions,
|
|
1892
|
+
// No cached etag: unconditional create/overwrite. After a
|
|
1893
|
+
// successful read or write, CAS on that etag.
|
|
1894
|
+
...(etag === undefined ? {} : { ifMatch: etag }),
|
|
1895
|
+
});
|
|
1896
|
+
} else {
|
|
1897
|
+
await files.write(key, contents, callOptions);
|
|
1898
|
+
}
|
|
1899
|
+
} catch (error) {
|
|
1900
|
+
if (isHostConflict(error)) {
|
|
1901
|
+
throw new PathError(path, `${path} changed since you read it — read it again and rewrite.`);
|
|
1902
|
+
}
|
|
1903
|
+
throw error;
|
|
1904
|
+
}
|
|
1905
|
+
const stat = await files.stat(key, callOptions);
|
|
1906
|
+
if (stat?.etag !== undefined) {
|
|
1907
|
+
readEtags.set(key, stat.etag);
|
|
1908
|
+
} else {
|
|
1909
|
+
readEtags.delete(key);
|
|
1910
|
+
}
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1913
|
+
return {
|
|
1914
|
+
list(prefix, options) {
|
|
1915
|
+
return listed.list(prefix, options);
|
|
1916
|
+
},
|
|
1917
|
+
async stat(path) {
|
|
1918
|
+
return listed.stat(path);
|
|
1919
|
+
},
|
|
1920
|
+
async read(path) {
|
|
1921
|
+
return readText(path);
|
|
1922
|
+
},
|
|
1923
|
+
async *grep(query) {
|
|
1924
|
+
yield* limitResults(uncapped(), query.maxResults);
|
|
1925
|
+
async function* uncapped() {
|
|
1926
|
+
const scopePath =
|
|
1927
|
+
query.path === undefined || query.path === "" ? "/" : normalizeFsPath(query.path);
|
|
1928
|
+
const regex = compileGrepPattern(query.pattern, query.caseInsensitive, scopePath);
|
|
1929
|
+
const info = await listed.stat(scopePath);
|
|
1930
|
+
if (scopePath !== "/" && info.kind === "file") {
|
|
1931
|
+
if (
|
|
1932
|
+
query.glob !== undefined &&
|
|
1933
|
+
!pathMatchesGlob(scopePath, scopePath, query.glob, {
|
|
1934
|
+
matchBasename: true,
|
|
1935
|
+
})
|
|
1936
|
+
) {
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
if (isExcludedPath(scopePath, query.excludes)) {
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1942
|
+
yield* grepFileContent({
|
|
1943
|
+
path: scopePath,
|
|
1944
|
+
content: await readText(scopePath),
|
|
1945
|
+
regex,
|
|
1946
|
+
});
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
for await (const entry of listed.list(
|
|
1950
|
+
scopePath === "/" ? undefined : scopePath,
|
|
1951
|
+
query.excludes === undefined ? undefined : { excludes: query.excludes },
|
|
1952
|
+
)) {
|
|
1953
|
+
if (
|
|
1954
|
+
query.glob !== undefined &&
|
|
1955
|
+
!pathMatchesGlob(entry.path, scopePath, query.glob, {
|
|
1956
|
+
matchBasename: true,
|
|
1957
|
+
})
|
|
1958
|
+
) {
|
|
1959
|
+
continue;
|
|
1960
|
+
}
|
|
1961
|
+
yield* grepFileContent({
|
|
1962
|
+
path: entry.path,
|
|
1963
|
+
content: await readText(entry.path),
|
|
1964
|
+
regex,
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
},
|
|
1969
|
+
async *glob(pattern, dir, options) {
|
|
1970
|
+
const dirPath = dir === undefined || dir === "" ? "/" : normalizeFsPath(dir);
|
|
1971
|
+
yield* globFromList(listed.list(dirPath === "/" ? undefined : dirPath), {
|
|
1972
|
+
pattern,
|
|
1973
|
+
dir: dirPath,
|
|
1974
|
+
...(options?.limit === undefined ? {} : { limit: options.limit }),
|
|
1975
|
+
});
|
|
1976
|
+
},
|
|
1977
|
+
async write(inputPath, contents) {
|
|
1978
|
+
await writeHost(inputPath, contents);
|
|
1979
|
+
},
|
|
1980
|
+
async delete(inputPath) {
|
|
1981
|
+
const path = normalizeFsPath(inputPath);
|
|
1982
|
+
const key = hostKey(path);
|
|
1983
|
+
if (key === "" || !(await files.exists(key, callOptions))) {
|
|
1984
|
+
throw new FileNotFoundError(path);
|
|
1985
|
+
}
|
|
1986
|
+
await files.remove(key, callOptions);
|
|
1987
|
+
readEtags.delete(key);
|
|
1988
|
+
},
|
|
1989
|
+
search: emptySearch,
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
async function* globFromList(
|
|
1994
|
+
source: AsyncIterable<DirEntry>,
|
|
1995
|
+
options: { pattern: string; dir: string; limit?: number },
|
|
1996
|
+
): AsyncGenerator<DirEntry> {
|
|
1997
|
+
yield* limitResults(uncapped(), options.limit);
|
|
1998
|
+
async function* uncapped() {
|
|
1999
|
+
for await (const entry of source) {
|
|
2000
|
+
if (pathMatchesGlob(entry.path, options.dir, options.pattern)) {
|
|
2001
|
+
yield entry;
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}
|