@cursor/july 0.1.104 → 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 (286) 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/deployments-channel.d.ts.map +1 -1
  5. package/dist/channels/deployments/deployments-channel.js +1 -0
  6. package/dist/channels/deployments/types.d.ts +7 -8
  7. package/dist/channels/deployments/types.d.ts.map +1 -1
  8. package/dist/channels/github/types.d.ts +2 -4
  9. package/dist/channels/github/types.d.ts.map +1 -1
  10. package/dist/channels/gitlab/types.d.ts +2 -5
  11. package/dist/channels/gitlab/types.d.ts.map +1 -1
  12. package/dist/channels/origin/types.d.ts +2 -3
  13. package/dist/channels/origin/types.d.ts.map +1 -1
  14. package/dist/channels/slack/defaults.d.ts.map +1 -1
  15. package/dist/channels/slack/defaults.js +3 -0
  16. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  17. package/dist/channels/slack/dispatch.js +1 -1
  18. package/dist/channels/slack/live-delivery.d.ts.map +1 -1
  19. package/dist/channels/slack/live-delivery.js +48 -11
  20. package/dist/channels/slack/types.d.ts +4 -3
  21. package/dist/channels/slack/types.d.ts.map +1 -1
  22. package/dist/docs/404.html +3 -3
  23. package/dist/docs/ab.html +6 -6
  24. package/dist/docs/assets/{app.DbMWUyGb.js → app.CtuckIiL.js} +1 -1
  25. package/dist/docs/assets/chunks/@localSearchIndexroot.DXXZxiMv.js +1 -0
  26. package/dist/docs/assets/chunks/{VPLocalSearchBox.DcNeTh9o.js → VPLocalSearchBox.Bkkhnu8K.js} +2 -2
  27. package/dist/docs/assets/chunks/{theme.DMjhY3gl.js → theme.DhpIe0Pa.js} +2 -2
  28. package/dist/docs/assets/guides_grokbot-agents.md.DVqdhBKb.js +9 -0
  29. package/dist/docs/assets/guides_grokbot-agents.md.DVqdhBKb.lean.js +1 -0
  30. package/dist/docs/assets/{guides_opentelemetry.md.COh9jFVg.js → guides_opentelemetry.md.SCRMskno.js} +3 -3
  31. package/dist/docs/assets/{guides_opentelemetry.md.COh9jFVg.lean.js → guides_opentelemetry.md.SCRMskno.lean.js} +1 -1
  32. package/dist/docs/assets/index.md.BW_6tOgR.js +5 -0
  33. package/dist/docs/assets/index.md.BW_6tOgR.lean.js +1 -0
  34. package/dist/docs/assets/{reference_channels.md.DBGcaB7m.js → reference_channels.md.D-qTqwcq.js} +2 -2
  35. package/dist/docs/assets/{reference_channels.md.DBGcaB7m.lean.js → reference_channels.md.D-qTqwcq.lean.js} +1 -1
  36. package/dist/docs/assets/{reference_cli.md.CJNc_xYK.js → reference_cli.md.Dm67hd2D.js} +3 -2
  37. package/dist/docs/assets/{reference_extensions.md.DykHW3qL.js → reference_extensions.md.CGmMLblt.js} +1 -1
  38. package/dist/docs/assets/{skills_otel.md.CqhobH3B.js → skills_otel.md.B5Ddv1xH.js} +1 -1
  39. package/dist/docs/assets/{style.BRuM8477.css → style.DCD_zyg3.css} +1 -1
  40. package/dist/docs/assets/templates_grokbot-agents.md.c1s6Flp9.js +3 -0
  41. package/dist/docs/assets/templates_grokbot-agents.md.c1s6Flp9.lean.js +1 -0
  42. package/dist/docs/building-with-agents.html +6 -6
  43. package/dist/docs/concepts.html +5 -5
  44. package/dist/docs/deployment.html +6 -6
  45. package/dist/docs/evals.html +6 -6
  46. package/dist/docs/guides/agent-to-agent.html +6 -6
  47. package/dist/docs/guides/cloud-agents.html +6 -6
  48. package/dist/docs/guides/convert-automation.html +6 -6
  49. package/dist/docs/guides/github.html +6 -6
  50. package/dist/docs/guides/grokbot-agents.html +35 -0
  51. package/dist/docs/guides/grokbot-agents.md +88 -0
  52. package/dist/docs/guides/human-in-the-loop.html +6 -6
  53. package/dist/docs/guides/mcp-oauth.html +6 -6
  54. package/dist/docs/guides/opentelemetry.html +8 -8
  55. package/dist/docs/guides/opentelemetry.md +3 -4
  56. package/dist/docs/guides/slack.html +6 -6
  57. package/dist/docs/guides/webhooks.html +6 -6
  58. package/dist/docs/hashmap.json +1 -1
  59. package/dist/docs/hillclimbing.html +6 -6
  60. package/dist/docs/index.html +8 -8
  61. package/dist/docs/index.md +6 -1
  62. package/dist/docs/llms-full.txt +178 -30
  63. package/dist/docs/llms.txt +2 -0
  64. package/dist/docs/quickstart.html +6 -6
  65. package/dist/docs/reference/agent-config.html +6 -6
  66. package/dist/docs/reference/artifacts.html +6 -6
  67. package/dist/docs/reference/channels.html +7 -7
  68. package/dist/docs/reference/channels.md +11 -19
  69. package/dist/docs/reference/cli.html +10 -9
  70. package/dist/docs/reference/cli.md +7 -3
  71. package/dist/docs/reference/connections.html +6 -6
  72. package/dist/docs/reference/extensions.html +7 -7
  73. package/dist/docs/reference/extensions.md +2 -0
  74. package/dist/docs/reference/hooks.html +6 -6
  75. package/dist/docs/reference/http-api.html +6 -6
  76. package/dist/docs/reference/instructions.html +6 -6
  77. package/dist/docs/reference/playground.html +5 -5
  78. package/dist/docs/reference/project-layout.html +6 -6
  79. package/dist/docs/reference/prompt.html +6 -6
  80. package/dist/docs/reference/result.html +6 -6
  81. package/dist/docs/reference/schedules.html +6 -6
  82. package/dist/docs/reference/sessions.html +5 -5
  83. package/dist/docs/reference/skills.html +6 -6
  84. package/dist/docs/reference/subagents.html +6 -6
  85. package/dist/docs/reference/tools.html +6 -6
  86. package/dist/docs/scaffolding-agents.html +5 -5
  87. package/dist/docs/skills/ab.html +6 -6
  88. package/dist/docs/skills/create-agent.html +6 -6
  89. package/dist/docs/skills/debug.html +5 -5
  90. package/dist/docs/skills/evals.html +6 -6
  91. package/dist/docs/skills/framework-map.html +5 -5
  92. package/dist/docs/skills/github.html +6 -6
  93. package/dist/docs/skills/hillclimb.html +6 -6
  94. package/dist/docs/skills/index.html +5 -5
  95. package/dist/docs/skills/mcp-auth.html +6 -6
  96. package/dist/docs/skills/otel.html +8 -8
  97. package/dist/docs/skills/otel.md +3 -3
  98. package/dist/docs/skills/setup-slack.html +6 -6
  99. package/dist/docs/storage.html +6 -6
  100. package/dist/docs/templates/agentic-owners.html +6 -6
  101. package/dist/docs/templates/agents-md.html +6 -6
  102. package/dist/docs/templates/code-wiki.html +6 -6
  103. package/dist/docs/templates/demo.html +6 -6
  104. package/dist/docs/templates/grokbot-agents.html +29 -0
  105. package/dist/docs/templates/grokbot-agents.md +48 -0
  106. package/dist/docs/templates/pr-autofixer.html +6 -6
  107. package/dist/docs/templates/security-help.html +6 -6
  108. package/dist/docs/templates/security-reviewer.html +6 -6
  109. package/dist/docs/templates/triage.html +6 -6
  110. package/dist/docs/troubleshooting.html +5 -5
  111. package/dist/files.d.ts +7 -2
  112. package/dist/files.d.ts.map +1 -1
  113. package/dist/files.js +7 -2
  114. package/dist/index.d.ts +4 -5
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +3 -4
  117. package/dist/internal/cli-deploy.d.ts.map +1 -1
  118. package/dist/internal/cli-deploy.js +23 -11
  119. package/dist/internal/cursor/backend-client.d.ts +25 -0
  120. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  121. package/dist/internal/cursor/backend-client.js +57 -2
  122. package/dist/internal/cursor-agent-template.d.ts +1 -1
  123. package/dist/internal/cursor-agent-template.d.ts.map +1 -1
  124. package/dist/internal/cursor-agent-template.js +1 -0
  125. package/dist/internal/deploy-client.d.ts +8 -0
  126. package/dist/internal/deploy-client.d.ts.map +1 -1
  127. package/dist/internal/deploy-client.js +14 -0
  128. package/dist/internal/deploy-manifest.d.ts +3 -0
  129. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  130. package/dist/internal/deploy-manifest.js +15 -12
  131. package/dist/internal/discovery/agent.d.ts.map +1 -1
  132. package/dist/internal/discovery/agent.js +1 -0
  133. package/dist/internal/discovery/info.d.ts.map +1 -1
  134. package/dist/internal/discovery/info.js +7 -3
  135. package/dist/internal/discovery/modules.d.ts +1 -1
  136. package/dist/internal/discovery/modules.d.ts.map +1 -1
  137. package/dist/internal/discovery/modules.js +1 -0
  138. package/dist/internal/discovery/project.d.ts.map +1 -1
  139. package/dist/internal/discovery/project.js +3 -0
  140. package/dist/internal/discovery/reminders.d.ts +7 -0
  141. package/dist/internal/discovery/reminders.d.ts.map +1 -0
  142. package/dist/internal/discovery/reminders.js +65 -0
  143. package/dist/internal/discovery/subagent.js +1 -0
  144. package/dist/internal/distribution.d.ts +5 -0
  145. package/dist/internal/distribution.d.ts.map +1 -1
  146. package/dist/internal/distribution.js +17 -0
  147. package/dist/internal/framework-file-storage.d.ts +3 -1
  148. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  149. package/dist/internal/framework-file-storage.js +3 -1
  150. package/dist/internal/framework-storage-selection.d.ts +14 -3
  151. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  152. package/dist/internal/framework-storage-selection.js +36 -6
  153. package/dist/internal/guest-network.d.ts.map +1 -1
  154. package/dist/internal/guest-network.js +2 -0
  155. package/dist/internal/hosted-delivery-protocol.d.ts +48 -0
  156. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  157. package/dist/internal/hosted-delivery-protocol.js +60 -0
  158. package/dist/internal/hosted-delivery.d.ts +17 -0
  159. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  160. package/dist/internal/hosted-delivery.js +112 -19
  161. package/dist/internal/hosted-managed-automation.d.ts.map +1 -1
  162. package/dist/internal/hosted-managed-automation.js +27 -2
  163. package/dist/internal/init-project.d.ts.map +1 -1
  164. package/dist/internal/init-project.js +4 -1
  165. package/dist/internal/local-control-plane.d.ts +18 -2
  166. package/dist/internal/local-control-plane.d.ts.map +1 -1
  167. package/dist/internal/local-control-plane.js +199 -17
  168. package/dist/internal/reminder-control-plane-protocol.d.ts +187 -0
  169. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -0
  170. package/dist/internal/reminder-control-plane-protocol.js +244 -0
  171. package/dist/internal/reminder-runner.d.ts +48 -6
  172. package/dist/internal/reminder-runner.d.ts.map +1 -1
  173. package/dist/internal/reminder-runner.js +336 -48
  174. package/dist/internal/reminder-schedule.d.ts +5 -2
  175. package/dist/internal/reminder-schedule.d.ts.map +1 -1
  176. package/dist/internal/reminder-schedule.js +8 -6
  177. package/dist/internal/reminder-store.d.ts +24 -7
  178. package/dist/internal/reminder-store.d.ts.map +1 -1
  179. package/dist/internal/reminder-store.js +6 -5
  180. package/dist/internal/request-error-status.d.ts +2 -0
  181. package/dist/internal/request-error-status.d.ts.map +1 -1
  182. package/dist/internal/request-error-status.js +22 -3
  183. package/dist/internal/scm/pr-url.d.ts +40 -0
  184. package/dist/internal/scm/pr-url.d.ts.map +1 -1
  185. package/dist/internal/scm/pr-url.js +93 -14
  186. package/dist/internal/sdk-runner.d.ts +12 -0
  187. package/dist/internal/sdk-runner.d.ts.map +1 -1
  188. package/dist/internal/sdk-runner.js +18 -0
  189. package/dist/internal/server.d.ts.map +1 -1
  190. package/dist/internal/server.js +78 -30
  191. package/dist/internal/session-engine.d.ts +12 -0
  192. package/dist/internal/session-engine.d.ts.map +1 -1
  193. package/dist/internal/session-engine.js +137 -52
  194. package/dist/internal/store-mirror.d.ts +2 -2
  195. package/dist/internal/store-mirror.js +2 -2
  196. package/dist/internal/tenant-slack/relay.d.ts +2 -0
  197. package/dist/internal/tenant-slack/relay.d.ts.map +1 -1
  198. package/dist/internal/tenant-slack/relay.js +18 -8
  199. package/dist/internal/workspace-sync.d.ts +31 -6
  200. package/dist/internal/workspace-sync.d.ts.map +1 -1
  201. package/dist/internal/workspace-sync.js +67 -12
  202. package/dist/internal/workspace.d.ts +9 -0
  203. package/dist/internal/workspace.d.ts.map +1 -1
  204. package/dist/internal/workspace.js +16 -0
  205. package/dist/playground/assets/index-Bq2HpEQB.js +67 -0
  206. package/dist/playground/assets/index-CZKKNlmb.css +1 -0
  207. package/dist/playground/index.html +2 -2
  208. package/dist/reminders.d.ts +24 -5
  209. package/dist/reminders.d.ts.map +1 -1
  210. package/dist/reminders.js +28 -5
  211. package/dist/types.d.ts +98 -28
  212. package/dist/types.d.ts.map +1 -1
  213. package/docs/README.md +6 -1
  214. package/docs/guides/grokbot-agents.md +93 -0
  215. package/docs/guides/opentelemetry.md +3 -4
  216. package/docs/reference/channels.md +11 -19
  217. package/docs/reference/cli.md +7 -3
  218. package/docs/reference/extensions.md +2 -0
  219. package/docs/templates/grokbot-agents.md +53 -0
  220. package/package.json +12 -3
  221. package/skills/otel/SKILL.md +3 -3
  222. package/src/bin/agent-serve.ts +1 -9
  223. package/src/channels/bitbucket/types.ts +2 -4
  224. package/src/channels/deployments/deployments-channel.ts +1 -0
  225. package/src/channels/deployments/types.ts +7 -8
  226. package/src/channels/github/types.ts +2 -4
  227. package/src/channels/gitlab/types.ts +2 -5
  228. package/src/channels/origin/types.ts +2 -3
  229. package/src/channels/slack/defaults.ts +3 -0
  230. package/src/channels/slack/dispatch.ts +1 -0
  231. package/src/channels/slack/live-delivery.ts +53 -12
  232. package/src/channels/slack/types.ts +4 -3
  233. package/src/files.ts +9 -2
  234. package/src/index.ts +6 -3
  235. package/src/internal/cli-deploy.ts +30 -12
  236. package/src/internal/cursor/backend-client.ts +90 -2
  237. package/src/internal/cursor-agent-template.ts +1 -0
  238. package/src/internal/deploy-client.ts +16 -0
  239. package/src/internal/deploy-manifest.ts +16 -11
  240. package/src/internal/discovery/agent.ts +1 -0
  241. package/src/internal/discovery/info.ts +6 -0
  242. package/src/internal/discovery/modules.ts +2 -4
  243. package/src/internal/discovery/project.ts +3 -0
  244. package/src/internal/discovery/reminders.ts +65 -0
  245. package/src/internal/discovery/subagent.ts +1 -0
  246. package/src/internal/distribution.ts +20 -0
  247. package/src/internal/framework-file-storage.ts +3 -1
  248. package/src/internal/framework-storage-selection.ts +43 -6
  249. package/src/internal/guest-network.ts +3 -0
  250. package/src/internal/hosted-delivery-protocol.ts +96 -0
  251. package/src/internal/hosted-delivery.ts +207 -28
  252. package/src/internal/hosted-managed-automation.ts +49 -5
  253. package/src/internal/init-project.ts +4 -1
  254. package/src/internal/local-control-plane.ts +281 -22
  255. package/src/internal/reminder-control-plane-protocol.ts +499 -0
  256. package/src/internal/reminder-runner.ts +421 -48
  257. package/src/internal/reminder-schedule.ts +11 -6
  258. package/src/internal/reminder-store.ts +27 -7
  259. package/src/internal/request-error-status.ts +27 -3
  260. package/src/internal/scm/pr-url.ts +167 -20
  261. package/src/internal/sdk-runner.ts +19 -0
  262. package/src/internal/server.ts +85 -16
  263. package/src/internal/session-engine.ts +173 -56
  264. package/src/internal/store-mirror.ts +2 -2
  265. package/src/internal/tenant-slack/relay.ts +28 -4
  266. package/src/internal/workspace-sync.ts +84 -12
  267. package/src/internal/workspace.ts +20 -0
  268. package/src/reminders.ts +35 -4
  269. package/src/types.ts +104 -28
  270. package/templates/grokbot-agents/README.md +26 -0
  271. package/templates/grokbot-agents/agent/agent.ts +6 -0
  272. package/templates/grokbot-agents/agent/extensions/grokbot.ts +5 -0
  273. package/templates/grokbot-agents/agent/instructions.md +7 -0
  274. package/templates/grokbot-agents/evals/evals.config.ts +5 -0
  275. package/templates/grokbot-agents/evals/grokbot-agents.eval.ts +18 -0
  276. package/templates/grokbot-agents/init.json +18 -0
  277. package/templates/grokbot-agents/package.json +17 -0
  278. package/templates/grokbot-agents/tsconfig.json +12 -0
  279. package/dist/docs/assets/chunks/@localSearchIndexroot.Bqsulb9K.js +0 -1
  280. package/dist/docs/assets/index.md.D75GWhPl.js +0 -5
  281. package/dist/docs/assets/index.md.D75GWhPl.lean.js +0 -1
  282. package/dist/playground/assets/index-8YiozU89.js +0 -67
  283. package/dist/playground/assets/index-MbMxXg-y.css +0 -1
  284. /package/dist/docs/assets/{reference_cli.md.CJNc_xYK.lean.js → reference_cli.md.Dm67hd2D.lean.js} +0 -0
  285. /package/dist/docs/assets/{reference_extensions.md.DykHW3qL.lean.js → reference_extensions.md.CGmMLblt.lean.js} +0 -0
  286. /package/dist/docs/assets/{skills_otel.md.CqhobH3B.lean.js → skills_otel.md.B5Ddv1xH.lean.js} +0 -0
