@cursor/july 0.1.54 → 0.1.61

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 (293) hide show
  1. package/dist/bin/agent-serve.js +30 -23
  2. package/dist/channels/github/github-channel.d.ts +12 -0
  3. package/dist/channels/github/github-channel.d.ts.map +1 -1
  4. package/dist/channels/github/github-channel.js +67 -15
  5. package/dist/channels/github/types.d.ts +27 -1
  6. package/dist/channels/github/types.d.ts.map +1 -1
  7. package/dist/channels/origin/cursor-account.d.ts +22 -0
  8. package/dist/channels/origin/cursor-account.d.ts.map +1 -0
  9. package/dist/channels/origin/cursor-account.js +35 -0
  10. package/dist/channels/origin/events.d.ts +10 -0
  11. package/dist/channels/origin/events.d.ts.map +1 -0
  12. package/dist/channels/origin/events.js +27 -0
  13. package/dist/channels/origin/index.d.ts +29 -0
  14. package/dist/channels/origin/index.d.ts.map +1 -0
  15. package/dist/channels/origin/index.js +28 -0
  16. package/dist/channels/origin/origin-channel.d.ts +68 -0
  17. package/dist/channels/origin/origin-channel.d.ts.map +1 -0
  18. package/dist/channels/origin/origin-channel.js +567 -0
  19. package/dist/channels/origin/origin-webhook.d.ts +38 -0
  20. package/dist/channels/origin/origin-webhook.d.ts.map +1 -0
  21. package/dist/channels/origin/origin-webhook.js +151 -0
  22. package/dist/channels/origin/types.d.ts +152 -0
  23. package/dist/channels/origin/types.d.ts.map +1 -0
  24. package/dist/channels/origin/types.js +1 -0
  25. package/dist/channels/slack/doctor.d.ts +17 -1
  26. package/dist/channels/slack/doctor.d.ts.map +1 -1
  27. package/dist/channels/slack/doctor.js +186 -10
  28. package/dist/docs/404.html +2 -2
  29. package/dist/docs/ab.html +4 -4
  30. package/dist/docs/assets/{app.DAKcDclS.js → app.CW3KJh72.js} +1 -1
  31. package/dist/docs/assets/chunks/@localSearchIndexroot.BuymfBAo.js +1 -0
  32. package/dist/docs/assets/chunks/{VPLocalSearchBox.BNIaCSfG.js → VPLocalSearchBox.Bk6EWpPj.js} +1 -1
  33. package/dist/docs/assets/chunks/{theme.B47GzJjc.js → theme.Bz9AodBA.js} +2 -2
  34. package/dist/docs/assets/{example-agents_fsd.md.DPz9ezO4.js → example-agents_fsd.md.ZeGEpAw_.js} +2 -2
  35. package/dist/docs/assets/{example-agents_fsd.md.DPz9ezO4.lean.js → example-agents_fsd.md.ZeGEpAw_.lean.js} +1 -1
  36. package/dist/docs/assets/{example-agents_security-reviewer.md.Dkf1gyo6.js → example-agents_security-reviewer.md.DBL1TwtP.js} +2 -2
  37. package/dist/docs/assets/{example-agents_security-reviewer.md.Dkf1gyo6.lean.js → example-agents_security-reviewer.md.DBL1TwtP.lean.js} +1 -1
  38. package/dist/docs/assets/guides_convert-automation.md.BhMzTkE5.js +12 -0
  39. package/dist/docs/assets/guides_convert-automation.md.BhMzTkE5.lean.js +1 -0
  40. package/dist/docs/assets/{guides_github.md.B8QKtIpw.js → guides_github.md.CLLQJKRB.js} +4 -4
  41. package/dist/docs/assets/{guides_github.md.B8QKtIpw.lean.js → guides_github.md.CLLQJKRB.lean.js} +1 -1
  42. package/dist/docs/assets/index.md.DhRHS_-L.js +5 -0
  43. package/dist/docs/assets/{index.md.COeoSkcF.lean.js → index.md.DhRHS_-L.lean.js} +1 -1
  44. package/dist/docs/assets/{reference_cli.md.-V6J7Cl8.js → reference_cli.md.Cl14Jfo3.js} +10 -2
  45. package/dist/docs/assets/{reference_cli.md.-V6J7Cl8.lean.js → reference_cli.md.Cl14Jfo3.lean.js} +1 -1
  46. package/dist/docs/assets/scaffolding-agents.md.CrWSA0Ko.js +1 -0
  47. package/dist/docs/assets/{scaffolding-agents.md.mkc3B_ZW.lean.js → scaffolding-agents.md.CrWSA0Ko.lean.js} +1 -1
  48. package/dist/docs/assets/templates_agentic-owners.md.BkTLORaU.js +14 -0
  49. package/dist/docs/assets/templates_agentic-owners.md.BkTLORaU.lean.js +1 -0
  50. package/dist/docs/assets/templates_demo.md.Bgd6MBaZ.js +4 -0
  51. package/dist/docs/assets/templates_demo.md.Bgd6MBaZ.lean.js +1 -0
  52. package/dist/docs/assets/templates_pr-autofixer.md.DcmoeUNZ.js +8 -0
  53. package/dist/docs/assets/templates_pr-autofixer.md.DcmoeUNZ.lean.js +1 -0
  54. package/dist/docs/assets/templates_security-reviewer.md.C0yIUaYs.js +2 -0
  55. package/dist/docs/assets/templates_security-reviewer.md.C0yIUaYs.lean.js +1 -0
  56. package/dist/docs/assets/templates_triage.md.DWuQ1bZz.js +9 -0
  57. package/dist/docs/assets/templates_triage.md.DWuQ1bZz.lean.js +1 -0
  58. package/dist/docs/building-with-agents.html +4 -4
  59. package/dist/docs/concepts.html +5 -5
  60. package/dist/docs/deployment.html +4 -4
  61. package/dist/docs/evals.html +4 -4
  62. package/dist/docs/example-agents/approval-buddy.html +4 -4
  63. package/dist/docs/example-agents/benny.html +4 -4
  64. package/dist/docs/example-agents/bugbot.html +4 -4
  65. package/dist/docs/example-agents/codebase-wiki.html +4 -4
  66. package/dist/docs/example-agents/codeowners-review.html +4 -4
  67. package/dist/docs/example-agents/concierge.html +4 -4
  68. package/dist/docs/example-agents/fsd.html +5 -5
  69. package/dist/docs/example-agents/index.html +4 -4
  70. package/dist/docs/example-agents/knowledge-base.html +4 -4
  71. package/dist/docs/example-agents/oncall.html +4 -4
  72. package/dist/docs/example-agents/security-reviewer.html +5 -5
  73. package/dist/docs/example-agents/slack-agent.html +4 -4
  74. package/dist/docs/example-agents/weather-agent.html +4 -4
  75. package/dist/docs/guides/agent-to-agent.html +4 -4
  76. package/dist/docs/guides/cloud-runtime.html +4 -4
  77. package/dist/docs/guides/convert-automation.html +36 -0
  78. package/dist/docs/guides/github.html +7 -7
  79. package/dist/docs/guides/human-in-the-loop.html +4 -4
  80. package/dist/docs/guides/mcp-oauth.html +4 -4
  81. package/dist/docs/guides/opentelemetry.html +4 -4
  82. package/dist/docs/guides/slack.html +4 -4
  83. package/dist/docs/guides/webhooks.html +4 -4
  84. package/dist/docs/hashmap.json +1 -1
  85. package/dist/docs/hillclimbing.html +4 -4
  86. package/dist/docs/index.html +6 -6
  87. package/dist/docs/quickstart.html +4 -4
  88. package/dist/docs/reference/agent-config.html +4 -4
  89. package/dist/docs/reference/artifacts.html +4 -4
  90. package/dist/docs/reference/channels.html +4 -4
  91. package/dist/docs/reference/cli.html +14 -6
  92. package/dist/docs/reference/connections.html +4 -4
  93. package/dist/docs/reference/hooks.html +4 -4
  94. package/dist/docs/reference/http-api.html +4 -4
  95. package/dist/docs/reference/instructions.html +4 -4
  96. package/dist/docs/reference/playground.html +4 -4
  97. package/dist/docs/reference/project-layout.html +4 -4
  98. package/dist/docs/reference/prompt.html +4 -4
  99. package/dist/docs/reference/schedules.html +4 -4
  100. package/dist/docs/reference/sessions.html +4 -4
  101. package/dist/docs/reference/skills.html +4 -4
  102. package/dist/docs/reference/subagents.html +4 -4
  103. package/dist/docs/reference/tools.html +4 -4
  104. package/dist/docs/scaffolding-agents.html +5 -5
  105. package/dist/docs/storage.html +4 -4
  106. package/dist/docs/templates/agentic-owners.html +38 -0
  107. package/dist/docs/templates/demo.html +28 -0
  108. package/dist/docs/templates/pr-autofixer.html +32 -0
  109. package/dist/docs/templates/security-reviewer.html +26 -0
  110. package/dist/docs/templates/triage.html +14 -16
  111. package/dist/docs/troubleshooting.html +4 -4
  112. package/dist/index.d.ts +3 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +2 -2
  115. package/dist/internal/cli-ax.d.ts +2 -0
  116. package/dist/internal/cli-ax.d.ts.map +1 -1
  117. package/dist/internal/cli-ax.js +30 -1
  118. package/dist/internal/cli-deploy.js +1 -1
  119. package/dist/internal/cli-slack.d.ts +4 -0
  120. package/dist/internal/cli-slack.d.ts.map +1 -1
  121. package/dist/internal/cli-slack.js +46 -20
  122. package/dist/internal/cursor-event-relay.d.ts +59 -11
  123. package/dist/internal/cursor-event-relay.d.ts.map +1 -1
  124. package/dist/internal/cursor-event-relay.js +133 -26
  125. package/dist/internal/discovery.d.ts.map +1 -1
  126. package/dist/internal/discovery.js +11 -2
  127. package/dist/internal/distribution.d.ts.map +1 -1
  128. package/dist/internal/distribution.js +1 -0
  129. package/dist/internal/handleAgentServeTrigger.d.ts +33 -6
  130. package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
  131. package/dist/internal/handleAgentServeTrigger.js +97 -19
  132. package/dist/internal/init-interview.d.ts +67 -0
  133. package/dist/internal/init-interview.d.ts.map +1 -0
  134. package/dist/internal/init-interview.js +300 -0
  135. package/dist/internal/init-project.d.ts +7 -0
  136. package/dist/internal/init-project.d.ts.map +1 -1
  137. package/dist/internal/init-project.js +99 -43
  138. package/dist/internal/mcp-endpoint.d.ts +7 -0
  139. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  140. package/dist/internal/mcp-endpoint.js +7 -0
  141. package/dist/internal/server.d.ts.map +1 -1
  142. package/dist/internal/server.js +159 -57
  143. package/dist/internal/session-engine.d.ts.map +1 -1
  144. package/dist/internal/session-engine.js +20 -21
  145. package/dist/internal/session-links.d.ts +14 -0
  146. package/dist/internal/session-links.d.ts.map +1 -0
  147. package/dist/internal/session-links.js +69 -0
  148. package/dist/internal/sessions-client.d.ts.map +1 -1
  149. package/dist/internal/sessions-client.js +1 -0
  150. package/dist/internal/slack-provision-client.js +1 -1
  151. package/dist/playground/assets/index-ClbuaLpm.css +1 -0
  152. package/dist/playground/assets/index-SqkR13k_.js +85 -0
  153. package/dist/playground/index.html +2 -2
  154. package/dist/types.d.ts +19 -12
  155. package/dist/types.d.ts.map +1 -1
  156. package/docs/README.md +15 -0
  157. package/docs/example-agents/fsd.md +3 -0
  158. package/docs/example-agents/security-reviewer.md +3 -0
  159. package/docs/guides/convert-automation.md +176 -0
  160. package/docs/guides/github.md +6 -2
  161. package/docs/reference/cli.md +36 -10
  162. package/docs/scaffolding-agents.md +3 -0
  163. package/docs/templates/agentic-owners.md +97 -0
  164. package/docs/templates/demo.md +84 -0
  165. package/docs/templates/pr-autofixer.md +136 -0
  166. package/docs/templates/security-reviewer.md +89 -0
  167. package/docs/templates/triage.md +59 -101
  168. package/package.json +9 -1
  169. package/skills/github/SKILL.md +4 -5
  170. package/src/bin/agent-serve.ts +13 -6
  171. package/src/channels/github/github-channel.ts +95 -18
  172. package/src/channels/github/types.ts +31 -0
  173. package/src/channels/origin/cursor-account.ts +64 -0
  174. package/src/channels/origin/events.ts +41 -0
  175. package/src/channels/origin/index.ts +29 -0
  176. package/src/channels/origin/origin-channel.ts +784 -0
  177. package/src/channels/origin/origin-webhook.ts +202 -0
  178. package/src/channels/origin/types.ts +186 -0
  179. package/src/channels/slack/doctor.ts +218 -5
  180. package/src/index.ts +3 -1
  181. package/src/internal/cli-ax.ts +33 -1
  182. package/src/internal/cli-deploy.ts +2 -2
  183. package/src/internal/cli-slack.ts +68 -19
  184. package/src/internal/cursor-event-relay.ts +193 -31
  185. package/src/internal/discovery.ts +15 -5
  186. package/src/internal/distribution.ts +1 -0
  187. package/src/internal/handleAgentServeTrigger.ts +129 -19
  188. package/src/internal/init-interview.ts +384 -0
  189. package/src/internal/init-project.ts +146 -46
  190. package/src/internal/mcp-endpoint.ts +7 -0
  191. package/src/internal/server.ts +188 -58
  192. package/src/internal/session-engine.ts +5 -21
  193. package/src/internal/session-links.ts +88 -0
  194. package/src/internal/sessions-client.ts +1 -0
  195. package/src/internal/slack-provision-client.ts +1 -1
  196. package/src/types.ts +19 -12
  197. package/templates/agentic-owners/README.md +73 -0
  198. package/templates/agentic-owners/agent/agent.ts +15 -0
  199. package/templates/agentic-owners/agent/channels/github.ts +85 -0
  200. package/templates/agentic-owners/agent/instructions.md +34 -0
  201. package/templates/agentic-owners/agent/lib/config.ts +13 -0
  202. package/templates/agentic-owners/agent/lib/github.ts +241 -0
  203. package/templates/agentic-owners/agent/lib/owners/README.md +50 -0
  204. package/templates/agentic-owners/agent/lib/owners/constants.ts +22 -0
  205. package/templates/agentic-owners/agent/lib/owners/decision.ts +485 -0
  206. package/templates/agentic-owners/agent/lib/owners/handles.ts +54 -0
  207. package/templates/agentic-owners/agent/lib/owners/match.ts +177 -0
  208. package/templates/agentic-owners/agent/lib/owners/matching.ts +95 -0
  209. package/templates/agentic-owners/agent/lib/owners/parse.ts +589 -0
  210. package/templates/agentic-owners/agent/lib/owners/policyMode.ts +65 -0
  211. package/templates/agentic-owners/agent/lib/owners/prompt.ts +66 -0
  212. package/templates/agentic-owners/agent/lib/owners/prompts/base-review.md +105 -0
  213. package/templates/agentic-owners/agent/lib/owners/types.ts +45 -0
  214. package/templates/agentic-owners/agent/lib/review.ts +777 -0
  215. package/templates/agentic-owners/agent/tools/record_review.ts +69 -0
  216. package/templates/agentic-owners/evals/evals.config.ts +5 -0
  217. package/templates/agentic-owners/evals/owners.eval.ts +116 -0
  218. package/templates/agentic-owners/package.json +20 -0
  219. package/templates/agentic-owners/tsconfig.json +12 -0
  220. package/templates/demo/README.md +33 -0
  221. package/templates/demo/agent/agent.ts +15 -0
  222. package/templates/demo/agent/channels/github.ts +50 -0
  223. package/templates/demo/agent/channels/queue.ts +30 -0
  224. package/templates/demo/agent/instructions.md +8 -0
  225. package/templates/demo/agent/lib/collect.ts +78 -0
  226. package/templates/demo/agent/tools/record_demo.ts +40 -0
  227. package/templates/demo/evals/demo.eval.ts +33 -0
  228. package/templates/demo/evals/evals.config.ts +5 -0
  229. package/templates/demo/package.json +18 -0
  230. package/templates/demo/tsconfig.json +12 -0
  231. package/templates/pr-autofixer/README.md +44 -0
  232. package/templates/pr-autofixer/agent/agent.ts +22 -0
  233. package/templates/pr-autofixer/agent/channels/drive.ts +40 -0
  234. package/templates/pr-autofixer/agent/channels/github.ts +167 -0
  235. package/templates/pr-autofixer/agent/channels/slack.ts +17 -0
  236. package/templates/pr-autofixer/agent/hooks/bind-agent.ts +19 -0
  237. package/templates/pr-autofixer/agent/instructions.md +83 -0
  238. package/templates/pr-autofixer/agent/lib/affinity.ts +33 -0
  239. package/templates/pr-autofixer/agent/lib/drive-schemas.ts +15 -0
  240. package/templates/pr-autofixer/agent/lib/drive.ts +79 -0
  241. package/templates/pr-autofixer/agent/lib/merge-watch.ts +123 -0
  242. package/templates/pr-autofixer/agent/lib/pr-state.ts +54 -0
  243. package/templates/pr-autofixer/agent/lib/repos.ts +19 -0
  244. package/templates/pr-autofixer/agent/lib/start-drive.ts +122 -0
  245. package/templates/pr-autofixer/agent/lib/webhook-buffer.ts +225 -0
  246. package/templates/pr-autofixer/agent/lib/webhook-routing.ts +231 -0
  247. package/templates/pr-autofixer/agent/storage.ts +7 -0
  248. package/templates/pr-autofixer/agent/tools/drive_pr.ts +22 -0
  249. package/templates/pr-autofixer/evals/coordinator.eval.ts +16 -0
  250. package/templates/pr-autofixer/evals/evals.config.ts +5 -0
  251. package/templates/pr-autofixer/init.json +25 -0
  252. package/templates/pr-autofixer/package.json +18 -0
  253. package/templates/pr-autofixer/tsconfig.json +12 -0
  254. package/templates/security-reviewer/README.md +31 -0
  255. package/templates/security-reviewer/agent/agent.ts +15 -0
  256. package/templates/security-reviewer/agent/channels/github.ts +46 -0
  257. package/templates/security-reviewer/agent/instructions.md +22 -0
  258. package/templates/security-reviewer/agent/lib/repos.ts +5 -0
  259. package/templates/security-reviewer/agent/tools/post_findings.ts +72 -0
  260. package/templates/security-reviewer/evals/evals.config.ts +5 -0
  261. package/templates/security-reviewer/evals/review.eval.ts +53 -0
  262. package/templates/security-reviewer/init.json +25 -0
  263. package/templates/security-reviewer/package.json +18 -0
  264. package/templates/security-reviewer/tsconfig.json +12 -0
  265. package/templates/triage/README.md +27 -29
  266. package/templates/triage/agent/agent.ts +1 -0
  267. package/templates/triage/agent/channels/queue.ts +47 -0
  268. package/templates/triage/agent/channels/webhook.ts +50 -0
  269. package/templates/triage/agent/instructions.md +24 -13
  270. package/templates/triage/agent/lib/actuate.ts +759 -0
  271. package/templates/triage/agent/lib/parse-queue-event.ts +168 -0
  272. package/templates/triage/agent/lib/tracker.ts +5 -0
  273. package/templates/triage/agent/lib/types.ts +52 -0
  274. package/templates/triage/agent/lib/verify-webhook.ts +81 -0
  275. package/templates/triage/agent/skills/triage-rubric.md +6 -5
  276. package/templates/triage/agent/tools/record_triage.ts +24 -5
  277. package/templates/triage/evals/triage.eval.ts +25 -3
  278. package/templates/triage/overlays/jira/README.md +21 -0
  279. package/templates/triage/overlays/jira/agent/lib/tracker.ts +8 -0
  280. package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +7 -0
  281. package/templates/triage/overlays/linear/README.md +21 -0
  282. package/templates/triage/overlays/linear/agent/lib/tracker.ts +8 -0
  283. package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +7 -0
  284. package/templates/triage/package.json +1 -1
  285. package/dist/docs/assets/chunks/@localSearchIndexroot.C4uxzYEU.js +0 -1
  286. package/dist/docs/assets/index.md.COeoSkcF.js +0 -5
  287. package/dist/docs/assets/scaffolding-agents.md.mkc3B_ZW.js +0 -1
  288. package/dist/docs/assets/templates_triage.md.CConZt1z.js +0 -11
  289. package/dist/docs/assets/templates_triage.md.CConZt1z.lean.js +0 -1
  290. package/dist/playground/assets/index-BHAPd9KT.js +0 -85
  291. package/dist/playground/assets/index-DpKH0HcT.css +0 -1
  292. package/templates/triage/agent/channels/intake.ts +0 -20
  293. package/templates/triage/agent/channels/slack.ts +0 -3
