@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
@@ -36,9 +36,15 @@ import {
36
36
  HOSTED_DELIVERY_HEADER,
37
37
  HOSTED_DELIVERY_PROTOCOL_VERSION,
38
38
  HOSTED_EXECUTION_PATH,
39
+ HOSTED_GUEST_RETRY_TERMINAL,
40
+ HOSTED_GUEST_RETRY_TRANSIENT,
39
41
  type HostedAdmission,
42
+ type HostedGuestRetryDisposition,
43
+ hostedGuestErrorResponse,
44
+ isHostedReminderAdmission,
40
45
  parseHostedAdmission,
41
46
  parseHostedExecution,
47
+ parseHostedReminderFirePayload,
42
48
  } from "./hosted-delivery-protocol.js";
43
49
  import {
44
50
  abortReasonFromTurnStatus,
@@ -50,9 +56,13 @@ import {
50
56
  type HostedExecutionFlushSinks,
51
57
  } from "./hosted-execution-flush.js";
52
58
  import { recordHostedManagedAutomation } from "./hosted-managed-automation.js";
53
- import { errorResponse, readJsonObject } from "./http-channel.js";
59
+ import { readJsonObject } from "./http-channel.js";
54
60
  import type { LogRingEntry } from "./log-ring.js";
55
61
  import { endActiveHttpSpan } from "./otel/http.js";
62
+ import {
63
+ ReminderValidationError,
64
+ UnknownReminderError,
65
+ } from "./reminder-runner.js";
56
66
  import { statusForThrownRequestError } from "./request-error-status.js";
57
67
  import type { Router } from "./router.js";
58
68
  import type { SessionRunExecutionWrite } from "./session-run-log.js";
@@ -108,6 +118,32 @@ function boundedMessage(text: string): string {
108
118
  : text;
109
119
  }
110
120
 
121
+ function terminalHostedError(
122
+ status: number,
123
+ error: string,
124
+ message?: string
125
+ ): Response {
126
+ return hostedGuestErrorResponse({
127
+ status,
128
+ error,
129
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
130
+ message,
131
+ });
132
+ }
133
+
134
+ function transientHostedError(
135
+ status: number,
136
+ error: string,
137
+ message?: string
138
+ ): Response {
139
+ return hostedGuestErrorResponse({
140
+ status,
141
+ error,
142
+ retry: HOSTED_GUEST_RETRY_TRANSIENT,
143
+ message,
144
+ });
145
+ }
146
+
111
147
  /**
112
148
  * Classify deterministic authored protocol violations as non-retryable 422
113
149
  * admissions. Anything else returns `undefined` so callers fall through to
@@ -126,7 +162,7 @@ function nonRetryableRejection(error: unknown): AdmissionDispatch | undefined {
126
162
  return undefined;
127
163
  }
128
164
  return {
129
- response: errorResponse(
165
+ response: terminalHostedError(
130
166
  422,
131
167
  code,
132
168
  boundedMessage((error as Error).message)
@@ -150,10 +186,7 @@ export async function dispatchHostedAdmission(
150
186
  const adapter = getHostedAdmissionAdapter(input.definition);
151
187
  if (adapter === undefined || adapter.kind !== input.delivery.channelKind) {
152
188
  return {
153
- response: Response.json(
154
- { ok: false, error: "channel_kind_mismatch" },
155
- { status: 422 }
156
- ),
189
+ response: terminalHostedError(422, "channel_kind_mismatch"),
157
190
  };
158
191
  }
159
192
  // The admission window marker follows the async graph into task bodies so
@@ -161,6 +194,70 @@ export async function dispatchHostedAdmission(
161
194
  return runDuringHostedAdmission(() => runAdmission(input, adapter));
162
195
  }
163
196
 
197
+ /**
198
+ * Reserved reminder admission: parse the compact payload and invoke
199
+ * ReminderRunner.dispatch. Returns a standard hosted outcome (`task` /
200
+ * `skip`) and never opens the send-capture / model-session path here —
201
+ * prompt-form fires still follow up inside the runner.
202
+ */
203
+ async function dispatchHostedReminderAdmission(
204
+ input: {
205
+ fireReminder?(
206
+ reminderId: string,
207
+ expectedFireCount: number
208
+ ): Promise<{
209
+ reminderId: string;
210
+ outcome: "fired" | "noop";
211
+ reason?: string;
212
+ }>;
213
+ },
214
+ delivery: HostedAdmission
215
+ ): Promise<Response> {
216
+ if (input.fireReminder === undefined) {
217
+ return transientHostedError(
218
+ 503,
219
+ "reminder_dispatch_unavailable",
220
+ "This guest has no reminder runner wired for hosted admission."
221
+ );
222
+ }
223
+ const payload = parseHostedReminderFirePayload(delivery.payload);
224
+ if (payload === undefined) {
225
+ return terminalHostedError(
226
+ 400,
227
+ "invalid_reminder_payload",
228
+ "Expected reminder payload { reminderId, fireCount }."
229
+ );
230
+ }
231
+ try {
232
+ const result = await input.fireReminder(
233
+ payload.reminderId,
234
+ payload.fireCount
235
+ );
236
+ const outcome = result.outcome === "noop" ? "skip" : "task";
237
+ return Response.json({
238
+ ok: true,
239
+ v: HOSTED_DELIVERY_PROTOCOL_VERSION,
240
+ outcome,
241
+ });
242
+ } catch (error) {
243
+ if (error instanceof UnknownReminderError) {
244
+ return terminalHostedError(
245
+ 404,
246
+ "unknown_reminder",
247
+ boundedMessage(error.message)
248
+ );
249
+ }
250
+ if (error instanceof ReminderValidationError) {
251
+ return terminalHostedError(
252
+ 400,
253
+ "invalid_reminder",
254
+ boundedMessage(error.message)
255
+ );
256
+ }
257
+ throw error;
258
+ }
259
+ }
260
+
164
261
  async function runAdmission(
165
262
  input: DispatchInput,
166
263
  adapter: HostedAdmissionAdapter
@@ -198,9 +295,9 @@ async function runAdmission(
198
295
  }
199
296
  if (!dispatched.ok) {
200
297
  return {
201
- response: Response.json(
202
- { ok: false, error: "channel_dispatch_failed" },
203
- { status: dispatched.status >= 400 ? dispatched.status : 502 }
298
+ response: terminalHostedError(
299
+ dispatched.status >= 400 ? dispatched.status : 502,
300
+ "channel_dispatch_failed"
204
301
  ),
205
302
  };
206
303
  }
@@ -213,7 +310,7 @@ async function runAdmission(
213
310
  return rejected;
214
311
  }
215
312
  return {
216
- response: errorResponse(
313
+ response: terminalHostedError(
217
314
  503,
218
315
  "background_dispatch_failed",
219
316
  boundedMessage(error instanceof Error ? error.message : String(error))
@@ -240,10 +337,7 @@ async function runAdmission(
240
337
  const outcome = dispatchOutcome(dispatched);
241
338
  if (outcome === undefined || outcome === "send") {
242
339
  return {
243
- response: Response.json(
244
- { ok: false, error: "channel_outcome_missing" },
245
- { status: 502 }
246
- ),
340
+ response: terminalHostedError(502, "channel_outcome_missing"),
247
341
  };
248
342
  }
249
343
  return {
@@ -329,6 +423,19 @@ export function registerHostedDeliveryRoute(input: {
329
423
  channelId: string,
330
424
  sessionPublicId?: string
331
425
  ): ChannelHandlerArgs;
426
+ /**
427
+ * Reserved reminder admission: dispatch a hydrated ReminderRunner fire
428
+ * without authored channel admission. Returns the runner's outcome so the
429
+ * route can map fired → task and noop → skip.
430
+ */
431
+ fireReminder?(
432
+ reminderId: string,
433
+ expectedFireCount: number
434
+ ): Promise<{
435
+ reminderId: string;
436
+ outcome: "fired" | "noop";
437
+ reason?: string;
438
+ }>;
332
439
  /**
333
440
  * Await the session's durable mirror (dispatch chain + storage queue)
334
441
  * before the execution reply: the control plane may park the pod the
@@ -400,7 +507,11 @@ export function registerHostedDeliveryRoute(input: {
400
507
  const consumed = consumeBoundSecrets();
401
508
  return consumed.ok
402
509
  ? undefined
403
- : errorResponse(503, consumed.code, boundedMessage(consumed.message));
510
+ : transientHostedError(
511
+ 503,
512
+ consumed.code,
513
+ boundedMessage(consumed.message)
514
+ );
404
515
  };
405
516
  const finishNetworkWait = async (
406
517
  phase: "admission" | "execution"
@@ -423,7 +534,7 @@ export function registerHostedDeliveryRoute(input: {
423
534
  : "Guest network is not ready for outbound requests.";
424
535
  return {
425
536
  timing,
426
- response: errorResponse(
537
+ response: transientHostedError(
427
538
  503,
428
539
  GUEST_NETWORK_UNAVAILABLE,
429
540
  boundedMessage(message)
@@ -483,7 +594,7 @@ export function registerHostedDeliveryRoute(input: {
483
594
  `[agent-sdk] hosted admission rejected: envelope failed to parse keys=${JSON.stringify(rawKeys)} hasManagedAutomation=${String(rawKeys.includes("managedAutomation"))}`
484
595
  );
485
596
  return finish(
486
- errorResponse(
597
+ terminalHostedError(
487
598
  400,
488
599
  "invalid_hosted_admission",
489
600
  "Expected a supported Agent SDK hosted-admission envelope."
@@ -494,12 +605,20 @@ export function registerHostedDeliveryRoute(input: {
494
605
  `[agent-sdk] hosted admission received deliveryId=${delivery.deliveryId} channelId=${delivery.channelId} channelKind=${delivery.channelKind} eventType=${delivery.eventType} sessionMode=${delivery.sessionMode} managedAutomation=${delivery.managedAutomation === undefined ? "<absent>" : `automationUuid=${delivery.managedAutomation.automationUuid} mcpServerNames=${String(delivery.managedAutomation.mcpServerNames.length)} slackChannels=${delivery.managedAutomation.slackChannels === undefined ? "<absent>" : JSON.stringify(delivery.managedAutomation.slackChannels)}`}`
495
606
  );
496
607
  recordHostedManagedAutomation(delivery);
608
+ if (isHostedReminderAdmission(delivery)) {
609
+ const network = await finishNetworkWait("admission");
610
+ guestNetwork = network.timing;
611
+ if (network.response !== undefined) {
612
+ return finish(network.response);
613
+ }
614
+ return finish(await dispatchHostedReminderAdmission(input, delivery));
615
+ }
497
616
  const channel = input.channels.find(
498
617
  (candidate) => candidate.id === delivery.channelId
499
618
  );
500
619
  if (channel === undefined) {
501
620
  return finish(
502
- errorResponse(
621
+ terminalHostedError(
503
622
  404,
504
623
  "channel_not_found",
505
624
  `No channel named "${delivery.channelId}" is mounted.`
@@ -556,7 +675,7 @@ export function registerHostedDeliveryRoute(input: {
556
675
  const execution = parseHostedExecution(await readJsonObject(request));
557
676
  if (execution === undefined) {
558
677
  return finish(
559
- errorResponse(
678
+ terminalHostedError(
560
679
  400,
561
680
  "invalid_hosted_execution",
562
681
  "Expected a supported Agent SDK hosted-execution envelope."
@@ -567,7 +686,7 @@ export function registerHostedDeliveryRoute(input: {
567
686
  const admitted = pending.get(execution.admissionToken);
568
687
  if (admitted === undefined) {
569
688
  return finish(
570
- errorResponse(
689
+ transientHostedError(
571
690
  409,
572
691
  "hosted_admission_unavailable",
573
692
  "The hosted admission token is missing or expired."
@@ -579,7 +698,7 @@ export function registerHostedDeliveryRoute(input: {
579
698
  admitted.sessionPublicId !== execution.sessionPublicId
580
699
  ) {
581
700
  return finish(
582
- errorResponse(
701
+ transientHostedError(
583
702
  409,
584
703
  "hosted_admission_session_mismatch",
585
704
  "The hosted admission token is already bound to another session."
@@ -682,11 +801,15 @@ export function registerHostedDeliveryRoute(input: {
682
801
  // waitForCompletion resolves (does not throw) on a quiet
683
802
  // Connect abort. Map that to guest_connect_stalled so TAS
684
803
  // retries the same pod. Real runner failures stay turn_failed.
804
+ const hostedFailure = hostedFailureForUnfinishedTurn(
805
+ outcome.errorMessage
806
+ );
685
807
  return {
686
808
  status: 503,
687
809
  body: {
688
810
  ok: false,
689
- error: hostedErrorForUnfinishedTurn(outcome.errorMessage),
811
+ error: hostedFailure.error,
812
+ retry: hostedFailure.retry,
690
813
  turnStatus: outcome.status,
691
814
  message: outcome.errorMessage,
692
815
  },
@@ -739,16 +862,20 @@ function evictHostedSdkSessions(
739
862
  }
740
863
  }
741
864
 
742
- function hostedErrorForUnfinishedTurn(
743
- errorMessage: string | undefined
744
- ): typeof GUEST_CONNECT_STALLED | "turn_failed" {
865
+ function hostedFailureForUnfinishedTurn(errorMessage: string | undefined): {
866
+ error: typeof GUEST_CONNECT_STALLED | "turn_failed";
867
+ retry: HostedGuestRetryDisposition;
868
+ } {
745
869
  if (
746
870
  errorMessage !== undefined &&
747
871
  isQuietGuestConnectStallMessage(errorMessage)
748
872
  ) {
749
- return GUEST_CONNECT_STALLED;
873
+ return {
874
+ error: GUEST_CONNECT_STALLED,
875
+ retry: HOSTED_GUEST_RETRY_TRANSIENT,
876
+ };
750
877
  }
751
- return "turn_failed";
878
+ return { error: "turn_failed", retry: HOSTED_GUEST_RETRY_TERMINAL };
752
879
  }
753
880
 
754
881
  async function afterHostedWork<T>(