@cursor/july 0.1.6 → 0.1.8

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 (179) hide show
  1. package/dist/bin/agent-serve.js +73 -19
  2. package/dist/channels/slack/channel-watch.d.ts +6 -1
  3. package/dist/channels/slack/channel-watch.d.ts.map +1 -1
  4. package/dist/channels/slack/channel-watch.js +22 -1
  5. package/dist/channels/slack/cursor-account.d.ts +4 -0
  6. package/dist/channels/slack/cursor-account.d.ts.map +1 -1
  7. package/dist/channels/slack/cursor-account.js +12 -2
  8. package/dist/channels/slack/defaults.d.ts +10 -5
  9. package/dist/channels/slack/defaults.d.ts.map +1 -1
  10. package/dist/channels/slack/defaults.js +39 -17
  11. package/dist/channels/slack/dispatch.d.ts +18 -0
  12. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  13. package/dist/channels/slack/dispatch.js +141 -38
  14. package/dist/channels/slack/inbound.d.ts +13 -3
  15. package/dist/channels/slack/inbound.d.ts.map +1 -1
  16. package/dist/channels/slack/inbound.js +17 -9
  17. package/dist/channels/slack/index.d.ts +4 -0
  18. package/dist/channels/slack/index.d.ts.map +1 -1
  19. package/dist/channels/slack/index.js +4 -0
  20. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  21. package/dist/channels/slack/live-delivery.js +1 -0
  22. package/dist/channels/slack/manifest.d.ts.map +1 -1
  23. package/dist/channels/slack/manifest.js +3 -0
  24. package/dist/channels/slack/nudge-carrier.d.ts +19 -0
  25. package/dist/channels/slack/nudge-carrier.d.ts.map +1 -0
  26. package/dist/channels/slack/nudge-carrier.js +166 -0
  27. package/dist/channels/slack/nudge-store.d.ts +61 -0
  28. package/dist/channels/slack/nudge-store.d.ts.map +1 -0
  29. package/dist/channels/slack/nudge-store.js +266 -0
  30. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  31. package/dist/channels/slack/slack-channel.js +74 -25
  32. package/dist/channels/slack/stop.d.ts +14 -0
  33. package/dist/channels/slack/stop.d.ts.map +1 -0
  34. package/dist/channels/slack/stop.js +22 -0
  35. package/dist/channels/slack/thread-context.d.ts +81 -0
  36. package/dist/channels/slack/thread-context.d.ts.map +1 -0
  37. package/dist/channels/slack/thread-context.js +470 -0
  38. package/dist/channels/slack/types.d.ts +27 -0
  39. package/dist/channels/slack/types.d.ts.map +1 -1
  40. package/dist/docs/404.html +2 -2
  41. package/dist/docs/ab.html +4 -4
  42. package/dist/docs/assets/{app.DMboGKUD.js → app.BP8mAVMW.js} +1 -1
  43. package/dist/docs/assets/chunks/@localSearchIndexroot.DevOabKJ.js +1 -0
  44. package/dist/docs/assets/chunks/{VPLocalSearchBox.DkEqEnJU.js → VPLocalSearchBox.1FXIZbz8.js} +1 -1
  45. package/dist/docs/assets/chunks/{theme.ASugdMNm.js → theme.Dm1R02v9.js} +2 -2
  46. package/dist/docs/assets/example-agents_index.md.CwtWu5ix.js +2 -0
  47. package/dist/docs/assets/{example-agents_index.md.CRqJlnIf.lean.js → example-agents_index.md.CwtWu5ix.lean.js} +1 -1
  48. package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.js +10 -0
  49. package/dist/docs/assets/example-agents_oncall.md.BG_sUMly.lean.js +1 -0
  50. package/dist/docs/assets/{guides_slack.md.CCwqHvSV.js → guides_slack.md.FWale6Ip.js} +4 -3
  51. package/dist/docs/assets/{guides_slack.md.CCwqHvSV.lean.js → guides_slack.md.FWale6Ip.lean.js} +1 -1
  52. package/dist/docs/assets/{reference_sessions.md.DdjWabnN.js → reference_sessions.md.DLd6mvbv.js} +2 -2
  53. package/dist/docs/assets/{reference_sessions.md.DdjWabnN.lean.js → reference_sessions.md.DLd6mvbv.lean.js} +1 -1
  54. package/dist/docs/assets/{storage.md.CVnInNiN.js → storage.md.Cu3MwM2a.js} +3 -2
  55. package/dist/docs/assets/{storage.md.CVnInNiN.lean.js → storage.md.Cu3MwM2a.lean.js} +1 -1
  56. package/dist/docs/building-with-agents.html +4 -4
  57. package/dist/docs/concepts.html +4 -4
  58. package/dist/docs/deployment.html +4 -4
  59. package/dist/docs/evals.html +4 -4
  60. package/dist/docs/example-agents/approval-buddy.html +4 -4
  61. package/dist/docs/example-agents/benny.html +5 -5
  62. package/dist/docs/example-agents/bugbot.html +5 -5
  63. package/dist/docs/example-agents/codebase-wiki.html +4 -4
  64. package/dist/docs/example-agents/codeowners-review.html +4 -4
  65. package/dist/docs/example-agents/concierge.html +4 -4
  66. package/dist/docs/example-agents/fsd.html +4 -4
  67. package/dist/docs/example-agents/index.html +6 -6
  68. package/dist/docs/example-agents/knowledge-base.html +4 -4
  69. package/dist/docs/example-agents/oncall.html +34 -0
  70. package/dist/docs/example-agents/security-reviewer.html +4 -4
  71. package/dist/docs/example-agents/slack-agent.html +4 -4
  72. package/dist/docs/example-agents/weather-agent.html +4 -4
  73. package/dist/docs/guides/agent-to-agent.html +4 -4
  74. package/dist/docs/guides/cloud-runtime.html +4 -4
  75. package/dist/docs/guides/github.html +4 -4
  76. package/dist/docs/guides/human-in-the-loop.html +4 -4
  77. package/dist/docs/guides/slack.html +7 -6
  78. package/dist/docs/guides/webhooks.html +4 -4
  79. package/dist/docs/hashmap.json +1 -1
  80. package/dist/docs/hillclimbing.html +4 -4
  81. package/dist/docs/index.html +4 -4
  82. package/dist/docs/quickstart.html +4 -4
  83. package/dist/docs/reference/agent-config.html +4 -4
  84. package/dist/docs/reference/channels.html +4 -4
  85. package/dist/docs/reference/cli.html +4 -4
  86. package/dist/docs/reference/connections.html +4 -4
  87. package/dist/docs/reference/hooks.html +4 -4
  88. package/dist/docs/reference/http-api.html +4 -4
  89. package/dist/docs/reference/instructions.html +4 -4
  90. package/dist/docs/reference/playground.html +4 -4
  91. package/dist/docs/reference/project-layout.html +4 -4
  92. package/dist/docs/reference/schedules.html +4 -4
  93. package/dist/docs/reference/sessions.html +5 -5
  94. package/dist/docs/reference/skills.html +4 -4
  95. package/dist/docs/reference/subagents.html +4 -4
  96. package/dist/docs/reference/tools.html +4 -4
  97. package/dist/docs/scaffolding-agents.html +4 -4
  98. package/dist/docs/storage.html +7 -6
  99. package/dist/docs/troubleshooting.html +4 -4
  100. package/dist/evals.d.ts +2 -2
  101. package/dist/internal/cli-ax.d.ts +23 -10
  102. package/dist/internal/cli-ax.d.ts.map +1 -1
  103. package/dist/internal/cli-ax.js +358 -55
  104. package/dist/internal/cli-mcp.d.ts +64 -0
  105. package/dist/internal/cli-mcp.d.ts.map +1 -0
  106. package/dist/internal/cli-mcp.js +570 -0
  107. package/dist/internal/distribution.d.ts.map +1 -1
  108. package/dist/internal/distribution.js +2 -0
  109. package/dist/internal/eval-run-store.d.ts +2 -0
  110. package/dist/internal/eval-run-store.d.ts.map +1 -1
  111. package/dist/internal/eval-run-store.js +4 -4
  112. package/dist/internal/evals-client.d.ts +96 -0
  113. package/dist/internal/evals-client.d.ts.map +1 -0
  114. package/dist/internal/evals-client.js +262 -0
  115. package/dist/internal/host-kv.d.ts +17 -0
  116. package/dist/internal/host-kv.d.ts.map +1 -0
  117. package/dist/internal/host-kv.js +77 -0
  118. package/dist/internal/init-project.js +3 -3
  119. package/dist/internal/server.d.ts.map +1 -1
  120. package/dist/internal/server.js +19 -2
  121. package/dist/internal/session-engine.d.ts +42 -7
  122. package/dist/internal/session-engine.d.ts.map +1 -1
  123. package/dist/internal/session-engine.js +247 -51
  124. package/dist/internal/storage-coordinator.d.ts +18 -1
  125. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  126. package/dist/internal/storage-coordinator.js +43 -0
  127. package/dist/playground/assets/index-Bpr4Th4M.js +319 -0
  128. package/dist/playground/index.html +1 -1
  129. package/dist/storage-backends/file-kv.d.ts +42 -0
  130. package/dist/storage-backends/file-kv.d.ts.map +1 -0
  131. package/dist/storage-backends/file-kv.js +190 -0
  132. package/dist/storage-backends/postgres-kv.d.ts +77 -0
  133. package/dist/storage-backends/postgres-kv.d.ts.map +1 -0
  134. package/dist/storage-backends/postgres-kv.js +180 -0
  135. package/dist/storage.d.ts +10 -1
  136. package/dist/storage.d.ts.map +1 -1
  137. package/dist/storage.js +10 -1
  138. package/dist/types.d.ts +79 -0
  139. package/dist/types.d.ts.map +1 -1
  140. package/docs/example-agents/index.md +14 -9
  141. package/docs/example-agents/oncall.md +216 -0
  142. package/docs/guides/slack.md +11 -2
  143. package/docs/reference/sessions.md +13 -4
  144. package/docs/storage.md +27 -0
  145. package/package.json +15 -1
  146. package/skills/framework-map/SKILL.md +6 -4
  147. package/src/bin/agent-serve.ts +79 -18
  148. package/src/channels/slack/channel-watch.ts +28 -1
  149. package/src/channels/slack/cursor-account.ts +20 -0
  150. package/src/channels/slack/defaults.ts +51 -20
  151. package/src/channels/slack/dispatch.ts +215 -40
  152. package/src/channels/slack/inbound.ts +30 -10
  153. package/src/channels/slack/index.ts +4 -0
  154. package/src/channels/slack/live-delivery.ts +1 -0
  155. package/src/channels/slack/manifest.ts +3 -0
  156. package/src/channels/slack/nudge-carrier.ts +182 -0
  157. package/src/channels/slack/nudge-store.ts +308 -0
  158. package/src/channels/slack/slack-channel.ts +106 -31
  159. package/src/channels/slack/stop.ts +25 -0
  160. package/src/channels/slack/thread-context.ts +572 -0
  161. package/src/channels/slack/types.ts +27 -0
  162. package/src/evals.ts +2 -2
  163. package/src/internal/cli-ax.ts +466 -75
  164. package/src/internal/cli-mcp.ts +708 -0
  165. package/src/internal/distribution.ts +2 -0
  166. package/src/internal/eval-run-store.ts +5 -0
  167. package/src/internal/evals-client.ts +431 -0
  168. package/src/internal/host-kv.ts +85 -0
  169. package/src/internal/init-project.ts +3 -3
  170. package/src/internal/server.ts +43 -0
  171. package/src/internal/session-engine.ts +351 -50
  172. package/src/internal/storage-coordinator.ts +41 -0
  173. package/src/storage-backends/file-kv.ts +221 -0
  174. package/src/storage-backends/postgres-kv.ts +248 -0
  175. package/src/storage.ts +11 -1
  176. package/src/types.ts +83 -0
  177. package/dist/docs/assets/chunks/@localSearchIndexroot.O6eP7QZr.js +0 -1
  178. package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +0 -2
  179. package/dist/playground/assets/index-mux9aj5P.js +0 -319