@@ -25,6 +25,7 @@ import { CLI_COMMAND_NAME as CLI } from "./distribution.js";
25
25
  import { loadAgentLocalEnv } from "./local-env.js";
26
26
  import { openBrowser } from "./open-browser.js";
27
27
  import { AgentServeSlackClient, SlackProvisionApiError, } from "./slack-provision-client.js";
28
+ import { stderrPalette } from "./terminal-style.js";
28
29
  const SLACK_HELP = `${CLI} slack — Slack channel pack helpers (Socket Mode)
29
30
 
30
31
  Usage:
@@ -41,6 +42,7 @@ Usage:
41
42
  ${CLI} slack manifest --env dev|prod|both [--dir .] [--name NAME]
42
43
  [--print]
43
44
  ${CLI} slack doctor [--dir .] [--prefix PREFIX | --no-prefix] [--json]
45
+ [--channel C0123ABCD]...
44
46
 
45
47
  create/destroy/icon — dedicated Socket Mode app via the Cursor dashboard:
46
48
  create Opens the signed-in dashboard wizard. Finish name, workspace,
@@ -98,13 +100,17 @@ export function cmdSlack(subcommand, options) {
98
100
  }
99
101
  function runDoctor(options) {
100
102
  return __awaiter(this, void 0, void 0, function* () {
101
- var _a;
103
+ var _a, _b;
102
104
  const dir = resolvePath(options.dir);
103
105
  // Tokens usually live in the agent's .env.local; real env still wins.
104
106
  loadAgentLocalEnv(dir);
105
107
  const envPrefix = resolveDoctorEnvPrefix(options, dir);
106
108
  const doctor = (_a = options.doctorImpl) !== null && _a !== void 0 ? _a : runSlackDoctor;
107
- const result = yield doctor(envPrefix === undefined ? {} : { envPrefix });
109
+ const channels = (_b = options.channels) !== null && _b !== void 0 ? _b : [];
110
+ const result = yield doctor({
111
+ envPrefix,
112
+ channels: channels.length > 0 ? channels : undefined,
113
+ });
108
114
  if (options.json) {
109
115
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
110
116
  }
@@ -241,7 +247,7 @@ function applySlackCreateFileIcon(ctx, source, appId) {
241
247
  */
242
248
  function prepareProvision(options) {
243
249
  return __awaiter(this, void 0, void 0, function* () {
244
- var _a, _b, _c, _d;
250
+ var _a, _b, _c, _d, _e;
245
251
  const out = (_a = options.out) !== null && _a !== void 0 ? _a : ((text) => void process.stdout.write(text));
246
252
  const err = errStream(options);
247
253
  const auth = yield resolveDeployAuth({
@@ -264,12 +270,31 @@ function prepareProvision(options) {
264
270
  json: options.json === true,
265
271
  out,
266
272
  err,
267
- openBrowserImpl: (_b = options.openBrowserImpl) !== null && _b !== void 0 ? _b : openBrowser,
268
- pollIntervalMs: (_c = options.connectPollIntervalMs) !== null && _c !== void 0 ? _c : DEFAULT_WIZARD_POLL_INTERVAL_MS,
269
- pollTimeoutMs: (_d = options.connectPollTimeoutMs) !== null && _d !== void 0 ? _d : DEFAULT_WIZARD_POLL_TIMEOUT_MS,
273
+ dim: ((_b = options.palette) !== null && _b !== void 0 ? _b : stderrPalette()).dim,
274
+ openBrowserImpl: (_c = options.openBrowserImpl) !== null && _c !== void 0 ? _c : openBrowser,
275
+ pollIntervalMs: (_d = options.connectPollIntervalMs) !== null && _d !== void 0 ? _d : DEFAULT_WIZARD_POLL_INTERVAL_MS,
276
+ pollTimeoutMs: (_e = options.connectPollTimeoutMs) !== null && _e !== void 0 ? _e : DEFAULT_WIZARD_POLL_TIMEOUT_MS,
270
277
  };
271
278
  });
272
279
  }
280
+ function writePendingAdminWait(ctx, poll) {
281
+ const appSuffix = poll.appId === undefined ? "" : ` (${poll.appId})`;
282
+ const requestUrl = poll.oauthAuthorizeUrl !== undefined && poll.oauthAuthorizeUrl.length > 0
283
+ ? poll.oauthAuthorizeUrl
284
+ : undefined;
285
+ ctx.err(`Waiting for a Slack admin to approve the app${appSuffix}.\n\n`);
286
+ if (requestUrl !== undefined) {
287
+ ctx.err(ctx.dim(` Slack will notify workspace owners once the request is in their queue.\n` +
288
+ ` Open this page to file it or send a reminder:\n\n`));
289
+ ctx.err(` ${requestUrl}\n\n`);
290
+ ctx.openBrowserImpl(requestUrl);
291
+ }
292
+ else {
293
+ ctx.err(ctx.dim(` Slack will notify workspace owners once the request is in their queue.\n\n`));
294
+ }
295
+ ctx.err(ctx.dim(` Keep this command running.\n` +
296
+ ` After an admin approves, click Retry in the dashboard.\n`));
297
+ }
273
298
  export function cmdSlackCreate(options) {
274
299
  return __awaiter(this, void 0, void 0, function* () {
275
300
  var _a, _b, _c;
@@ -298,7 +323,7 @@ export function cmdSlackCreate(options) {
298
323
  return 1;
299
324
  }
300
325
  if (wrote.length > 0 && !ctx.json) {
301
- ctx.err(`Scaffolded the Slack channel: ${wrote.join(", ")}\n`);
326
+ ctx.err(`${ctx.dim(`Scaffolded the Slack channel: ${wrote.join(", ")}`)}\n`);
302
327
  }
303
328
  const source = yield inferDeployGitSource(target.dir);
304
329
  let minted;
@@ -321,9 +346,10 @@ export function cmdSlackCreate(options) {
321
346
  catch (error) {
322
347
  return renderSlackApiError(error, ctx.err);
323
348
  }
324
- ctx.err(`Finish Slack setup in the browser:\n\n ${minted.url}\n\n` +
325
- `Sign in as the same Cursor account that ran this command. ` +
326
- `The CLI waits here (up to ${Math.round(ctx.pollTimeoutMs / 60000)} minutes).\n`);
349
+ const waitMinutes = Math.round(ctx.pollTimeoutMs / 60000);
350
+ ctx.err(`Finish Slack setup in the browser:\n\n ${minted.url}\n\n`);
351
+ ctx.err(ctx.dim(` Sign in as the same Cursor account that ran this command.\n` +
352
+ ` The CLI waits here (up to ${waitMinutes} minutes).\n`));
327
353
  ctx.openBrowserImpl(minted.url);
328
354
  const deadline = Date.now() + ctx.pollTimeoutMs;
329
355
  let sawPendingAdmin = false;
@@ -348,17 +374,12 @@ export function cmdSlackCreate(options) {
348
374
  }
349
375
  if (poll.status === "pending_admin_approval" && !sawPendingAdmin) {
350
376
  sawPendingAdmin = true;
351
- const appSuffix = poll.appId === undefined ? "" : ` (${poll.appId})`;
352
- ctx.err(`Waiting for a Slack admin to approve the app${appSuffix}. Keep this command running.\n` +
353
- `Managed install does not file the request. Open Slack to submit it; that same page lets you send a reminder to workspace owners.\n`);
354
- if (poll.oauthAuthorizeUrl !== undefined &&
355
- poll.oauthAuthorizeUrl.length > 0) {
356
- ctx.err(` ${poll.oauthAuthorizeUrl}\n`);
357
- }
358
- ctx.err("After an admin approves, click Retry in the dashboard.\n");
377
+ writePendingAdminWait(ctx, poll);
359
378
  }
360
379
  if (Date.now() >= deadline) {
361
- ctx.err(`Timed out waiting for Slack setup. Finish it in the browser, then re-run \`${CLI} slack create\`.\n ${minted.url}\n`);
380
+ ctx.err(`Timed out waiting for Slack setup.\n\n`);
381
+ ctx.err(ctx.dim(` Finish it in the browser, then re-run \`${CLI} slack create\`.\n\n`));
382
+ ctx.err(` ${minted.url}\n`);
362
383
  return 1;
