@cursor/july 0.1.94 → 0.1.95

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 (209) hide show
  1. package/dist/channels/github/github-channel.d.ts.map +1 -1
  2. package/dist/channels/github/github-channel.js +14 -2
  3. package/dist/channels/github/types.d.ts +18 -3
  4. package/dist/channels/github/types.d.ts.map +1 -1
  5. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  6. package/dist/channels/origin/origin-channel.js +11 -3
  7. package/dist/channels/origin/origin-webhook.d.ts +11 -1
  8. package/dist/channels/origin/origin-webhook.d.ts.map +1 -1
  9. package/dist/channels/origin/origin-webhook.js +23 -3
  10. package/dist/channels/origin/types.d.ts +8 -0
  11. package/dist/channels/origin/types.d.ts.map +1 -1
  12. package/dist/channels/slack/pr-ref.d.ts +7 -1
  13. package/dist/channels/slack/pr-ref.d.ts.map +1 -1
  14. package/dist/channels/slack/pr-ref.js +42 -23
  15. package/dist/docs/404.html +2 -2
  16. package/dist/docs/ab.html +4 -4
  17. package/dist/docs/assets/{app.CFDEas4I.js → app.BBj0klBO.js} +1 -1
  18. package/dist/docs/assets/chunks/@localSearchIndexroot.oqPawjiD.js +1 -0
  19. package/dist/docs/assets/chunks/{VPLocalSearchBox.B1IIYpYS.js → VPLocalSearchBox.CUEXpL78.js} +1 -1
  20. package/dist/docs/assets/chunks/{theme.Ct4NSiLm.js → theme.DabmQnia.js} +2 -2
  21. package/dist/docs/assets/index.md.BoHaMdeZ.js +5 -0
  22. package/dist/docs/assets/{index.md.DRakGHFe.lean.js → index.md.BoHaMdeZ.lean.js} +1 -1
  23. package/dist/docs/assets/{reference_cli.md.Cw6_ICYG.js → reference_cli.md.BsMOxDvh.js} +3 -2
  24. package/dist/docs/assets/{reference_cli.md.Cw6_ICYG.lean.js → reference_cli.md.BsMOxDvh.lean.js} +1 -1
  25. package/dist/docs/assets/{reference_skills.md.8son6Hjm.js → reference_skills.md.BFW9retM.js} +3 -3
  26. package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.js → templates_agentic-owners.md.BZSH4N9z.js} +1 -1
  27. package/dist/docs/assets/{templates_demo.md.DhFcWN6j.js → templates_demo.md.BeQX9V3H.js} +1 -1
  28. package/dist/docs/assets/{templates_pr-autofixer.md.DU7dQpor.js → templates_pr-autofixer.md.x5zl6-GT.js} +2 -2
  29. package/dist/docs/assets/{templates_pr-autofixer.md.DU7dQpor.lean.js → templates_pr-autofixer.md.x5zl6-GT.lean.js} +1 -1
  30. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.js +4 -0
  31. package/dist/docs/assets/templates_security-help.md.C3Ny_Qr2.lean.js +1 -0
  32. package/dist/docs/assets/{templates_security-reviewer.md.CTa7u_l1.js → templates_security-reviewer.md.lshxbCLK.js} +2 -2
  33. package/dist/docs/assets/{templates_security-reviewer.md.CTa7u_l1.lean.js → templates_security-reviewer.md.lshxbCLK.lean.js} +1 -1
  34. package/dist/docs/assets/{templates_triage.md.CVlpctKS.js → templates_triage.md.Co4UNzkZ.js} +3 -3
  35. package/dist/docs/assets/{templates_triage.md.CVlpctKS.lean.js → templates_triage.md.Co4UNzkZ.lean.js} +1 -1
  36. package/dist/docs/building-with-agents.html +4 -4
  37. package/dist/docs/concepts.html +4 -4
  38. package/dist/docs/deployment.html +4 -4
  39. package/dist/docs/evals.html +4 -4
  40. package/dist/docs/guides/agent-to-agent.html +4 -4
  41. package/dist/docs/guides/cloud-runtime.html +4 -4
  42. package/dist/docs/guides/convert-automation.html +4 -4
  43. package/dist/docs/guides/github.html +4 -4
  44. package/dist/docs/guides/human-in-the-loop.html +4 -4
  45. package/dist/docs/guides/mcp-oauth.html +4 -4
  46. package/dist/docs/guides/opentelemetry.html +4 -4
  47. package/dist/docs/guides/slack.html +4 -4
  48. package/dist/docs/guides/webhooks.html +4 -4
  49. package/dist/docs/hashmap.json +1 -1
  50. package/dist/docs/hillclimbing.html +4 -4
  51. package/dist/docs/index.html +6 -6
  52. package/dist/docs/index.md +3 -1
  53. package/dist/docs/llms-full.txt +90 -26
  54. package/dist/docs/llms.txt +1 -0
  55. package/dist/docs/quickstart.html +4 -4
  56. package/dist/docs/reference/agent-config.html +4 -4
  57. package/dist/docs/reference/artifacts.html +4 -4
  58. package/dist/docs/reference/channels.html +4 -4
  59. package/dist/docs/reference/cli.html +7 -6
  60. package/dist/docs/reference/cli.md +3 -1
  61. package/dist/docs/reference/connections.html +4 -4
  62. package/dist/docs/reference/hooks.html +4 -4
  63. package/dist/docs/reference/http-api.html +4 -4
  64. package/dist/docs/reference/instructions.html +4 -4
  65. package/dist/docs/reference/playground.html +4 -4
  66. package/dist/docs/reference/project-layout.html +4 -4
  67. package/dist/docs/reference/prompt.html +4 -4
  68. package/dist/docs/reference/schedules.html +4 -4
  69. package/dist/docs/reference/sessions.html +4 -4
  70. package/dist/docs/reference/skills.html +7 -7
  71. package/dist/docs/reference/subagents.html +4 -4
  72. package/dist/docs/reference/tools.html +4 -4
  73. package/dist/docs/scaffolding-agents.html +4 -4
  74. package/dist/docs/storage.html +4 -4
  75. package/dist/docs/templates/agentic-owners.html +7 -7
  76. package/dist/docs/templates/agentic-owners.md +1 -1
  77. package/dist/docs/templates/demo.html +6 -6
  78. package/dist/docs/templates/demo.md +3 -2
  79. package/dist/docs/templates/pr-autofixer.html +6 -6
  80. package/dist/docs/templates/pr-autofixer.md +7 -13
  81. package/dist/docs/templates/security-help.html +30 -0
  82. package/dist/docs/templates/security-help.md +65 -0
  83. package/dist/docs/templates/security-reviewer.html +6 -6
  84. package/dist/docs/templates/security-reviewer.md +1 -2
  85. package/dist/docs/templates/triage.html +7 -7
  86. package/dist/docs/templates/triage.md +2 -6
  87. package/dist/docs/troubleshooting.html +4 -4
  88. package/dist/files-backends/cursor-hosted.d.ts +6 -2
  89. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  90. package/dist/files-backends/cursor-hosted.js +2 -2
  91. package/dist/files.d.ts +2 -0
  92. package/dist/files.d.ts.map +1 -1
  93. package/dist/files.js +5 -0
  94. package/dist/internal/cli-deploy.d.ts.map +1 -1
  95. package/dist/internal/cli-deploy.js +135 -6
  96. package/dist/internal/conversation-mirror.d.ts +82 -0
  97. package/dist/internal/conversation-mirror.d.ts.map +1 -0
  98. package/dist/internal/conversation-mirror.js +251 -0
  99. package/dist/internal/deferred-channel-session.d.ts +20 -0
  100. package/dist/internal/deferred-channel-session.d.ts.map +1 -0
  101. package/dist/internal/deferred-channel-session.js +62 -0
  102. package/dist/internal/deploy-client.d.ts +13 -1
  103. package/dist/internal/deploy-client.d.ts.map +1 -1
  104. package/dist/internal/deploy-client.js +11 -1
  105. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  106. package/dist/internal/deploy-manifest.js +11 -5
  107. package/dist/internal/discovery.d.ts.map +1 -1
  108. package/dist/internal/discovery.js +22 -2
  109. package/dist/internal/framework-storage-selection.d.ts +32 -16
  110. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  111. package/dist/internal/framework-storage-selection.js +51 -17
  112. package/dist/internal/hosted-admission-context.d.ts +20 -0
  113. package/dist/internal/hosted-admission-context.d.ts.map +1 -0
  114. package/dist/internal/hosted-admission-context.js +31 -0
  115. package/dist/internal/hosted-delivery-protocol.d.ts +5 -0
  116. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  117. package/dist/internal/hosted-delivery-protocol.js +33 -1
  118. package/dist/internal/hosted-delivery.d.ts +4 -2
  119. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  120. package/dist/internal/hosted-delivery.js +75 -35
  121. package/dist/internal/hosted-managed-automation.d.ts +30 -0
  122. package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
  123. package/dist/internal/hosted-managed-automation.js +58 -0
  124. package/dist/internal/review-comments.d.ts.map +1 -1
  125. package/dist/internal/review-comments.js +10 -98
  126. package/dist/internal/scm/pr-url.d.ts +14 -0
  127. package/dist/internal/scm/pr-url.d.ts.map +1 -0
  128. package/dist/internal/scm/pr-url.js +65 -0
  129. package/dist/internal/sdk-runner.d.ts +14 -0
  130. package/dist/internal/sdk-runner.d.ts.map +1 -1
  131. package/dist/internal/sdk-runner.js +41 -2
  132. package/dist/internal/server.d.ts.map +1 -1
  133. package/dist/internal/server.js +10 -2
  134. package/dist/internal/session-engine.d.ts.map +1 -1
  135. package/dist/internal/session-engine.js +9 -0
  136. package/dist/playground/assets/index-CF7hUDnQ.css +1 -0
  137. package/dist/playground/assets/{index-B3JCyigB.js → index-CZA1uEWA.js} +48 -48
  138. package/dist/playground/index.html +2 -2
  139. package/dist/storage-backends/cursor-hosted.d.ts +7 -2
  140. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  141. package/dist/storage-backends/cursor-hosted.js +2 -2
  142. package/docs/README.md +3 -1
  143. package/docs/reference/cli.md +3 -1
  144. package/docs/templates/agentic-owners.md +1 -1
  145. package/docs/templates/demo.md +3 -2
  146. package/docs/templates/pr-autofixer.md +7 -13
  147. package/docs/templates/security-help.md +70 -0
  148. package/docs/templates/security-reviewer.md +1 -2
  149. package/docs/templates/triage.md +2 -6
  150. package/package.json +1 -1
  151. package/src/channels/github/github-channel.ts +23 -8
  152. package/src/channels/github/types.ts +19 -2
  153. package/src/channels/origin/origin-channel.ts +13 -1
  154. package/src/channels/origin/origin-webhook.ts +27 -3
  155. package/src/channels/origin/types.ts +8 -0
  156. package/src/channels/slack/pr-ref.ts +56 -25
  157. package/src/files-backends/cursor-hosted.ts +9 -3
  158. package/src/files.ts +11 -0
  159. package/src/internal/cli-deploy.ts +171 -7
  160. package/src/internal/conversation-mirror.ts +330 -0
  161. package/src/internal/deferred-channel-session.ts +61 -0
  162. package/src/internal/deploy-client.ts +24 -1
  163. package/src/internal/deploy-manifest.ts +10 -5
  164. package/src/internal/discovery.ts +25 -2
  165. package/src/internal/framework-storage-selection.ts +61 -19
  166. package/src/internal/hosted-admission-context.ts +37 -0
  167. package/src/internal/hosted-delivery-protocol.ts +44 -1
  168. package/src/internal/hosted-delivery.ts +95 -40
  169. package/src/internal/hosted-managed-automation.ts +72 -0
  170. package/src/internal/review-comments.ts +10 -113
  171. package/src/internal/scm/pr-url.ts +95 -0
  172. package/src/internal/sdk-runner.ts +57 -2
  173. package/src/internal/server.ts +10 -0
  174. package/src/internal/session-engine.ts +12 -0
  175. package/src/storage-backends/cursor-hosted.ts +10 -3
  176. package/templates/agentic-owners/README.md +1 -1
  177. package/templates/agentic-owners/agent/agent.ts +0 -10
  178. package/templates/agentic-owners/agent/channels/github.ts +5 -14
  179. package/templates/agentic-owners/agent/lib/config.ts +0 -8
  180. package/templates/agentic-owners/agent/lib/review.ts +2 -15
  181. package/templates/agentic-owners/agent/tools/record_review.ts +2 -4
  182. package/templates/demo/agent/agent.ts +0 -10
  183. package/templates/pr-autofixer/README.md +0 -2
  184. package/templates/pr-autofixer/agent/agent.ts +0 -11
  185. package/templates/pr-autofixer/agent/channels/slack.ts +0 -7
  186. package/templates/pr-autofixer/agent/lib/pr-state.ts +5 -17
  187. package/templates/pr-autofixer/agent/lib/repos.ts +0 -1
  188. package/templates/security-help/README.md +2 -2
  189. package/templates/security-help/agent/agent.ts +1 -2
  190. package/templates/security-help/agent/channels/slack.ts +0 -3
  191. package/templates/security-help/agent/instructions.md +9 -10
  192. package/templates/security-help/agent/skills/access-request.md +1 -1
  193. package/templates/security-help/agent/skills/faq.md +31 -0
  194. package/templates/security-help/agent/skills/security-playbooks.md +1 -1
  195. package/templates/security-help/package.json +1 -2
  196. package/templates/security-reviewer/agent/agent.ts +0 -10
  197. package/templates/triage/agent/agent.ts +0 -10
  198. package/templates/triage/agent/channels/queue.ts +1 -1
  199. package/templates/triage/agent/channels/webhook.ts +1 -3
  200. package/dist/docs/assets/chunks/@localSearchIndexroot.DU3U2Ij2.js +0 -1
  201. package/dist/docs/assets/index.md.DRakGHFe.js +0 -5
  202. package/dist/playground/assets/index-D9N7-q97.css +0 -1
  203. package/templates/security-help/agent/knowledge/faq/approvals.md +0 -5
  204. package/templates/security-help/agent/knowledge/faq/channels.md +0 -6
  205. package/templates/security-help/agent/knowledge/faq/phishing.md +0 -10
  206. package/templates/security-help/agent/skills/security-first-pass.md +0 -15
  207. /package/dist/docs/assets/{reference_skills.md.8son6Hjm.lean.js → reference_skills.md.BFW9retM.lean.js} +0 -0
  208. /package/dist/docs/assets/{templates_agentic-owners.md.DqtPdm6f.lean.js → templates_agentic-owners.md.BZSH4N9z.lean.js} +0 -0
  209. /package/dist/docs/assets/{templates_demo.md.DhFcWN6j.lean.js → templates_demo.md.BeQX9V3H.lean.js} +0 -0