@@ -11,6 +11,8 @@ import { join } from "node:path";
11
11
  import { fileURLToPath, pathToFileURL } from "node:url";
12
12
  /** Published npm package name (pre-launch codename for Agent SDK). */
13
13
  export const PACKAGE_NAME = "@cursor/july";
14
+ const HOSTED_WORKTREE_SHA_FILENAME = ".cursor-hosted-worktree-sha";
15
+ const GIT_COMMIT_SHA_RE = /^[0-9a-f]{40,64}$/;
14
16
  /**
15
17
  * Bracketed product tag for stderr / ServeOptions.logger lines
16
18
  * (`[agent-sdk] …`, `[agent-sdk/slack] …`).
@@ -45,6 +47,21 @@ function packageManifest() {
45
47
  export function packageVersion() {
46
48
  return packageManifest().version;
47
49
  }
50
+ /**
51
+ * Git commit of a checkout-built framework distribution. Published npm
52
+ * packages do not carry this marker and return undefined.
53
+ */
54
+ export function packageGitSha() {
55
+ try {
56
+ const sha = readFileSync(join(packageRootDir(), "dist", HOSTED_WORKTREE_SHA_FILENAME), "utf8")
57
+ .trim()
58
+ .toLowerCase();
59
+ return GIT_COMMIT_SHA_RE.test(sha) ? sha : undefined;
60
+ }
61
+ catch (_a) {
62
+ return undefined;
63
+ }
64
+ }
48
65
  export function cliVersionInfo() {
49
66
  return {
50
67
  name: PACKAGE_NAME,
@@ -9,7 +9,9 @@
9
9
  * - the **framework-level** store (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`)
10
10
  * holds engine-owned session state — session records, event transcripts,
11
11
  * hosted-execution run logs, the continuation index, and the SDK
12
- * conversation mirror — and is never exposed to authors or models.
12
+ * conversation mirror — and is never mounted into author code or models.
13
+ * The authenticated dashboard may read diagnostic families, but never the
14
+ * continuation index.
13
15
  *
14
16
  * This module puts framework session state on the framework store. The
15
17
  * {@link storageKeys} scheme was designed for exactly this: keys are a
@@ -1 +1 @@
1
- {"version":3,"file":"framework-file-storage.d.ts","sourceRoot":"","sources":["../../src/internal/framework-file-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK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CAAC;AAkBF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,CAuDvE;AA+CD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,EAAE,EAAE,mBAAmB,CAAC;IACxB,KAAK,EAAE,mBAAmB,CAAC;CAC5B,GAAG,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAe1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GACrC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CA0BnC"}
@@ -9,7 +9,9 @@
9
9
  * - the **framework-level** store (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`)
10
10
  * holds engine-owned session state — session records, event transcripts,
11
11
  * hosted-execution run logs, the continuation index, and the SDK
12
- * conversation mirror — and is never exposed to authors or models.
12
+ * conversation mirror — and is never mounted into author code or models.
13
+ * The authenticated dashboard may read diagnostic families, but never the
14
+ * continuation index.
13
15
  *
14
16
  * This module puts framework session state on the framework store. The
15
17
  * {@link storageKeys} scheme was designed for exactly this: keys are a
@@ -13,7 +13,10 @@
13
13
  * That selection is a hosting-mode question, not an authoring question.
14
14
  * Architecture v2 moves it here: `agent/storage.ts` is rejected at
15
15
  * discovery (error diagnostic, so serve and deploy fail early), and the
16
- * platform picks the default
16
+ * platform picks the default. Architecture v1 with no authored file now
17
+ * uses the same hosted-vs-self-hosted split, so deleting `agent/storage.ts`
18
+ * (required to deploy the same tree onto v2) does not drop the Cursor-hosted
19
+ * session mirror on a still-v1 pod.
17
20
  *
18
21
  * - **Cursor-managed hosting** (the deployment-generation environment
19
22
  * variable is set, same signal that registers `GET /v1/manifest`):
@@ -33,8 +36,10 @@
33
36
  * - **Self-hosted**: no mirror. `--state-root` is the durable copy, which
34
37
  * is correct when the operator owns the disk.
35
38
  *
36
- * v1 keeps the authored definition (or nothing) so existing deployments are
37
- * untouched while they run.
39
+ * v1 still honors an authored `agent/storage.ts` when present. Hosted v1
40
+ * pods with no authored file get the Cursor-hosted lazy mirror (gated on
41
+ * `AGENT_SERVE_DEPLOYMENT_ID`, the same signal the previous authored sinks
42
+ * used). Self-hosted v1 with no authored file stays disk-only.
38
43
  *
39
44
  * Local disk is not part of this decision. `<stateRoot>/sessions/<id>/`
40
45
  * already holds `session.json` and `events.ndjson` unconditionally, through
@@ -43,6 +48,12 @@
43
48
  */
44
49
  import { type StorageDefinition } from "../storage.js";
45
50
  import type { AgentArchitecture } from "../types.js";
51
+ /**
52
+ * Hosted v2 event-chunk flush debounce. Matches the session view's live poll
53
+ * cadence; a streaming turn still caps each chunk at the coordinator's batch
54
+ * limit, so a long turn writes a few dozen chunks rather than one per event.
55
+ */
56
+ export declare const HOSTED_V2_EVENT_FLUSH_DEBOUNCE_MS = 2000;
46
57
  export interface FrameworkStorageSelectionInput {
47
58
  /** `agent/storage.ts`, when the author wrote one (v1 only: discovery rejects it on v2). */
48
59
  readonly authored: StorageDefinition | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"framework-storage-selection.d.ts","sourceRoot":"","sources":["../../src/internal/framework-storage-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAGH,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AASrD,MAAM,WAAW,8BAA8B;IAC7C,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACjD,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtD,iEAAiE;IACjE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,8BAA8B,GACpC,iBAAiB,GAAG,SAAS,CAwD/B"}
1
+ {"version":3,"file":"framework-storage-selection.d.ts","sourceRoot":"","sources":["../../src/internal/framework-storage-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAMtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AASrD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AAEvD,MAAM,WAAW,8BAA8B;IAC7C,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACjD,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtD,iEAAiE;IACjE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,8BAA8B,GACpC,iBAAiB,GAAG,SAAS,CA6E/B"}
@@ -13,7 +13,10 @@
13
13
  * That selection is a hosting-mode question, not an authoring question.
14
14
  * Architecture v2 moves it here: `agent/storage.ts` is rejected at
15
15
  * discovery (error diagnostic, so serve and deploy fail early), and the
16
- * platform picks the default
16
+ * platform picks the default. Architecture v1 with no authored file now
17
+ * uses the same hosted-vs-self-hosted split, so deleting `agent/storage.ts`
18
+ * (required to deploy the same tree onto v2) does not drop the Cursor-hosted
19
+ * session mirror on a still-v1 pod.
17
20
  *
18
21
  * - **Cursor-managed hosting** (the deployment-generation environment
19
22
  * variable is set, same signal that registers `GET /v1/manifest`):
@@ -33,8 +36,10 @@
33
36
  * - **Self-hosted**: no mirror. `--state-root` is the durable copy, which
34
37
  * is correct when the operator owns the disk.
35
38
  *
36
- * v1 keeps the authored definition (or nothing) so existing deployments are
37
- * untouched while they run.
39
+ * v1 still honors an authored `agent/storage.ts` when present. Hosted v1
40
+ * pods with no authored file get the Cursor-hosted lazy mirror (gated on
41
+ * `AGENT_SERVE_DEPLOYMENT_ID`, the same signal the previous authored sinks
42
+ * used). Self-hosted v1 with no authored file stays disk-only.
38
43
  *
39
44
  * Local disk is not part of this decision. `<stateRoot>/sessions/<id>/`
40
45
  * already holds `session.json` and `events.ndjson` unconditionally, through
@@ -43,10 +48,17 @@
43
48
  */
44
49
  import { cursorHostedFiles } from "../files-backends/cursor-hosted.js";
45
50
  import { defineStorage } from "../storage.js";
51
+ import { AGENT_SERVE_DEPLOYMENT_ID_ENV_VAR, cursorHostedStorage, } from "../storage-backends/cursor-hosted.js";
46
52
  import { cursorHostedStorageV2 } from "../storage-backends/cursor-hosted-v2.js";
47
53
  import { resolveApiKeySync } from "./cursor/credentials.js";
48
54
  import { composeFrameworkStorage, fileSinkStorageCore, frameworkGuardedCas, } from "./framework-file-storage.js";
49
55
  import { resolveAgentV2Hosting } from "./v2-hosting.js";
56
+ /**
57
+ * Hosted v2 event-chunk flush debounce. Matches the session view's live poll
58
+ * cadence; a streaming turn still caps each chunk at the coordinator's batch
59
+ * limit, so a long turn writes a few dozen chunks rather than one per event.
60
+ */
61
+ export const HOSTED_V2_EVENT_FLUSH_DEBOUNCE_MS = 2000;
50
62
  /**
51
63
  * Pick the backend for framework session state.
52
64
  *
@@ -54,9 +66,19 @@ import { resolveAgentV2Hosting } from "./v2-hosting.js";
54
66
  * disk is the only copy.
55
67
  */
56
68
  export function selectFrameworkStorageDefinition(input) {
69
+ var _a, _b;
57
70
  if (input.architecture !== "v2") {
58
- // v1: the author decides, or there is no mirror.
59
- return input.authored;
71
+ if (input.authored !== undefined) {
72
+ return input.authored;
73
+ }
74
+ const env = (_a = input.env) !== null && _a !== void 0 ? _a : process.env;
75
+ if (((_b = env[AGENT_SERVE_DEPLOYMENT_ID_ENV_VAR]) !== null && _b !== void 0 ? _b : "").trim() !== "") {
76
+ // Hosted v1 pod with no authored sink: keep the Cursor-hosted
77
+ // mirror (lazy restore) so agents can delete `agent/storage.ts`
78
+ // without losing durability while they still run architecture v1.
79
+ return defineStorage(Object.assign({ name: "cursor-hosted (lazy restore)", policy: { restore: "off" } }, cursorHostedStorage()));
80
+ }
81
+ return undefined;
60
82
  }
61
83
  if (input.authored !== undefined) {
62
84
  // Discovery rejects agent/storage.ts on v2 before an engine is built;
@@ -77,7 +99,15 @@ export function selectFrameworkStorageDefinition(input) {
77
99
  // backend it is per-key HTTP round trips before the listener even
78
100
  // comes up). Follow-ups restore lazily by continuation or session id;
79
101
  // GET /v1/sessions lists from the sink either way.
80
- const policy = { restore: "off" };
102
+ //
103
+ // Events flush on a quiet-period debounce rather than only at turn end so
104
+ // the read-only session view and dashboard trace (which have no resident
105
+ // engine to ask) see steps mid-turn. The turn-end record still lands
106
+ // before the execution reply: drainSessionDurability forces the flush.
107
+ const policy = {
108
+ restore: "off",
109
+ debounceMs: HOSTED_V2_EVENT_FLUSH_DEBOUNCE_MS,
110
+ };
81
111
  // Full chain (env → bind file → stored login): frozen engines listen
82
112
  // unsigned and bind store ids + CURSOR_API_KEY at task time, after this
83
113
  // definition is constructed.
@@ -1 +1 @@
1
- {"version":3,"file":"guest-network.d.ts","sourceRoot":"","sources":["../../src/internal/guest-network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,QAAS,CAAC;AAuB1D,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,Q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O,CAAC,sBAAsB,CAAC,CAkDjC;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAuCnB"}
@@ -27,6 +27,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
27
27
  step((generator = generator.apply(thisArg, _arguments || [])).next());
28
28
  });
29
29
  };
30
+ import { HOSTED_GUEST_RETRY_TRANSIENT } from "./hosted-delivery-protocol.js";
30
31
  export const GUEST_NETWORK_UNAVAILABLE = "guest_network_unavailable";
31
32
  export const GUEST_CONNECT_STALLED = "guest_connect_stalled";
32
33
  /** Control-plane readiness probe. Auth none, same as `/v1/health`. */
@@ -290,6 +291,7 @@ export function guestNetworkReadinessResponse() {
290
291
  return new Response(JSON.stringify({
291
292
  ok: false,
292
293
  error: GUEST_NETWORK_UNAVAILABLE,
294
+ retry: HOSTED_GUEST_RETRY_TRANSIENT,
293
295
  message: error.message,
294
296
  waitMs: error.waitMs,
295
297
  probeAttempts: error.probeAttempts,
@@ -2,6 +2,28 @@ export declare const HOSTED_DELIVERY_PROTOCOL_VERSION = 2;
2
2
  export declare const HOSTED_DELIVERY_HEADER = "x-agent-sdk-hosted-delivery";
3
3
  export declare const HOSTED_ADMISSION_PATH = "/v1/internal/hosted-admission";
4
4
  export declare const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
5
+ export declare const HOSTED_GUEST_RETRY_TRANSIENT = "transient";
6
+ export declare const HOSTED_GUEST_RETRY_TERMINAL = "terminal";
7
+ export type HostedGuestRetryDisposition = typeof HOSTED_GUEST_RETRY_TRANSIENT | typeof HOSTED_GUEST_RETRY_TERMINAL;
8
+ export type HostedGuestError = {
9
+ ok: false;
10
+ error: string;
11
+ retry: HostedGuestRetryDisposition;
12
+ message?: string;
13
+ turnStatus?: string;
14
+ };
15
+ /**
16
+ * Hosted delivery is the only HTTP surface whose failures drive Temporal
17
+ * retries. Keep its retry disposition explicit instead of making the shared
18
+ * HTTP error helper guess from a status code.
19
+ */
20
+ export declare function hostedGuestErrorResponse(input: {
21
+ status: number;
22
+ error: string;
23
+ retry: HostedGuestRetryDisposition;
24
+ message?: string;
25
+ turnStatus?: string;
26
+ }): Response;
5
27
  /**
6
28
  * Filename under the serve `--state-root` (not the per-slug SessionEngine
7
29
  * dir). Hosted freeze uses `/workspace/.agent-serve`; the Temporal host
@@ -9,6 +31,22 @@ export declare const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
9
31
  * Must match `AGENT_SERVE_ENGINE_HOSTED_EXECUTION_DIAG_PATH` basename.
10
32
  */
11
33
  export declare const HOSTED_EXECUTION_DIAG_FILENAME = "hosted-execution.json";
34
+ /**
35
+ * Reserved hosted-admission `channelKind` for durable reminder fires.
36
+ * Bypasses authored channel admission and invokes ReminderRunner.dispatch.
37
+ * Backend builds envelopes with this constant + {@link HOSTED_REMINDER_EVENT_TYPE}.
38
+ */
39
+ export declare const HOSTED_REMINDER_CHANNEL_KIND = "agent-sdk:reminder";
40
+ /**
41
+ * Reserved hosted-admission `eventType` for durable reminder fires.
42
+ * Payload is {@link HostedReminderFirePayload}.
43
+ */
44
+ export declare const HOSTED_REMINDER_EVENT_TYPE = "agent-sdk.reminder/fire";
45
+ /** Compact reminder-fire payload on the reserved hosted-admission path. */
46
+ export type HostedReminderFirePayload = {
47
+ reminderId: string;
48
+ fireCount: number;
49
+ };
12
50
  export type HostedAdmissionManagedAutomation = {
13
51
  automationUuid: string;
14
52
  mcpServerNames: string[];
@@ -57,5 +95,15 @@ export type HostedExecutionOutcome = {
57
95
  };
58
96
  export declare function parseHostedAdmission(value: unknown): HostedAdmission | undefined;
59
97
  export declare function parseHostedExecution(value: unknown): HostedExecution | undefined;
98
+ /**
99
+ * True when the admission envelope is the reserved internal reminder fire
100
+ * path (not an authored channel event).
101
+ */
102
+ export declare function isHostedReminderAdmission(delivery: HostedAdmission): boolean;
103
+ /**
104
+ * Parse `{ reminderId, fireCount }` from a reserved reminder admission
105
+ * payload. Rejects unknown keys and non-integer fireCount.
106
+ */
107
+ export declare function parseHostedReminderFirePayload(value: unknown): HostedReminderFirePayload | undefined;
60
108
  export declare function parseHostedAdmissionOutcome(value: unknown): HostedAdmissionOutcome | undefined;
61
109
  //# sourceMappingURL=hosted-delivery-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-delivery-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AAEtE,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,CAAC,CAAC;IACL,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,GAAG,cAAc,CAAC;IACtC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAC9B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,CAAC,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAC5C;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,CAAC,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,CAAC,CAAC;IACL,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,CAAC;IACL,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAyEF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,SAAS,CAuB7B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,SAAS,CAe7B;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,sBAAsB,GAAG,SAAS,CAkBpC"}
1
+ {"version":3,"file":"hosted-delivery-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,2BAA2B,aAAa,CAAC;AAEtD,MAAM,MAAM,2BAA2B,GACnC,OAAO,4BAA4B,GACnC,OAAO,2BAA2B,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,2BAA2B,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;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AAC,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,CAAC,CAAC;IACL,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,CAAC;IACL,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAyEF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,SAAS,CAuB7B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,SAAS,CAe7B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAK5E;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,GACb,yBAAyB,GAAG,SAAS,CAqBvC;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,sBAAsB,GAAG,SAAS,CAkBpC"}
@@ -2,6 +2,23 @@ export const HOSTED_DELIVERY_PROTOCOL_VERSION = 2;
2
2
  export const HOSTED_DELIVERY_HEADER = "x-agent-sdk-hosted-delivery";
3
3
  export const HOSTED_ADMISSION_PATH = "/v1/internal/hosted-admission";
4
4
  export const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
5
+ export const HOSTED_GUEST_RETRY_TRANSIENT = "transient";
6
+ export const HOSTED_GUEST_RETRY_TERMINAL = "terminal";
7
+ /**
8
+ * Hosted delivery is the only HTTP surface whose failures drive Temporal
9
+ * retries. Keep its retry disposition explicit instead of making the shared
10
+ * HTTP error helper guess from a status code.
11
+ */
12
+ export function hostedGuestErrorResponse(input) {
13
+ const body = {
14
+ ok: false,
15
+ error: input.error,
16
+ retry: input.retry,
17
+ message: input.message,
18
+ turnStatus: input.turnStatus,
19
+ };
20
+ return Response.json(body, { status: input.status });
21
+ }
5
22
  /**
6
23
  * Filename under the serve `--state-root` (not the per-slug SessionEngine
7
24
  * dir). Hosted freeze uses `/workspace/.agent-serve`; the Temporal host
@@ -9,6 +26,17 @@ export const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
9
26
  * Must match `AGENT_SERVE_ENGINE_HOSTED_EXECUTION_DIAG_PATH` basename.
10
27
  */
11
28
  export const HOSTED_EXECUTION_DIAG_FILENAME = "hosted-execution.json";
29
+ /**
30
+ * Reserved hosted-admission `channelKind` for durable reminder fires.
31
+ * Bypasses authored channel admission and invokes ReminderRunner.dispatch.
32
+ * Backend builds envelopes with this constant + {@link HOSTED_REMINDER_EVENT_TYPE}.
33
+ */
34
+ export const HOSTED_REMINDER_CHANNEL_KIND = "agent-sdk:reminder";
35
+ /**
36
+ * Reserved hosted-admission `eventType` for durable reminder fires.
37
+ * Payload is {@link HostedReminderFirePayload}.
38
+ */
39
+ export const HOSTED_REMINDER_EVENT_TYPE = "agent-sdk.reminder/fire";
12
40
  const DELIVERY_KEYS = new Set([
13
41
  "v",
14
42
  "channelId",
@@ -103,6 +131,38 @@ export function parseHostedExecution(value) {
103
131
  }
104
132
  return body;
105
133
  }
134
+ /**
135
+ * True when the admission envelope is the reserved internal reminder fire
136
+ * path (not an authored channel event).
137
+ */
138
+ export function isHostedReminderAdmission(delivery) {
139
+ return (delivery.channelKind === HOSTED_REMINDER_CHANNEL_KIND &&
140
+ delivery.eventType === HOSTED_REMINDER_EVENT_TYPE);
141
+ }
142
+ /**
143
+ * Parse `{ reminderId, fireCount }` from a reserved reminder admission
144
+ * payload. Rejects unknown keys and non-integer fireCount.
145
+ */
146
+ export function parseHostedReminderFirePayload(value) {
147
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
148
+ return undefined;
149
+ }
150
+ const body = value;
151
+ const keys = Object.keys(body);
152
+ if (keys.length !== 2 ||
153
+ !Object.hasOwn(body, "reminderId") ||
154
+ !Object.hasOwn(body, "fireCount") ||
155
+ !boundedString(body.reminderId, 128) ||
156
+ typeof body.fireCount !== "number" ||
157
+ !Number.isInteger(body.fireCount) ||
158
+ body.fireCount < 0) {
159
+ return undefined;
160
+ }
161
+ return {
162
+ reminderId: body.reminderId,
163
+ fireCount: body.fireCount,
164
+ };
165
+ }
106
166
  export function parseHostedAdmissionOutcome(value) {
107
167
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
108
168
  return undefined;
@@ -39,6 +39,16 @@ export declare function registerHostedDeliveryRoute(input: {
39
39
  definition: object;
40
40
  }>;
41
41
  buildHandlerArgs(channelId: string, sessionPublicId?: string): ChannelHandlerArgs;
42
+ /**
43
+ * Reserved reminder admission: dispatch a hydrated ReminderRunner fire
44
+ * without authored channel admission. Returns the runner's outcome so the
45
+ * route can map fired → task and noop → skip.
46
+ */
47
+ fireReminder?(reminderId: string, expectedFireCount: number): Promise<{
48
+ reminderId: string;
49
+ outcome: "fired" | "noop";
50
+ reason?: string;
51
+ }>;
42
52
  /**
43
53
  * Await the session's durable mirror (dispatch chain + storage queue)
44
54
  * before the execution reply: the control plane may park the pod the
@@ -68,6 +78,13 @@ export declare function registerHostedDeliveryRoute(input: {
68
78
  flushStartLog?(startLogId: string): Promise<void>;
69
79
  /** Snapshot of the process log ring at persist time. */
70
80
  snapshotLogs?(): LogRingEntry[];
81
+ /**
82
+ * Drop the cached SDK agent handle before the HTTP reply. Hosted v2
83
+ * hibernates this process as soon as the reply lands; leaving the handle
84
+ * in memory freezes a dead Connect/HTTP2 session that the next wake
85
+ * then reuses.
86
+ */
87
+ evictSdkSession?(sessionId: string): void;
71
88
  /**
72
89
  * Wait until guest egress works before authored admission/execution.
73
90
  * Defaults to {@link waitForGuestNetworkReady}. Tests inject a stub.
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"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