@cursor/july 0.1.105 → 0.1.107

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 (217) hide show
  1. package/dist/bin/agent-serve.js +1 -8
  2. package/dist/channels/bitbucket/types.d.ts +2 -4
  3. package/dist/channels/bitbucket/types.d.ts.map +1 -1
  4. package/dist/channels/deployments/types.d.ts +5 -8
  5. package/dist/channels/deployments/types.d.ts.map +1 -1
  6. package/dist/channels/github/types.d.ts +2 -4
  7. package/dist/channels/github/types.d.ts.map +1 -1
  8. package/dist/channels/gitlab/types.d.ts +2 -5
  9. package/dist/channels/gitlab/types.d.ts.map +1 -1
  10. package/dist/channels/origin/types.d.ts +2 -3
  11. package/dist/channels/origin/types.d.ts.map +1 -1
  12. package/dist/channels/slack/defaults.d.ts.map +1 -1
  13. package/dist/channels/slack/defaults.js +3 -0
  14. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  15. package/dist/channels/slack/dispatch.js +1 -1
  16. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  17. package/dist/channels/slack/live-delivery.js +48 -11
  18. package/dist/channels/slack/types.d.ts +4 -3
  19. package/dist/channels/slack/types.d.ts.map +1 -1
  20. package/dist/docs/404.html +3 -3
  21. package/dist/docs/ab.html +6 -6
  22. package/dist/docs/assets/{app.BVwaffdK.js → app.CtuckIiL.js} +1 -1
  23. package/dist/docs/assets/chunks/@localSearchIndexroot.DXXZxiMv.js +1 -0
  24. package/dist/docs/assets/chunks/{VPLocalSearchBox.WuWTZ1x8.js → VPLocalSearchBox.Bkkhnu8K.js} +2 -2
  25. package/dist/docs/assets/chunks/{theme.BYdI_6sF.js → theme.DhpIe0Pa.js} +2 -2
  26. package/dist/docs/assets/{guides_opentelemetry.md.COh9jFVg.js → guides_opentelemetry.md.SCRMskno.js} +3 -3
  27. package/dist/docs/assets/{guides_opentelemetry.md.COh9jFVg.lean.js → guides_opentelemetry.md.SCRMskno.lean.js} +1 -1
  28. package/dist/docs/assets/{reference_channels.md.DBGcaB7m.js → reference_channels.md.D-qTqwcq.js} +2 -2
  29. package/dist/docs/assets/{reference_channels.md.DBGcaB7m.lean.js → reference_channels.md.D-qTqwcq.lean.js} +1 -1
  30. package/dist/docs/assets/{reference_cli.md.C6Lo8SEd.js → reference_cli.md.Dm67hd2D.js} +1 -1
  31. package/dist/docs/assets/{skills_otel.md.CqhobH3B.js → skills_otel.md.B5Ddv1xH.js} +1 -1
  32. package/dist/docs/assets/{style.BRuM8477.css → style.DCD_zyg3.css} +1 -1
  33. package/dist/docs/building-with-agents.html +6 -6
  34. package/dist/docs/concepts.html +5 -5
  35. package/dist/docs/deployment.html +6 -6
  36. package/dist/docs/evals.html +6 -6
  37. package/dist/docs/guides/agent-to-agent.html +6 -6
  38. package/dist/docs/guides/cloud-agents.html +6 -6
  39. package/dist/docs/guides/convert-automation.html +6 -6
  40. package/dist/docs/guides/github.html +6 -6
  41. package/dist/docs/guides/grokbot-agents.html +6 -6
  42. package/dist/docs/guides/human-in-the-loop.html +6 -6
  43. package/dist/docs/guides/mcp-oauth.html +6 -6
  44. package/dist/docs/guides/opentelemetry.html +8 -8
  45. package/dist/docs/guides/opentelemetry.md +3 -4
  46. package/dist/docs/guides/slack.html +6 -6
  47. package/dist/docs/guides/webhooks.html +6 -6
  48. package/dist/docs/hashmap.json +1 -1
  49. package/dist/docs/hillclimbing.html +6 -6
  50. package/dist/docs/index.html +6 -6
  51. package/dist/docs/llms-full.txt +22 -28
  52. package/dist/docs/quickstart.html +6 -6
  53. package/dist/docs/reference/agent-config.html +6 -6
  54. package/dist/docs/reference/artifacts.html +6 -6
  55. package/dist/docs/reference/channels.html +7 -7
  56. package/dist/docs/reference/channels.md +11 -19
  57. package/dist/docs/reference/cli.html +8 -8
  58. package/dist/docs/reference/cli.md +5 -2
  59. package/dist/docs/reference/connections.html +6 -6
  60. package/dist/docs/reference/extensions.html +6 -6
  61. package/dist/docs/reference/hooks.html +6 -6
  62. package/dist/docs/reference/http-api.html +6 -6
  63. package/dist/docs/reference/instructions.html +6 -6
  64. package/dist/docs/reference/playground.html +5 -5
  65. package/dist/docs/reference/project-layout.html +6 -6
  66. package/dist/docs/reference/prompt.html +6 -6
  67. package/dist/docs/reference/result.html +6 -6
  68. package/dist/docs/reference/schedules.html +6 -6
  69. package/dist/docs/reference/sessions.html +5 -5
  70. package/dist/docs/reference/skills.html +6 -6
  71. package/dist/docs/reference/subagents.html +6 -6
  72. package/dist/docs/reference/tools.html +6 -6
  73. package/dist/docs/scaffolding-agents.html +5 -5
  74. package/dist/docs/skills/ab.html +6 -6
  75. package/dist/docs/skills/create-agent.html +6 -6
  76. package/dist/docs/skills/debug.html +5 -5
  77. package/dist/docs/skills/evals.html +6 -6
  78. package/dist/docs/skills/framework-map.html +5 -5
  79. package/dist/docs/skills/github.html +6 -6
  80. package/dist/docs/skills/hillclimb.html +6 -6
  81. package/dist/docs/skills/index.html +5 -5
  82. package/dist/docs/skills/mcp-auth.html +6 -6
  83. package/dist/docs/skills/otel.html +8 -8
  84. package/dist/docs/skills/otel.md +3 -3
  85. package/dist/docs/skills/setup-slack.html +6 -6
  86. package/dist/docs/storage.html +6 -6
  87. package/dist/docs/templates/agentic-owners.html +6 -6
  88. package/dist/docs/templates/agents-md.html +6 -6
  89. package/dist/docs/templates/code-wiki.html +6 -6
  90. package/dist/docs/templates/demo.html +6 -6
  91. package/dist/docs/templates/grokbot-agents.html +6 -6
  92. package/dist/docs/templates/pr-autofixer.html +6 -6
  93. package/dist/docs/templates/security-help.html +6 -6
  94. package/dist/docs/templates/security-reviewer.html +6 -6
  95. package/dist/docs/templates/triage.html +6 -6
  96. package/dist/docs/troubleshooting.html +5 -5
  97. package/dist/index.d.ts +4 -5
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +3 -4
  100. package/dist/internal/cli-deploy.d.ts.map +1 -1
  101. package/dist/internal/cli-deploy.js +23 -11
  102. package/dist/internal/cursor/backend-client.d.ts +25 -0
  103. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  104. package/dist/internal/cursor/backend-client.js +57 -2
  105. package/dist/internal/deploy-client.d.ts +8 -0
  106. package/dist/internal/deploy-client.d.ts.map +1 -1
  107. package/dist/internal/deploy-client.js +14 -0
  108. package/dist/internal/deploy-manifest.d.ts +3 -0
  109. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  110. package/dist/internal/deploy-manifest.js +15 -12
  111. package/dist/internal/discovery/agent.d.ts.map +1 -1
  112. package/dist/internal/discovery/agent.js +1 -0
  113. package/dist/internal/discovery/info.d.ts.map +1 -1
  114. package/dist/internal/discovery/info.js +7 -3
  115. package/dist/internal/discovery/modules.d.ts +1 -1
  116. package/dist/internal/discovery/modules.d.ts.map +1 -1
  117. package/dist/internal/discovery/modules.js +1 -0
  118. package/dist/internal/discovery/project.d.ts.map +1 -1
  119. package/dist/internal/discovery/project.js +3 -0
  120. package/dist/internal/discovery/reminders.d.ts +7 -0
  121. package/dist/internal/discovery/reminders.d.ts.map +1 -0
  122. package/dist/internal/discovery/reminders.js +65 -0
  123. package/dist/internal/discovery/subagent.js +1 -0
  124. package/dist/internal/distribution.d.ts +5 -0
  125. package/dist/internal/distribution.d.ts.map +1 -1
  126. package/dist/internal/distribution.js +17 -0
  127. package/dist/internal/framework-storage-selection.d.ts +14 -3
  128. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  129. package/dist/internal/framework-storage-selection.js +36 -6
  130. package/dist/internal/guest-network.d.ts.map +1 -1
  131. package/dist/internal/guest-network.js +2 -0
  132. package/dist/internal/hosted-delivery-protocol.d.ts +48 -0
  133. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  134. package/dist/internal/hosted-delivery-protocol.js +60 -0
  135. package/dist/internal/hosted-delivery.d.ts +10 -0
  136. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  137. package/dist/internal/hosted-delivery.js +83 -18
  138. package/dist/internal/local-control-plane.d.ts +18 -2
  139. package/dist/internal/local-control-plane.d.ts.map +1 -1
  140. package/dist/internal/local-control-plane.js +199 -17
  141. package/dist/internal/reminder-control-plane-protocol.d.ts +187 -0
  142. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -0
  143. package/dist/internal/reminder-control-plane-protocol.js +244 -0
  144. package/dist/internal/reminder-runner.d.ts +48 -6
  145. package/dist/internal/reminder-runner.d.ts.map +1 -1
  146. package/dist/internal/reminder-runner.js +336 -48
  147. package/dist/internal/reminder-schedule.d.ts +5 -2
  148. package/dist/internal/reminder-schedule.d.ts.map +1 -1
  149. package/dist/internal/reminder-schedule.js +8 -6
  150. package/dist/internal/reminder-store.d.ts +24 -7
  151. package/dist/internal/reminder-store.d.ts.map +1 -1
  152. package/dist/internal/reminder-store.js +6 -5
  153. package/dist/internal/request-error-status.d.ts +2 -0
  154. package/dist/internal/request-error-status.d.ts.map +1 -1
  155. package/dist/internal/request-error-status.js +22 -3
  156. package/dist/internal/scm/pr-url.d.ts +40 -0
  157. package/dist/internal/scm/pr-url.d.ts.map +1 -1
  158. package/dist/internal/scm/pr-url.js +93 -14
  159. package/dist/internal/server.d.ts.map +1 -1
  160. package/dist/internal/server.js +67 -27
  161. package/dist/internal/session-engine.d.ts +4 -0
  162. package/dist/internal/session-engine.d.ts.map +1 -1
  163. package/dist/internal/session-engine.js +5 -0
  164. package/dist/playground/assets/{index-BaQzjaNK.js → index-Bq2HpEQB.js} +23 -23
  165. package/dist/playground/assets/index-CZKKNlmb.css +1 -0
  166. package/dist/playground/index.html +2 -2
  167. package/dist/reminders.d.ts +24 -5
  168. package/dist/reminders.d.ts.map +1 -1
  169. package/dist/reminders.js +28 -5
  170. package/dist/types.d.ts +89 -20
  171. package/dist/types.d.ts.map +1 -1
  172. package/docs/guides/opentelemetry.md +3 -4
  173. package/docs/reference/channels.md +11 -19
  174. package/docs/reference/cli.md +5 -2
  175. package/package.json +3 -3
  176. package/skills/otel/SKILL.md +3 -3
  177. package/src/bin/agent-serve.ts +1 -9
  178. package/src/channels/bitbucket/types.ts +2 -4
  179. package/src/channels/deployments/types.ts +5 -8
  180. package/src/channels/github/types.ts +2 -4
  181. package/src/channels/gitlab/types.ts +2 -5
  182. package/src/channels/origin/types.ts +2 -3
  183. package/src/channels/slack/defaults.ts +3 -0
  184. package/src/channels/slack/dispatch.ts +1 -0
  185. package/src/channels/slack/live-delivery.ts +53 -12
  186. package/src/channels/slack/types.ts +4 -3
  187. package/src/index.ts +6 -3
  188. package/src/internal/cli-deploy.ts +30 -12
  189. package/src/internal/cursor/backend-client.ts +90 -2
  190. package/src/internal/deploy-client.ts +16 -0
  191. package/src/internal/deploy-manifest.ts +16 -11
  192. package/src/internal/discovery/agent.ts +1 -0
  193. package/src/internal/discovery/info.ts +6 -0
  194. package/src/internal/discovery/modules.ts +2 -4
  195. package/src/internal/discovery/project.ts +3 -0
  196. package/src/internal/discovery/reminders.ts +65 -0
  197. package/src/internal/discovery/subagent.ts +1 -0
  198. package/src/internal/distribution.ts +20 -0
  199. package/src/internal/framework-storage-selection.ts +43 -6
  200. package/src/internal/guest-network.ts +3 -0
  201. package/src/internal/hosted-delivery-protocol.ts +96 -0
  202. package/src/internal/hosted-delivery.ts +154 -27
  203. package/src/internal/local-control-plane.ts +281 -22
  204. package/src/internal/reminder-control-plane-protocol.ts +499 -0
  205. package/src/internal/reminder-runner.ts +421 -48
  206. package/src/internal/reminder-schedule.ts +11 -6
  207. package/src/internal/reminder-store.ts +27 -7
  208. package/src/internal/request-error-status.ts +27 -3
  209. package/src/internal/scm/pr-url.ts +167 -20
  210. package/src/internal/server.ts +69 -16
  211. package/src/internal/session-engine.ts +5 -0
  212. package/src/reminders.ts +35 -4
  213. package/src/types.ts +95 -20
  214. package/dist/docs/assets/chunks/@localSearchIndexroot.CJxMklAy.js +0 -1
  215. package/dist/playground/assets/index-CceqnLTX.css +0 -1
  216. /package/dist/docs/assets/{reference_cli.md.C6Lo8SEd.lean.js → reference_cli.md.Dm67hd2D.lean.js} +0 -0
  217. /package/dist/docs/assets/{skills_otel.md.CqhobH3B.lean.js → skills_otel.md.B5Ddv1xH.lean.js} +0 -0