@@ -2,36 +2,52 @@
2
2
  * Which backend framework session state is mirrored to.
3
3
  *
4
4
  * Framework state — session records, event chunks, the continuation index —
5
- * is how a session outlives the process that served it. Today that mirror
6
- * exists only when the agent author wrote `agent/storage.ts`, which makes
7
- * platform durability an agent-level decision: of the first-party agents,
8
- * some choose `cursorHostedStorage()` and some choose `fileKv()` (pod-local
9
- * disk, lost on pod replacement), and one selects between them at runtime by
10
- * reading the deployment-id environment variable itself.
5
+ * is how a session outlives the process that served it. On architecture v1
6
+ * that mirror exists only when the agent author wrote `agent/storage.ts`,
7
+ * which makes platform durability an agent-level decision: of the
8
+ * first-party agents, some choose `cursorHostedStorage()` and some choose
9
+ * `fileKv()` (pod-local disk, lost on pod replacement), and one selects
10
+ * between them at runtime by reading the deployment-id environment variable
11
+ * itself.
11
12
  *
12
- * That selection is a hosting-mode question, not an authoring question, and
13
- * this module is where it will move. It deliberately reproduces today's
14
- * behavior exactly for now authored definition or nothing so the change
15
- * that makes framework durability automatic is a change to
16
- * {@link selectFrameworkStorageDefinition} alone, reviewable on its own and
17
- * revertable without touching the engine.
13
+ * That selection is a hosting-mode question, not an authoring question.
14
+ * Architecture v2 moves it here: `agent/storage.ts` is rejected at
15
+ * discovery (error diagnostic, so serve and deploy fail early), and the
16
+ * platform picks the default
17
+ *
18
+ * - **Cursor-managed hosting** (the deployment-generation environment
19
+ * variable is set, same signal that registers `GET /v1/manifest`):
20
+ * the Cursor-hosted backend, so session records, event chunks, `host.kv`,
21
+ * eval runs, and A/B samples land in the control plane and survive pod
22
+ * replacement. The API key resolves through the full credential chain on
23
+ * every call because hosted freeze snapshots listen unsigned and the
24
+ * binder drops the key file after restore.
25
+ * - **Self-hosted**: no mirror. `--state-root` is the durable copy, which
26
+ * is correct when the operator owns the disk.
27
+ *
28
+ * v1 keeps the authored definition (or nothing) so existing deployments are
29
+ * untouched while they run.
18
30
  *
