@cursor/july 0.1.16 → 0.1.17

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.
Files changed (236) hide show
  1. package/README.md +9 -4
  2. package/dist/bin/agent-serve.js +60 -2
  3. package/dist/channels/slack/api.d.ts.map +1 -1
  4. package/dist/channels/slack/api.js +13 -3
  5. package/dist/channels/slack/auth.d.ts +7 -1
  6. package/dist/channels/slack/auth.d.ts.map +1 -1
  7. package/dist/channels/slack/auth.js +14 -0
  8. package/dist/channels/slack/blocks.d.ts +61 -0
  9. package/dist/channels/slack/blocks.d.ts.map +1 -0
  10. package/dist/channels/slack/blocks.js +90 -0
  11. package/dist/channels/slack/defaults.d.ts +2 -0
  12. package/dist/channels/slack/defaults.d.ts.map +1 -1
  13. package/dist/channels/slack/defaults.js +29 -3
  14. package/dist/channels/slack/dispatch.d.ts +3 -17
  15. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  16. package/dist/channels/slack/index.d.ts +1 -0
  17. package/dist/channels/slack/index.d.ts.map +1 -1
  18. package/dist/channels/slack/index.js +1 -0
  19. package/dist/channels/slack/interactive.d.ts +39 -3
  20. package/dist/channels/slack/interactive.d.ts.map +1 -1
  21. package/dist/channels/slack/interactive.js +152 -7
  22. package/dist/channels/slack/manifest.d.ts +3 -0
  23. package/dist/channels/slack/manifest.d.ts.map +1 -1
  24. package/dist/channels/slack/manifest.js +3 -0
  25. package/dist/channels/slack/setup.d.ts +4 -1
  26. package/dist/channels/slack/setup.d.ts.map +1 -1
  27. package/dist/channels/slack/setup.js +16 -2
  28. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  29. package/dist/channels/slack/slack-channel.js +24 -3
  30. package/dist/channels/slack/types.d.ts +77 -0
  31. package/dist/channels/slack/types.d.ts.map +1 -1
  32. package/dist/connections.d.ts +4 -1
  33. package/dist/connections.d.ts.map +1 -1
  34. package/dist/connections.js +4 -1
  35. package/dist/docs/404.html +2 -2
  36. package/dist/docs/ab.html +3 -3
  37. package/dist/docs/assets/{app.DjHC-Ggf.js → app.BbEXr2KO.js} +1 -1
  38. package/dist/docs/assets/chunks/@localSearchIndexroot.DCBsrfwP.js +1 -0
  39. package/dist/docs/assets/chunks/{VPLocalSearchBox.DwviwmIq.js → VPLocalSearchBox.DBEi4HDp.js} +1 -1
  40. package/dist/docs/assets/chunks/{theme.BIpeYSon.js → theme.DGfptcHw.js} +2 -2
  41. package/dist/docs/assets/{guides_mcp-oauth.md.DqmEOQY1.js → guides_mcp-oauth.md.Dd8EgSem.js} +3 -2
  42. package/dist/docs/assets/{guides_mcp-oauth.md.DqmEOQY1.lean.js → guides_mcp-oauth.md.Dd8EgSem.lean.js} +1 -1
  43. package/dist/docs/assets/{guides_slack.md.FWale6Ip.js → guides_slack.md.D_xFKlnF.js} +1 -1
  44. package/dist/docs/assets/{reference_connections.md.CsSr3rDz.js → reference_connections.md.B9Q3TOve.js} +12 -5
  45. package/dist/docs/assets/{reference_connections.md.CsSr3rDz.lean.js → reference_connections.md.B9Q3TOve.lean.js} +1 -1
  46. package/dist/docs/building-with-agents.html +3 -3
  47. package/dist/docs/concepts.html +3 -3
  48. package/dist/docs/deployment.html +3 -3
  49. package/dist/docs/evals.html +3 -3
  50. package/dist/docs/example-agents/approval-buddy.html +3 -3
  51. package/dist/docs/example-agents/benny.html +3 -3
  52. package/dist/docs/example-agents/bugbot.html +3 -3
  53. package/dist/docs/example-agents/codebase-wiki.html +3 -3
  54. package/dist/docs/example-agents/codeowners-review.html +3 -3
  55. package/dist/docs/example-agents/concierge.html +3 -3
  56. package/dist/docs/example-agents/fsd.html +3 -3
  57. package/dist/docs/example-agents/index.html +3 -3
  58. package/dist/docs/example-agents/knowledge-base.html +3 -3
  59. package/dist/docs/example-agents/oncall.html +3 -3
  60. package/dist/docs/example-agents/security-reviewer.html +3 -3
  61. package/dist/docs/example-agents/slack-agent.html +3 -3
  62. package/dist/docs/example-agents/weather-agent.html +3 -3
  63. package/dist/docs/guides/agent-to-agent.html +3 -3
  64. package/dist/docs/guides/cloud-runtime.html +3 -3
  65. package/dist/docs/guides/github.html +3 -3
  66. package/dist/docs/guides/human-in-the-loop.html +3 -3
  67. package/dist/docs/guides/mcp-oauth.html +6 -5
  68. package/dist/docs/guides/slack.html +5 -5
  69. package/dist/docs/guides/webhooks.html +3 -3
  70. package/dist/docs/hashmap.json +1 -1
  71. package/dist/docs/hillclimbing.html +3 -3
  72. package/dist/docs/index.html +3 -3
  73. package/dist/docs/quickstart.html +3 -3
  74. package/dist/docs/reference/agent-config.html +3 -3
  75. package/dist/docs/reference/channels.html +3 -3
  76. package/dist/docs/reference/cli.html +3 -3
  77. package/dist/docs/reference/connections.html +14 -7
  78. package/dist/docs/reference/hooks.html +3 -3
  79. package/dist/docs/reference/http-api.html +3 -3
  80. package/dist/docs/reference/instructions.html +3 -3
  81. package/dist/docs/reference/playground.html +3 -3
  82. package/dist/docs/reference/project-layout.html +3 -3
  83. package/dist/docs/reference/prompt.html +3 -3
  84. package/dist/docs/reference/schedules.html +3 -3
  85. package/dist/docs/reference/sessions.html +3 -3
  86. package/dist/docs/reference/skills.html +3 -3
  87. package/dist/docs/reference/subagents.html +3 -3
  88. package/dist/docs/reference/tools.html +3 -3
  89. package/dist/docs/scaffolding-agents.html +3 -3
  90. package/dist/docs/storage.html +3 -3
  91. package/dist/docs/troubleshooting.html +3 -3
  92. package/dist/evals/assertions.d.ts +190 -0
  93. package/dist/evals/assertions.d.ts.map +1 -0
  94. package/dist/evals/assertions.js +461 -0
  95. package/dist/evals/expect.d.ts +95 -0
  96. package/dist/evals/expect.d.ts.map +1 -0
  97. package/dist/evals/expect.js +194 -0
  98. package/dist/evals/judge.d.ts +133 -0
  99. package/dist/evals/judge.d.ts.map +1 -0
  100. package/dist/evals/judge.js +228 -0
  101. package/dist/evals/loaders.d.ts +51 -0
  102. package/dist/evals/loaders.d.ts.map +1 -0
  103. package/dist/evals/loaders.js +124 -0
  104. package/dist/evals/matchers.d.ts +95 -0
  105. package/dist/evals/matchers.d.ts.map +1 -0
  106. package/dist/evals/matchers.js +145 -0
  107. package/dist/evals/reporters.d.ts +70 -0
  108. package/dist/evals/reporters.d.ts.map +1 -0
  109. package/dist/evals/reporters.js +221 -0
  110. package/dist/evals/results.d.ts +103 -0
  111. package/dist/evals/results.d.ts.map +1 -0
  112. package/dist/evals/results.js +28 -0
  113. package/dist/evals/run-facts.d.ts +77 -0
  114. package/dist/evals/run-facts.d.ts.map +1 -0
  115. package/dist/evals/run-facts.js +187 -0
  116. package/dist/evals.d.ts +118 -31
  117. package/dist/evals.d.ts.map +1 -1
  118. package/dist/evals.js +46 -12
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +1 -1
  122. package/dist/internal/cli-ax.d.ts +27 -0
  123. package/dist/internal/cli-ax.d.ts.map +1 -1
  124. package/dist/internal/cli-ax.js +90 -12
  125. package/dist/internal/cli-mcp.d.ts +8 -0
  126. package/dist/internal/cli-mcp.d.ts.map +1 -1
  127. package/dist/internal/cli-mcp.js +98 -0
  128. package/dist/internal/cli-slack.d.ts +29 -1
  129. package/dist/internal/cli-slack.d.ts.map +1 -1
  130. package/dist/internal/cli-slack.js +777 -12
  131. package/dist/internal/deploy-client.d.ts +7 -0
  132. package/dist/internal/deploy-client.d.ts.map +1 -1
  133. package/dist/internal/deploy-client.js +9 -0
  134. package/dist/internal/discovery.d.ts.map +1 -1
  135. package/dist/internal/discovery.js +29 -9
  136. package/dist/internal/distribution.d.ts.map +1 -1
  137. package/dist/internal/distribution.js +2 -0
  138. package/dist/internal/eval-judge-model.d.ts +59 -0
  139. package/dist/internal/eval-judge-model.d.ts.map +1 -0
  140. package/dist/internal/eval-judge-model.js +131 -0
  141. package/dist/internal/eval-run-store.d.ts.map +1 -1
  142. package/dist/internal/eval-run-store.js +12 -20
  143. package/dist/internal/eval-runner.d.ts +31 -25
  144. package/dist/internal/eval-runner.d.ts.map +1 -1
  145. package/dist/internal/eval-runner.js +329 -126
  146. package/dist/internal/evals-client.d.ts.map +1 -1
  147. package/dist/internal/evals-client.js +4 -1
  148. package/dist/internal/local-env.d.ts +8 -0
  149. package/dist/internal/local-env.d.ts.map +1 -0
  150. package/dist/internal/local-env.js +47 -0
  151. package/dist/internal/playground/static.d.ts +3 -0
  152. package/dist/internal/playground/static.d.ts.map +1 -1
  153. package/dist/internal/playground/static.js +3 -0
  154. package/dist/internal/run-client.d.ts +15 -0
  155. package/dist/internal/run-client.d.ts.map +1 -1
  156. package/dist/internal/run-client.js +3 -2
  157. package/dist/internal/sdk-runner.d.ts +36 -1
  158. package/dist/internal/sdk-runner.d.ts.map +1 -1
  159. package/dist/internal/sdk-runner.js +65 -25
  160. package/dist/internal/server.d.ts.map +1 -1
  161. package/dist/internal/server.js +10 -1
  162. package/dist/internal/session-engine.d.ts +18 -5
  163. package/dist/internal/session-engine.d.ts.map +1 -1
  164. package/dist/internal/session-engine.js +72 -19
  165. package/dist/internal/slack-provision-client.d.ts +130 -0
  166. package/dist/internal/slack-provision-client.d.ts.map +1 -0
  167. package/dist/internal/slack-provision-client.js +284 -0
  168. package/dist/playground/assets/cursor-icons-16-f_W_ogc-.woff2 +0 -0
  169. package/dist/playground/assets/index-CidizGZv.css +1 -0
  170. package/dist/playground/assets/index-DNqirsrK.js +85 -0
  171. package/dist/playground/index.html +2 -2
  172. package/dist/types.d.ts +70 -4
  173. package/dist/types.d.ts.map +1 -1
  174. package/dist/types.js +26 -0
  175. package/docs/guides/mcp-oauth.md +10 -5
  176. package/docs/guides/slack.md +3 -2
  177. package/docs/reference/connections.md +28 -18
  178. package/package.json +20 -2
  179. package/skills/create-agent/SKILL.md +15 -7
  180. package/skills/debug/SKILL.md +3 -1
  181. package/skills/mcp-auth/SKILL.md +1 -1
  182. package/skills/setup-slack/SKILL.md +173 -11
  183. package/src/bin/agent-serve.ts +63 -2
  184. package/src/channels/slack/api.ts +16 -3
  185. package/src/channels/slack/auth.ts +16 -1
  186. package/src/channels/slack/blocks.ts +139 -0
  187. package/src/channels/slack/defaults.ts +32 -4
  188. package/src/channels/slack/dispatch.ts +3 -18
  189. package/src/channels/slack/index.ts +1 -0
  190. package/src/channels/slack/interactive.ts +183 -19
  191. package/src/channels/slack/manifest.ts +3 -0
  192. package/src/channels/slack/setup.ts +16 -2
  193. package/src/channels/slack/slack-channel.ts +37 -6
  194. package/src/channels/slack/types.ts +89 -0
  195. package/src/connections.ts +4 -1
  196. package/src/evals/assertions.ts +704 -0
  197. package/src/evals/expect.ts +272 -0
  198. package/src/evals/judge.ts +346 -0
  199. package/src/evals/loaders.ts +113 -0
  200. package/src/evals/matchers.ts +246 -0
  201. package/src/evals/reporters.ts +274 -0
  202. package/src/evals/results.ts +132 -0
  203. package/src/evals/run-facts.ts +274 -0
  204. package/src/evals.ts +205 -42
  205. package/src/index.ts +2 -0
  206. package/src/internal/cli-ax.ts +134 -15
  207. package/src/internal/cli-mcp.ts +118 -5
  208. package/src/internal/cli-slack.ts +993 -15
  209. package/src/internal/deploy-client.ts +10 -0
  210. package/src/internal/discovery.ts +31 -5
  211. package/src/internal/distribution.ts +2 -0
  212. package/src/internal/eval-judge-model.ts +148 -0
  213. package/src/internal/eval-run-store.ts +10 -14
  214. package/src/internal/eval-runner.ts +460 -214
  215. package/src/internal/evals-client.ts +5 -0
  216. package/src/internal/local-env.ts +53 -0
  217. package/src/internal/playground/static.ts +3 -0
  218. package/src/internal/run-client.ts +17 -1
  219. package/src/internal/sdk-runner.ts +103 -22
  220. package/src/internal/server.ts +10 -0
  221. package/src/internal/session-engine.ts +89 -21
  222. package/src/internal/slack-provision-client.ts +438 -0
  223. package/src/types.ts +92 -4
  224. package/dist/channels/slack/post-update-delivery.d.ts +0 -85
  225. package/dist/channels/slack/post-update-delivery.d.ts.map +0 -1
  226. package/dist/docs/assets/chunks/@localSearchIndexroot.DZtu0ZIc.js +0 -1
  227. package/dist/internal/json-dir-store.d.ts +0 -32
  228. package/dist/internal/json-dir-store.d.ts.map +0 -1
  229. package/dist/internal/persistence-coordinator.d.ts +0 -127
  230. package/dist/internal/persistence-coordinator.d.ts.map +0 -1
  231. package/dist/persistence.d.ts +0 -184
  232. package/dist/persistence.d.ts.map +0 -1
  233. package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
  234. package/dist/playground/assets/index-Bwl4Onx4.js +0 -85
  235. package/dist/playground/assets/index-ByV4nfch.css +0 -1
  236. /package/dist/docs/assets/{guides_slack.md.FWale6Ip.lean.js → guides_slack.md.D_xFKlnF.lean.js} +0 -0