363
384
  }
364
385
  yield sleep(ctx.pollIntervalMs);
@@ -391,7 +412,8 @@ export function cmdSlackCreate(options) {
391
412
  process.env[key] = value;
392
413
  }
393
414
  if (poll.localEnv.appToken === undefined) {
394
- ctx.err(`warning: Slack did not return an app-level token, so ${target.envKeys.app} was not written; re-run \`${CLI} slack create\` to recover it.\n`);
415
+ ctx.err(ctx.dim(`warning: Slack did not return an app-level token, so ${target.envKeys.app} was not written.\n` +
416
+ ` Re-run \`${CLI} slack create\` to recover it.\n`));
395
417
  }
396
418
  let iconStatus;
397
419
  if (poll.appId !== undefined) {
@@ -653,11 +675,15 @@ function ensureEnvLocalGitignored(dir) {
653
675
  });
654
676
  }
655
677
  function renderDoctorReport(result) {
678
+ var _a;
656
679
  let text = `env: ${result.envKeys.bot} / ${result.envKeys.app}\n`;
657
680
  for (const check of result.checks) {
658
681
  text += `${check.ok ? "ok" : "!!"} ${check.id}: ${check.message}\n`;
659
682
  }
660
683
  text += result.ok ? "doctor: pass\n" : "doctor: fail\n";
684
+ for (const note of (_a = result.notes) !== null && _a !== void 0 ? _a : []) {
685
+ text += `\nnote: ${note}\n`;
686
+ }
661
687
  return text;
662
688
  }