19
31
  * Local disk is not part of this decision. `<stateRoot>/sessions/<id>/`
20
32
  * already holds `session.json` and `events.ndjson` unconditionally, through
21
33
  * the session store; what this selects is the durable mirror *beyond* the
22
34
  * pod's filesystem.
23
35
  */
24
- import type { StorageDefinition } from "../storage.js";
36
+ import { type StorageDefinition } from "../storage.js";
37
+ import type { AgentArchitecture } from "../types.js";
25
38
  export interface FrameworkStorageSelectionInput {
26
- /** `agent/storage.ts`, when the author wrote one. */
39
+ /** `agent/storage.ts`, when the author wrote one (v1 only: discovery rejects it on v2). */
27
40
  readonly authored: StorageDefinition | undefined;
41
+ /** {@link AgentConfig.architecture}; omitted means v1. */
42
+ readonly architecture?: AgentArchitecture | undefined;
43
+ /** Environment override for tests; defaults to `process.env`. */
44
+ readonly env?: Record<string, string | undefined>;
28
45
  }
29
46
  /**
30
47
  * Pick the backend for framework session state.
31
48
  *
32
49
  * Returns `undefined` when there is no mirror, in which case the pod's local
33
- * disk is the only copy — the condition F0 exists to remove for hosted
34
- * deployments.
50
+ * disk is the only copy.
35
51
  */