package/README.md CHANGED
@@ -696,12 +696,17 @@ declares a local stdio server instead, and `{ agent: "<slug>" }` declares a
696
696
  `{ cursorAccount: true }` declares a **Cursor account MCP connection**: the
697
697
  agent gets the MCP connectors the signed-in Cursor account already
698
698
  authorized (dashboard → MCP) with zero token plumbing. Every tool executes
699
- on the Cursor backend with the account's stored OAuth credentials raw
700
- tokens never reach the serve host, session workspaces, or traces. Optional
701
- `servers: ["Linear", …]` restricts which connectors are exposed.
699
+ on the Cursor backend with the account's stored OAuth credentials; raw
700
+ tokens never reach the serve host, session workspaces, or traces. Omit
701
+ `servers`, or pass `servers: "*"`, to forward every connected HTTP/SSE
702
+ connector. Pass `servers: ["Linear", ...]` to expose only named connectors.
702
703
 
703
704
  ```ts
704
- // agent/mcp-connections/cursor.ts the account's connectors, one line
705
+ // agent/mcp-connections/cursor.ts: every connected connector
706
+ export default defineConnection({ cursorAccount: true });
707
+ // same, spelled out:
708
+ export default defineConnection({ cursorAccount: true, servers: "*" });
709
+ // only Linear:
705
710
  export default defineConnection({ cursorAccount: true, servers: ["Linear"] });
706
711
  ```