663
689
  function renderSlackApiError(error, err) {
@@ -100,6 +100,12 @@ export interface CursorScmEvent {
100
100
  * Zod-valid `issue_comment` / `pull_request_review_comment` webhook body.
101
101
  */
102
102
  comment?: CursorScmCommentMeta;
103
+ /**
104
+ * Origin comment snapshot. Ids are Origin string ids, not GitHub integers.
105
+ */
106
+ originComment?: CursorScmOriginCommentMeta;
107
+ /** Origin actor (author / pusher / commenter) when present. */
108
+ originActor?: CursorScmOriginActorMeta;
103
109
  /** `check_run` snapshot; enough to stub `onCheckRun`. */
104
110
  checkRun?: CursorScmCheckRunMeta;
105
111
  /** `check_suite` snapshot; enough to stub `onCheckSuite`. */
@@ -109,11 +115,35 @@ export interface CursorScmEvent {
109
115
  /** GitHub-side event time from the payload, when present. */
110
116
  occurredAtMs?: number;
111
117
  }
118
+ export type CursorScmOriginActorMeta = {
119
+ id: string;
120
+ kind?: string;
121
+ };
122
+ export type CursorScmOriginCommentMeta = {
123
+ id: string;
124
+ body?: string;
125
+ author?: CursorScmOriginActorMeta;
126
+ };
127
+ export type CursorScmProvider = "github" | "origin";
128
+ export interface CursorScmSubscription {
129
+ provider: CursorScmProvider;
130
+ repo: string;
131
+ events: readonly string[];
132
+ }
112
133
  export interface CursorEventRelayOptions {
113
134
  baseUrl: string;
114
135
  apiKey: string;
115
- repos: readonly string[];
116
- events: readonly string[];
136
+ /**
137
+ * GitHub-only shorthand. Ignored when {@link subscriptions} is set.
138
+ * Existing `--cursor-events --repo` hosts keep passing these.
139
+ */
140
+ repos?: readonly string[];
141
+ events?: readonly string[];
142
+ /**
143
+ * Mixed GitHub + Origin registrations. Provider is part of the
144
+ * subscription key: mirrored `owner/name` slugs must not collide.
145
+ */
146
+ subscriptions?: readonly CursorScmSubscription[];
117
147
  stateDir: string;
118
148
  /**
119
149
  * Called for each matching event; failures retry a bounded number of
@@ -164,25 +194,43 @@ export declare function scmMetadataToGitHubPayload(event: {
164
194
  workflowRun?: CursorScmWorkflowRunMeta;
165
195
  }): Record<string, unknown>;
166
196
  /**
167
- * GitHub SCM-events relay: a thin {@link CursorRelayCore} adapter. Consumers
197
+ * Origin webhook envelope from an SCM-events metadata record. One parser
198
+ * handles both live Origin deliveries and this stub: `{ deliveryId, event }`.
199
+ */
200
+ export declare function scmMetadataToOriginPayload(event: {
201
+ repo: string;
202
+ eventName: string;
203
+ deliveryId?: string;
204
+ action?: string;
205
+ prNumber?: number;
206
+ prUrl?: string;
207
+ pullRequest?: CursorScmPullRequestMeta;
208
+ originComment?: CursorScmOriginCommentMeta;
209
+ originActor?: CursorScmOriginActorMeta;
210
+ occurredAtMs?: number;
211
+ }): Record<string, unknown>;
212
+ export declare function resolveCursorScmSubscriptions(options: Pick<CursorEventRelayOptions, "repos" | "events" | "subscriptions">): CursorScmSubscription[];
213
+ /**
214
+ * SCM-events relay: a thin {@link CursorRelayCore} adapter. Consumers
168
215
  * keep the same `new CursorEventRelay(options).start()/.stop()` surface.
169
216
  */
170
217
  export declare class CursorEventRelay {
171
218
  private readonly options;
172
219
  private readonly core;
220
+ private readonly subscriptions;
173
221
  /**
174
- * Normalized repos the server confirmed for THIS consumer. The stream is
175
- * shared with sibling consumers of the same principal, so only events for
176
- * these repos may dispatch.
222
+ * Confirmed `provider:repo` keys for THIS consumer, with the event kinds
223
+ * requested for each. The stream is shared with sibling consumers, so
224
+ * GitHub and Origin deliveries for the same owner/name must not mix.
177
225
  */
178
- private subscribedRepos;
179
- private readonly loggedSkippedRepos;
226
+ private subscribedEvents;
227
+ private readonly loggedSkippedKeys;
180
228
  constructor(options: CursorEventRelayOptions);
181
229
  /**
182
230
  * Whether an event from the shared stream belongs to THIS consumer: the
183
- * repo must be one the server confirmed for us and the event kind one the
184
- * mounted channels declared. Anything else came from a sibling consumer's
185
- * subscription and must not fire this host's hooks.
231
+ * provider+repo must be one the server confirmed for us and the event kind
232
+ * one that subscription declared. GitHub and Origin share owner/name slugs
233
+ * on mirrors, so the provider is part of the key.
186
234
  */
187
235
  private shouldDispatch;
188
236
  start(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-event-relay.d.ts","sourceRoot":"","sources":["../../src/internal/cursor-event-relay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,8EA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AAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoE1B;AAUD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC,GAC3E,qBAAqB,EAAE,CAczB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAWf,OAAO,CAAC,QAAQ,CAAC,OAAO;IAVpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkC;IACvD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0B;IACxD;;;;OAIG;IACH,OAAO,CAAC,gBAAgB,CAA0C;IAClE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqB;IAEvD,YAA6B,OAAO,EAAE,uBAAuB,EAsE5D;IAED;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAetB,KAAK,IAAI,IAAI,CAEZ;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1B;CACF"}
@@ -238,29 +238,125 @@ function stubGitHubWorkflowRun(meta, pullRequests) {
238
238
  return object;
239
239
  }
240
240
  /**
241
- * GitHub SCM-events relay: a thin {@link CursorRelayCore} adapter. Consumers
241
+ * Origin webhook envelope from an SCM-events metadata record. One parser
242
+ * handles both live Origin deliveries and this stub: `{ deliveryId, event }`.
243
+ */
244
+ export function scmMetadataToOriginPayload(event) {
245
+ var _a, _b, _c;
246
+ const slash = event.repo.indexOf("/");
247
+ const owner = slash === -1 ? "" : event.repo.slice(0, slash);
248
+ const name = slash === -1 ? event.repo : event.repo.slice(slash + 1);
249
+ const prMeta = event.pullRequest;
250
+ const prNumber = (_a = prMeta === null || prMeta === void 0 ? void 0 : prMeta.number) !== null && _a !== void 0 ? _a : event.prNumber;
251
+ const prUrl = (_c = (_b = prMeta === null || prMeta === void 0 ? void 0 : prMeta.url) !== null && _b !== void 0 ? _b : event.prUrl) !== null && _c !== void 0 ? _c : (prNumber !== undefined
252
+ ? `https://cursor.com/codebase/${owner}/${name}/pull/${prNumber}`
253
+ : undefined);
254
+ const payload = {
255
+ repository: {
256
+ name,
257
+ owner: { slug: owner },
258
+ },
259
+ };
260
+ if (prNumber !== undefined) {
261
+ const pullRequest = {
262
+ number: prNumber,
263
+ url: prUrl,
264
+ };
265
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.title) !== undefined)
266
+ pullRequest.title = prMeta.title;
267
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.body) !== undefined)
268
+ pullRequest.body = prMeta.body;
269
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.draft) !== undefined)
270
+ pullRequest.draft = prMeta.draft;
271
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.merged) !== undefined)
272
+ pullRequest.merged = prMeta.merged;
273
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.headRef) !== undefined || (prMeta === null || prMeta === void 0 ? void 0 : prMeta.headSha) !== undefined) {
274
+ pullRequest.head = {
275
+ ref: prMeta.headRef,
276
+ sha: prMeta.headSha,
277
+ };
278
+ }
279
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.baseRef) !== undefined || (prMeta === null || prMeta === void 0 ? void 0 : prMeta.baseSha) !== undefined) {
280
+ pullRequest.base = {
281
+ ref: prMeta.baseRef,
282
+ sha: prMeta.baseSha,
283
+ };
284
+ }
285
+ if ((prMeta === null || prMeta === void 0 ? void 0 : prMeta.authorLogin) !== undefined) {
286
+ pullRequest.author = { id: prMeta.authorLogin };
287
+ }
288
+ payload.pullRequest = pullRequest;
289
+ }
290
+ const commentMeta = event.originComment;
291
+ if (commentMeta !== undefined) {
292
+ const comment = { id: commentMeta.id };
293
+ if (commentMeta.body !== undefined)
294
+ comment.body = commentMeta.body;
295
+ if (commentMeta.author !== undefined)
296
+ comment.author = commentMeta.author;
297
+ payload.comment = comment;
298
+ }
299
+ if (event.originActor !== undefined) {
300
+ payload.actor = event.originActor;
301
+ }
302
+ return {
303
+ deliveryId: event.deliveryId,
304
+ event: Object.assign(Object.assign({ type: event.eventName }, (event.occurredAtMs === undefined
305
+ ? {}
306
+ : { eventTime: new Date(event.occurredAtMs).toISOString() })), { payload }),
307
+ };
308
+ }
309
+ function subscriptionKey(provider, repo) {
310
+ return `${provider}:${repo.toLowerCase()}`;
311
+ }
312
+ function subscriptionLabel(provider, repo) {
313
+ return provider === "github" ? repo : `${provider}:${repo}`;
314
+ }
315
+ export function resolveCursorScmSubscriptions(options) {
316
+ var _a, _b;
317
+ if (options.subscriptions !== undefined) {
318
+ return options.subscriptions.map((subscription) => ({
319
+ provider: subscription.provider,
320
+ repo: subscription.repo.trim().toLowerCase(),
321
+ events: [...subscription.events],
322
+ }));
323
+ }
324
+ const events = [...((_a = options.events) !== null && _a !== void 0 ? _a : [])];
325
+ return ((_b = options.repos) !== null && _b !== void 0 ? _b : []).map((repo) => ({
326
+ provider: "github",
327
+ repo: repo.trim().toLowerCase(),
328
+ events,
329
+ }));
330
+ }
331
+ /**
332
+ * SCM-events relay: a thin {@link CursorRelayCore} adapter. Consumers
242
333
  * keep the same `new CursorEventRelay(options).start()/.stop()` surface.
243
334
  */