@@ -27,7 +27,7 @@ import { resolve } from "node:path";
27
27
  import { parseArgs } from "node:util";
28
28
  import { formatDiagnostics, projectInfo, resolveAgentMounts, serve, } from "../index.js";
29
29
  import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
30
- import { cmdCall, cmdChat, cmdEval, cmdInit, cmdLogs, cmdPlayground, cmdResume, cmdRun, cmdSession, cmdSessions, cmdTrajectory, } from "../internal/cli-ax.js";
30
+ import { cmdCall, cmdChat, cmdEval, 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 } from "../internal/distribution.js";
33
33
  import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
@@ -65,10 +65,17 @@ Usage:
65
65
  ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
66
66
  [--session <id>] [--slug <slug>] [--team <id>]
67
67
  ${CLI} init [dir] [--json]
68
+ ${CLI} mcp --prod [--slug <slug>] [--team <id>] [--dir <path>]
69
+ | --url <baseUrl> [--bearer-token <t>]
70
+ ${CLI} mcp install [--name <serverName>] [--print] [--json]
71
+ (same target flags as mcp)
68
72
  ${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
69
73
  [--tag <tag>]... [--verbose] [--timeout-ms <n>]
70
- [--no-stream] [--local | --url <baseUrl>] [--slug <slug>]
74
+ [--no-stream] [--no-wait]
75
+ [--prod | --url <baseUrl>] [--slug <slug>]
71
76
  [--team <id>]
77
+ ${CLI} eval status [runId] --prod|--url <baseUrl> [--dir <path>] [--json]
78
+ [--slug <slug>] [--team <id>]
72
79
  ${CLI} info [--dir <path>] [--json]
73
80
  ${CLI} validate [--dir <path>]
74
81
  ${CLI} login [--api-key <key>] [--key-name <name>]
@@ -131,12 +138,29 @@ Commands:
131
138
  run login when unsigned, then print next steps. --json is
132
139
  machine-readable and never blocks on login. No directory:
133
140
  print the setup guide.
141
+ mcp Serve this agent's MCP endpoint over stdio for MCP clients
142
+ that spawn local servers (e.g. Cursor). Proxies
143
+ newline-delimited JSON-RPC to <target>/v1/mcp. --prod resolves
144
+ the hosted deployment with the signed-in Cursor account and
145
+ re-mints short-lived engine credentials as they expire;
146
+ --url targets a running server. stdout is reserved for the
147
+ MCP wire. \`mcp install\` writes the matching entry into
148
+ ~/.cursor/mcp.json (--print to preview; --name to override
149
+ the server name).
134
150
  eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
135
- Runs against the team's hosted deployment by default (slug from
136
- --slug or the directory name); pass --local for an ephemeral
137
- local server, or --url for a running one. Pass evalId args to
138
- select: one datapoint (weather/nyc), a whole file (weather
139
- all cases in that file), several of either, or omit to run all.
151
+ Default: ephemeral local harness against evals on disk. Pass
152
+ --prod to kick off the batch on the team's hosted deployment
153
+ (slug from --slug or the directory name) via /v1/dev/evals/runs
154
+ so results appear in the playground and persist when the agent
155
+ declares an evals storage table; or --url for a running server
156
+ (same server-side path). With --prod/--url, pass --no-wait to
157
+ return the runId immediately without polling; check later with
158
+ \`${CLI} eval status <runId> --prod\` (omit runId to list recent
159
+ runs; exit 3 while still running). The status subcommand only
160
+ binds when --prod/--url is set, so an eval id named status still
161
+ runs locally. Pass evalId args to select: one datapoint
162
+ (weather/nyc), a whole file (weather → all cases in that file),
163
+ several of either, or omit to run all.
140
164
  info Print the discovered agent surface (tools, skills, channels, ...).
141
165
  validate Check the project(s) and exit non-zero on error diagnostics.
142
166
  login Sign the host in to Cursor: browser sign-in mints a named,
@@ -171,7 +195,8 @@ Agent loop:
171
195
  ${CLI} validate --dir .
172
196
  ${CLI} info --dir . --json
173
197
  ${CLI} run --dir . --message "..."
174
- ${CLI} eval --local --dir .
198
+ ${CLI} eval --dir .
199
+ ${CLI} eval --prod --dir .
175
200
  ${CLI} dev .
176
201
 
177
202
  Options:
@@ -210,15 +235,14 @@ Options:
210
235
  --prod chat/resume/run/call/eval/logs/sessions/session/playground:
211
236
  use the team's hosted deployment. Slug from --slug or the
212
237
  --dir basename. Mutually exclusive with --url. Requires
213
- \`${CLI} login\`. (eval already defaults to the
214
- deployment; there --prod is just being explicit.)
215
- --local eval: run against an ephemeral local server instead of
216
- the hosted deployment. Mutually exclusive with --url.
238
+ \`${CLI} login\`. For eval, this is how you opt into the
239
+ persisted server-side batch (default is local).
217
240
  --once logs: print current progress / log buffer once and exit
218
241
  (default is to follow).
219
242
  --print playground: print the URL only; do not open a browser.
220
- --no-wait deploy/stop: return right after the request is accepted
221
- instead of polling until a terminal status.
243
+ --no-wait deploy/stop/eval: return right after the request is
244
+ accepted instead of polling until a terminal status.
245
+ For eval, prints the runId (deployment / --url only).
222
246
  --no-playground Disable the bundled web playground at /playground (also skips
223
247
  auto-build / HMR).
224
248
  --no-docs Disable the documentation site at /docs (also skips its
@@ -326,7 +350,6 @@ function main(argv) {
326
350
  "no-docs": { type: "boolean", default: false },
327
351
  url: { type: "string" },
328
352
  prod: { type: "boolean", default: false },
329
- local: { type: "boolean", default: false },
330
353
  message: { type: "string", multiple: true },
331
354
  input: { type: "string" },
332
355
  "messages-file": { type: "string" },
@@ -380,8 +403,9 @@ function main(argv) {
380
403
  });
381
404
  const dir = (_h = values.dir) !== null && _h !== void 0 ? _h : ".";
382
405
  // Best-effort, cached, and silent on failure. `update` does its own fresh
383
- // lookup, and --json runs stay quiet for machine consumers.
384
- if (command !== "update" && values.json !== true) {
406
+ // lookup, --json runs stay quiet for machine consumers, and `mcp` skips it
407
+ // so MCP client spawns stay fast (stdout there is the protocol wire).
408
+ if (command !== "update" && command !== "mcp" && values.json !== true) {
385
409
  yield warnIfOutdated();
386
410
  }
387
411
  switch (command) {
@@ -442,6 +466,21 @@ function main(argv) {
442
466
  json: values.json,
443
467
  });
444
468
  }
469
+ case "mcp": {
470
+ const { cmdMcp } = yield import("../internal/cli-mcp.js");
471
+ return cmdMcp(positionals[0], {
472
+ dir,
473
+ slug: values.slug,
474
+ team: values.team,
475
+ apiKey: values["api-key"],
476
+ url: values.url,
477
+ prod: values.prod,
478
+ bearerToken: values["bearer-token"],
479
+ name: values.name,
480
+ print: values.print,
481
+ json: values.json,
482
+ });
483
+ }
445
484
  case "login": {
446
485
  const { cmdLogin } = yield import("../internal/cli-cursor.js");
447
486
  return cmdLogin({
@@ -550,6 +589,21 @@ function main(argv) {
550
589
  }));
551
590
  }
552
591
  case "eval": {
592
+ // Remote status subcommand only when targeting --prod/--url. Otherwise
593
+ // the bare token "status" is a normal eval id (evals/status.eval.ts).
594
+ if (positionals[0] === "status" &&
595
+ (values.prod === true || values.url !== undefined)) {
596
+ return cmdEvalStatus(positionals[1], axFromOptions({
597
+ dir,
598
+ json: values.json,
599
+ url: values.url,
600
+ prod: values.prod,
601
+ team: values.team,
602
+ apiKey: values["api-key"],
603
+ slug: values.slug,
604
+ bearerToken: values["bearer-token"],
605
+ }));
606
+ }
553
607
  return cmdEval(axFromOptions({
554
608
  dir,
555
609
  evalIds: positionals,
@@ -559,7 +613,7 @@ function main(argv) {
559
613
  tags: values.tag,
560
614
  url: values.url,
561
615
  prod: values.prod,
562
- local: values.local,
616
+ noWait: values["no-wait"],
563
617
  team: values.team,
564
618
  apiKey: values["api-key"],
565
619
  slug: values.slug,
@@ -870,7 +924,7 @@ function axFromOptions(partial) {
870
924
  toolInput: partial.toolInput,
871
925
  url: partial.url,
872
926
  prod: partial.prod,
873
- local: partial.local,
927
+ noWait: partial.noWait,
874
928
  team: partial.team,
875
929
  apiKey: partial.apiKey,
876
930
  fetchImpl: partial.fetchImpl,
@@ -6,7 +6,10 @@
6
6
  * - Top-level posts only by default; thread replies never dispatch unless
7
7
  * `posts: "all"` is configured.
8
8
  * - Posts that @mention the bot are skipped here (the `app_mention` path
9
- * owns them), and bot-authored posts are dropped upstream in parsing.
9
+ * owns them).
10
+ * - Bot-authored posts are dropped unless `includeBotPosts` is configured
11
+ * (alert feeds / webhook integrations); the watching bot's own posts are
12
+ * always dropped either way (loop safety).
10
13
  * - An optional debounce window lets rapid edits settle: edits update the
11
14
  * pending text, deleting the post cancels the dispatch.
12
15
  */
@@ -40,6 +43,8 @@ export declare function createChannelPostWatcher(args: {
40
43
  allowlist: SlackChannelAllowlist;
41
44
  /** Bot user id (from `auth.test`) so bot mentions route via app_mention. */
42
45
  getBotUserId: () => string | undefined;
46
+ /** This app's own `bot_id` (from `auth.test`) for self-post loop safety. */
47
+ getBotId?: () => string | undefined;
43
48
  dispatch: (message: SlackMessage, eventId?: string) => void;
44
49
  log?: SlackLog;
45
50
  }): ChannelPostWatcher;
@@ -1 +1 @@
1
- {"version":3,"file":"channel-watch.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/channel-watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAIzE,sEAAsE;AACtE,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAE3C,YAAY,OAAO,EAAE,SAAS,MAAM,EAAE,EAerC;IAED,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAElC;IAED,eAAe,IAAI,MAAM,EAAE,CAE1B;IAED,uDAAuD;IACvD,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI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,EAerC;IAED,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAElC;IAED,eAAe,IAAI,MAAM,EAAE,CAE1B;IAED,uDAAuD;IACvD,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAO9D;CACF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,GAAG,GAAE,QAA0B,GAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,MAAM,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnE,2CAA2C;IAC3C,IAAI,IAAI,IAAI,CAAC;CACd;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,wBAAwB,CAAC;IAClC,SAAS,EAAE,qBAAqB,CAAC;IACjC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB,GAAG,kBAAkB,CA0HrB"}
@@ -6,7 +6,10 @@
6
6
  * - Top-level posts only by default; thread replies never dispatch unless
7
7
  * `posts: "all"` is configured.
8
8
  * - Posts that @mention the bot are skipped here (the `app_mention` path
9
- * owns them), and bot-authored posts are dropped upstream in parsing.
9
+ * owns them).
10
+ * - Bot-authored posts are dropped unless `includeBotPosts` is configured
11
+ * (alert feeds / webhook integrations); the watching bot's own posts are
12
+ * always dropped either way (loop safety).
10
13
  * - An optional debounce window lets rapid edits settle: edits update the
11
14
  * pending text, deleting the post cancels the dispatch.
12
15
  */
@@ -100,6 +103,7 @@ export function createChannelPostWatcher(args) {
100
103
  var _a, _b;
101
104
  const log = (_a = args.log) !== null && _a !== void 0 ? _a : defaultSlackLog;
102
105
  const includeReplies = args.options.posts === "all";
106
+ const includeBotPosts = args.options.includeBotPosts === true;
103
107
  const debounceMs = (_b = args.options.debounceMs) !== null && _b !== void 0 ? _b : 0;
104
108
  const pending = new Map();
105
109
  const pendingKey = (channelId, ts) => `${channelId}:${ts}`;
@@ -122,6 +126,7 @@ export function createChannelPostWatcher(args) {
122
126
  }
123
127
  return {
124
128
  handle(event, eventId) {
129
+ var _a;
125
130
  if (event.kind === "deleted") {
126
131
  const key = pendingKey(event.channelId, event.ts);
127
132
  const entry = pending.get(key);
@@ -151,6 +156,22 @@ export function createChannelPostWatcher(args) {
151
156
  return skip("thread reply (posts: top-level)", message);
152
157
  }
153
158
  const botUserId = args.getBotUserId();
159
+ const author = message.author;
160
+ if ((author === null || author === void 0 ? void 0 : author.isBot) === true) {
161
+ if (!includeBotPosts) {
162
+ return skip("bot-authored post (includeBotPosts off)", message);
163
+ }
164
+ const selfBotId = (_a = args.getBotId) === null || _a === void 0 ? void 0 : _a.call(args);
165
+ if (selfBotId === undefined && botUserId === undefined) {
166
+ return skip("bot-authored post (bot identity unknown; loop safety)", message);
167
+ }
168
+ if ((selfBotId !== undefined && author.botId === selfBotId) ||
169
+ (botUserId !== undefined &&
170
+ author.userId !== "" &&
171
+ author.userId === botUserId)) {
172
+ return skip("own post (loop safety)", message);
173
+ }
174
+ }
154
175
  if (botUserId !== undefined && message.text.includes(`<@${botUserId}>`)) {
155
176
  return skip("bot mention (app_mention path owns it)", message);
156
177
  }
@@ -72,5 +72,9 @@ export declare function dispatchCursorSlackEnvelope(args: {
72
72
  envelope: CursorSlackEnvelope;
73
73
  send: SendMessageFn;
74
74
  host: HostContext;
75
+ hasContinuationSession?: (continuationToken: string) => Promise<boolean>;
76
+ isContinuationBusy?: (continuationToken: string) => Promise<boolean>;
77
+ getContinuationLastBotMessageTs?: (continuationToken: string) => Promise<string | undefined>;
78
+ interruptContinuation?: (continuationToken: string) => Promise<boolean>;
75
79
  }): Promise<void>;
76
80
  //# sourceMappingURL=cursor-account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-account.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/cursor-account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAEhB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,8BAA8B,IAAI,wBAAwB,CAezE;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC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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;CACzE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+DhB"}
@@ -81,8 +81,18 @@ export function dispatchCursorSlackEnvelope(args) {
81
81
  const isDm = envelope.channelType === "im" || envelope.channelId.startsWith("D");
82
82
  const kind = isDm ? "direct_message" : "app_mention";
83
83
  const handler = isDm ? runtime.onDirectMessage : runtime.onAppMention;
84
- yield dispatchInboundMessage(Object.assign({ kind,
84
+ yield dispatchInboundMessage(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ kind,
85
85
  message,
86
- handler, send: args.send, credentials: runtime.credentials, host: args.host, log }, (envelope.eventId === undefined ? {} : { eventId: envelope.eventId })));
86
+ handler, send: args.send, credentials: runtime.credentials, host: args.host, log }, (args.hasContinuationSession === undefined
87
+ ? {}
88
+ : { hasContinuationSession: args.hasContinuationSession })), (args.isContinuationBusy === undefined
89
+ ? {}
90
+ : { isContinuationBusy: args.isContinuationBusy })), (args.getContinuationLastBotMessageTs === undefined
91
+ ? {}
92
+ : {
93
+ getContinuationLastBotMessageTs: args.getContinuationLastBotMessageTs,
94
+ })), (args.interruptContinuation === undefined
95
+ ? {}
96
+ : { interruptContinuation: args.interruptContinuation })), (envelope.eventId === undefined ? {} : { eventId: envelope.eventId })));
87
97
  });
88
98
  }
@@ -4,13 +4,16 @@
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
- export declare const defaultOnAppMention: SlackMessageHandler;
8
- export declare const defaultOnDirectMessage: SlackMessageHandler;
7
+ /** Default mention/DM inbound handler (optional custom loading rotation). */
8
+ export declare function createDefaultOnInbound(loadingMessages?: readonly string[]): SlackMessageHandler;
9
9
  /**
10
- * Default watched-channel-post handler: same thread-scoped principal as
11
- * mentions (so a later @mention continues the session), tagged with an
12
- * `engagement: "channel_post"` attribute for auth policies.
10
+ * Default watched-channel-post handler (optional custom loading rotation).
11
+ * Same thread-scoped principal as mentions, tagged with
12
+ * `engagement: "channel_post"` for auth policies.
13
13
  */
14
+ export declare function createDefaultOnChannelPost(loadingMessages?: readonly string[]): SlackMessageHandler;
15
+ export declare const defaultOnAppMention: SlackMessageHandler;
16
+ export declare const defaultOnDirectMessage: SlackMessageHandler;
14
17
  export declare const defaultOnChannelPost: SlackMessageHandler;
15
18
  export interface BuildDefaultEventsOptions {
16
19
  credentials?: SlackCredentials;
@@ -18,6 +21,8 @@ export interface BuildDefaultEventsOptions {
18
21
  thinkingSteps?: boolean;
19
22
  suggestedPrompts?: SlackSuggestedPrompt[];
20
23
  suggestedPromptsTitle?: string;
24
+ /** Rotating assistant status lines; defaults to pack constants. */
25
+ loadingMessages?: readonly string[];
21
26
  /** Resolved per-call so channel onStart can rebind the server logger. */
22
27
  getLog?: () => SlackLog;
23
28
  }
@@ -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;AAQpB,eAAO,MAAM,mBA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,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,CAiYzC"}
@@ -17,23 +17,39 @@ 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 defaultOnInbound = (ctx, message) => __awaiter(void 0, void 0, void 0, function* () {
21
- yield ctx.thread.startTyping("Thinking…");
22
- const auth = defaultSlackAuth(message, ctx);
23
- return auth === null ? null : { auth };
24
- });
25
- export const defaultOnAppMention = defaultOnInbound;
26
- export const defaultOnDirectMessage = defaultOnInbound;
20
+ function resolveLoadingMessages(loadingMessages) {
21
+ if (loadingMessages !== undefined && loadingMessages.length > 0) {
22
+ return [...loadingMessages];
23
+ }
24
+ return [...SLACK_DEFAULT_LOADING_MESSAGES];
25
+ }
26
+ /** Default mention/DM inbound handler (optional custom loading rotation). */
27
+ export function createDefaultOnInbound(loadingMessages) {
28
+ const rotating = resolveLoadingMessages(loadingMessages);
29
+ return (ctx, message) => __awaiter(this, void 0, void 0, function* () {
30
+ yield ctx.thread.startTyping("Thinking…", rotating);
31
+ const auth = defaultSlackAuth(message, ctx);
32
+ return auth === null ? null : { auth };
33
+ });
34
+ }
27
35
  /**
28
- * Default watched-channel-post handler: same thread-scoped principal as
29
- * mentions (so a later @mention continues the session), tagged with an
30
- * `engagement: "channel_post"` attribute for auth policies.
36
+ * Default watched-channel-post handler (optional custom loading rotation).
37
+ * Same thread-scoped principal as mentions, tagged with
38
+ * `engagement: "channel_post"` for auth policies.
31
39
  */
32
- export const defaultOnChannelPost = (ctx, message) => __awaiter(void 0, void 0, void 0, function* () {
33
- yield ctx.thread.startTyping("Thinking…");
34
- const auth = defaultSlackAuth(message, ctx, { engagement: "channel_post" });
35
- return auth === null ? null : { auth };
36
- });
40
+ export function createDefaultOnChannelPost(loadingMessages) {
41
+ const rotating = resolveLoadingMessages(loadingMessages);
42
+ return (ctx, message) => __awaiter(this, void 0, void 0, function* () {
43
+ yield ctx.thread.startTyping("Thinking…", rotating);
44
+ const auth = defaultSlackAuth(message, ctx, {
45
+ engagement: "channel_post",
46
+ });
47
+ return auth === null ? null : { auth };
48
+ });
49
+ }
50
+ export const defaultOnAppMention = createDefaultOnInbound();
51
+ export const defaultOnDirectMessage = createDefaultOnInbound();
52
+ export const defaultOnChannelPost = createDefaultOnChannelPost();
37
53
  /**
38
54
  * Build default stream-event handlers (typing, streaming, replies).
39
55
  * Streaming / thinking default to ON.
@@ -48,6 +64,7 @@ export function buildDefaultEvents(options = {}) {
48
64
  const thinkingSteps = options.thinkingSteps !== false;
49
65
  const suggestedPrompts = (_a = options.suggestedPrompts) !== null && _a !== void 0 ? _a : [];
50
66
  const suggestedPromptsTitle = options.suggestedPromptsTitle;
67
+ const loadingMessages = resolveLoadingMessages(options.loadingMessages);
51
68
  const botToken = credentials === null || credentials === void 0 ? void 0 : credentials.botToken;
52
69
  const getLog = (_b = options.getLog) !== null && _b !== void 0 ? _b : (() => defaultSlackLog);
53
70
  const strategy = createStreamDeliveryStrategy({ botToken, getLog });
@@ -61,6 +78,7 @@ export function buildDefaultEvents(options = {}) {
61
78
  channel.state.streamTs = null;
62
79
  channel.state.streamChannelId = null;
63
80
  channel.state.lastPostedText = null;
81
+ // Keep lastBotMessageTs across turns — warm delta watermark.
64
82
  channel.state.approvalMessageByCallId = {};
65
83
  const state = channel.state;
66
84
  if (state.channelId === null || state.threadTs === null) {
@@ -77,7 +95,7 @@ export function buildDefaultEvents(options = {}) {
77
95
  channelId: state.channelId,
78
96
  threadTs: state.threadTs,
79
97
  status: "Working…",
80
- loadingMessages: [...SLACK_DEFAULT_LOADING_MESSAGES],
98
+ loadingMessages,
81
99
  });
82
100
  // Retry streaming each turn unless a prior call proved the feature
83
101
  // unsupported for this workspace/app. Thinking stays on setStatus
@@ -143,7 +161,10 @@ export function buildDefaultEvents(options = {}) {
143
161
  channelId: channel.state.channelId,
144
162
  threadTs: channel.state.threadTs,
145
163
  status,
146
- loadingMessages: [status, ...SLACK_DEFAULT_LOADING_MESSAGES],
164
+ loadingMessages: [
165
+ status,
166
+ ...loadingMessages.filter((message) => message !== status),
167
+ ],
147
168
  });
148
169
  channel.state.lastReasoningTypingAtMs = now;
149
170
  channel.state.lastReasoningTypingStatus = status;
@@ -285,6 +306,7 @@ export function buildDefaultEvents(options = {}) {
285
306
  threadTs: state.threadTs,
286
307
  });
287
308
  channel.state.lastPostedText = event.data.text;
309
+ channel.state.lastBotMessageTs = posted.ts;
288
310
  log.info("reply delivered via postMessage", {
289
311
  channel: state.channelId,
290
312
  thread_ts: state.threadTs,
@@ -23,6 +23,20 @@ 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>;
26
40
  }
27
41
  export declare function dispatchInboundMessage(args: {
28
42
  kind: "app_mention" | "direct_message" | "channel_post";
@@ -31,6 +45,10 @@ export declare function dispatchInboundMessage(args: {
31
45
  send: SendMessageFn;
32
46
  credentials: SlackCredentials | undefined;
33
47
  host: HostContext;
48
+ hasContinuationSession?: (continuationToken: string) => Promise<boolean>;
49
+ isContinuationBusy?: (continuationToken: string) => Promise<boolean>;
50
+ getContinuationLastBotMessageTs?: (continuationToken: string) => Promise<string | undefined>;
51
+ interruptContinuation?: (continuationToken: string) => Promise<boolean>;
34
52
  log?: SlackLog;
35
53
  eventId?: string;
36
54
  }): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/channels/slack/dispatch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAa,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAO1D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAEhB,YAAY,EACZ,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAKpB,uCAAuC;AACvC,wBAAgB,sBAAsB,CACpC,KAAK,GAAE,OAAO,CAAC,iBAAiB,CAAM,GACrC,iBAAiB,CAgBnB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC/C,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