@@ -2,14 +2,19 @@
2
2
  * Reminder document store used by the local control plane
3
3
  * (`<stateRoot>/control-plane/reminders/`).
4
4
  *
5
- * Handlers (`run` / function `until`) are not serializable — they live only
6
- * in the in-memory {@link ReminderRunner} registry. The control plane holds
7
- * schedule, prompt, target, and status so prompt-form reminders survive
8
- * restart.
5
+ * Anonymous `run` / function `until` handlers are not serializable — they live
6
+ * only in the in-memory {@link ReminderRunner} registry. Named `handler` +
7
+ * `args` and prompt-form reminders survive restart (handlers resolve from
8
+ * `agent/reminders/` on every fire).
9
9
  */
10
- import type { ReminderBusyPolicy, ReminderScheduleKind, ReminderStatus } from "../types.js";
10
+ import type { JsonObject, ReminderBusyPolicy, ReminderScheduleKind, ReminderStatus } from "../types.js";
11
11
  export declare const REMINDER_SNAPSHOT_VERSION: 1;
12
12
  export type { ReminderBusyPolicy, ReminderScheduleKind, ReminderStatus, } from "../types.js";
13
+ /**
14
+ * Internal record status. `firing` is CP claim state and must not appear on
15
+ * public {@link ReminderStatus} / {@link ReminderInfo}.
16
+ */
17
+ export type ReminderRecordStatus = ReminderStatus | "firing";
13
18
  /** Serializable reminder record (no function bodies). */