244
335
  export class CursorEventRelay {
245
336
  constructor(options) {
246
337
  this.options = options;
247
338
  /**
248
- * Normalized repos the server confirmed for THIS consumer. The stream is
249
- * shared with sibling consumers of the same principal, so only events for
250
- * these repos may dispatch.
339
+ * Confirmed `provider:repo` keys for THIS consumer, with the event kinds
340
+ * requested for each. The stream is shared with sibling consumers, so
341
+ * GitHub and Origin deliveries for the same owner/name must not mix.
251
342
  */
252
- this.subscribedRepos = new Set();
253
- this.loggedSkippedRepos = new Set();
343
+ this.subscribedEvents = new Map();
344
+ this.loggedSkippedKeys = new Set();
345
+ this.subscriptions = resolveCursorScmSubscriptions(options);
346
+ const requestedEvents = new Map(this.subscriptions.map((subscription) => [
347
+ subscriptionKey(subscription.provider, subscription.repo),
348
+ new Set(subscription.events),
349
+ ]));
254
350
  const adapter = {
255
351
  logPrefix: "cursor-events",
256
352
  subscribePath: "/v0/scm-events/subscriptions",
257
353
  pollPath: "/v0/scm-events",
258
354
  buildRegistrationBody: (consumerId) => ({
259
355
  consumerId,
260
- subscriptions: this.options.repos.map((repo) => ({
261
- provider: "github",
262
- repo,
263
- events: [...this.options.events],
356
+ subscriptions: this.subscriptions.map((subscription) => ({
357
+ provider: subscription.provider,
358
+ repo: subscription.repo,
359
+ events: [...subscription.events],
264
360
  })),
265
361
  }),
266
362
  // Empty subscriptions drop this consumer's registration on clean stop
@@ -270,18 +366,27 @@ export class CursorEventRelay {
270
366
  subscriptions: [],
271
367
  }),
272
368
  applyRegistrationResponse: (json) => {
273
- var _a, _b;
369
+ var _a, _b, _c;
274
370
  const result = json;
275
371
  const statuses = (_a = result.repos) !== null && _a !== void 0 ? _a : [];
276
- this.subscribedRepos = new Set(statuses
277
- .filter((status) => status.isSubscribed)
278
- .map((status) => status.repo));
372
+ this.subscribedEvents = new Map();
279
373
  const lines = [];
280
- for (const status of statuses.filter((s) => !s.isSubscribed)) {
281
- lines.push(`not subscribed to ${status.repo}: ${(_b = status.detail) !== null && _b !== void 0 ? _b : "unknown reason"}`);
374
+ const confirmed = [];
375
+ for (const status of statuses) {
376
+ const provider = status.provider || "github";
377
+ const key = subscriptionKey(provider, status.repo);
378
+ if (!status.isSubscribed) {
379
+ lines.push(`not subscribed to ${subscriptionLabel(provider, status.repo)}: ${(_b = status.detail) !== null && _b !== void 0 ? _b : "unknown reason"}`);
380
+ continue;
381
+ }
382
+ this.subscribedEvents.set(key, (_c = requestedEvents.get(key)) !== null && _c !== void 0 ? _c : new Set());
383
+ confirmed.push(subscriptionLabel(provider, status.repo));
282
384
  }
283
- if (this.subscribedRepos.size > 0) {
284
- lines.push(`subscribed to ${[...this.subscribedRepos].join(", ")} for events: ${this.options.events.join(", ")}`);
385
+ if (confirmed.length > 0) {
386
+ const eventKinds = [
387
+ ...new Set(this.subscriptions.flatMap((s) => [...s.events])),
388
+ ];
389
+ lines.push(`subscribed to ${confirmed.join(", ")} for events: ${eventKinds.join(", ")}`);
285
390
  }
286
391
  return lines;
287
392
  },
@@ -296,19 +401,21 @@ export class CursorEventRelay {
296
401
  }
297
402
  /**
298
403
  * Whether an event from the shared stream belongs to THIS consumer: the
299
- * repo must be one the server confirmed for us and the event kind one the
300
- * mounted channels declared. Anything else came from a sibling consumer's
301
- * subscription and must not fire this host's hooks.
404
+ * provider+repo must be one the server confirmed for us and the event kind
405
+ * one that subscription declared. GitHub and Origin share owner/name slugs
406
+ * on mirrors, so the provider is part of the key.
302
407
  */
303
408
  shouldDispatch(event) {
304
- if (!this.subscribedRepos.has(event.repo)) {
305
- if (!this.loggedSkippedRepos.has(event.repo)) {
306
- this.loggedSkippedRepos.add(event.repo);
307
- this.options.logger(`[agent-sdk] cursor-events: skipping events for ${event.repo}: not in this host's subscription (another consumer of this API key likely subscribed it)`);
409
+ const key = subscriptionKey(event.provider || "github", event.repo);
410
+ const events = this.subscribedEvents.get(key);
411
+ if (events === undefined) {
412
+ if (!this.loggedSkippedKeys.has(key)) {
413
+ this.loggedSkippedKeys.add(key);
414
+ this.options.logger(`[agent-sdk] cursor-events: skipping events for ${subscriptionLabel(event.provider || "github", event.repo)}: not in this host's subscription (another consumer of this API key likely subscribed it)`);
308
415
  }
309
416
  return false;
310
417
  }
311
- return this.options.events.includes(event.eventName);
418
+ return events.has(event.eventName);
312
419
  }
313
420
  start() {
314
421
  this.core.start();
@@ -1 +1 @@
1
-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CAAE,CAAC,CAAC,CA6BzD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,uBAAuB,GAAG;IACjC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACtB,GACL,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC,CAgBzD;AAWD,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,MAAM,CAIrC,CAAC;AAEH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,YAAY,CAAC,CAmEvB;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAElE;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAOnE;AAmuBD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiB3E;AAgyBD,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,CA2JnE"}
@@ -27,11 +27,12 @@ var __rest = (this && this.__rest) || function (s, e) {
27
27
  };
28
28
  import { readdir, readFile, stat } from "node:fs/promises";
29
29
  import { basename, extname, isAbsolute, join, relative, resolve, } from "node:path";
30
+ import { pathToFileURL } from "node:url";
30
31
  import { resolveABMaxPlaygroundSessions } from "../ab.js";
31
32
  import { resolveArtifactsMax } from "../artifacts.js";
32
33
  import { httpChannel } from "../channels.js";
33
34
  import { cursorAccountServersHasMixedWildcard, DEFAULT_MODEL, isInlineStdioConnection, MAX_RUNNING_TURNS_LIMIT, normalizeCursorAccountServers, toPublicCloudInfo, } from "../types.js";
34
- import { importAuthoredModule, registerAuthoredModuleLoaders, } from "./authored-loaders.js";
35
+ import { registerAuthoredModuleLoaders } from "./authored-loaders.js";
35
36
  import { normalizePositiveInt } from "./bounded-int.js";
36
37
  import { getDefinitionKind } from "./brand.js";
37
38
  import { artifactBuiltinTool, builtinTools, TAG_ARTIFACT_TOOL_NAME, } from "./builtin-tools/index.js";
@@ -45,6 +46,11 @@ import { withIdentityPreamble } from "./workspace.js";
45
46
  const MODULE_EXTENSIONS = new Set([".ts", ".mts", ".js", ".mjs"]);
46
47
  const NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
47
48
  const SKILL_DESCRIPTION_FALLBACK = (name) => `Instructions for the ${name} skill.`;
49
+ function defaultImportModule(absolutePath) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ return (yield import(pathToFileURL(absolutePath).href));
52
+ });
53
+ }
48
54
  /**
49
55
  * True when `dir` looks like an agent project root: it has a nested `agent/`
50
56
  * directory, or flat-layout markers (`agent.ts` / `instructions.md`) directly
@@ -193,7 +199,7 @@ export function loadAgentProject(dir_1) {
193
199
  const ctx = {
194
200
  rootDir,
195
201
  diagnostics,
196
- importModule: (_a = options.importModule) !== null && _a !== void 0 ? _a : importAuthoredModule,
202
+ importModule: (_a = options.importModule) !== null && _a !== void 0 ? _a : defaultImportModule,
197
203
  };
198
204
  const name = (_b = (yield readPackageName(rootDir))) !== null && _b !== void 0 ? _b : basename(rootDir);
199
205
  const agent = yield loadAgent(ctx, agentDir, {
@@ -1638,6 +1644,9 @@ export function projectInfo(project) {
1638
1644
  if ((meta === null || meta === void 0 ? void 0 : meta.githubWebhookEvents) !== undefined) {
1639
1645
  info.githubWebhookEvents = meta.githubWebhookEvents;
1640
1646
  }
1647
+ if ((meta === null || meta === void 0 ? void 0 : meta.originWebhookEvents) !== undefined) {
1648
+ info.originWebhookEvents = meta.originWebhookEvents;
1649
+ }
1641
1650
  if ((meta === null || meta === void 0 ? void 0 : meta.slackChannelPosts) !== undefined) {
1642
1651
  info.slackChannelPosts = meta.slackChannelPosts;
1643
1652
  }
@@ -1 +1 @@
1
- {"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../../src/internal/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,sEAAsE;AACtE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,UAAU,EAAE,MAA2B,CAAC;AACrD,eAAO,MAAM,gBAAgB,EAAE,MAAiC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAA+B,CAAC;AAc/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CA0BzC,CAAC"}
1
+ {"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../../src/internal/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,sEAAsE;AACtE,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,UAAU,EAAE,MAA2B,CAAC;AACrD,eAAO,MAAM,gBAAgB,EAAE,MAAiC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAA+B,CAAC;AAc/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,MAAM,CAOvC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAC/C,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CA2BzC,CAAC"}
@@ -80,6 +80,7 @@ export const AUTHORING_ENTRY_FILES = [
80
80
  ["channels", "channels.js"],
81
81
  ["channels/slack", "channels/slack/index.js"],
82
82
  ["channels/github", "channels/github/index.js"],
83
+ ["channels/origin", "channels/origin/index.js"],
83
84
  ["skills", "skills.js"],
84
85
  ["schedules", "schedules.js"],
85
86
  ["reminders", "reminders.js"],
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * Unified entry for dispatching agent-serve triggers from an external ingress
3
- * (e.g. the Cursor backend GitHub webhook). Mirrors Automations'
4
- * `handleAutomationTrigger`, but only GitHub is supported for now.
3
+ * (e.g. the Cursor backend GitHub webhook or Origin cursor-internal tap).
4
+ * Mirrors Automations' `handleAutomationTrigger`.
5
5
  *
6
6
  * Callers must authenticate the delivery before invoking this (the backend
7
- * verifies GitHub HMAC at `/github_webhook`). This fan-out does not re-check
8
- * signatures same trust model as Bugbot after `verifyGithubRequest`.
7
+ * verifies GitHub HMAC at `/github_webhook` and Origin v1ed at the
8
+ * cursor-internal app). This fan-out does not re-check signatures — same
9
+ * trust model as Bugbot after `verifyGithubRequest`.
9
10
  *
10
11
  * Each agent's `onPullRequest` / `onComment` / … hooks decide whether to run.
11
12
  */
12
13
  import type { GitHubChannelOptions } from "../channels/github/types.js";
14
+ import type { OriginChannelOptions } from "../channels/origin/types.js";
13
15
  import type { ChannelHandlerArgs } from "../types.js";
14
16
  export interface AgentServeGitHubTriggerTarget {
15
17
  /** Agent mount slug (empty string in single-agent mode). */
@@ -27,7 +29,18 @@ export interface AgentServeGitHubTriggerEvent {
27
29
  deliveryId?: string;
28
30
  targets: AgentServeGitHubTriggerTarget[];
29
31
  }
30
- export type AgentServeTriggerEvent = AgentServeGitHubTriggerEvent;
32
+ export interface AgentServeOriginTriggerTarget {
33
+ slug: string;
34
+ options: OriginChannelOptions;
35
+ args: ChannelHandlerArgs;
36
+ }
37
+ export interface AgentServeOriginTriggerEvent {
38
+ type: "origin";
39
+ /** Origin envelope JSON (signature already verified by the caller). */
40
+ bodyText: string;
41
+ targets: AgentServeOriginTriggerTarget[];
42
+ }
43
+ export type AgentServeTriggerEvent = AgentServeGitHubTriggerEvent | AgentServeOriginTriggerEvent;
31
44
  export interface AgentServeTriggerTargetResult {
32
45
  slug: string;
33
46
  status: number;
@@ -53,7 +66,21 @@ export declare function collectGitHubTriggerTargets(input: {
53
66
  }>;
54
67
  }): AgentServeGitHubTriggerTarget[];
55
68
  /**
56
- * Dispatch an agent-serve trigger. GitHub only for now.
69
+ * Build fan-out targets from mounted agent projects that export an origin
70
+ * channel created via {@link originChannel}.
71
+ */
72
+ export declare function collectOriginTriggerTargets(input: {
73
+ mounts: Array<{
74
+ slug: string;
75
+ channels: Array<{
76
+ id: string;
77
+ definition: object;
78
+ }>;
79
+ buildHandlerArgs: (channelId: string) => ChannelHandlerArgs;
80
+ }>;
81
+ }): AgentServeOriginTriggerTarget[];
82
+ /**
83
+ * Dispatch an agent-serve trigger. GitHub and Origin webhook fan-out.
57
84
  */
58
85
  export declare function handleAgentServeTrigger(event: AgentServeTriggerEvent): Promise<AgentServeTriggerResult>;
59
86
  //# sourceMappingURL=handleAgentServeTrigger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAgentServeTrigger.d.ts","sourceRoot":"","sources":["../../src/internal/handleAgentServeTrigger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO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