@cursor/july 0.1.99 → 0.1.101
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 +4 -2
- package/dist/bin/agent-serve.js +3 -2
- package/dist/channels/deployments/deployments-channel.d.ts +41 -5
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
- package/dist/channels/deployments/deployments-channel.js +88 -8
- package/dist/channels/deployments/types.d.ts +4 -3
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/github/defaults.d.ts.map +1 -1
- package/dist/channels/github/defaults.js +28 -3
- package/dist/channels/github/progress.d.ts +7 -0
- package/dist/channels/github/progress.d.ts.map +1 -1
- package/dist/channels/origin/defaults.d.ts +43 -0
- package/dist/channels/origin/defaults.d.ts.map +1 -0
- package/dist/channels/origin/defaults.js +111 -0
- package/dist/channels/origin/index.d.ts +2 -0
- package/dist/channels/origin/index.d.ts.map +1 -1
- package/dist/channels/origin/index.js +2 -0
- package/dist/channels/origin/origin-channel.d.ts +2 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +24 -3
- package/dist/channels/origin/state.d.ts +32 -0
- package/dist/channels/origin/state.d.ts.map +1 -0
- package/dist/channels/origin/state.js +23 -0
- package/dist/channels/origin/types.d.ts +23 -1
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/api.d.ts +16 -7
- package/dist/channels/slack/api.d.ts.map +1 -1
- package/dist/channels/slack/api.js +31 -14
- package/dist/channels/slack/code-fences.d.ts +17 -0
- package/dist/channels/slack/code-fences.d.ts.map +1 -0
- package/dist/channels/slack/code-fences.js +168 -0
- package/dist/channels/slack/constants.d.ts +6 -0
- package/dist/channels/slack/constants.d.ts.map +1 -1
- package/dist/channels/slack/constants.js +6 -0
- package/dist/channels/slack/defaults.d.ts +9 -4
- package/dist/channels/slack/defaults.d.ts.map +1 -1
- package/dist/channels/slack/defaults.js +154 -76
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +3 -3
- package/dist/channels/slack/inbound.d.ts +9 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -1
- package/dist/channels/slack/inbound.js +14 -0
- package/dist/channels/slack/index.d.ts +2 -0
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +2 -0
- package/dist/channels/slack/live-delivery.d.ts +5 -0
- package/dist/channels/slack/live-delivery.d.ts.map +1 -1
- package/dist/channels/slack/live-delivery.js +116 -21
- 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 +104 -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 +40 -0
- package/dist/channels/slack/reply-options.d.ts.map +1 -0
- package/dist/channels/slack/reply-options.js +150 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +8 -4
- package/dist/channels/slack/stream.d.ts +22 -10
- package/dist/channels/slack/stream.d.ts.map +1 -1
- package/dist/channels/slack/stream.js +9 -16
- 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 +178 -0
- package/dist/channels/slack/types.d.ts +145 -6
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/connections.d.ts +18 -2
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +18 -2
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +6 -6
- package/dist/docs/ab.md +1 -1
- package/dist/docs/assets/{ab.md.DJo5r4R-.js → ab.md.mlVgqvSk.js} +1 -1
- package/dist/docs/assets/{app.BplEAZ3S.js → app.BASO9Kih.js} +1 -1
- package/dist/docs/assets/{building-with-agents.md.DI4mEzlt.js → building-with-agents.md.CUSWxlP_.js} +2 -2
- package/dist/docs/assets/chunks/@localSearchIndexroot.DbFXINq2.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CHXyv4wP.js → VPLocalSearchBox.DwkqxoE0.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BTcsZmjQ.js → theme.CCil_13e.js} +2 -2
- package/dist/docs/assets/{evals.md.lfJoEVc8.js → evals.md.CPzDAwoH.js} +1 -1
- package/dist/docs/assets/{guides_github.md.Cnh2mL4a.js → guides_github.md.BtPr9GaP.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.CN-6YmTJ.js → guides_mcp-oauth.md.Dp6cDP7f.js} +1 -1
- package/dist/docs/assets/{guides_opentelemetry.md.bmPmkvJu.js → guides_opentelemetry.md.BVTXDCRg.js} +2 -2
- package/dist/docs/assets/{guides_slack.md.VDXQV3ja.js → guides_slack.md.9oHPye9o.js} +19 -3
- package/dist/docs/assets/{guides_slack.md.VDXQV3ja.lean.js → guides_slack.md.9oHPye9o.lean.js} +1 -1
- package/dist/docs/assets/hillclimbing.md.CpTGTCle.js +4 -0
- package/dist/docs/assets/{index.md.CVeRUOeZ.js → index.md.Bb4k8kUm.js} +1 -1
- package/dist/docs/assets/{quickstart.md.Nj_LjW_a.js → quickstart.md.DdQOF7Y8.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.DxldvyIB.js → reference_connections.md.Di6jJAXF.js} +13 -3
- package/dist/docs/assets/{reference_connections.md.DxldvyIB.lean.js → reference_connections.md.Di6jJAXF.lean.js} +1 -1
- package/dist/docs/assets/{reference_http-api.md.BEJx9XVj.js → reference_http-api.md.oySXBO8o.js} +1 -1
- package/dist/docs/assets/scaffolding-agents.md.em43xlY1.js +1 -0
- package/dist/docs/assets/skills_ab.md.CsFNatVx.js +26 -0
- package/dist/docs/assets/skills_ab.md.CsFNatVx.lean.js +1 -0
- package/dist/docs/assets/skills_create-agent.md.BVoWPcan.js +8 -0
- package/dist/docs/assets/skills_create-agent.md.BVoWPcan.lean.js +1 -0
- package/dist/docs/assets/skills_debug.md.CDbPhHfg.js +1 -0
- package/dist/docs/assets/skills_debug.md.CDbPhHfg.lean.js +1 -0
- package/dist/docs/assets/skills_evals.md.723kpUmA.js +25 -0
- package/dist/docs/assets/skills_evals.md.723kpUmA.lean.js +1 -0
- package/dist/docs/assets/skills_framework-map.md.BTi817yv.js +1 -0
- package/dist/docs/assets/skills_framework-map.md.BTi817yv.lean.js +1 -0
- package/dist/docs/assets/skills_github.md.D0JahM8c.js +16 -0
- package/dist/docs/assets/skills_github.md.D0JahM8c.lean.js +1 -0
- package/dist/docs/assets/skills_hillclimb.md.B_zJerxA.js +7 -0
- package/dist/docs/assets/skills_hillclimb.md.B_zJerxA.lean.js +1 -0
- package/dist/docs/assets/skills_index.md.DKwIxzGg.js +1 -0
- package/dist/docs/assets/skills_index.md.DKwIxzGg.lean.js +1 -0
- package/dist/docs/assets/skills_mcp-auth.md.DGvFP3HE.js +18 -0
- package/dist/docs/assets/skills_mcp-auth.md.DGvFP3HE.lean.js +1 -0
- package/dist/docs/assets/skills_otel.md.CgiZryR3.js +8 -0
- package/dist/docs/assets/skills_otel.md.CgiZryR3.lean.js +1 -0
- package/dist/docs/assets/skills_setup-slack.md.BBgx8lUz.js +20 -0
- package/dist/docs/assets/skills_setup-slack.md.BBgx8lUz.lean.js +1 -0
- package/dist/docs/assets/{troubleshooting.md.DCiPBhYs.js → troubleshooting.md.Cus_YZga.js} +1 -1
- package/dist/docs/building-with-agents.html +6 -6
- package/dist/docs/building-with-agents.md +14 -11
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/evals.html +6 -6
- package/dist/docs/evals.md +1 -1
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +4 -4
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +5 -5
- package/dist/docs/guides/github.md +1 -1
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +5 -5
- package/dist/docs/guides/mcp-oauth.md +1 -1
- package/dist/docs/guides/opentelemetry.html +7 -7
- package/dist/docs/guides/opentelemetry.md +2 -2
- package/dist/docs/guides/slack.html +22 -6
- package/dist/docs/guides/slack.md +80 -1
- package/dist/docs/guides/webhooks.html +5 -5
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +6 -6
- package/dist/docs/hillclimbing.md +5 -5
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +1 -1
- package/dist/docs/llms-full.txt +1073 -31
- package/dist/docs/llms.txt +14 -0
- package/dist/docs/quickstart.html +5 -5
- package/dist/docs/quickstart.md +1 -1
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +4 -4
- package/dist/docs/reference/connections.html +17 -7
- package/dist/docs/reference/connections.md +32 -1
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +6 -6
- package/dist/docs/reference/http-api.md +1 -1
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/scaffolding-agents.md +3 -3
- package/dist/docs/skills/ab.html +52 -0
- package/dist/docs/skills/ab.md +50 -0
- package/dist/docs/skills/create-agent.html +34 -0
- package/dist/docs/skills/create-agent.md +160 -0
- package/dist/docs/skills/debug.html +27 -0
- package/dist/docs/skills/debug.md +36 -0
- package/dist/docs/skills/evals.html +51 -0
- package/dist/docs/skills/evals.md +99 -0
- package/dist/docs/skills/framework-map.html +27 -0
- package/dist/docs/skills/framework-map.md +95 -0
- package/dist/docs/skills/github.html +42 -0
- package/dist/docs/skills/github.md +93 -0
- package/dist/docs/skills/hillclimb.html +33 -0
- package/dist/docs/skills/hillclimb.md +55 -0
- package/dist/docs/skills/index.html +27 -0
- package/dist/docs/skills/index.md +21 -0
- package/dist/docs/skills/mcp-auth.html +44 -0
- package/dist/docs/skills/mcp-auth.md +76 -0
- package/dist/docs/skills/otel.html +34 -0
- package/dist/docs/skills/otel.md +48 -0
- package/dist/docs/skills/setup-slack.html +46 -0
- package/dist/docs/skills/setup-slack.md +141 -0
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/agents-md.html +4 -4
- package/dist/docs/templates/code-wiki.html +4 -4
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +4 -4
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +1 -1
- package/dist/extensions/cursor-cloud-agents/extension.d.ts +55 -0
- package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/extension.js +64 -0
- package/dist/extensions/cursor-cloud-agents/lib/cloud.d.ts +30 -0
- package/dist/extensions/cursor-cloud-agents/lib/cloud.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/cloud.js +45 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +25 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/fleet.js +85 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts +15 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/lib/repos.js +55 -0
- package/dist/extensions/cursor-cloud-agents/skills/handoff.md +27 -0
- package/dist/extensions/cursor-cloud-agents/tools/follow_up.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/follow_up.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/follow_up.js +37 -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 +83 -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/status.d.ts +4 -0
- package/dist/extensions/cursor-cloud-agents/tools/status.d.ts.map +1 -0
- package/dist/extensions/cursor-cloud-agents/tools/status.js +41 -0
- package/dist/extensions.d.ts +49 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +75 -0
- package/dist/files-backends/cursor-hosted.d.ts +6 -0
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +6 -9
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/internal/advertise-tools.d.ts +4 -1
- package/dist/internal/advertise-tools.d.ts.map +1 -1
- package/dist/internal/advertise-tools.js +20 -1
- package/dist/internal/as-of.d.ts +18 -0
- package/dist/internal/as-of.d.ts.map +1 -1
- package/dist/internal/as-of.js +131 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +66 -21
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +3 -1
- package/dist/internal/conversation-mirror.d.ts.map +1 -1
- package/dist/internal/conversation-mirror.js +3 -4
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts +16 -0
- package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-deployment-secrets.js +61 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts +15 -0
- package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -0
- package/dist/internal/cursor/hosted-store-secrets.js +48 -0
- package/dist/internal/cursor-deployment-relay.d.ts +15 -1
- package/dist/internal/cursor-deployment-relay.d.ts.map +1 -1
- package/dist/internal/cursor-deployment-relay.js +46 -7
- package/dist/internal/deploy-client.d.ts +29 -6
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +61 -19
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +426 -121
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +5 -0
- package/dist/internal/framework-file-storage.d.ts +15 -8
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +70 -10
- package/dist/internal/framework-storage-selection.d.ts +12 -12
- package/dist/internal/framework-storage-selection.d.ts.map +1 -1
- package/dist/internal/framework-storage-selection.js +33 -39
- package/dist/internal/hosted-delivery.d.ts +3 -1
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +19 -32
- package/dist/internal/hosted-execution-diag.d.ts +5 -0
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
- package/dist/internal/hosted-execution-diag.js +5 -0
- package/dist/internal/hosted-execution-flush.d.ts +46 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -0
- package/dist/internal/hosted-execution-flush.js +81 -0
- package/dist/internal/mcp-endpoint.js +1 -0
- package/dist/internal/mcp-host.d.ts +2 -1
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +35 -15
- package/dist/internal/review-comments.d.ts +1 -1
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +4 -4
- package/dist/internal/server.d.ts +3 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +79 -104
- package/dist/internal/session-engine.d.ts +9 -7
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +45 -34
- package/dist/internal/session-run-log.d.ts +5 -4
- package/dist/internal/session-run-log.d.ts.map +1 -1
- package/dist/internal/session-run-log.js +8 -8
- 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 +151 -0
- package/dist/internal/storage-coordinator.d.ts +0 -6
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +1 -9
- package/dist/internal/tool-policy.d.ts +8 -0
- package/dist/internal/tool-policy.d.ts.map +1 -1
- package/dist/internal/tool-policy.js +19 -7
- package/dist/playground/assets/{index-jzNbJENa.js → index-BnNN1-EK.js} +45 -45
- package/dist/playground/assets/index-DBQCwFp0.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted-v2.d.ts +83 -0
- package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -0
- package/dist/storage-backends/cursor-hosted-v2.js +164 -0
- package/dist/storage-backends/cursor-hosted.d.ts +6 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +6 -1
- package/dist/storage-protocol.d.ts +24 -0
- package/dist/storage-protocol.d.ts.map +1 -1
- package/dist/storage-protocol.js +33 -0
- package/dist/storage.d.ts +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/types.d.ts +123 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +29 -1
- package/docs/README.md +1 -1
- package/docs/ab.md +1 -1
- package/docs/building-with-agents.md +14 -11
- package/docs/evals.md +1 -1
- package/docs/guides/github.md +1 -1
- package/docs/guides/mcp-oauth.md +1 -1
- package/docs/guides/opentelemetry.md +2 -2
- package/docs/guides/slack.md +80 -1
- package/docs/hillclimbing.md +5 -5
- package/docs/quickstart.md +1 -1
- package/docs/reference/connections.md +32 -1
- package/docs/reference/http-api.md +1 -1
- package/docs/scaffolding-agents.md +3 -3
- package/docs/skills/index.md +26 -0
- package/docs/troubleshooting.md +1 -1
- package/package.json +18 -4
- package/src/bin/agent-serve.ts +11 -2
- package/src/channels/deployments/deployments-channel.ts +117 -8
- package/src/channels/deployments/types.ts +4 -3
- package/src/channels/github/defaults.ts +36 -3
- package/src/channels/github/progress.ts +7 -0
- package/src/channels/origin/defaults.ts +143 -0
- package/src/channels/origin/index.ts +2 -0
- package/src/channels/origin/origin-channel.ts +37 -1
- package/src/channels/origin/state.ts +54 -0
- package/src/channels/origin/types.ts +24 -0
- package/src/channels/slack/api.ts +37 -18
- package/src/channels/slack/code-fences.ts +183 -0
- package/src/channels/slack/constants.ts +6 -0
- package/src/channels/slack/defaults.ts +173 -92
- package/src/channels/slack/dispatch.ts +8 -1
- package/src/channels/slack/inbound.ts +17 -0
- package/src/channels/slack/index.ts +2 -0
- package/src/channels/slack/live-delivery.ts +142 -28
- package/src/channels/slack/reasoning-card.ts +140 -0
- package/src/channels/slack/redact.ts +6 -0
- package/src/channels/slack/reply-options.ts +229 -0
- package/src/channels/slack/slack-channel.ts +7 -2
- package/src/channels/slack/stream.ts +31 -24
- package/src/channels/slack/tool-cards.ts +221 -0
- package/src/channels/slack/types.ts +159 -6
- package/src/connections.ts +18 -1
- package/src/extensions/cursor-cloud-agents/extension.ts +118 -0
- package/src/extensions/cursor-cloud-agents/lib/cloud.ts +79 -0
- package/src/extensions/cursor-cloud-agents/lib/fleet.ts +109 -0
- package/src/extensions/cursor-cloud-agents/lib/repos.ts +81 -0
- package/src/extensions/cursor-cloud-agents/skills/handoff.md +27 -0
- package/src/extensions/cursor-cloud-agents/tools/follow_up.ts +29 -0
- package/src/extensions/cursor-cloud-agents/tools/launch.ts +84 -0
- package/src/extensions/cursor-cloud-agents/tools/list.ts +31 -0
- package/src/extensions/cursor-cloud-agents/tools/status.ts +39 -0
- package/src/extensions.ts +98 -0
- package/src/files-backends/cursor-hosted.ts +15 -5
- package/src/index.ts +2 -0
- package/src/internal/advertise-tools.ts +37 -12
- package/src/internal/as-of.ts +163 -0
- package/src/internal/cli-deploy.ts +88 -25
- package/src/internal/continuation-identity.ts +3 -1
- package/src/internal/conversation-mirror.ts +3 -8
- package/src/internal/cursor/hosted-deployment-secrets.ts +72 -0
- package/src/internal/cursor/hosted-store-secrets.ts +72 -0
- package/src/internal/cursor-deployment-relay.ts +65 -8
- package/src/internal/deploy-client.ts +83 -28
- package/src/internal/discovery.ts +479 -114
- package/src/internal/distribution.ts +5 -0
- package/src/internal/framework-file-storage.ts +80 -10
- package/src/internal/framework-storage-selection.ts +31 -44
- package/src/internal/hosted-delivery.ts +38 -63
- package/src/internal/hosted-execution-diag.ts +6 -0
- package/src/internal/hosted-execution-flush.ts +142 -0
- package/src/internal/mcp-endpoint.ts +1 -0
- package/src/internal/mcp-host.ts +40 -14
- package/src/internal/review-comments.ts +5 -2
- package/src/internal/server.ts +81 -100
- package/src/internal/session-engine.ts +56 -28
- package/src/internal/session-run-log.ts +8 -12
- package/src/internal/start-log-store.ts +177 -0
- package/src/internal/storage-coordinator.ts +1 -11
- package/src/internal/tool-policy.ts +39 -9
- package/src/storage-backends/cursor-hosted-v2.ts +219 -0
- package/src/storage-backends/cursor-hosted.ts +6 -1
- package/src/storage-protocol.ts +37 -0
- package/src/storage.ts +1 -0
- package/src/types.ts +177 -14
- package/dist/docs/assets/chunks/@localSearchIndexroot.DpuI4i7Z.js +0 -1
- package/dist/docs/assets/hillclimbing.md.DhESf3OO.js +0 -4
- package/dist/docs/assets/scaffolding-agents.md.D7UUkWw0.js +0 -1
- package/dist/internal/null-kv-storage.d.ts +0 -48
- package/dist/internal/null-kv-storage.d.ts.map +0 -1
- package/dist/internal/null-kv-storage.js +0 -58
- package/dist/playground/assets/index-D7rGZNjy.css +0 -1
- package/src/internal/null-kv-storage.ts +0 -74
- /package/dist/docs/assets/{ab.md.DJo5r4R-.lean.js → ab.md.mlVgqvSk.lean.js} +0 -0
- /package/dist/docs/assets/{building-with-agents.md.DI4mEzlt.lean.js → building-with-agents.md.CUSWxlP_.lean.js} +0 -0
- /package/dist/docs/assets/{evals.md.lfJoEVc8.lean.js → evals.md.CPzDAwoH.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.Cnh2mL4a.lean.js → guides_github.md.BtPr9GaP.lean.js} +0 -0
- /package/dist/docs/assets/{guides_mcp-oauth.md.CN-6YmTJ.lean.js → guides_mcp-oauth.md.Dp6cDP7f.lean.js} +0 -0
- /package/dist/docs/assets/{guides_opentelemetry.md.bmPmkvJu.lean.js → guides_opentelemetry.md.BVTXDCRg.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.DhESf3OO.lean.js → hillclimbing.md.CpTGTCle.lean.js} +0 -0
- /package/dist/docs/assets/{index.md.CVeRUOeZ.lean.js → index.md.Bb4k8kUm.lean.js} +0 -0
- /package/dist/docs/assets/{quickstart.md.Nj_LjW_a.lean.js → quickstart.md.DdQOF7Y8.lean.js} +0 -0
- /package/dist/docs/assets/{reference_http-api.md.BEJx9XVj.lean.js → reference_http-api.md.oySXBO8o.lean.js} +0 -0
- /package/dist/docs/assets/{scaffolding-agents.md.D7UUkWw0.lean.js → scaffolding-agents.md.em43xlY1.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.DCiPBhYs.lean.js → troubleshooting.md.Cus_YZga.lean.js} +0 -0
|
@@ -16,8 +16,10 @@ import { attachHostedAdmissionAdapter } from "../../internal/hosted-admission-ad
|
|
|
16
16
|
import { bindLocalIngressSend } from "../../internal/local-ingress.js";
|
|
17
17
|
import { buildOriginBinding } from "./binding.js";
|
|
18
18
|
import { parseCursorOriginRepoScope, registerOriginCursorAccountRuntime, } from "./cursor-account.js";
|
|
19
|
+
import { buildDefaultOriginEvents } from "./defaults.js";
|
|
19
20
|
import { deriveOriginWebhookEvents, ORIGIN_CHANNEL_KIND } from "./events.js";
|
|
20
21
|
import { DEFAULT_ORIGIN_API_BASE_URL, OriginJwksUnavailableError, verifyOriginWebhook, } from "./origin-webhook.js";
|
|
22
|
+
import { emptyOriginChannelState, originChannelStateForEvent, } from "./state.js";
|
|
21
23
|
/**
|
|
22
24
|
* Default dispatch gate when no `onPullRequest` hook is declared: the common
|
|
23
25
|
* review triggers start a turn as the delivery's actor.
|
|
@@ -304,7 +306,7 @@ function isTaskDispatch(dispatch) {
|
|
|
304
306
|
return "task" in dispatch;
|
|
305
307
|
}
|
|
306
308
|
function enrichEventContext(input) {
|
|
307
|
-
return Object.assign(Object.assign({}, input.ctx), { host: input.args.host, artifacts: input.args.artifacts, origin: buildOriginBinding({
|
|
309
|
+
return Object.assign(Object.assign({}, input.ctx), { host: input.args.host, artifacts: input.args.artifacts, send: input.args.send, origin: buildOriginBinding({
|
|
308
310
|
repository: input.ctx.repository,
|
|
309
311
|
installationId: input.ctx.installationId,
|
|
310
312
|
cursorAccount: input.options.cursorAccount !== undefined &&
|
|
@@ -337,9 +339,12 @@ function startTurn(input) {
|
|
|
337
339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
338
340
|
var _a;
|
|
339
341
|
const source = continuationSource(input.options.continuation, "origin");
|
|
340
|
-
const session = yield input.args.send(input.message, Object.assign(Object.assign(Object.assign({ auth: input.dispatch.auth }, (source === "engine"
|
|
342
|
+
const session = yield input.args.send(input.message, Object.assign(Object.assign(Object.assign(Object.assign({ auth: input.dispatch.auth }, (source === "engine"
|
|
341
343
|
? { continuationToken: originContinuationKey(input.ctx) }
|
|
342
|
-
: {})), { title: (_a = input.dispatch.title) !== null && _a !== void 0 ? _a : defaultOriginTitle(input.ctx) }), (input.cloud === undefined ? {} : { cloud: input.cloud }))
|
|
344
|
+
: {})), { title: (_a = input.dispatch.title) !== null && _a !== void 0 ? _a : defaultOriginTitle(input.ctx) }), (input.cloud === undefined ? {} : { cloud: input.cloud })), { state: input.state,
|
|
345
|
+
// Resume must refresh the triggering comment / delivery identifiers so
|
|
346
|
+
// reply delivery targets the latest wake, not the session's first.
|
|
347
|
+
refreshState: input.state }));
|
|
343
348
|
if (isDeferredChannelSession(session)) {
|
|
344
349
|
// Hosted admission captured the send; the control plane allocates the
|
|
345
350
|
// session after acknowledgement, so there is nothing to report yet.
|
|
@@ -395,6 +400,14 @@ function applyDispatch(input) {
|
|
|
395
400
|
message,
|
|
396
401
|
dispatch: input.dispatch,
|
|
397
402
|
cloud: input.cloud,
|
|
403
|
+
state: originChannelStateForEvent({
|
|
404
|
+
repository: input.ctx.repository,
|
|
405
|
+
pullRequestNumber: input.ctx.pullRequestNumber,
|
|
406
|
+
installationId: input.ctx.installationId,
|
|
407
|
+
deliveryId: input.ctx.deliveryId,
|
|
408
|
+
eventType: input.ctx.eventType,
|
|
409
|
+
triggeringCommentId: input.triggeringCommentId,
|
|
410
|
+
}),
|
|
398
411
|
});
|
|
399
412
|
});
|
|
400
413
|
}
|
|
@@ -450,6 +463,7 @@ export function dispatchOriginWebhook(input) {
|
|
|
450
463
|
dispatch,
|
|
451
464
|
extra: { event: eventType },
|
|
452
465
|
message: `Origin comment on ${ctx.repository.fullName}#${ctx.pullRequestNumber}`,
|
|
466
|
+
triggeringCommentId: commentId,
|
|
453
467
|
});
|
|
454
468
|
}
|
|
455
469
|
if (eventType.startsWith("pull_request.review.")) {
|
|
@@ -587,8 +601,15 @@ export function originChannel(options = {}) {
|
|
|
587
601
|
if (channelOptions.continuation !== undefined) {
|
|
588
602
|
channelOptions.continuation = normalizeIdentity(channelOptions.continuation, "origin");
|
|
589
603
|
}
|
|
604
|
+
const events = Object.assign(Object.assign({}, buildDefaultOriginEvents({
|
|
605
|
+
cursorAccount: channelOptions.cursorAccount,
|
|
606
|
+
app: channelOptions.app,
|
|
607
|
+
deliverReplies: channelOptions.deliverReplies,
|
|
608
|
+
})), options.events);
|
|
590
609
|
const definition = defineChannel({
|
|
591
610
|
auth,
|
|
611
|
+
state: emptyOriginChannelState(),
|
|
612
|
+
events,
|
|
592
613
|
onStart: options.onStart,
|
|
593
614
|
onStop: options.onStop,
|
|
594
615
|
meta: {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable per-session Origin channel state.
|
|
3
|
+
*
|
|
4
|
+
* Persisted with the turn (same mechanism as `GitHubChannelState`) so
|
|
5
|
+
* channel stream-event handlers — reply delivery in ./defaults.ts — can
|
|
6
|
+
* rebuild a repo-bound Origin handle without re-parsing the webhook.
|
|
7
|
+
*/
|
|
8
|
+
export interface OriginChannelState {
|
|
9
|
+
owner: string;
|
|
10
|
+
repo: string;
|
|
11
|
+
pullRequestNumber: number | null;
|
|
12
|
+
/** Origin app installation id from the delivery envelope, when present. */
|
|
13
|
+
installationId: string | null;
|
|
14
|
+
/** Comment id that woke the turn (comment events only). */
|
|
15
|
+
triggeringCommentId: string | null;
|
|
16
|
+
deliveryId: string | null;
|
|
17
|
+
eventType: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function emptyOriginChannelState(overrides?: Partial<OriginChannelState>): OriginChannelState;
|
|
20
|
+
/** Build the per-turn channel state from a dispatched event's context. */
|
|
21
|
+
export declare function originChannelStateForEvent(input: {
|
|
22
|
+
repository: {
|
|
23
|
+
owner: string;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
pullRequestNumber: number;
|
|
27
|
+
installationId?: string;
|
|
28
|
+
deliveryId?: string;
|
|
29
|
+
eventType: string;
|
|
30
|
+
triggeringCommentId?: string;
|
|
31
|
+
}): OriginChannelState;
|
|
32
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/channels/origin/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,2EAA2E;IAC3E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,2DAA2D;IAC3D,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAC1C,kBAAkB,CAWpB;AAED,0EAA0E;AAC1E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,GAAG,kBAAkB,CAUrB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable per-session Origin channel state.
|
|
3
|
+
*
|
|
4
|
+
* Persisted with the turn (same mechanism as `GitHubChannelState`) so
|
|
5
|
+
* channel stream-event handlers — reply delivery in ./defaults.ts — can
|
|
6
|
+
* rebuild a repo-bound Origin handle without re-parsing the webhook.
|
|
7
|
+
*/
|
|
8
|
+
export function emptyOriginChannelState(overrides = {}) {
|
|
9
|
+
return Object.assign({ owner: "", repo: "", pullRequestNumber: null, installationId: null, triggeringCommentId: null, deliveryId: null, eventType: null }, overrides);
|
|
10
|
+
}
|
|
11
|
+
/** Build the per-turn channel state from a dispatched event's context. */
|
|
12
|
+
export function originChannelStateForEvent(input) {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
return emptyOriginChannelState({
|
|
15
|
+
owner: input.repository.owner,
|
|
16
|
+
repo: input.repository.name,
|
|
17
|
+
pullRequestNumber: input.pullRequestNumber,
|
|
18
|
+
installationId: (_a = input.installationId) !== null && _a !== void 0 ? _a : null,
|
|
19
|
+
triggeringCommentId: (_b = input.triggeringCommentId) !== null && _b !== void 0 ? _b : null,
|
|
20
|
+
deliveryId: (_c = input.deliveryId) !== null && _c !== void 0 ? _c : null,
|
|
21
|
+
eventType: input.eventType,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ContinuationIdentity } from "../../continuation.js";
|
|
2
|
-
import type { AgentCloudOptions, ArtifactsApi, AuthContext, AuthPolicy, ChannelStartArgs, HostContext } from "../../types.js";
|
|
2
|
+
import type { AgentCloudOptions, ArtifactsApi, AuthContext, AuthPolicy, ChannelEventHandlers, ChannelStartArgs, HostContext, SendMessageFn } from "../../types.js";
|
|
3
3
|
import type { OriginTokenProvider } from "./api.js";
|
|
4
4
|
import type { OriginHandle } from "./binding.js";
|
|
5
|
+
import type { OriginChannelState } from "./state.js";
|
|
5
6
|
export interface OriginActor {
|
|
6
7
|
id: string;
|
|
7
8
|
kind?: string;
|
|
@@ -57,6 +58,12 @@ export interface OriginEventContext {
|
|
|
57
58
|
*/
|
|
58
59
|
payload: Record<string, unknown>;
|
|
59
60
|
sender?: OriginActor;
|
|
61
|
+
/**
|
|
62
|
+
* Channel `send`. Set on every delivery path (HTTP webhook, hosted
|
|
63
|
+
* admission, SCM events) so a hook can start a turn itself instead of
|
|
64
|
+
* returning `{ auth, message }` or a deferred `{ task }`.
|
|
65
|
+
*/
|
|
66
|
+
send?: SendMessageFn;
|
|
60
67
|
host: HostContext;
|
|
61
68
|
artifacts: ArtifactsApi;
|
|
62
69
|
/**
|
|
@@ -206,6 +213,21 @@ export interface OriginChannelOptions {
|
|
|
206
213
|
* pull request URL, or a resolver for custom cloud options.
|
|
207
214
|
*/
|
|
208
215
|
cloud?: boolean | AgentCloudOptions | OriginCloudOptionsResolver;
|
|
216
|
+
/**
|
|
217
|
+
* When false, skip posting completed assistant messages (and failure
|
|
218
|
+
* notices) back to the Origin pull request. Defaults to true — the GitHub
|
|
219
|
+
* channel's reply-delivery posture. Outbound credentials resolve like
|
|
220
|
+
* `ctx.origin`: {@link app} / `ORIGIN_APP_*` env when configured,
|
|
221
|
+
* otherwise the Cursor-account session exchange (hosted v2 deployments
|
|
222
|
+
* post as the deployment service-account principal).
|
|
223
|
+
*/
|
|
224
|
+
deliverReplies?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Channel stream-event handlers, merged over the built-in reply-delivery
|
|
227
|
+
* defaults (`buildDefaultOriginEvents`) — same override contract as the
|
|
228
|
+
* GitHub channel's `events`.
|
|
229
|
+
*/
|
|
230
|
+
events?: ChannelEventHandlers<OriginChannelState>;
|
|
209
231
|
/** Called once when the server mounts this channel. */
|
|
210
232
|
onStart?: (args: ChannelStartArgs) => void | Promise<void>;
|
|
211
233
|
/** Called when the server shuts down. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channels/origin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channels/origin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE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;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;IACpB;;;;OAIG;IACH,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,oEAAoE;IACpE,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,iBAAiB,GAAG,0BAA0B,CAAC;IACjE;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;IAClD,uDAAuD;IACvD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ArtifactsApi, HostContext } from "../../types.js";
|
|
5
5
|
import { type SlackLog } from "./log.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { StreamChunk } from "./stream.js";
|
|
7
7
|
import type { SlackApiTransport, SlackBinding, SlackBotToken, SlackCredentials, SlackSuggestedPrompt, SoftSlackResult } from "./types.js";
|
|
8
8
|
/** Whether a bot token slot holds an API transport instead of a token. */
|
|
9
9
|
export declare function isSlackApiTransport(token: SlackBotToken | undefined): token is SlackApiTransport;
|
|
@@ -41,10 +41,18 @@ export declare function truncateTypingStatus(status: string, max?: number): stri
|
|
|
41
41
|
export declare function truncateLoadingMessages(messages: string[], nowMs?: number): string[];
|
|
42
42
|
export declare function truncateTitle(title: string, max?: number): string;
|
|
43
43
|
/**
|
|
44
|
-
* Show or clear the
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
44
|
+
* Show or clear the status chip under the thread.
|
|
45
|
+
*
|
|
46
|
+
* Status text goes through `assistant.threads.setStatus` alone. The agent
|
|
47
|
+
* session is only written when clearing: Agent UX ignores an empty assistant
|
|
48
|
+
* status, so `agents.sessions.setStatus` `active` is what actually drops the
|
|
49
|
+
* chip. That same write must not accompany status text — Slack applies it
|
|
50
|
+
* asynchronously and it blanks the chip when it lands after the text, which
|
|
51
|
+
* reads as flicker between updates. A `processing` write would be worse:
|
|
52
|
+
* Agent UX paints its own generic "is working…" over the assistant text
|
|
53
|
+
* while the session is `processing`. An open `chat.startStream` also flips
|
|
54
|
+
* the session to `processing` on Slack's side, so status text only shows on
|
|
55
|
+
* non-streaming turns. The empty assistant call stays for older workspaces.
|
|
48
56
|
*/
|
|
49
57
|
export declare function setThreadStatus(args: {
|
|
50
58
|
botToken: SlackBotToken | undefined;
|
|
@@ -71,7 +79,7 @@ export declare function startChatStream(args: {
|
|
|
71
79
|
channel: string;
|
|
72
80
|
thread_ts?: string;
|
|
73
81
|
markdown_text?: string;
|
|
74
|
-
chunks?:
|
|
82
|
+
chunks?: StreamChunk[];
|
|
75
83
|
recipient_user_id?: string;
|
|
76
84
|
recipient_team_id?: string;
|
|
77
85
|
}): Promise<SoftSlackResult<{
|
|
@@ -83,13 +91,14 @@ export declare function appendChatStream(args: {
|
|
|
83
91
|
channel: string;
|
|
84
92
|
ts: string;
|
|
85
93
|
markdown_text?: string;
|
|
86
|
-
chunks?:
|
|
94
|
+
chunks?: StreamChunk[];
|
|
87
95
|
}): Promise<SoftSlackResult>;
|
|
88
96
|
export declare function stopChatStream(args: {
|
|
89
97
|
botToken: SlackBotToken | undefined;
|
|
90
98
|
channel: string;
|
|
91
99
|
ts: string;
|
|
92
100
|
markdown_text?: string;
|
|
101
|
+
chunks?: StreamChunk[];
|
|
93
102
|
blocks?: unknown[];
|
|
94
103
|
}): Promise<SoftSlackResult>;
|
|
95
104
|
export declare function postMessage(args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAYhE,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,0EAA0E;AAC1E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,KAAK,IAAI,iBAAiB,CAM5B;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,gBAAgB,GAAG,SAAS,GACxC,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,0DAA0D;AAC1D,wBAAsB,eAAe,CACnC,WAAW,E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CAAC,CAY3B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC;IACxB,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB,GAAG,YAAY,CAuGf"}
|
|
@@ -12,6 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import { ErrorCode, WebClient } from "@slack/web-api";
|
|
14
14
|
import { slackifyMarkdown } from "slackify-markdown";
|
|
15
|
+
import { highlightCodeFences } from "./code-fences.js";
|
|
15
16
|
import { SLACK_DEFAULT_LOADING_MESSAGES, SLACK_LOADING_MESSAGE_MAX_LEN, SLACK_LOADING_MESSAGES_MAX, SLACK_STATUS_MAX_LEN, SLACK_TITLE_MAX_LEN, SLACK_TYPING_MIN_INTERVAL_MS, SLACK_UNSUPPORTED_ERRORS, } from "./constants.js";
|
|
16
17
|
import { tryResolveAppToken, tryResolveBotToken } from "./credentials.js";
|
|
17
18
|
import { defaultSlackLog } from "./log.js";
|
|
@@ -145,10 +146,18 @@ export function truncateTitle(title, max) {
|
|
|
145
146
|
// Assistant / stream helpers
|
|
146
147
|
// ---------------------------------------------------------------------------
|
|
147
148
|
/**
|
|
148
|
-
* Show or clear the
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
149
|
+
* Show or clear the status chip under the thread.
|
|
150
|
+
*
|
|
151
|
+
* Status text goes through `assistant.threads.setStatus` alone. The agent
|
|
152
|
+
* session is only written when clearing: Agent UX ignores an empty assistant
|
|
153
|
+
* status, so `agents.sessions.setStatus` `active` is what actually drops the
|
|
154
|
+
* chip. That same write must not accompany status text — Slack applies it
|
|
155
|
+
* asynchronously and it blanks the chip when it lands after the text, which
|
|
156
|
+
* reads as flicker between updates. A `processing` write would be worse:
|
|
157
|
+
* Agent UX paints its own generic "is working…" over the assistant text
|
|
158
|
+
* while the session is `processing`. An open `chat.startStream` also flips
|
|
159
|
+
* the session to `processing` on Slack's side, so status text only shows on
|
|
160
|
+
* non-streaming turns. The empty assistant call stays for older workspaces.
|
|
152
161
|
*/
|
|
153
162
|
export function setThreadStatus(args) {
|
|
154
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -156,15 +165,6 @@ export function setThreadStatus(args) {
|
|
|
156
165
|
return { ok: false, error: "missing_channel_or_thread" };
|
|
157
166
|
}
|
|
158
167
|
const status = truncateTypingStatus(args.status);
|
|
159
|
-
const sessionResult = yield callSlackApiSoft({
|
|
160
|
-
botToken: args.botToken,
|
|
161
|
-
operation: "agents.sessions.setStatus",
|
|
162
|
-
body: {
|
|
163
|
-
channel_id: args.channelId,
|
|
164
|
-
thread_ts: args.threadTs,
|
|
165
|
-
status: status.length > 0 ? "processing" : "active",
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
168
|
const body = {
|
|
169
169
|
channel_id: args.channelId,
|
|
170
170
|
thread_ts: args.threadTs,
|
|
@@ -181,7 +181,21 @@ export function setThreadStatus(args) {
|
|
|
181
181
|
if (loading_messages.length > 0) {
|
|
182
182
|
body.loading_messages = loading_messages;
|
|
183
183
|
}
|
|
184
|
+
return callSlackApiSoft({
|
|
185
|
+
botToken: args.botToken,
|
|
186
|
+
operation: "assistant.threads.setStatus",
|
|
187
|
+
body,
|
|
188
|
+
});
|
|
184
189
|
}
|
|
190
|
+
const sessionResult = yield callSlackApiSoft({
|
|
191
|
+
botToken: args.botToken,
|
|
192
|
+
operation: "agents.sessions.setStatus",
|
|
193
|
+
body: {
|
|
194
|
+
channel_id: args.channelId,
|
|
195
|
+
thread_ts: args.threadTs,
|
|
196
|
+
status: "active",
|
|
197
|
+
},
|
|
198
|
+
});
|
|
185
199
|
const assistantResult = yield callSlackApiSoft({
|
|
186
200
|
botToken: args.botToken,
|
|
187
201
|
operation: "assistant.threads.setStatus",
|
|
@@ -295,6 +309,9 @@ export function stopChatStream(args) {
|
|
|
295
309
|
if (args.markdown_text !== undefined) {
|
|
296
310
|
body.markdown_text = args.markdown_text;
|
|
297
311
|
}
|
|
312
|
+
if (args.chunks !== undefined && args.chunks.length > 0) {
|
|
313
|
+
body.chunks = args.chunks;
|
|
314
|
+
}
|
|
298
315
|
if (args.blocks !== undefined && args.blocks.length > 0) {
|
|
299
316
|
body.blocks = args.blocks;
|
|
300
317
|
}
|
|
@@ -365,7 +382,7 @@ export function postMessage(args) {
|
|
|
365
382
|
response = yield callSlackApi({
|
|
366
383
|
botToken: args.botToken,
|
|
367
384
|
operation: "chat.postMessage",
|
|
368
|
-
body: Object.assign(Object.assign({}, base), { markdown_text: args.text }),
|
|
385
|
+
body: Object.assign(Object.assign({}, base), { markdown_text: highlightCodeFences(args.text) }),
|
|
369
386
|
});
|
|
370
387
|
// Older workspaces / scopes may not accept markdown_text — retry with text.
|
|
371
388
|
// Also fall back when markdown_text hits its 12k limit (msg_too_long) while
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack highlights a fenced code block only when its info string is a
|
|
3
|
+
* language it knows (`ts`, `python`, …). Models on this harness cite code
|
|
4
|
+
* with Cursor's `startLine:endLine:path` form, or a bare path, which Slack
|
|
5
|
+
* shows verbatim as the block's header with no highlighting. The header is
|
|
6
|
+
* the only slot Slack offers, so a block gets colors by moving the reference
|
|
7
|
+
* to a comment on its first line. Files whose language has no comment
|
|
8
|
+
* syntax, or that Slack cannot color anyway, keep the reference as header.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Rewrite fence info strings so Slack highlights the block. Safe to run on
|
|
12
|
+
* a growing stream: the output for a prefix is a prefix of the output for
|
|
13
|
+
* the full text, because an opening fence whose line has not ended yet is
|
|
14
|
+
* held back rather than emitted half-formed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function highlightCodeFences(markdown: string): string;
|
|
17
|
+
//# sourceMappingURL=code-fences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-fences.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/code-fences.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgIH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwC5D"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack highlights a fenced code block only when its info string is a
|
|
3
|
+
* language it knows (`ts`, `python`, …). Models on this harness cite code
|
|
4
|
+
* with Cursor's `startLine:endLine:path` form, or a bare path, which Slack
|
|
5
|
+
* shows verbatim as the block's header with no highlighting. The header is
|
|
6
|
+
* the only slot Slack offers, so a block gets colors by moving the reference
|
|
7
|
+
* to a comment on its first line. Files whose language has no comment
|
|
8
|
+
* syntax, or that Slack cannot color anyway, keep the reference as header.
|
|
9
|
+
*/
|
|
10
|
+
const FENCE = /^(\s*)(`{3,}|~{3,})(.*)$/;
|
|
11
|
+
/** A line that may still grow into a fence. */
|
|
12
|
+
const FENCE_START = /^\s*(`{1,2}|~{1,2})$/;
|
|
13
|
+
const CITATION = /^(\d+):(\d+):(\S+)$/;
|
|
14
|
+
const LANGUAGE_BY_EXTENSION = {
|
|
15
|
+
ts: "ts",
|
|
16
|
+
mts: "ts",
|
|
17
|
+
cts: "ts",
|
|
18
|
+
tsx: "tsx",
|
|
19
|
+
js: "js",
|
|
20
|
+
mjs: "js",
|
|
21
|
+
cjs: "js",
|
|
22
|
+
jsx: "jsx",
|
|
23
|
+
py: "python",
|
|
24
|
+
go: "go",
|
|
25
|
+
rs: "rust",
|
|
26
|
+
java: "java",
|
|
27
|
+
kt: "kotlin",
|
|
28
|
+
swift: "swift",
|
|
29
|
+
rb: "ruby",
|
|
30
|
+
php: "php",
|
|
31
|
+
c: "c",
|
|
32
|
+
h: "c",
|
|
33
|
+
cc: "cpp",
|
|
34
|
+
cpp: "cpp",
|
|
35
|
+
hpp: "cpp",
|
|
36
|
+
cs: "csharp",
|
|
37
|
+
json: "json",
|
|
38
|
+
jsonc: "jsonc",
|
|
39
|
+
yaml: "yaml",
|
|
40
|
+
yml: "yaml",
|
|
41
|
+
toml: "toml",
|
|
42
|
+
xml: "xml",
|
|
43
|
+
html: "html",
|
|
44
|
+
css: "css",
|
|
45
|
+
scss: "scss",
|
|
46
|
+
md: "markdown",
|
|
47
|
+
mdx: "mdx",
|
|
48
|
+
sh: "bash",
|
|
49
|
+
bash: "bash",
|
|
50
|
+
zsh: "bash",
|
|
51
|
+
sql: "sql",
|
|
52
|
+
proto: "protobuf",
|
|
53
|
+
tf: "hcl",
|
|
54
|
+
graphql: "graphql",
|
|
55
|
+
dockerfile: "dockerfile",
|
|
56
|
+
ini: "ini",
|
|
57
|
+
};
|
|
58
|
+
/** `[open, close]` comment delimiters; languages without one (JSON) are absent. */
|
|
59
|
+
const COMMENT_BY_LANGUAGE = {
|
|
60
|
+
ts: ["//", ""],
|
|
61
|
+
tsx: ["//", ""],
|
|
62
|
+
js: ["//", ""],
|
|
63
|
+
jsx: ["//", ""],
|
|
64
|
+
go: ["//", ""],
|
|
65
|
+
rust: ["//", ""],
|
|
66
|
+
java: ["//", ""],
|
|
67
|
+
kotlin: ["//", ""],
|
|
68
|
+
swift: ["//", ""],
|
|
69
|
+
php: ["//", ""],
|
|
70
|
+
c: ["//", ""],
|
|
71
|
+
cpp: ["//", ""],
|
|
72
|
+
csharp: ["//", ""],
|
|
73
|
+
jsonc: ["//", ""],
|
|
74
|
+
protobuf: ["//", ""],
|
|
75
|
+
python: ["#", ""],
|
|
76
|
+
ruby: ["#", ""],
|
|
77
|
+
yaml: ["#", ""],
|
|
78
|
+
toml: ["#", ""],
|
|
79
|
+
bash: ["#", ""],
|
|
80
|
+
dockerfile: ["#", ""],
|
|
81
|
+
ini: ["#", ""],
|
|
82
|
+
hcl: ["#", ""],
|
|
83
|
+
graphql: ["#", ""],
|
|
84
|
+
sql: ["--", ""],
|
|
85
|
+
css: ["/*", "*/"],
|
|
86
|
+
scss: ["/*", "*/"],
|
|
87
|
+
html: ["<!--", "-->"],
|
|
88
|
+
xml: ["<!--", "-->"],
|
|
89
|
+
markdown: ["<!--", "-->"],
|
|
90
|
+
mdx: ["<!--", "-->"],
|
|
91
|
+
};
|
|
92
|
+
function languageForPath(path) {
|
|
93
|
+
const base = path.slice(path.lastIndexOf("/") + 1).toLowerCase();
|
|
94
|
+
const ext = base.includes(".") ? base.slice(base.lastIndexOf(".") + 1) : base;
|
|
95
|
+
return LANGUAGE_BY_EXTENSION[ext];
|
|
96
|
+
}
|
|
97
|
+
function looksLikePath(info) {
|
|
98
|
+
return info.includes("/") || languageForPath(info) !== undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Replacement lines for an opening fence whose info string is a citation or
|
|
102
|
+
* a path: the fence tagged with the language, then the reference as a
|
|
103
|
+
* comment. Falls back to the reference as the header when the block cannot
|
|
104
|
+
* carry a comment. `null` when the info string is neither.
|
|
105
|
+
*/
|
|
106
|
+
function rewriteOpening(indent, marks, info) {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
const token = (_a = info.trim().split(/\s+/)[0]) !== null && _a !== void 0 ? _a : "";
|
|
109
|
+
const cited = CITATION.exec(token);
|
|
110
|
+
const path = (_b = cited === null || cited === void 0 ? void 0 : cited[3]) !== null && _b !== void 0 ? _b : (looksLikePath(token) ? token : undefined);
|
|
111
|
+
if (path === undefined) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const reference = cited === null ? path : `${path}:${cited[1]}-${cited[2]}`;
|
|
115
|
+
const language = languageForPath(path);
|
|
116
|
+
const comment = language === undefined ? undefined : COMMENT_BY_LANGUAGE[language];
|
|
117
|
+
if (comment === undefined) {
|
|
118
|
+
return [`${indent}${marks}${reference}`];
|
|
119
|
+
}
|
|
120
|
+
const [open, close] = comment;
|
|
121
|
+
const commented = close === "" ? `${open} ${reference}` : `${open} ${reference} ${close}`;
|
|
122
|
+
return [`${indent}${marks}${language}`, `${indent}${commented}`];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Rewrite fence info strings so Slack highlights the block. Safe to run on
|
|
126
|
+
* a growing stream: the output for a prefix is a prefix of the output for
|
|
127
|
+
* the full text, because an opening fence whose line has not ended yet is
|
|
128
|
+
* held back rather than emitted half-formed.
|
|
129
|
+
*/
|
|
130
|
+
export function highlightCodeFences(markdown) {
|
|
131
|
+
var _a;
|
|
132
|
+
const complete = markdown.endsWith("\n");
|
|
133
|
+
const lines = markdown.split("\n");
|
|
134
|
+
if (complete) {
|
|
135
|
+
lines.pop();
|
|
136
|
+
}
|
|
137
|
+
const out = [];
|
|
138
|
+
let open = null;
|
|
139
|
+
const heldBack = () => `${out.join("\n")}${out.length > 0 ? "\n" : ""}`;
|
|
140
|
+
for (const [index, line] of lines.entries()) {
|
|
141
|
+
const last = index === lines.length - 1 && !complete;
|
|
142
|
+
const fence = FENCE.exec(line);
|
|
143
|
+
if (fence === null) {
|
|
144
|
+
if (last && open === null && FENCE_START.test(line)) {
|
|
145
|
+
return heldBack();
|
|
146
|
+
}
|
|
147
|
+
out.push(line);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const [, indent = "", marks = "", info = ""] = fence;
|
|
151
|
+
if (open !== null) {
|
|
152
|
+
if (marks[0] === open.marks[0] &&
|
|
153
|
+
marks.length >= open.marks.length &&
|
|
154
|
+
info.trim() === "") {
|
|
155
|
+
open = null;
|
|
156
|
+
}
|
|
157
|
+
out.push(line);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (last) {
|
|
161
|
+
// Opening fence still being written: wait for the whole line.
|
|
162
|
+
return heldBack();
|
|
163
|
+
}
|
|
164
|
+
open = { marks };
|
|
165
|
+
out.push(...((_a = rewriteOpening(indent, marks, info)) !== null && _a !== void 0 ? _a : [line]));
|
|
166
|
+
}
|
|
167
|
+
return complete ? `${out.join("\n")}\n` : out.join("\n");
|
|
168
|
+
}
|
|
@@ -12,6 +12,12 @@ export declare const SLACK_LOADING_MESSAGE_MAX_LEN = 50;
|
|
|
12
12
|
/** Slack `assistant.threads.setStatus` accepts at most 5 `loading_messages`. */
|
|
13
13
|
export declare const SLACK_LOADING_MESSAGES_MAX = 5;
|
|
14
14
|
export declare const SLACK_TITLE_MAX_LEN = 80;
|
|
15
|
+
/**
|
|
16
|
+
* `markdown_text` (and so a streamed message, cards included) tops out near
|
|
17
|
+
* 12k characters; past it Slack answers `msg_too_long`. Plain `text` allows
|
|
18
|
+
* about 40k.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SLACK_MARKDOWN_TEXT_MAX_LEN = 12000;
|
|
15
21
|
/** Rotating assistant status lines (Slack `loading_messages`). */
|
|
16
22
|
export declare const SLACK_DEFAULT_LOADING_MESSAGES: readonly ["Thinking…", "Working on it…", "Almost there…"];
|
|
17
23
|
/** Slack API errors that mean a feature is unavailable for this app. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/constants.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,4BAA4B,OAAQ,CAAC;AAClD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,mBAAmB,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/constants.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,4BAA4B,OAAQ,CAAC;AAClD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,kEAAkE;AAClE,eAAO,MAAM,8BAA8B,YACzC,WAAW,EACX,gBAAgB,EAChB,eAAe,CACP,CAAC;AAEX,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAO/C,CAAC"}
|
|
@@ -12,6 +12,12 @@ export const SLACK_LOADING_MESSAGE_MAX_LEN = 50;
|
|
|
12
12
|
/** Slack `assistant.threads.setStatus` accepts at most 5 `loading_messages`. */
|
|
13
13
|
export const SLACK_LOADING_MESSAGES_MAX = 5;
|
|
14
14
|
export const SLACK_TITLE_MAX_LEN = 80;
|
|
15
|
+
/**
|
|
16
|
+
* `markdown_text` (and so a streamed message, cards included) tops out near
|
|
17
|
+
* 12k characters; past it Slack answers `msg_too_long`. Plain `text` allows
|
|
18
|
+
* about 40k.
|
|
19
|
+
*/
|
|
20
|
+
export const SLACK_MARKDOWN_TEXT_MAX_LEN = 12000;
|
|
15
21
|
/** Rotating assistant status lines (Slack `loading_messages`). */
|
|
16
22
|
export const SLACK_DEFAULT_LOADING_MESSAGES = [
|
|
17
23
|
"Thinking…",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ChannelEventHandlers } from "../../types.js";
|
|
5
5
|
import { type SlackLog } from "./log.js";
|
|
6
|
-
import type { SlackAccessPolicy, SlackChannelState, SlackCredentials, SlackMessageHandler, SlackRespondTo, SlackSuggestedPrompt } from "./types.js";
|
|
6
|
+
import type { SlackAccessPolicy, SlackChannelState, SlackCredentials, SlackMessageHandler, SlackReplyOptions, SlackRespondTo, SlackSuggestedPrompt, SlackToolLabels } from "./types.js";
|
|
7
7
|
export declare function resolveSlackRespondTo(policy: SlackAccessPolicy | undefined): SlackRespondTo;
|
|
8
8
|
/** Defaults to true when omitted. */
|
|
9
9
|
export declare function resolveSlackBlockExternals(policy: SlackAccessPolicy | undefined): boolean;
|
|
@@ -22,18 +22,23 @@ export declare const defaultOnDirectMessage: SlackMessageHandler;
|
|
|
22
22
|
export declare const defaultOnChannelPost: SlackMessageHandler;
|
|
23
23
|
export interface BuildDefaultEventsOptions {
|
|
24
24
|
credentials?: SlackCredentials;
|
|
25
|
+
/** Same shape as `slackChannel({ reply })`; see {@link SlackReplyOptions}. */
|
|
26
|
+
reply?: SlackReplyOptions;
|
|
27
|
+
/** Same as `slackChannel({ toolLabels })`. */
|
|
28
|
+
toolLabels?: SlackToolLabels;
|
|
29
|
+
/** @deprecated Use `reply`. */
|
|
25
30
|
streaming?: boolean;
|
|
31
|
+
/** @deprecated Use `reply`. */
|
|
26
32
|
thinkingSteps?: boolean;
|
|
33
|
+
/** @deprecated Use `reply.status.idle`. */
|
|
34
|
+
loadingMessages?: readonly string[];
|
|
27
35
|
suggestedPrompts?: SlackSuggestedPrompt[];
|
|
28
36
|
suggestedPromptsTitle?: string;
|
|
29
|
-
/** Rotating assistant status lines; defaults to pack constants. */
|
|
30
|
-
loadingMessages?: readonly string[];
|
|
31
37
|
/** Resolved per-call so channel onStart can rebind the server logger. */
|
|
32
38
|
getLog?: () => SlackLog;
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* Build default stream-event handlers (typing, streaming, replies).
|
|
36
|
-
* Streaming / thinking default to ON.
|
|
37
42
|
*
|
|
38
43
|
* Tool-approval cards are a separate primitive — compose with
|
|
39
44
|
* `buildToolApprovalEvents` or set `toolApprovals: true` on `slackChannel`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAUhF,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAO1D,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,eAAe,EAChB,MAAM,YAAY,CAAC;AAMpB,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,cAAc,CAEhB;AAED,qCAAqC;AACrC,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,OAAO,CAET;AAED,6EAA6E;AAC7E,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAS7E;AAyBD,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,EACnC,MAAM,CAAC,EAAE,iBAAiB,GACzB,mBAAmB,CAQrB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,EACnC,MAAM,CAAC,EAAE,iBAAiB,GACzB,mBAAmB,CAWrB;AAED,eAAO,MAAM,mBAAmB,EAAE,mBACR,CAAC;AAC3B,eAAO,MAAM,sBAAsB,EAAE,mBACX,CAAC;AAC3B,eAAO,MAAM,oBAAoB,EAAE,mBACL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