14
19
  export interface ReminderRecord {
15
20
  version: typeof REMINDER_SNAPSHOT_VERSION;
@@ -25,8 +30,15 @@ export interface ReminderRecord {
25
30
  /** Raw schedule value: every/delay string, cron expression, or ISO `at`. */
26
31
  scheduleValue: string;
27
32
  intervalMs?: number;
28
- /** Prompt form — mutually exclusive with in-memory `run`. */
33
+ /** Prompt form — mutually exclusive with `handler` and in-memory `run`. */
29
34
  prompt?: string;
35
+ /**
36
+ * Named handler stem (`agent/reminders/<name>.ts`). Mutually exclusive with
37
+ * `prompt` and in-memory `run`.
38
+ */
39
+ handler?: string;
40
+ /** Serializable args for {@link handler}. */
41
+ args?: JsonObject;
30
42
  /**
31
43
  * True when create() registered a `run` handler. Handlers are not
32
44
  * serializable; after restart, armed records with this flag and no live
@@ -38,9 +50,14 @@ export interface ReminderRecord {
38
50
  /** Natural-language until (agent-facing); function until is in-memory only. */
39
51
  untilPrompt?: string;
40
52
  busyPolicy: ReminderBusyPolicy;
41
- status: ReminderStatus;
53
+ status: ReminderRecordStatus;
42
54
  disarmReason?: string;
43
55
  fireCount: number;
56
+ /**
57
+ * CAS generation. Cancel/rekey and successful outcome apply bump this so
58
+ * in-flight outcomes cannot resurrect a superseded reminder.
59
+ */
60
+ generation?: number;
44
61
  nextFireAtMs: number;
45
62
  createdAt: string;
46
63
  updatedAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"reminder-store.d.ts","sourceRoot":"","sources":["../../src/internal/reminder-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AAEpD,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,yBAAyB,CAAC;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,EAAE,oBAAoB,CAAC;IACnC,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAC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EhD,OAAO,CAAC,QAAQ;IAIV,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhC;IAEK,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAiBtC;IAEK,SAAS,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAI3C;IAEK,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAsBzD;IAEK,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhD;IAEK,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtC;CACF"}
@@ -2,10 +2,10 @@
2
2
  * Reminder document store used by the local control plane
3
3
  * (`<stateRoot>/control-plane/reminders/`).
4
4
  *
5
- * Handlers (`run` / function `until`) are not serializable — they live only
6
- * in the in-memory {@link ReminderRunner} registry. The control plane holds
7
- * schedule, prompt, target, and status so prompt-form reminders survive
8
- * restart.
5
+ * Anonymous `run` / function `until` handlers are not serializable — they live
6
+ * only in the in-memory {@link ReminderRunner} registry. Named `handler` +
7
+ * `args` and prompt-form reminders survive restart (handlers resolve from
8
+ * `agent/reminders/` on every fire).
9
9
  */
10
10
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11
11
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -74,7 +74,8 @@ export class ReminderStore {
74
74
  listArmed() {
75
75
  return __awaiter(this, void 0, void 0, function* () {
76
76
  const all = yield this.list();
77
- return all.filter((r) => r.status === "armed");
77
+ // Treat in-flight claims as still armed for restart / listing purposes.
78
+ return all.filter((r) => r.status === "armed" || r.status === "firing");
78
79
  });
79
80
  }
80
81
  get(id) {
@@ -1,7 +1,9 @@
1
+ import { type HostedGuestRetryDisposition } from "./hosted-delivery-protocol.js";
1
2
  export interface MappedRequestError {
2
3
  status: 400 | 403 | 409 | 503;
3
4
  code: string;
4
5
  message: string;
6
+ retry: HostedGuestRetryDisposition;
5
7
  }
6
8
  /**
7
9
  * Expected throw → HTTP mapping used by `handleRequest` and hosted flush.
@@ -1 +1 @@
1
- {"version":3,"file":"request-error-status.d.ts","sourceRoot":"","sources":["../../src/internal/request-error-status.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GACb,kBAAkB,GAAG,SAAS,CA4ChC;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAElE"}
1
+ {"version":3,"file":"request-error-status.d.ts","sourceRoot":"","sources":["../../src/internal/request-error-status.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,2BAA2B,EACjC,MAAM,+BAA+B,CAAC;AAGvC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,2BAA2B,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GACb,kBAAkB,GAAG,SAAS,CA8DhC;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAElE"}
@@ -1,6 +1,7 @@
1
1
  import { InvalidAsOfError, VacuousTimeArgsError } from "./as-of.js";
2
2
  import { V2EngineError } from "./continuation-identity.js";
3
3
  import { GUEST_CONNECT_STALLED, GUEST_NETWORK_UNAVAILABLE, GuestNetworkUnavailableError, hasGuestNetworkErrno, isQuietGuestConnectStall, } from "./guest-network.js";
4
+ import { HOSTED_GUEST_RETRY_TERMINAL, HOSTED_GUEST_RETRY_TRANSIENT, } from "./hosted-delivery-protocol.js";
4
5
  import { SessionAuthError, SessionBusyError } from "./session-engine.js";
5
6
  /**
6
7
  * Expected throw → HTTP mapping used by `handleRequest` and hosted flush.
@@ -8,21 +9,37 @@ import { SessionAuthError, SessionBusyError } from "./session-engine.js";
8
9
  */
9
10
  export function mapThrownRequestError(error) {
10
11
  if (error instanceof SessionBusyError) {
11
- return { status: 409, code: "session_busy", message: error.message };
12
+ return {
13
+ status: 409,
14
+ code: "session_busy",
15
+ message: error.message,
16
+ retry: HOSTED_GUEST_RETRY_TRANSIENT,
17
+ };
12
18
  }
13
19
  if (error instanceof V2EngineError) {
14
20
  return {
15
21
  status: 409,
16
22
  code: "v2_identity_conflict",
17
23
  message: "Control-plane session identity conflicts with existing state.",
24
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
18
25
  };
19
26
  }
20
27
  if (error instanceof SessionAuthError) {
21
- return { status: 403, code: "forbidden", message: error.message };
28
+ return {
29
+ status: 403,
30
+ code: "forbidden",
31
+ message: error.message,
32
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
33
+ };
22
34
  }
23
35
  if (error instanceof InvalidAsOfError ||
24
36
  error instanceof VacuousTimeArgsError) {
25
- return { status: 400, code: "invalid_request", message: error.message };
37
+ return {
38
+ status: 400,
39
+ code: "invalid_request",
40
+ message: error.message,
41
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
42
+ };
26
43
  }
27
44
  if (error instanceof GuestNetworkUnavailableError ||
28
45
  hasGuestNetworkErrno(error)) {
@@ -32,6 +49,7 @@ export function mapThrownRequestError(error) {
32
49
  message: error instanceof Error
33
50
  ? error.message
34
51
  : "Guest network is not ready for outbound requests.",
52
+ retry: HOSTED_GUEST_RETRY_TRANSIENT,
35
53
  };
36
54
  }
37
55
  if (isQuietGuestConnectStall(error)) {
@@ -41,6 +59,7 @@ export function mapThrownRequestError(error) {
41
59
  message: error instanceof Error
42
60
  ? error.message
43
61
  : "Guest Connect stalled without a network errno.",
62
+ retry: HOSTED_GUEST_RETRY_TRANSIENT,
44
63
  };
45
64
  }
46
65
  return undefined;
@@ -1,8 +1,18 @@
1
1
  /**
2
2
  * Provider-neutral PR URL parse. GitHub.com plus the Origin page shapes
3
3
  * humans paste: cursor.com/codebase, review.cursor.com/pr, origin.cursor.com.
4
+ *
5
+ * {@link parseScmPrUrl} is the wider parse the review seams use: it also
6
+ * recognizes GitLab merge requests (`/-/merge_requests/<iid>` on any host),
7
+ * Bitbucket Cloud / Data Center pull requests, and GitHub Enterprise Server
8
+ * (`/<owner>/<repo>/pull/<n>` on a host that is none of the above). The
9
+ * narrow {@link parsePrUrl} keeps its github.com + Origin contract for the
10
+ * free-text callers (Slack `pr-ref`) where "any host with /pull/N" would be
11
+ * too eager.
4
12
  */
5
13
  export type PrProvider = "github" | "origin";
14
+ /** Every SCM the review seams can address. */
15
+ export type ScmPrProvider = PrProvider | "gitlab" | "bitbucket";
6
16
  export type ParsedPrUrl = {
7
17
  provider: PrProvider;
8
18
  owner: string;
@@ -10,5 +20,35 @@ export type ParsedPrUrl = {
10
20
  number: number;
11
21
  url: string;
12
22
  };
23
+ export type ParsedScmPrUrl = {
24
+ provider: ScmPrProvider;
25
+ /**
26
+ * Namespace half of the repo: GitHub owner, GitLab group path (nested
27
+ * groups joined with `/`), Bitbucket workspace / project key (`~user`
28
+ * for Data Center personal repos).
29
+ */
30
+ owner: string;
31
+ repo: string;
32
+ number: number;
33
+ /** Canonical PR page URL. */
34
+ url: string;
35
+ /**
36
+ * Hostname the PR lives on (lowercase). `github.com` for dotcom, the
37
+ * GHES hostname for GitHub Enterprise, `gitlab.com` or the self-managed
38
+ * host for GitLab, `bitbucket.org` or the Data Center host for Bitbucket.
39
+ * Origin PRs report the Origin page host.
40
+ */
41
+ host: string;
42
+ };
43
+ /** github.com and Origin only — the contract free-text PR references use. */
13
44
  export declare function parsePrUrl(raw: string): ParsedPrUrl | undefined;
45
+ /**
46
+ * Every provider shape, including GitHub Enterprise Server. The GitLab and
47
+ * Bitbucket path shapes are unambiguous on any host; a plain
48
+ * `/<owner>/<repo>/pull/<n>` on a host that is not github.com, Origin,
49
+ * GitLab, or Bitbucket is taken as GHES (the only remaining forge with that
50
+ * route). Callers that must not accept arbitrary hosts use
51
+ * {@link parsePrUrl}.
52
+ */
53
+ export declare function parseScmPrUrl(raw: string): ParsedScmPrUrl | undefined;
14
54
  //# sourceMappingURL=pr-url.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pr-url.d.ts","sourceRoot":"","sources":["../../../src/internal/scm/pr-url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAuCF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CA0C/D"}
1
+ {"version":3,"file":"pr-url.d.ts","sourceRoot":"","sources":["../../../src/internal/scm/pr-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7C,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAoDF,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAY/D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAyHrE"}
@@ -1,6 +1,14 @@
1
1
  /**
2
2
  * Provider-neutral PR URL parse. GitHub.com plus the Origin page shapes
3
3
  * humans paste: cursor.com/codebase, review.cursor.com/pr, origin.cursor.com.
4
+ *
5
+ * {@link parseScmPrUrl} is the wider parse the review seams use: it also
6
+ * recognizes GitLab merge requests (`/-/merge_requests/<iid>` on any host),
7
+ * Bitbucket Cloud / Data Center pull requests, and GitHub Enterprise Server
8
+ * (`/<owner>/<repo>/pull/<n>` on a host that is none of the above). The
9
+ * narrow {@link parsePrUrl} keeps its github.com + Origin contract for the
10
+ * free-text callers (Slack `pr-ref`) where "any host with /pull/N" would be
11
+ * too eager.
4
12
  */
5
13
  const ORIGIN_PAGE = /^origin(-[a-z0-9]+)?\.cursor\.com$/i;
6
14
  function positiveInt(raw) {
@@ -13,14 +21,18 @@ function positiveInt(raw) {
13
21
  }
14
22
  return n;
15
23
  }
16
- function parsed(provider, owner, repo, number) {
17
- if (owner === undefined || repo === undefined || number === undefined) {
24
+ function parsed(provider, host, owner, repo, number, url) {
25
+ if (owner === undefined ||
26
+ owner === "" ||
27
+ repo === undefined ||
28
+ repo === "" ||
29
+ number === undefined) {
18
30
  return undefined;
19
31
  }
20
- const url = provider === "origin"
32
+ const canonical = url !== null && url !== void 0 ? url : (provider === "origin"
21
33
  ? `https://cursor.com/codebase/${owner}/${repo}/pull/${number}`
22
- : `https://github.com/${owner}/${repo}/pull/${number}`;
23
- return { provider, owner, repo, number, url };
34
+ : `https://${host}/${owner}/${repo}/pull/${number}`);
35
+ return { provider, owner, repo, number, url: canonical, host };
24
36
  }
25
37
  /** Strip Slack mrkdwn wrappers and trailing punctuation before `URL`. */
26
38
  function normalizeRaw(raw) {
@@ -29,7 +41,32 @@ function normalizeRaw(raw) {
29
41
  .replace(/^[<[]+/, "")
30
42
  .replace(/[>\].,;]+$/, "");
31
43
  }
44
+ function isGithubDotCom(host) {
45
+ return host === "github.com" || host === "www.github.com";
46
+ }
47
+ /** github.com and Origin only — the contract free-text PR references use. */
32
48
  export function parsePrUrl(raw) {
49
+ const wide = parseScmPrUrl(raw);
50
+ if (wide === undefined) {
51
+ return undefined;
52
+ }
53
+ if (wide.provider === "origin") {
54
+ return Object.assign(Object.assign({}, wide), { provider: "origin" });
55
+ }
56
+ if (wide.provider === "github" && isGithubDotCom(wide.host)) {
57
+ return Object.assign(Object.assign({}, wide), { provider: "github" });
58
+ }
59
+ return undefined;
60
+ }
61
+ /**
62
+ * Every provider shape, including GitHub Enterprise Server. The GitLab and
63
+ * Bitbucket path shapes are unambiguous on any host; a plain
64
+ * `/<owner>/<repo>/pull/<n>` on a host that is not github.com, Origin,
65
+ * GitLab, or Bitbucket is taken as GHES (the only remaining forge with that
66
+ * route). Callers that must not accept arbitrary hosts use
67
+ * {@link parsePrUrl}.
68
+ */
69
+ export function parseScmPrUrl(raw) {
33
70
  let url;
34
71
  try {
35
72
  url = new URL(normalizeRaw(raw));
@@ -37,29 +74,71 @@ export function parsePrUrl(raw) {
37
74
  catch (_a) {
38
75
  return undefined;
39
76
  }
77
+ if (url.protocol !== "https:" && url.protocol !== "http:") {
78
+ return undefined;
79
+ }
40
80
  const parts = url.pathname.split("/").filter(Boolean);
41
81
  const host = url.hostname.toLowerCase();
42
- if ((host === "github.com" || host === "www.github.com") &&
43
- parts.length >= 4 &&
44
- parts[2] === "pull") {
45
- return parsed("github", parts[0], parts[1], positiveInt(parts[3]));
46
- }
47
82
  if (ORIGIN_PAGE.test(host) && parts.length >= 4 && parts[2] === "github") {
48
- return parsed("origin", parts[0], parts[1], positiveInt(parts[3]));
83
+ return parsed("origin", host, parts[0], parts[1], positiveInt(parts[3]));
49
84
  }
50
85
  if ((host === "cursor.com" || host === "www.cursor.com") &&
51
86
  parts[0] === "codebase" &&
52
87
  parts.length >= 5 &&
53
88
  parts[3] === "pull") {
54
- return parsed("origin", parts[1], parts[2], positiveInt(parts[4]));
89
+ return parsed("origin", host, parts[1], parts[2], positiveInt(parts[4]));
55
90
  }
56
91
  if (host === "review.cursor.com" && parts[0] === "pr") {
57
92
  if (parts.length >= 5 && parts[3] === "github") {
58
- return parsed("origin", parts[1], parts[2], positiveInt(parts[4]));
93
+ return parsed("origin", host, parts[1], parts[2], positiveInt(parts[4]));
59
94
  }
60
95
  if (parts.length >= 4) {
61
- return parsed("origin", parts[1], parts[2], positiveInt(parts[3]));
96
+ return parsed("origin", host, parts[1], parts[2], positiveInt(parts[3]));
62
97
  }
63
98
  }
99
+ // GitLab MR page: /<group>/[<subgroup>/…]<project>/-/merge_requests/<iid>
100
+ const separator = parts.indexOf("-");
101
+ if (separator >= 2 &&
102
+ parts[separator + 1] === "merge_requests" &&
103
+ parts.length >= separator + 3) {
104
+ const owner = parts.slice(0, separator - 1).join("/");
105
+ const repo = parts[separator - 1];
106
+ const number = positiveInt(parts[separator + 2]);
107
+ return parsed("gitlab", host, owner, repo, number, number === undefined
108
+ ? undefined
109
+ : `https://${host}/${owner}/${repo}/-/merge_requests/${number}`);
110
+ }
111
+ // Bitbucket Cloud: bitbucket.org/<workspace>/<slug>/pull-requests/<id>
112
+ if ((host === "bitbucket.org" || host === "www.bitbucket.org") &&
113
+ parts.length >= 4 &&
114
+ parts[2] === "pull-requests") {
115
+ const number = positiveInt(parts[3]);
116
+ return parsed("bitbucket", "bitbucket.org", parts[0], parts[1], number, number === undefined
117
+ ? undefined
118
+ : `https://bitbucket.org/${parts[0]}/${parts[1]}/pull-requests/${number}`);
119
+ }
120
+ // Bitbucket Data Center: [/<context>]/projects/<KEY>/repos/<slug>/pull-requests/<id>
121
+ // (personal repos: /users/<name>/repos/<slug>/…, full name `~name/slug`).
122
+ const dc = parts.findIndex((part, index) => (part === "projects" || part === "users") &&
123
+ parts[index + 2] === "repos" &&
124
+ parts[index + 4] === "pull-requests");
125
+ if (dc !== -1 && parts.length >= dc + 6) {
126
+ const number = positiveInt(parts[dc + 5]);
127
+ const owner = parts[dc] === "users" ? `~${parts[dc + 1]}` : parts[dc + 1];
128
+ const slug = parts[dc + 3];
129
+ const context = parts.slice(0, dc).join("/");
130
+ return parsed("bitbucket", host, owner, slug, number, number === undefined
131
+ ? undefined
132
+ : `${url.origin}/${context === "" ? "" : `${context}/`}${parts.slice(dc, dc + 4).join("/")}/pull-requests/${number}`);
133
+ }
134
+ // GitHub (dotcom or Enterprise Server): /<owner>/<repo>/pull/<n>. Checked
135
+ // last so the forge-specific shapes above win on shared hosts.
136
+ if (parts.length >= 4 &&
137
+ parts[2] === "pull" &&
138
+ !ORIGIN_PAGE.test(host) &&
139
+ !/(^|\.)cursor\.com$/.test(host)) {
140
+ const githubHost = isGithubDotCom(host) ? "github.com" : host;
141
+ return parsed("github", githubHost, parts[0], parts[1], positiveInt(parts[3]));
142
+ }
64
143
  return undefined;
65
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoDH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AA2FrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AA8CpE,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AASpE,OAAO,EAEL,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAsB,mBAAmB,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AAqB,CAAC;IACxC,yEAAyE;IACzE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAC5D,wEAAwE;IACxE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CA4nC3B"}
@@ -62,6 +62,7 @@ import { GUEST_NETWORK_PATH, guestNetworkReadinessResponse, } from "./guest-netw
62
62
  import { collectGitHubTriggerTargets, collectOriginTriggerTargets, handleAgentServeTrigger, } from "./handleAgentServeTrigger.js";
63
63
  import { createHostPlatforms, warmupHostGitHubAuth } from "./host-platforms.js";
64
64
  import { registerHostedDeliveryRoute } from "./hosted-delivery.js";
65
+ import { HOSTED_DELIVERY_HEADER, HOSTED_GUEST_RETRY_TERMINAL, hostedGuestErrorResponse, } from "./hosted-delivery-protocol.js";
65
66
  import { hostedErrorStackSnippet } from "./hosted-execution-diag.js";
66
67
  import { flushHostedExecutionProcessDeath } from "./hosted-execution-flush.js";
67
68
  import { buildHttpChannelRoutes, errorResponse, jsonResponse, readJsonObject, requireSessionOwner, } from "./http-channel.js";
@@ -82,7 +83,7 @@ import { createCursorHostedPlatformTimers } from "./platform-timers.js";
82
83
  import { renderAgentsIndexHtml, renderPlaygroundAsset, renderPlaygroundIndexHtml, } from "./playground/static.js";
83
84
  import { ensurePlaygroundBundle, playgroundDevBaseFromEnv, playgroundDevBasePath, startPlaygroundDevServer, } from "./playground/toolchain.js";
84
85
  import { collectMemoryHealthFields, sumEventLogStats, } from "./process-memory-telemetry.js";
85
- import { ReminderRunner, ReminderValidationError, UnknownReminderError, } from "./reminder-runner.js";
86
+ import { ReminderRunner, ReminderValidationError, rejectAnonymousReminderHandlers, UnknownReminderError, } from "./reminder-runner.js";
86
87
  import { mapThrownRequestError } from "./request-error-status.js";
87
88
  import { assertAccountConnectionsNotAnonymous, resolveMountConnections, validateMountConnectionsConfig, } from "./resolved-connections.js";
88
89
  import { Router } from "./router.js";
@@ -126,8 +127,8 @@ function isV2Project(project) {
126
127
  export function startServer(mounts_1) {
127
128
  return __awaiter(this, arguments, void 0, function* (mounts, options = {}) {
128
129
  var _a, _b, _c, _d, _e, _f;
129
- var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
130
- var _6;
130
+ var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
131
+ var _7;
131
132
  if (mounts.length === 0) {
132
133
  throw new Error("startServer requires at least one agent mount");
133
134
  }
@@ -144,13 +145,13 @@ export function startServer(mounts_1) {
144
145
  const playground = (_j = options.playground) !== null && _j !== void 0 ? _j : true;
145
146
  const hosted = options;
146
147
  const noControlPlane = hosted.noControlPlane === true;
147
- const scmProxyRequested = hosted.cursorScmProxy === true || hosted.cursorGithubProxy === true;
148
+ const scmProxyRequested = hosted.cursorScmProxy === true;
148
149
  const runSchedules = (_k = options.schedules) !== null && _k !== void 0 ? _k : !dev;
149
150
  const runReminders = (_l = options.reminders) !== null && _l !== void 0 ? _l : !dev;
150
151
  // CURSOR_AGENTKIT_VERSION is still the env the SDK reads when building
151
152
  // its client-version header (wire prefix remains `agentkit-`). Setting it
152
153
  // here makes the internal-only agentkit_enabled gate apply to every turn.
153
- (_m = (_6 = process.env).CURSOR_AGENTKIT_VERSION) !== null && _m !== void 0 ? _m : (_6.CURSOR_AGENTKIT_VERSION = packageVersion());
154
+ (_m = (_7 = process.env).CURSOR_AGENTKIT_VERSION) !== null && _m !== void 0 ? _m : (_7.CURSOR_AGENTKIT_VERSION = packageVersion());
154
155
  const authoredOtel = pickAuthoredOtel(mounts.map((m) => ({
155
156
  slug: m.slug,
156
157
  name: m.project.name,
@@ -560,19 +561,32 @@ export function startServer(mounts_1) {
560
561
  }
561
562
  const scheduleRunner = new ScheduleRunner(engine, project, logger);
562
563
  let reminderRunner;
564
+ const architecture = project.agent.architecture;
565
+ const useReminderCpProtocol = !noControlPlane && architecture === "v2";
563
566
  const localControlPlane = noControlPlane
564
567
  ? undefined
565
- : yield createLocalControlPlane({
566
- fireSchedule: (name) => scheduleRunner.dispatch(name),
567
- fireReminder: (id, fireCount) => reminderRunner.dispatch(id, { expectedFireCount: fireCount }),
568
- stateDir: join(stateRoot, "control-plane"),
569
- armReminderClocks: runReminders,
570
- logger,
571
- });
568
+ : yield createLocalControlPlane(Object.assign(Object.assign({ fireSchedule: (name) => scheduleRunner.dispatch(name) }, (useReminderCpProtocol
569
+ ? {
570
+ executeReminder: (descriptor) => reminderRunner.executeFire(descriptor),
571
+ }
572
+ : {
573
+ fireReminder: (id, fireCount) => reminderRunner.dispatch(id, {
574
+ expectedFireCount: fireCount,
575
+ }),
576
+ })), { stateDir: join(stateRoot, "control-plane"), armReminderClocks: runReminders, logger }));
572
577
  const timerClient = noControlPlane
573
578
  ? createCursorHostedPlatformTimers()
574
579
  : localControlPlane;
575
- reminderRunner = new ReminderRunner(engine, logger, timerClient);
580
+ reminderRunner = new ReminderRunner(engine, logger, timerClient, {
581
+ namedHandlers: (_z = project.reminders) !== null && _z !== void 0 ? _z : [],
582
+ // Architecture v2 rejects anonymous run/until everywhere (local + hosted).
583
+ rejectAnonymousHandlers: rejectAnonymousReminderHandlers({
584
+ noControlPlane,
585
+ architecture,
586
+ }),
587
+ architecture,
588
+ controlPlane: useReminderCpProtocol ? localControlPlane : undefined,
589
+ });
576
590
  const evalRuns = new EvalRunStore(project.rootDir, logger,
577
591
  // Playground eval history mirrors onto the defineStorage evals table.
578
592
  (_d = engine.storage) === null || _d === void 0 ? void 0 : _d.evalRuns());
@@ -630,6 +644,7 @@ export function startServer(mounts_1) {
630
644
  if (definition.onStart !== undefined) {
631
645
  const startArgs = {
632
646
  send: (message, sendOptions) => engine.send(channel.id, message, sendOptions),
647
+ architecture: project.agent.architecture,
633
648
  getSession: (sessionId) => engine.getChannelSession(channel.id, sessionId),
634
649
  receive: (target, input) => engine.receive(target, input),
635
650
  callTool: (toolName, input, callOptions) => engine.callTool(toolName, input, callOptions),
@@ -652,7 +667,7 @@ export function startServer(mounts_1) {
652
667
  }
653
668
  catch (error) {
654
669
  logger(`[agent-sdk] channel "${channel.id}" onStart failed: ${error instanceof Error
655
- ? ((_z = error.stack) !== null && _z !== void 0 ? _z : error.message)
670
+ ? ((_0 = error.stack) !== null && _0 !== void 0 ? _0 : error.message)
656
671
  : String(error)}`);
657
672
  }
658
673
  }
@@ -775,8 +790,8 @@ export function startServer(mounts_1) {
775
790
  const routeContinuation = localControlPlaneRoute(runtimes);
776
791
  const cursorEventsCommon = {
777
792
  config: effectiveCursorEvents,
778
- githubRepos: (_0 = (_e = cursorGithubConfig.cursorEvents) === null || _e === void 0 ? void 0 : _e.repos) !== null && _0 !== void 0 ? _0 : [],
779
- originRepos: (_1 = cursorOriginScope === null || cursorOriginScope === void 0 ? void 0 : cursorOriginScope.repos) !== null && _1 !== void 0 ? _1 : [],
793
+ githubRepos: (_1 = (_e = cursorGithubConfig.cursorEvents) === null || _e === void 0 ? void 0 : _e.repos) !== null && _1 !== void 0 ? _1 : [],
794
+ originRepos: (_2 = cursorOriginScope === null || cursorOriginScope === void 0 ? void 0 : cursorOriginScope.repos) !== null && _2 !== void 0 ? _2 : [],
780
795
  stateRoot: options.stateRoot,
781
796
  auth: cursorEventsAuth,
782
797
  logger,
@@ -805,9 +820,9 @@ export function startServer(mounts_1) {
805
820
  const server = createServer((req, res) => {
806
821
  void instrumentHttp(otelRuntime, req, res, () => handleRequest(router, req, res, logger));
807
822
  });
808
- const host = (_2 = options.host) !== null && _2 !== void 0 ? _2 : "127.0.0.1";
823
+ const host = (_3 = options.host) !== null && _3 !== void 0 ? _3 : "127.0.0.1";
809
824
  const portWasExplicit = options.port !== undefined;
810
- const requestedPort = (_3 = options.port) !== null && _3 !== void 0 ? _3 : DEFAULT_SERVE_PORT;
825
+ const requestedPort = (_4 = options.port) !== null && _4 !== void 0 ? _4 : DEFAULT_SERVE_PORT;
811
826
  let boundPort;
812
827
  try {
813
828
  boundPort = yield listenHttpServer({
@@ -829,7 +844,7 @@ export function startServer(mounts_1) {
829
844
  const address = server.address();
830
845
  const displayHost = host === "0.0.0.0" || host === "::" ? "127.0.0.1" : host;
831
846
  const url = `http://${displayHost}:${boundPort}`;
832
- const oauthOrigin = ((_4 = options.publicUrl) !== null && _4 !== void 0 ? _4 : url).replace(/\/$/, "");
847
+ const oauthOrigin = ((_5 = options.publicUrl) !== null && _5 !== void 0 ? _5 : url).replace(/\/$/, "");
833
848
  // Resolve peer + Cursor account MCP connections now that the listen port is
834
849
  // known (see resolved-connections.ts for the URL/runtime rules).
835
850
  for (const runtime of runtimes) {
@@ -865,7 +880,7 @@ export function startServer(mounts_1) {
865
880
  runtime.project.agent.cloud !== undefined;
866
881
  if ((hasServerTools || bridgeableNames.length > 0) && cloudCapable) {
867
882
  const basePath = runtime.slug === "" ? "" : `/${runtime.slug}`;
868
- const publicToolsUrl = (_5 = options.cloudToolsUrl) !== null && _5 !== void 0 ? _5 : (options.publicUrl === undefined
883
+ const publicToolsUrl = (_6 = options.cloudToolsUrl) !== null && _6 !== void 0 ? _6 : (options.publicUrl === undefined
869
884
  ? undefined
870
885
  : `${options.publicUrl.replace(/\/$/, "")}${basePath}${TOOL_MCP_ENDPOINT_PATH}`);
871
886
  if (publicToolsUrl === undefined) {
@@ -1085,7 +1100,7 @@ function mountAgentRoutes(router, runtime, args) {
1085
1100
  runtime,
1086
1101
  channelId,
1087
1102
  hostedSessionId,
1088
- }), drainSessionDurability: (sessionId) => engine.drainSessionDurability(sessionId), flushOtel: args.flushOtel }, (args.diagStateRoot === undefined
1103
+ }), fireReminder: (reminderId, fireCount) => reminderRunner.dispatch(reminderId, { expectedFireCount: fireCount }), drainSessionDurability: (sessionId) => engine.drainSessionDurability(sessionId), flushOtel: args.flushOtel }, (args.diagStateRoot === undefined
1089
1104
  ? {}
1090
1105
  : { stateRoot: args.diagStateRoot })), (sessionRunLog === undefined
1091
1106
  ? {}
@@ -2198,15 +2213,25 @@ function handleRequest(router, req, res, logger) {
2198
2213
  return __awaiter(this, void 0, void 0, function* () {
2199
2214
  var _a, _b, _c;
2200
2215
  let response;
2216
+ let hostedDeliveryRequest = false;
2201
2217
  const method = (_a = req.method) !== null && _a !== void 0 ? _a : "GET";
2202
2218
  try {
2203
2219
  const request = yield toFetchRequest(req);
2220
+ hostedDeliveryRequest = request.headers.get(HOSTED_DELIVERY_HEADER) === "1";
2221
+ const requestErrorResponse = (status, error, message) => hostedDeliveryRequest
2222
+ ? hostedGuestErrorResponse({
2223
+ status,
2224
+ error,
2225
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
2226
+ message,
2227
+ })
2228
+ : errorResponse(status, error, message);
2204
2229
  const url = new URL(request.url);
2205
2230
  const match = router.match(request.method, url.pathname);
2206
2231
  if (match === undefined) {
2207
2232
  response = router.hasPath(url.pathname)
2208
- ? errorResponse(405, "method_not_allowed", `${request.method} is not supported on ${url.pathname}.`)
2209
- : errorResponse(404, "not_found", `No route for ${request.method} ${url.pathname}.`);
2233
+ ? requestErrorResponse(405, "method_not_allowed", `${request.method} is not supported on ${url.pathname}.`)
2234
+ : requestErrorResponse(404, "not_found", `No route for ${request.method} ${url.pathname}.`);
2210
2235
  }
2211
2236
  else {
2212
2237
  const requestIp = (_b = req.socket.remoteAddress) !== null && _b !== void 0 ? _b : null;
@@ -2217,7 +2242,7 @@ function handleRequest(router, req, res, logger) {
2217
2242
  unauthorized = auth === null;
2218
2243
  }
2219
2244
  response = unauthorized
2220
- ? errorResponse(401, "unauthorized", "No auth policy admitted this request. In production, configure channel auth (e.g. bearerAuth) — the default localDevStrict() policy only admits loopback callers with a loopback Host.")
2245
+ ? requestErrorResponse(401, "unauthorized", "No auth policy admitted this request. In production, configure channel auth (e.g. bearerAuth) — the default localDevStrict() policy only admits loopback callers with a loopback Host.")
2221
2246
  : yield match.route.handler(request, {
2222
2247
  params: match.params,
2223
2248
  requestIp,
@@ -2228,16 +2253,31 @@ function handleRequest(router, req, res, logger) {
2228
2253
  catch (error) {
2229
2254
  const mapped = mapThrownRequestError(error);
2230
2255
  if (mapped !== undefined) {
2231
- response = errorResponse(mapped.status, mapped.code, mapped.message);
2256
+ response = hostedDeliveryRequest
2257
+ ? hostedGuestErrorResponse({
2258
+ status: mapped.status,
2259
+ error: mapped.code,
2260
+ retry: mapped.retry,
2261
+ message: mapped.message,
2262
+ })
2263
+ : errorResponse(mapped.status, mapped.code, mapped.message);
2232
2264
  }
2233
2265
  else {
2234
2266
  logger(`[agent-sdk] request failed: ${error instanceof Error
2235
2267
  ? ((_c = error.stack) !== null && _c !== void 0 ? _c : error.message)
2236
2268
  : String(error)}`);
2237
2269
  const snippet = hostedErrorStackSnippet(error);
2238
- response = errorResponse(500, "internal_error", snippet.length > 0
2270
+ const message = snippet.length > 0
2239
2271
  ? `Internal server error: ${snippet}`
2240
- : "Internal server error.");
2272
+ : "Internal server error.";
2273
+ response = hostedDeliveryRequest
2274
+ ? hostedGuestErrorResponse({
2275
+ status: 500,
2276
+ error: "internal_error",
2277
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
2278
+ message,
2279
+ })
2280
+ : errorResponse(500, "internal_error", message);
2241
2281
  }
2242
2282
  }
2243
2283
  try {
@@ -715,6 +715,10 @@ export declare class SessionEngine {
715
715
  * conversation whose blobs persisted but whose record (which selects the
716
716
  * conversation to hydrate) never reached the sink. No-op without a
717
717
  * storage mirror.
718
+ *
719
+ * Under a debounced event policy the turn-end flush is a timer, not the
720
+ * chain's tail, so flush explicitly before waiting on the queue; a no-op
721
+ * when the chain already flushed.
718
722
  */
719
723
  drainSessionDurability(sessionId: string): Promise<void>;
720
724
  waitForCompletion(sessionId: string): Promise<TurnOutcome>;