707
712
 
@@ -30,6 +30,7 @@ import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
30
30
  import { cmdCall, cmdChat, cmdEval, cmdEvalCancel, cmdEvalStatus, cmdInit, cmdLogs, cmdPlayground, cmdResume, cmdRun, cmdSession, cmdSessions, cmdTrajectory, } from "../internal/cli-ax.js";
31
31
  import { cmdDeploy, cmdDeploymentStatus, cmdDeployments, cmdRotatePodCredential, cmdRotateToken, cmdSecretsList, cmdSecretsSet, cmdSecretsUnset, cmdStop, } from "../internal/cli-deploy.js";
32
32
  import { CLI_COMMAND_NAME as CLI, packageVersion, } from "../internal/distribution.js";
33
+ import { loadAgentLocalEnv } from "../internal/local-env.js";
33
34
  import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
34
35
  import { cmdUpdate, warnIfOutdated } from "../internal/update-check.js";
35
36
  const HELP = `${CLI} — serve a filesystem-defined Cursor agent over channels
@@ -72,7 +73,9 @@ Usage:
72
73
  ${CLI} mcp oauth <connection> [--dir <path>] [--store] [--slug <slug>]
73
74
  ${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
74
75
  [--tag <tag>]... [--verbose] [--timeout-ms <n>]
75
- [--no-stream] [--no-wait]
76
+ [--strict] [--max-concurrency <n>]
77
+ [--junit <path>] [--artifacts <dir>|--no-artifacts]
78
+ [--skip-report] [--no-stream] [--no-wait]
76
79
  [--prod | --url <baseUrl>] [--slug <slug>]
77
80
  [--team <id>]
78
81
  ${CLI} eval status [runId] --prod|--url <baseUrl> [--dir <path>] [--json]
@@ -195,7 +198,8 @@ Commands:
195
198
  secrets Manage deployment secrets: set (upsert by name; NAMEs without
196
199
  =VALUE are prompted for with hidden input, or read from piped
197
200
  stdin), list (names + createdAt; never values), unset.
198
- slack Slack channel pack: init, manifests, doctor (see slack help).
201
+ slack Slack channel pack: create/destroy/icon (Cursor Add to Slack
202
+ provisioning), init, manifests, doctor (see slack help).
199
203
  github GitHub webhook pack: forward live deliveries, events, doctor
200
204
  (wraps \`gh webhook forward\`; see github help).
201
205
 
@@ -292,6 +296,13 @@ Options:
292
296
  --tag eval: only run cases with this tag (repeatable).
293
297
  --list eval: print discovered cases without running.
294
298
  --verbose eval: stream t.log lines and reply snippets.
299
+ --strict eval: a missed soft threshold (SCORED) also exits 1.
300
+ --max-concurrency eval: override evals.config.ts maxConcurrency.
301
+ --junit eval: write JUnit XML here for CI annotations.
302
+ --artifacts eval: run-artifact directory (default a timestamped dir
303
+ under <dir>/.agent-serve/evals/).
304
+ --no-artifacts eval: do not write run artifacts.
305
+ --skip-report eval: ignore reporters from evals.config.ts / eval files.
295
306
  --no-stream run/eval: silence live progress on stderr (JSON still prints).
296
307
  --json JSON output (init/info/chat/eval/logs/sessions/session/
297
308
  github; run defaults to JSON). logs: NDJSON progress/log
@@ -402,10 +413,14 @@ function main(argv) {
402
413
  "base-url": { type: "string" },
403
414
  print: { type: "boolean", default: false },
404
415
  store: { type: "boolean", default: false },
416
+ remote: { type: "boolean", default: false },
405
417
  transport: { type: "string" },
406
418
  prefix: { type: "string" },
407
419
  "no-prefix": { type: "boolean", default: false },
408
420
  "channel-posts": { type: "boolean", default: false },
421
+ "slack-team": { type: "string" },
422
+ icon: { type: "string" },
423
+ force: { type: "boolean", default: false },
409
424
  repo: { type: "string", multiple: true },
410
425
  org: { type: "string" },
411
426
  "cursor-events": { type: "boolean", default: false },
@@ -425,6 +440,12 @@ function main(argv) {
425
440
  all: { type: "boolean", default: false },
426
441
  "cursor-events-repo": { type: "string", multiple: true },
427
442
  "allow-domain": { type: "string", multiple: true },
443
+ strict: { type: "boolean", default: false },
444
+ junit: { type: "string" },
445
+ artifacts: { type: "string" },
446
+ "no-artifacts": { type: "boolean", default: false },
447
+ "skip-report": { type: "boolean", default: false },
448
+ "max-concurrency": { type: "string" },
428
449
  },
429
450
  });
430
451
  const dir = (_h = values.dir) !== null && _h !== void 0 ? _h : ".";
@@ -449,6 +470,13 @@ function main(argv) {
449
470
  prefix: values.prefix,
450
471
  noPrefix: values["no-prefix"],
451
472
  channelPosts: values["channel-posts"],
473
+ slackTeam: values["slack-team"],
474
+ prod: values.prod,
475
+ team: values.team,
476
+ apiKey: values["api-key"],
477
+ icon: values.icon,
478
+ force: values.force,
479
+ iconSource: positionals[0] === "icon" ? positionals[1] : undefined,
452
480
  });
453
481
  }
454
482
  case "github": {
@@ -507,6 +535,7 @@ function main(argv) {
507
535
  print: values.print,
508
536
  json: values.json,
509
537
  store: values.store,
538
+ remote: values.remote,
510
539
  oauthConnection: mcpSub === "oauth" ? positionals[1] : undefined,
511
540
  });
512
541
  }
@@ -663,6 +692,11 @@ function main(argv) {
663
692
  stateRoot: values["state-root"],
664
693
  timeoutMs: parseTimeoutMs(values["timeout-ms"]),
665
694
  stream: values["no-stream"] ? false : undefined,
695
+ strict: values.strict,
696
+ junit: values.junit,
697
+ artifacts: values["no-artifacts"] ? false : values.artifacts,
698
+ skipReport: values["skip-report"],
699
+ maxConcurrency: parseMaxConcurrency(values["max-concurrency"]),
666
700
  }));
667
701
  }
668
702
  case "chat": {
@@ -843,6 +877,14 @@ function main(argv) {
843
877
  }
844
878
  const dev = command === "dev" || values.dev === true;
845
879
  const style = stdoutPalette();
880
+ // Real env wins (loadEnvFile never overrides). Runs inside start()
881
+ // so dev's Enter-restart picks up tokens written since boot.
882
+ const loadLocalEnv = () => {
883
+ const loadedEnvFiles = loadAgentLocalEnv(serveDir);
884
+ if (loadedEnvFiles.length > 0) {
885
+ process.stdout.write(`${style.dim(`env: loaded ${loadedEnvFiles.join(", ")}`)}\n`);
886
+ }
887
+ };
846
888
  const serveOptions = {
847
889
  port,
848
890
  host: values.host,
@@ -877,6 +919,7 @@ function main(argv) {
877
919
  noSchedules: values["no-schedules"] === true,
878
920
  };
879
921
  const start = () => __awaiter(this, void 0, void 0, function* () {
922
+ loadLocalEnv();
880
923
  const next = yield serve(serveDir, serveOptions);
881
924
  printServeBanner(next, bannerOpts);
882
925
  if (enterToRestart) {
@@ -979,6 +1022,11 @@ function axFromOptions(partial) {
979
1022
  once: partial.once,
980
1023
  rawEvents: partial.rawEvents,
981
1024
  print: partial.print,
1025
+ strict: partial.strict,
1026
+ junit: partial.junit,
1027
+ artifacts: partial.artifacts,
1028
+ skipReport: partial.skipReport,
1029
+ maxConcurrency: partial.maxConcurrency,
982
1030
  };
983
1031
  }
984
1032
  function loadMessages(messages, messagesFile) {
@@ -1013,6 +1061,16 @@ function parseTimeoutMs(value) {
1013
1061
  }
1014
1062
  return n;
1015
1063
  }
1064
+ function parseMaxConcurrency(value) {
1065
+ if (value === undefined) {
1066
+ return undefined;
1067
+ }
1068
+ const n = Number.parseInt(value, 10);
1069
+ if (Number.isNaN(n) || n <= 0) {
1070
+ throw new Error(`invalid --max-concurrency: ${value}`);
1071
+ }
1072
+ return n;
1073
+ }
1016
1074
  /**
1017
1075
  * Load mounts the same way `serve` does (multi-agent layout by default).
1018
1076
  */
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AASlD,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,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,EAAE,gBAAgB,GAAG,SAAS,GACxC,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAkBD;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAC;IACpC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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,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB,GAAG,YAAY,CAsGf"}
@@ -262,7 +262,13 @@ export function postMessage(args) {
262
262
  base.thread_ts = args.threadTs;
263
263
  }
264
264
  const hasBlocks = args.blocks !== undefined && args.blocks.length > 0;
265
- const usePlainText = args.plainText === true || hasBlocks;
265
+ // User-group mentions (`<!subteam^…>`) and Slack mrkdwn links
266
+ // (`<https://…|label>`) only render correctly via mrkdwn `text`,
267
+ // not `markdown_text`.
268
+ const usePlainText = args.plainText === true ||
269
+ hasBlocks ||
270
+ args.text.includes("<!subteam^") ||
271
+ /<https?:\/\/[^|>]+\|/.test(args.text);
266
272
  let response;