36
52
  export declare function selectFrameworkStorageDefinition(input: FrameworkStorageSelectionInput): StorageDefinition | undefined;
37
53
  //# sourceMappingURL=framework-storage-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-storage-selection.d.ts","sourceRoot":"","sources":["../../src/internal/framework-storage-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,8BAA8B;IAC7C,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,8BAA8B,GACpC,iBAAiB,GAAG,SAAS,CAI/B"}
1
+ {"version":3,"file":"framework-storage-selection.d.ts","sourceRoot":"","sources":["../../src/internal/framework-storage-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrD,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,CA2B/B"}
@@ -2,34 +2,68 @@
2
2
  * Which backend framework session state is mirrored to.
3
3
  *
4
4
  * Framework state — session records, event chunks, the continuation index —
5
- * is how a session outlives the process that served it. Today that mirror
6
- * exists only when the agent author wrote `agent/storage.ts`, which makes
7
- * platform durability an agent-level decision: of the first-party agents,
8
- * some choose `cursorHostedStorage()` and some choose `fileKv()` (pod-local
9
- * disk, lost on pod replacement), and one selects between them at runtime by
10
- * reading the deployment-id environment variable itself.
5
+ * is how a session outlives the process that served it. On architecture v1
6
+ * that mirror exists only when the agent author wrote `agent/storage.ts`,
7
+ * which makes platform durability an agent-level decision: of the
8
+ * first-party agents, some choose `cursorHostedStorage()` and some choose
9
+ * `fileKv()` (pod-local disk, lost on pod replacement), and one selects
10
+ * between them at runtime by reading the deployment-id environment variable
11
+ * itself.
11
12
  *
12
- * That selection is a hosting-mode question, not an authoring question, and
13
- * this module is where it will move. It deliberately reproduces today's
14
- * behavior exactly for now authored definition or nothing so the change
15
- * that makes framework durability automatic is a change to
16
- * {@link selectFrameworkStorageDefinition} alone, reviewable on its own and
17
- * revertable without touching the engine.
13
+ * That selection is a hosting-mode question, not an authoring question.
14
+ * Architecture v2 moves it here: `agent/storage.ts` is rejected at
15
+ * discovery (error diagnostic, so serve and deploy fail early), and the
16
+ * platform picks the default
17
+ *
18
+ * - **Cursor-managed hosting** (the deployment-generation environment
19
+ * variable is set, same signal that registers `GET /v1/manifest`):
20
+ * the Cursor-hosted backend, so session records, event chunks, `host.kv`,
21
+ * eval runs, and A/B samples land in the control plane and survive pod
22
+ * replacement. The API key resolves through the full credential chain on
23
+ * every call because hosted freeze snapshots listen unsigned and the
24
+ * binder drops the key file after restore.
25
+ * - **Self-hosted**: no mirror. `--state-root` is the durable copy, which
26
+ * is correct when the operator owns the disk.
27
+ *
28
+ * v1 keeps the authored definition (or nothing) so existing deployments are
29
+ * untouched while they run.
18
30
  *
19
31
  * Local disk is not part of this decision. `<stateRoot>/sessions/<id>/`
20
32
  * already holds `session.json` and `events.ndjson` unconditionally, through
21
33
  * the session store; what this selects is the durable mirror *beyond* the
22
34
  * pod's filesystem.
23
35
  */
36
+ import { defineStorage } from "../storage.js";
37
+ import { cursorHostedStorage } from "../storage-backends/cursor-hosted.js";
38
+ import { resolveApiKeySync } from "./cursor/credentials.js";
39
+ import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
24
40
  /**
25
41
  * Pick the backend for framework session state.
26
42
  *
27
43
  * Returns `undefined` when there is no mirror, in which case the pod's local
28
- * disk is the only copy — the condition F0 exists to remove for hosted
29
- * deployments.
44
+ * disk is the only copy.
30
45
  */
31
46
  export function selectFrameworkStorageDefinition(input) {
32
- // Today: the author decides, or there is no mirror. Hosting-mode selection
33
- // replaces this body; every caller already routes through here.
34
- return input.authored;
47
+ var _a;
48
+ if (input.architecture !== "v2") {
49
+ // v1: the author decides, or there is no mirror.
50
+ return input.authored;
51
+ }
52
+ if (input.authored !== undefined) {
53
+ // Discovery rejects agent/storage.ts on v2 before an engine is built;
54
+ // an authored definition reaching this point is a wiring bug. Raise
55
+ // rather than silently discard what the author believes is configured.
56
+ throw new Error('defineStorage (agent/storage.ts) is not supported on architecture "v2": storage is platform-selected. Delete the file.');
57
+ }
58
+ const env = (_a = input.env) !== null && _a !== void 0 ? _a : process.env;
59
+ if (env[AGENT_SERVE_GENERATION_ENV_VAR] === undefined) {
60
+ // Self-hosted v2: the state root is the durable copy.
61
+ return undefined;
62
+ }
63
+ return defineStorage(Object.assign({ name: "cursor-hosted" }, cursorHostedStorage({
64
+ // Full chain (env → key file → stored login): frozen engines listen
65
+ // unsigned and bind CURSOR_API_KEY_FILE at task time, after this
66
+ // definition is constructed.
67
+ apiKey: () => { var _a; return (_a = resolveApiKeySync()) === null || _a === void 0 ? void 0 : _a.apiKey; },
68
+ })));
35
69
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A `send()` captured outside the delivery (typically at channel `onStart`,
3
+ * which binds directly to the engine) reached the engine during a hosted
4
+ * admission window. Running it would start a local July session on a
5
+ * sessionless pod — invisible to the control plane, destroyed with the pod —
6
+ * so it fails loudly instead. This is a deterministic authored bug and is
7
+ * surfaced as a non-retryable 422 by the admission route.
8
+ */
9
+ export declare class HostedAdmissionLocalSendError extends Error {
10
+ constructor();
11
+ }
12
+ /**
13
+ * Run `work` inside the hosted admission window. The context follows the
14
+ * async graph, including `waitUntil` task bodies scheduled during dispatch,
15
+ * so the engine can refuse local sends that bypass the capture stub.
16
+ */
17
+ export declare function runDuringHostedAdmission<T>(work: () => T): T;
18
+ /** True while executing inside a hosted admission window. */
19
+ export declare function isDuringHostedAdmission(): boolean;
20
+ //# sourceMappingURL=hosted-admission-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-admission-context.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-admission-context.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,cAQC;CACF;AAID;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAE5D;AAED,6DAA6D;AAC7D,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD"}
@@ -0,0 +1,31 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ /**
3
+ * A `send()` captured outside the delivery (typically at channel `onStart`,
4
+ * which binds directly to the engine) reached the engine during a hosted
5
+ * admission window. Running it would start a local July session on a
6
+ * sessionless pod — invisible to the control plane, destroyed with the pod —
7
+ * so it fails loudly instead. This is a deterministic authored bug and is
8
+ * surfaced as a non-retryable 422 by the admission route.
9
+ */
10
+ export class HostedAdmissionLocalSendError extends Error {
11
+ constructor() {
12
+ super("send() reached the local engine during hosted admission. A send " +
13
+ "captured at channel startup (onStart) bypasses hosted capture and " +
14
+ "would run an invisible local session on a sessionless pod. Use the " +
15
+ "per-delivery send passed to the task callback " +
16
+ "(task: (args) => args.send(…)) instead.");
17
+ }
18
+ }
19
+ const admissionWindow = new AsyncLocalStorage();
20
+ /**
21
+ * Run `work` inside the hosted admission window. The context follows the
22
+ * async graph, including `waitUntil` task bodies scheduled during dispatch,
23
+ * so the engine can refuse local sends that bypass the capture stub.
24
+ */
25
+ export function runDuringHostedAdmission(work) {
26
+ return admissionWindow.run(true, work);
27
+ }
28
+ /** True while executing inside a hosted admission window. */
29
+ export function isDuringHostedAdmission() {
30
+ return admissionWindow.getStore() === true;
31
+ }
@@ -2,6 +2,10 @@ 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 type HostedAdmissionManagedAutomation = {
6
+ automationUuid: string;
7
+ mcpServerNames: string[];
8
+ };
5
9
  export type HostedAdmission = {
6
10
  v: 2;
7
11
  channelId: string;
@@ -11,6 +15,7 @@ export type HostedAdmission = {
11
15
  sessionMode: "event" | "continuation";
12
16
  mailboxContinuationKey: string;
13
17
  payload: unknown;
18
+ managedAutomation?: HostedAdmissionManagedAutomation;
14
19
  };
15
20
  export type HostedAdmissionOutcome = {
16
21
  ok: true;
@@ -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;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,CAAC,CAAC;IACL,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,QAAQ,CAAC;IACtB,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;CAClB,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;AAkBF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,eAAe,GAAG,SAAS,CAsB7B;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;AAErE,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,CAAC,CAAC;IACL,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,QAAQ,CAAC;IACtB,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;AAsDF,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"}
@@ -11,11 +11,42 @@ const DELIVERY_KEYS = new Set([
11
11
  "sessionMode",
12
12
  "mailboxContinuationKey",
13
13
  "payload",
14
+ "managedAutomation",
14
15
  ]);
16
+ const MANAGED_AUTOMATION_KEYS = new Set(["automationUuid", "mcpServerNames"]);
17
+ /** More names than any real automation configures is a malformed envelope. */
18
+ const MANAGED_AUTOMATION_MAX_SERVERS = 64;
15
19
  const EXECUTION_KEYS = new Set(["v", "admissionToken", "sessionPublicId"]);
16
20
  function boundedString(value, max) {
17
21
  return typeof value === "string" && value.length > 0 && value.length <= max;
18
22
  }
23
+ /**
24
+ * Parse the optional managed-automation slice. Absent → valid (undefined);
25
+ * present-but-malformed → invalid (the whole admission fails closed, the
26
+ * strict posture the rest of the envelope already takes).
27
+ */
28
+ function parseManagedAutomation(value) {
29
+ if (value === undefined) {
30
+ return {};
31
+ }
32
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
33
+ return undefined;
34
+ }
35
+ const body = value;
36
+ if (Object.keys(body).some((key) => !MANAGED_AUTOMATION_KEYS.has(key)) ||
37
+ !boundedString(body.automationUuid, 128) ||
38
+ !Array.isArray(body.mcpServerNames) ||
39
+ body.mcpServerNames.length > MANAGED_AUTOMATION_MAX_SERVERS ||
40
+ !body.mcpServerNames.every((name) => boundedString(name, 256))) {
41
+ return undefined;
42
+ }
43
+ return {
44
+ managedAutomation: {
45
+ automationUuid: body.automationUuid,
46
+ mcpServerNames: body.mcpServerNames,
47
+ },
48
+ };
49
+ }
19
50
  export function parseHostedAdmission(value) {
20
51
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
21
52
  return undefined;
@@ -29,7 +60,8 @@ export function parseHostedAdmission(value) {
29
60
  !boundedString(body.eventType, 128) ||
30
61
  !boundedString(body.deliveryId, 256) ||
31
62
  (body.sessionMode !== "event" && body.sessionMode !== "continuation") ||
32
- !boundedString(body.mailboxContinuationKey, 512)) {
63
+ !boundedString(body.mailboxContinuationKey, 512) ||
64
+ parseManagedAutomation(body.managedAutomation) === undefined) {
33
65
  return undefined;
34
66
  }
35
67
  const prefix = body.sessionMode === "event" ? "evt:" : "cont:";
@@ -18,8 +18,10 @@ type AdmissionDispatch = {
18
18
  };
19
19
  /**
20
20
  * Run authored admission without creating a framework session. V1 GitHub
21
- * `task` callbacks execute as sessionless work; `send` is captured and
22
- * resumed only after the control plane allocates `ses_…`.
21
+ * `task` callbacks execute as sessionless work; the first `send` is captured
22
+ * and executed only after the control plane allocates `ses_…`. Capturing
23
+ * does not terminate the caller — `send` returns an inert deferred handle so
24
+ * a task body runs to completion before the admission response is computed.
23
25
  */
24
26
  export declare function dispatchHostedAdmission(input: DispatchInput): Promise<AdmissionDispatch>;
25
27
  export declare function registerHostedDeliveryRoute(input: {
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAgBF;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,iBAAiB,CAAC,CA2G5B;AAeD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,MAAM,GACvB,kBAAkB,CAAC;CACvB,GAAG,IAAI,CAqKP"}
1
+ {"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AASrB,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AA6DF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAa5B;AA2GD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,MAAM,GACvB,kBAAkB,CAAC;CACvB,GAAG,IAAI,CAsKP"}
@@ -9,19 +9,60 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { randomBytes } from "node:crypto";
11
11
  import { dispatchGitHubWebhook, getGitHubChannelOptions, getGitHubDispatchOutcome, withPropagatingGitHubBackgroundErrors, } from "../channels/github/github-channel.js";
12
+ import { createDeferredChannelSession, DeferredChannelSessionError, } from "./deferred-channel-session.js";
13
+ import { HostedAdmissionLocalSendError, runDuringHostedAdmission, } from "./hosted-admission-context.js";
12
14
  import { HOSTED_ADMISSION_PATH, HOSTED_DELIVERY_HEADER, HOSTED_DELIVERY_PROTOCOL_VERSION, HOSTED_EXECUTION_PATH, parseHostedAdmission, parseHostedExecution, } from "./hosted-delivery-protocol.js";
15
+ import { recordHostedManagedAutomation } from "./hosted-managed-automation.js";
13
16
  import { errorResponse, readJsonObject } from "./http-channel.js";
14
- class HostedSendAdmitted extends Error {
15
- constructor(prompt, options) {
16
- super("hosted channel admitted a send");
17
- this.prompt = prompt;
18
- this.options = options;
17
+ /**
18
+ * A second `send()` in one delivery is a deterministic authored bug — the
19
+ * wire protocol carries exactly one pending send per delivery — so it must
20
+ * fail the delivery exactly once. It surfaces as a 422 because the control
21
+ * plane retries 5xx admissions (fresh pod, side effects re-run, identical
22
+ * failure, up to the Temporal attempt cap); a non-5xx/408/429 status makes
23
+ * it reject the delivery non-retryably instead.
24
+ */
25
+ class HostedSendLimitExceeded extends Error {
26
+ constructor() {
27
+ super("The hosted delivery protocol carries exactly one pending send per " +
28
+ "delivery, and this delivery already captured one. Combine both " +
29
+ "messages into a single send(), or split the work across deliveries.");
30
+ }
31
+ }
32
+ // Authored/task-derived text stays bounded on this internal response path
33
+ // (and is never persisted to Temporal history by the control plane).
34
+ const MAX_ERROR_MESSAGE_LENGTH = 1024;
35
+ function boundedMessage(text) {
36
+ return text.length > MAX_ERROR_MESSAGE_LENGTH
37
+ ? `${text.slice(0, MAX_ERROR_MESSAGE_LENGTH)}…`
38
+ : text;
39
+ }
40
+ /**
41
+ * Classify deterministic authored protocol violations as non-retryable 422
42
+ * admissions. Anything else returns `undefined` so callers fall through to
43
+ * the existing (retryable or rethrow) handling.
44
+ */
45
+ function nonRetryableRejection(error) {
46
+ const code = error instanceof HostedSendLimitExceeded
47
+ ? "hosted_send_limit_exceeded"
48
+ : error instanceof DeferredChannelSessionError
49
+ ? "hosted_deferred_session_unusable"
50
+ : error instanceof HostedAdmissionLocalSendError
51
+ ? "hosted_local_send_rejected"
52
+ : undefined;
53
+ if (code === undefined) {
54
+ return undefined;
19
55
  }
56
+ return {
57
+ response: errorResponse(422, code, boundedMessage(error.message)),
58
+ };
20
59
  }
21
60
  /**
22
61
  * Run authored admission without creating a framework session. V1 GitHub
23
- * `task` callbacks execute as sessionless work; `send` is captured and
24
- * resumed only after the control plane allocates `ses_…`.
62
+ * `task` callbacks execute as sessionless work; the first `send` is captured
63
+ * and executed only after the control plane allocates `ses_…`. Capturing
64
+ * does not terminate the caller — `send` returns an inert deferred handle so
65
+ * a task body runs to completion before the admission response is computed.
25
66
  */
26
67
  export function dispatchHostedAdmission(input) {
27
68
  return __awaiter(this, void 0, void 0, function* () {
@@ -31,18 +72,23 @@ export function dispatchHostedAdmission(input) {
31
72
  response: Response.json({ ok: false, error: "channel_kind_mismatch" }, { status: 422 }),
32
73
  };
33
74
  }
75
+ // The admission window marker follows the async graph into task bodies so
76
+ // the engine can refuse local sends that would bypass the capture stub.
77
+ return runDuringHostedAdmission(() => runAdmission(input, github));
78
+ });
79
+ }
80
+ function runAdmission(input, github) {
81
+ return __awaiter(this, void 0, void 0, function* () {
34
82
  const background = [];
35
- let deferredSend;
83
+ let captured;
36
84
  const args = withPropagatingGitHubBackgroundErrors(Object.assign(Object.assign({}, input.args), { send: (message_1, ...args_1) => __awaiter(this, [message_1, ...args_1], void 0, function* (message, options = {}) {
37
- throw new HostedSendAdmitted(message, options);
85
+ if (captured !== undefined) {
86
+ throw new HostedSendLimitExceeded();
87
+ }
88
+ captured = { message, options };
89
+ return createDeferredChannelSession();
38
90
  }), waitUntil: (promise) => {
39
- background.push(promise.catch((error) => {
40
- if (error instanceof HostedSendAdmitted) {
41
- deferredSend = error;
42
- return;
43
- }
44
- throw error;
45
- }));
91
+ background.push(promise);
46
92
  } }));
47
93
  let dispatched;
48
94
  try {
@@ -55,20 +101,9 @@ export function dispatchHostedAdmission(input) {
55
101
  });
56
102
  }
57
103
  catch (error) {
58
- if (error instanceof HostedSendAdmitted) {
59
- return {
60
- response: Response.json({
61
- ok: true,
62
- v: HOSTED_DELIVERY_PROTOCOL_VERSION,
63
- outcome: "send",
64
- }),
65
- pendingSend: {
66
- channelId: input.delivery.channelId,
67
- message: error.prompt,
68
- options: error.options,
69
- mailboxContinuationKey: input.delivery.mailboxContinuationKey,
70
- },
71
- };
104
+ const rejected = nonRetryableRejection(error);
105
+ if (rejected !== undefined) {
106
+ return rejected;
72
107
  }
73
108
  throw error;
74
109
  }
@@ -80,12 +115,16 @@ export function dispatchHostedAdmission(input) {
80
115
  try {
81
116
  yield Promise.all(background);
82
117
  }
83
- catch (_a) {
118
+ catch (error) {
119
+ const rejected = nonRetryableRejection(error);
120
+ if (rejected !== undefined) {
121
+ return rejected;
122
+ }
84
123
  return {
85
- response: Response.json({ ok: false, error: "background_dispatch_failed" }, { status: 503 }),
124
+ response: errorResponse(503, "background_dispatch_failed", boundedMessage(error instanceof Error ? error.message : String(error))),
86
125
  };
87
126
  }
88
- if (deferredSend !== undefined) {
127
+ if (captured !== undefined) {
89
128
  return {
90
129
  response: Response.json({
91
130
  ok: true,
@@ -94,8 +133,8 @@ export function dispatchHostedAdmission(input) {
94
133
  }),
95
134
  pendingSend: {
96
135
  channelId: input.delivery.channelId,
97
- message: deferredSend.prompt,
98
- options: deferredSend.options,
136
+ message: captured.message,
137
+ options: captured.options,
99
138
  mailboxContinuationKey: input.delivery.mailboxContinuationKey,
100
139
  },
101
140
  };
@@ -158,6 +197,7 @@ export function registerHostedDeliveryRoute(input) {
158
197
  if (delivery === undefined) {
159
198
  return finish(errorResponse(400, "invalid_hosted_admission", "Expected a supported Agent SDK hosted-admission envelope."));
160
199
  }
200
+ recordHostedManagedAutomation(delivery);
161
201
  const channel = input.channels.find((candidate) => candidate.id === delivery.channelId);
162
202
  if (channel === undefined) {
163
203
  return finish(errorResponse(404, "channel_not_found", `No channel named "${delivery.channelId}" is mounted.`));
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Managed-automation envelope slices by provider delivery id (plan 0002
3
+ * G2), recorded at hosted admission so channel code running the delivery's
4
+ * task (or session turn) can attach the customer's MCP servers through the
5
+ * control-plane relay. In-memory and TTL-bounded like the hosted pending-
6
+ * send table: the envelope slice carries names only (never credentials)
7
+ * and evaporates with the process.
8
+ *
9
+ * A leaf module (protocol type import only) so product channels can read
10
+ * it without pulling the hosted-delivery route — and its session-engine
11
+ * dependency graph — into their bundles.
12
+ *
13
+ * INTERNAL: first-party multi-tenant deployment plumbing. Deliberately
14
+ * excluded from the published `@cursor/july` npm package (see the `files`
15
+ * whitelist); consumed by internal deployments via relative source imports.
16
+ */
17
+ import type { HostedAdmissionManagedAutomation } from "./hosted-delivery-protocol.js";
18
+ export declare function recordHostedManagedAutomation(delivery: {
19
+ deliveryId: string;
20
+ managedAutomation?: HostedAdmissionManagedAutomation;
21
+ }): void;
22
+ /**
23
+ * The managed automation the control plane attributed to a hosted delivery,
24
+ * when the envelope carried one. Undefined for non-managed deliveries,
25
+ * expired entries, and non-hosted (webhook/stream) dispatch paths.
26
+ */
27
+ export declare function getHostedManagedAutomation(deliveryId: string): HostedAdmissionManagedAutomation | undefined;
28
+ /** Drop recorded managed-automation slices (tests only). */
29
+ export declare function resetHostedManagedAutomationForTest(): void;
30
+ //# sourceMappingURL=hosted-managed-automation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-managed-automation.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-managed-automation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAUtF,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CACtD,GAAG,IAAI,CAiBP;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GACjB,gCAAgC,GAAG,SAAS,CAU9C;AAED,4DAA4D;AAC5D,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Managed-automation envelope slices by provider delivery id (plan 0002
3
+ * G2), recorded at hosted admission so channel code running the delivery's
4
+ * task (or session turn) can attach the customer's MCP servers through the
5
+ * control-plane relay. In-memory and TTL-bounded like the hosted pending-
6
+ * send table: the envelope slice carries names only (never credentials)
7
+ * and evaporates with the process.
8
+ *
9
+ * A leaf module (protocol type import only) so product channels can read
10
+ * it without pulling the hosted-delivery route — and its session-engine
11
+ * dependency graph — into their bundles.
12
+ *
13
+ * INTERNAL: first-party multi-tenant deployment plumbing. Deliberately
14
+ * excluded from the published `@cursor/july` npm package (see the `files`
15
+ * whitelist); consumed by internal deployments via relative source imports.
16
+ */
17
+ const managedAutomationByDelivery = new Map();
18
+ /** Long enough to outlive a slow review run kicked off by the delivery. */
19
+ const MANAGED_AUTOMATION_TTL_MS = 60 * 60000;
20
+ const MANAGED_AUTOMATION_MAX_ENTRIES = 10000;
21
+ export function recordHostedManagedAutomation(delivery) {
22
+ if (delivery.managedAutomation === undefined) {
23
+ return;
24
+ }
25
+ const now = Date.now();
26
+ for (const [key, entry] of managedAutomationByDelivery) {
27
+ if (entry.expiresAt <= now) {
28
+ managedAutomationByDelivery.delete(key);
29
+ }
30
+ }
31
+ if (managedAutomationByDelivery.size >= MANAGED_AUTOMATION_MAX_ENTRIES) {
32
+ managedAutomationByDelivery.clear();
33
+ }
34
+ managedAutomationByDelivery.set(delivery.deliveryId, {
35
+ managedAutomation: delivery.managedAutomation,
36
+ expiresAt: now + MANAGED_AUTOMATION_TTL_MS,
37
+ });
38
+ }
39
+ /**
40
+ * The managed automation the control plane attributed to a hosted delivery,
41
+ * when the envelope carried one. Undefined for non-managed deliveries,
42
+ * expired entries, and non-hosted (webhook/stream) dispatch paths.
43
+ */
44
+ export function getHostedManagedAutomation(deliveryId) {
45
+ const entry = managedAutomationByDelivery.get(deliveryId);
46
+ if (entry === undefined) {
47
+ return undefined;
48
+ }
49
+ if (entry.expiresAt <= Date.now()) {
50
+ managedAutomationByDelivery.delete(deliveryId);
51
+ return undefined;
52
+ }
53
+ return entry.managedAutomation;
54
+ }
55
+ /** Drop recorded managed-automation slices (tests only). */
56
+ export function resetHostedManagedAutomationForTest() {
57
+ managedAutomationByDelivery.clear();
58
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"review-comments.d.ts","sourceRoot":"","sources":["../../src/internal/review-comments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,CAAC;AAEhF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,sBAAsB,CAAC;IAClC,IAAI,EAAE,6BAA6B,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACxC,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAA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S,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAA;CAAE,CAkBvD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,oCAAoC,CAMnF;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,gBAAgB,GACvB,oCAAoC,CAMtC;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC,GAAG,oCAAoC,GAAG,SAAS,CAenD;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,sBAAsB,GAC7B,oCAAoC,CAMtC"}
1
+ {"version":3,"file":"review-comments.d.ts","sourceRoot":"","sources":["../../src/internal/review-comments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,CAAC;AAEhF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,sBAAsB,CAAC;IAClC,IAAI,EAAE,6BAA6B,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACxC,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU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