267
273
  if (usePlainText) {
268
274
  response = yield callSlackApi({
@@ -335,8 +341,12 @@ export function updateMessage(args) {
335
341
  channel: args.channel,
336
342
  ts: args.ts,
337
343
  };
338
- if (args.blocks !== undefined || args.plainText === true) {
339
- // Blocks / plainText force the legacy text path (same as postMessage).
344
+ if (args.blocks !== undefined ||
345
+ args.plainText === true ||
346
+ args.text.includes("<!subteam^") ||
347
+ /<https?:\/\/[^|>]+\|/.test(args.text)) {
348
+ // Blocks / plainText / user-group mentions / mrkdwn links force the
349
+ // legacy text path (same as postMessage).
340
350
  return callSlackApiSoft({
341
351
  botToken: args.botToken,
342
352
  operation: "chat.update",
@@ -2,7 +2,7 @@
2
2
  * Slack auth helpers — AuthContext builders for thread-scoped sessions.
3
3
  */
4
4
  import type { AuthContext } from "../../types.js";
5
- import type { SlackBinding, SlackMessage } from "./types.js";
5
+ import type { SlackBinding, SlackBlockAction, SlackMessage } from "./types.js";
6
6
  /**
7
7
  * Build a thread-scoped principal so any participant in the same Slack
8
8
  * thread can continue the session. The triggering user is preserved in
@@ -34,6 +34,12 @@ export declare function buildSlackInteractiveApprovalAuth(args: {
34
34
  teamId?: string;
35
35
  clickingUserId: string;
36
36
  }): AuthContext;
37
+ /**
38
+ * Default auth for an `onBlockAction` dispatch: the click's thread-scoped
39
+ * principal with the clicker in attributes, so replies in the same thread
40
+ * continue the session and the clicker is the attributable user.
41
+ */
42
+ export declare function blockActionAuth(action: SlackBlockAction): AuthContext;
37
43
  export declare function defaultSlackAuth(message: SlackMessage, ctx: SlackBinding, options?: {
38
44
  engagement?: string;
39
45
  }): AuthContext | null;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,WAAW,CA4Bd;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE;IACtD,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,WAAW,CAqBd;AAED,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6 +59,20 @@ export function buildSlackInteractiveApprovalAuth(args) {
59
59
  }
60
60
  return clickerAuth;
61
61
  }
62
+ /**
63
+ * Default auth for an `onBlockAction` dispatch: the click's thread-scoped
64
+ * principal with the clicker in attributes, so replies in the same thread
65
+ * continue the session and the clicker is the attributable user.
66
+ */
67
+ export function blockActionAuth(action) {
68
+ return buildSlackAuthContext({
69
+ channelId: action.channelId,
70
+ threadTs: action.threadTs,
71
+ teamId: action.teamId,
72
+ userId: action.userId,
73
+ userName: action.userName,
74
+ });
75
+ }
62
76
  export function defaultSlackAuth(message, ctx, options) {
63
77
  if (message.author === undefined) {
64
78
  return null;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Block Kit building helpers shared by card-building agents.
3
+ */
4
+ /** Slack cap for one section block's mrkdwn text. */
5
+ export declare const SLACK_SECTION_MRKDWN_MAX = 3000;
6
+ /** Slack caps for a native `table` block (one table per message). */
7
+ export declare const SLACK_TABLE_MAX_ROWS = 100;
8
+ export declare const SLACK_TABLE_MAX_COLUMNS = 20;
9
+ /**
10
+ * Pack lines into as few mrkdwn section blocks as fit the 3000-char cap,
11
+ * preserving order. Long lists (a full service fleet, a file inventory)
12
+ * overflow a single section and make `chat.postMessage` refuse the whole
13
+ * card with `invalid_blocks`.
14
+ */
15
+ export declare function mrkdwnSections(lines: readonly string[]): unknown[];
16
+ export type SlackTableAlign = "left" | "center" | "right";
17
+ export type SlackTableColumnSetting = {
18
+ align?: SlackTableAlign;
19
+ is_wrapped?: boolean;
20
+ };
21
+ /** Cell types accepted by Slack's native `table` block. */
22
+ export type SlackTableCell = {
23
+ type: "raw_text";
24
+ text: string;
25
+ } | {
26
+ type: "rich_text";
27
+ elements: Array<{
28
+ type: "rich_text_section";
29
+ elements: Array<{
30
+ type: "text";
31
+ text: string;
32
+ } | {
33
+ type: "link";
34
+ url: string;
35
+ text: string;
36
+ }>;
37
+ }>;
38
+ };
39
+ export type SlackTableBlock = {
40
+ type: "table";
41
+ rows: SlackTableCell[][];
42
+ column_settings?: SlackTableColumnSetting[];
43
+ };
44
+ /** Plain text cell (header or body). */
45
+ export declare function slackRawTextCell(text: string): SlackTableCell;
46
+ /** Linked cell via rich_text (preferred over mrkdwn `<url|label>` in tables). */
47
+ export declare function slackLinkCell(args: {
48
+ url: string;
49
+ text: string;
50
+ }): SlackTableCell;
51
+ /**
52
+ * Build a native Slack `table` block. First row is the header. Slack allows
53
+ * at most one table block per message, 100 rows, and 20 columns — callers
54
+ * should keep tables short.
55
+ */
56
+ export declare function slackTableBlock(args: {
57
+ headers: readonly string[];
58
+ rows: readonly (readonly SlackTableCell[])[];
59
+ columnSettings?: readonly SlackTableColumnSetting[];
60
+ }): SlackTableBlock | undefined;
61
+ //# sourceMappingURL=blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/blocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qDAAqD;AACrD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,EAAE,CA8BlE;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,mBAAmB,CAAC;QAC1B,QAAQ,EAAE,KAAK,CACX;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,GAC9B;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAC9C,CAAC;KACH,CAAC,CAAC;CACJ,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,cAAc,EAAE,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC7C,CAAC;AAEF,wCAAwC;AACxC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAE7D;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,cAAc,CAUjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC;IAC7C,cAAc,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACrD,GAAG,eAAe,GAAG,SAAS,CAgC9B"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Block Kit building helpers shared by card-building agents.
3
+ */
4
+ /** Slack cap for one section block's mrkdwn text. */
5
+ export const SLACK_SECTION_MRKDWN_MAX = 3000;
6
+ /** Slack caps for a native `table` block (one table per message). */
7
+ export const SLACK_TABLE_MAX_ROWS = 100;
8
+ export const SLACK_TABLE_MAX_COLUMNS = 20;
9
+ /**
10
+ * Pack lines into as few mrkdwn section blocks as fit the 3000-char cap,
11
+ * preserving order. Long lists (a full service fleet, a file inventory)
12
+ * overflow a single section and make `chat.postMessage` refuse the whole
13
+ * card with `invalid_blocks`.
14
+ */
15
+ export function mrkdwnSections(lines) {
16
+ const texts = [];
17
+ let current = "";
18
+ for (const raw of lines) {
19
+ // A single oversized line (one huge blob) hard-splits at the cap.
20
+ const parts = [];
21
+ for (let i = 0; i < Math.max(raw.length, 1); i += SLACK_SECTION_MRKDWN_MAX) {
22
+ parts.push(raw.slice(i, i + SLACK_SECTION_MRKDWN_MAX));
23
+ }
24
+ for (const line of parts) {
25
+ const next = current === "" ? line : `${current}\n${line}`;
26
+ if (next.length > SLACK_SECTION_MRKDWN_MAX && current !== "") {
27
+ texts.push(current);
28
+ current = line;
29
+ }
30
+ else {
31
+ current = next;
32
+ }
33
+ }
34
+ }
35
+ if (current !== "") {
36
+ texts.push(current);
37
+ }
38
+ return texts.map((text) => ({
39
+ type: "section",
40
+ text: { type: "mrkdwn", text },
41
+ }));
42
+ }
43
+ /** Plain text cell (header or body). */
44
+ export function slackRawTextCell(text) {
45
+ return { type: "raw_text", text };
46
+ }
47
+ /** Linked cell via rich_text (preferred over mrkdwn `<url|label>` in tables). */
48
+ export function slackLinkCell(args) {
49
+ return {
50
+ type: "rich_text",
51
+ elements: [
52
+ {
53
+ type: "rich_text_section",
54
+ elements: [{ type: "link", url: args.url, text: args.text }],
55
+ },
56
+ ],
57
+ };
58
+ }
59
+ /**
60
+ * Build a native Slack `table` block. First row is the header. Slack allows
61
+ * at most one table block per message, 100 rows, and 20 columns — callers
62
+ * should keep tables short.
63
+ */
64
+ export function slackTableBlock(args) {
65
+ if (args.headers.length === 0) {
66
+ return undefined;
67
+ }
68
+ if (args.headers.length > SLACK_TABLE_MAX_COLUMNS) {
69
+ throw new Error(`slackTableBlock: ${args.headers.length} columns exceeds Slack cap of ${SLACK_TABLE_MAX_COLUMNS}`);
70
+ }
71
+ // Header + body rows share the 100-row cap.
72
+ if (args.rows.length + 1 > SLACK_TABLE_MAX_ROWS) {
73
+ throw new Error(`slackTableBlock: ${args.rows.length + 1} rows exceeds Slack cap of ${SLACK_TABLE_MAX_ROWS}`);
74
+ }
75
+ const columnCount = args.headers.length;
76
+ for (const [index, row] of args.rows.entries()) {
77
+ if (row.length !== columnCount) {
78
+ throw new Error(`slackTableBlock: row ${index} has ${row.length} cells; expected ${columnCount}`);
79
+ }
80
+ }
81
+ const headerRow = args.headers.map((header) => slackRawTextCell(header));
82
+ const block = {
83
+ type: "table",
84
+ rows: [headerRow, ...args.rows.map((row) => [...row])],
85
+ };
86
+ if (args.columnSettings !== undefined && args.columnSettings.length > 0) {
87
+ block.column_settings = [...args.columnSettings];
88
+ }
89
+ return block;
90
+ }
@@ -4,6 +4,8 @@
4
4
  import type { ChannelEventHandlers } from "../../types.js";
5
5
  import { type SlackLog } from "./log.js";
6
6
  import type { SlackChannelState, SlackCredentials, SlackMessageHandler, SlackSuggestedPrompt } from "./types.js";
7
+ /** Scrubbed turn.failed body for Slack (secrets / paths / URLs stripped). */
8
+ export declare function formatSlackTurnFailureMessage(raw: string | undefined): string;
7
9
  /** Default mention/DM inbound handler (optional custom loading rotation). */
8
10
  export declare function createDefaultOnInbound(loadingMessages?: readonly string[]): SlackMessageHandler;
9
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAe3D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAWpB,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,mBAAmB,CAOrB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,mBAAmB,CASrB;AAED,eAAO,MAAM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;AAC3B,eAAO,MAAM,sBAAsB,EAAE,mBACX,CAAC;AAC3B,eAAO,MAAM,oBAAoB,EAAE,mBACL,CAAC;AAE/B,MAAM,WAAW,yBAAyB;IACxC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC1C,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mEAAmE;IACnE,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,QAAQ,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,yBAA8B,GACtC,oBAAoB,CAAC,iBAAiB,CAAC,CA8XzC"}
@@ -17,6 +17,34 @@ import { SLACK_DEFAULT_LOADING_MESSAGES, SLACK_TYPING_MIN_GROWTH, SLACK_TYPING_M
17
17
  import { createStreamDeliveryStrategy } from "./live-delivery.js";
18
18
  import { defaultSlackLog } from "./log.js";
19
19
  import { buildTaskChunkForResult, buildTaskChunksForCalls } from "./stream.js";
20
+ const SLACK_TURN_FAILURE_FALLBACK = "I hit an error while handling your request. Please try again or rephrase.";
21
+ const SLACK_TURN_FAILURE_MAX_CHARS = 400;
22
+ /** Scrubbed turn.failed body for Slack (secrets / paths / URLs stripped). */
23
+ export function formatSlackTurnFailureMessage(raw) {
24
+ var _a;
25
+ const scrubbed = scrubSlackErrorDetail((_a = raw === null || raw === void 0 ? void 0 : raw.trim()) !== null && _a !== void 0 ? _a : "");
26
+ if (scrubbed === "") {
27
+ return SLACK_TURN_FAILURE_FALLBACK;
28
+ }
29
+ if (/^I hit an error/i.test(scrubbed)) {
30
+ return scrubbed;
31
+ }
32
+ return `I hit an error while handling your request: ${scrubbed}`;
33
+ }
34
+ function scrubSlackErrorDetail(message) {
35
+ const scrubbed = message
36
+ .replace(/https?:\/\/\S+/gi, "[url]")
37
+ .replace(/\b(crsr_|xox[baprs]-|sk-|Bearer\s+)\S+/gi, "[redacted]")
38
+ .replace(/\/(?:home|Users|var\/folders)\/\S+/g, "[path]")
39
+ .replace(/\b[A-Za-z]:(?:\\|\/)[^\s]+/g, "[path]")
40
+ .replace(/\\\\[^\s]+/g, "[path]")
41
+ .replace(/\s+/g, " ")
42
+ .trim();
43
+ if (scrubbed.length <= SLACK_TURN_FAILURE_MAX_CHARS) {
44
+ return scrubbed;
45
+ }
46
+ return `${scrubbed.slice(0, SLACK_TURN_FAILURE_MAX_CHARS - 1)}…`;
47
+ }
20
48
  function resolveLoadingMessages(loadingMessages) {
21
49
  if (loadingMessages !== undefined && loadingMessages.length > 0) {
22
50
  return [...loadingMessages];
@@ -360,9 +388,7 @@ export function buildDefaultEvents(options = {}) {
360
388
  if (state.channelId === null || state.threadTs === null) {
361
389
  return;
362
390
  }
363
- // Do not echo engine/tool error text into Slack — it can leak
364
- // paths, tokens, or other sensitive detail to workspace members.
365
- const errorText = "I hit an error while handling your request. Please try again or rephrase.";
391
+ const errorText = formatSlackTurnFailureMessage(event.data.message);
366
392
  let delivered = false;
367
393
  if (state.streamTs !== null && state.streamTs !== "") {
368
394
  ({ delivered } = yield strategy.fail({
@@ -5,10 +5,10 @@ import type { HostContext, SendMessageFn } from "../../types.js";
5
5
  import type { ChannelPostWatcher } from "./channel-watch.js";
6
6
  import type { EventIdDedupe } from "./event-id-dedupe.js";
7
7
  import { type SlackLog } from "./log.js";
8
- import type { SlackChannelState, SlackCredentials, SlackMessage, SlackMessageHandler } from "./types.js";
8
+ import type { SlackChannelState, SlackContinuationProbes, SlackCredentials, SlackMessage, SlackMessageHandler } from "./types.js";
9
9
  /** Blank per-session adapter state. */
10
10
  export declare function emptySlackChannelState(patch?: Partial<SlackChannelState>): SlackChannelState;
11
- export interface SlackInboundDispatchDeps {
11
+ export interface SlackInboundDispatchDeps extends SlackContinuationProbes {
12
12
  send: SendMessageFn;
13
13
  waitUntil: (promise: Promise<unknown>) => void;
14
14
  onAppMention: SlackMessageHandler;
@@ -23,20 +23,6 @@ export interface SlackInboundDispatchDeps {
23
23
  directMessagesEnabled?: boolean;
24
24
  /** Opt-in channel watch; absent = channel posts are ignored. */
25
25
  channelWatch?: ChannelPostWatcher;
26
- /**
27
- * When set, full-thread hydration runs only for cold-start turns (no
28
- * existing session). Warm turns load a `<slack_thread_delta>` instead.
29
- */
30
- hasContinuationSession?: (continuationToken: string) => Promise<boolean>;
31
- /** True when a turn is already running for this Slack continuation. */
32
- isContinuationBusy?: (continuationToken: string) => Promise<boolean>;
33
- /**
34
- * Warm-delta watermark from session channel state (`lastBotMessageTs`).
35
- * When absent, delta falls back to the last matching bot post in-thread.
36
- */
37
- getContinuationLastBotMessageTs?: (continuationToken: string) => Promise<string | undefined>;
38
- /** Cancel the active turn + clear coalesced nudges for this continuation. */
39
- interruptContinuation?: (continuationToken: string) => Promise<boolean>;
40
26
  /**
41
27
  * When false, skip the built-in `eval` directive. Defaults to true when
42
28
  * `host.evals` is present.
@@ -46,7 +32,7 @@ export interface SlackInboundDispatchDeps {
46
32
  cursorAgentName?: string;
47
33
  }
48
34
  export declare function dispatchInboundMessage(args: {
49
- kind: "app_mention" | "direct_message" | "channel_post";
35
+ kind: "app_mention" | "direct_message" | "channel_post" | "block_action";
50
36
  message: SlackMessage;
51
37
  handler: SlackMessageHandler;
52
38
  send: SendMessageFn;
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/dispatch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAa,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAK7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAO1D,OAAO,EAAmB,KAAK,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sBAAsB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzE,kBAAkB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,+BAA+B,CAAC,EAAE,CAChC,iBAAiB,EAAE,MAAM,KACtB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,qBAAqB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CA2QhB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CA0GT"}
@@ -21,6 +21,7 @@ export * from "./api.js";
21
21
  export * from "./approvals.js";
22
22
  export * from "./assistant.js";
23
23
  export * from "./auth.js";
24
+ export * from "./blocks.js";
24
25
  export * from "./channel-watch.js";
25
26
  export * from "./constants.js";
26
27
  export * from "./credentials.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAA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AAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC"}
@@ -21,6 +21,7 @@ export * from "./api.js";
21
21
  export * from "./approvals.js";
22
22
  export * from "./assistant.js";
23
23
  export * from "./auth.js";
24
+ export * from "./blocks.js";
24
25
  export * from "./channel-watch.js";
25
26
  export * from "./constants.js";
26
27
  export * from "./credentials.js";
@@ -1,9 +1,14 @@
1
1
  /**
2
- * Socket Mode interactive payloads (Block Kit Approve/Deny).
2
+ * Socket Mode interactive payloads (Block Kit clicks).
3
+ *
4
+ * Built-in tool-approval Approve/Deny actions resolve parked calls
5
+ * ({@link dispatchInteractiveFromPayload}); everything else can be routed
6
+ * to an author handler ({@link dispatchBlockAction} via
7
+ * `slackChannel({ onBlockAction })`).
3
8
  */
4
- import type { ApprovalDecision, AuthContext, ChannelSession, PendingApproval } from "../../types.js";
9
+ import type { ApprovalDecision, AuthContext, ChannelSession, HostContext, PendingApproval, SendMessageFn } from "../../types.js";
5
10
  import { type SlackLog } from "./log.js";
6
- import type { SlackCredentials } from "./types.js";
11
+ import type { SlackBlockAction, SlackBlockActionHandler, SlackBotToken, SlackContinuationProbes, SlackCredentials } from "./types.js";
7
12
  export interface SlackInteractiveDispatchDeps {
8
13
  credentials: SlackCredentials | undefined;
9
14
  getSession: (sessionId: string) => Promise<ChannelSession | null>;
@@ -16,4 +21,35 @@ export interface SlackInteractiveDispatchDeps {
16
21
  * an agent-serve approval action (handled or rejected with a reason).
17
22
  */
18
23
  export declare function dispatchInteractiveFromPayload(payload: unknown, deps: SlackInteractiveDispatchDeps): Promise<boolean>;
24
+ /**
25
+ * Parse a Socket Mode `block_actions` payload into a {@link SlackBlockAction}.
26
+ * Returns null for non-`block_actions` payloads (view submissions, shortcuts)
27
+ * and malformed bodies.
28
+ */
29
+ export declare function parseSlackBlockAction(payload: unknown): SlackBlockAction | null;
30
+ /**
31
+ * Swap the clicked message's actions row for a context note (`chat.update`).
32
+ * Strips only the row the click came from (`action.blockId`); every other
33
+ * block survives. Soft: false when the payload carried no message blocks or
34
+ * the update failed — callers treat the dispatched turn as the durable
35
+ * record and the card as best-effort UI.
36
+ */
37
+ export declare function resolveBlockActionCard(args: {
38
+ botToken: SlackBotToken | undefined;
39
+ action: SlackBlockAction;
40
+ note: string;
41
+ }): Promise<boolean>;
42
+ export interface SlackBlockActionDispatchDeps extends SlackContinuationProbes {
43
+ handler: SlackBlockActionHandler;
44
+ send: SendMessageFn;
45
+ credentials: SlackCredentials | undefined;
46
+ host: HostContext;
47
+ log?: SlackLog;
48
+ }
49
+ /**
50
+ * Route a non-approval `block_actions` payload to the author handler and
51
+ * dispatch its decision as a turn on the click's thread. Returns true when
52
+ * the payload was a block action (dispatched or deliberately skipped).
53
+ */
54
+ export declare function dispatchBlockAction(payload: unknown, deps: SlackBlockActionDispatchDeps): Promise<boolean>;
19
55
  //# sourceMappingURL=interactive.d.ts.map