@cursor/july 0.1.43 → 0.1.46

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 (197) hide show
  1. package/AGENTS.md +5 -3
  2. package/README.md +3 -1
  3. package/dist/channels/github/api.d.ts +25 -0
  4. package/dist/channels/github/api.d.ts.map +1 -1
  5. package/dist/channels/github/api.js +48 -0
  6. package/dist/channels/github/cursor-account.d.ts +7 -0
  7. package/dist/channels/github/cursor-account.d.ts.map +1 -1
  8. package/dist/channels/github/cursor-account.js +18 -0
  9. package/dist/channels/github/defaults.d.ts +1 -1
  10. package/dist/channels/github/defaults.js +1 -1
  11. package/dist/channels/github/github-channel.d.ts.map +1 -1
  12. package/dist/channels/github/github-channel.js +15 -7
  13. package/dist/channels/github/progress.d.ts +6 -5
  14. package/dist/channels/github/progress.d.ts.map +1 -1
  15. package/dist/channels/github/progress.js +58 -16
  16. package/dist/channels/github/state.d.ts +11 -0
  17. package/dist/channels/github/state.d.ts.map +1 -1
  18. package/dist/channels/github/state.js +1 -1
  19. package/dist/channels/github/types.d.ts +11 -3
  20. package/dist/channels/github/types.d.ts.map +1 -1
  21. package/dist/channels.d.ts +17 -0
  22. package/dist/channels.d.ts.map +1 -1
  23. package/dist/channels.js +31 -0
  24. package/dist/docs/404.html +2 -2
  25. package/dist/docs/ab.html +3 -3
  26. package/dist/docs/assets/{app.DsTLo2j1.js → app.C2NFTb-h.js} +1 -1
  27. package/dist/docs/assets/chunks/@localSearchIndexroot.B-FxvuoI.js +1 -0
  28. package/dist/docs/assets/chunks/{VPLocalSearchBox.DoVfutcV.js → VPLocalSearchBox.o1_FJGip.js} +1 -1
  29. package/dist/docs/assets/chunks/{theme.DtuVtKkc.js → theme.BcGduE7g.js} +2 -2
  30. package/dist/docs/assets/{guides_github.md.DSg0j9qj.js → guides_github.md.B8QKtIpw.js} +7 -6
  31. package/dist/docs/assets/{guides_github.md.DSg0j9qj.lean.js → guides_github.md.B8QKtIpw.lean.js} +1 -1
  32. package/dist/docs/assets/guides_opentelemetry.md.Csn7ZI25.js +27 -0
  33. package/dist/docs/assets/guides_opentelemetry.md.Csn7ZI25.lean.js +1 -0
  34. package/dist/docs/assets/index.md.COeoSkcF.js +5 -0
  35. package/dist/docs/assets/index.md.COeoSkcF.lean.js +1 -0
  36. package/dist/docs/assets/{quickstart.md.rIbfahJM.js → quickstart.md.DZxBu44y.js} +18 -49
  37. package/dist/docs/assets/quickstart.md.DZxBu44y.lean.js +1 -0
  38. package/dist/docs/assets/{reference_agent-config.md.CRmkoxd6.js → reference_agent-config.md.DHkkvcEZ.js} +9 -4
  39. package/dist/docs/assets/{reference_agent-config.md.CRmkoxd6.lean.js → reference_agent-config.md.DHkkvcEZ.lean.js} +1 -1
  40. package/dist/docs/assets/{reference_cli.md.DqEqQpGn.js → reference_cli.md.BDmjPPAm.js} +2 -2
  41. package/dist/docs/assets/{reference_hooks.md.4cbRRIIu.js → reference_hooks.md.DJE5DXcT.js} +1 -1
  42. package/dist/docs/assets/{reference_tools.md.lSrsTxYJ.js → reference_tools.md.kJfJAP2m.js} +1 -1
  43. package/dist/docs/assets/{storage.md.DcGSnIxX.js → storage.md.CJYd5YmN.js} +2 -2
  44. package/dist/docs/assets/{storage.md.DcGSnIxX.lean.js → storage.md.CJYd5YmN.lean.js} +1 -1
  45. package/dist/docs/building-with-agents.html +3 -3
  46. package/dist/docs/concepts.html +3 -3
  47. package/dist/docs/deployment.html +3 -3
  48. package/dist/docs/evals.html +3 -3
  49. package/dist/docs/example-agents/approval-buddy.html +3 -3
  50. package/dist/docs/example-agents/benny.html +3 -3
  51. package/dist/docs/example-agents/bugbot.html +3 -3
  52. package/dist/docs/example-agents/codebase-wiki.html +3 -3
  53. package/dist/docs/example-agents/codeowners-review.html +3 -3
  54. package/dist/docs/example-agents/concierge.html +3 -3
  55. package/dist/docs/example-agents/fsd.html +3 -3
  56. package/dist/docs/example-agents/index.html +3 -3
  57. package/dist/docs/example-agents/knowledge-base.html +3 -3
  58. package/dist/docs/example-agents/oncall.html +3 -3
  59. package/dist/docs/example-agents/security-reviewer.html +3 -3
  60. package/dist/docs/example-agents/slack-agent.html +3 -3
  61. package/dist/docs/example-agents/weather-agent.html +3 -3
  62. package/dist/docs/guides/agent-to-agent.html +3 -3
  63. package/dist/docs/guides/cloud-runtime.html +3 -3
  64. package/dist/docs/guides/github.html +10 -9
  65. package/dist/docs/guides/human-in-the-loop.html +3 -3
  66. package/dist/docs/guides/mcp-oauth.html +3 -3
  67. package/dist/docs/guides/opentelemetry.html +12 -5
  68. package/dist/docs/guides/slack.html +3 -3
  69. package/dist/docs/guides/webhooks.html +3 -3
  70. package/dist/docs/hashmap.json +1 -1
  71. package/dist/docs/hillclimbing.html +3 -3
  72. package/dist/docs/index.html +8 -28
  73. package/dist/docs/quickstart.html +24 -55
  74. package/dist/docs/reference/agent-config.html +11 -6
  75. package/dist/docs/reference/artifacts.html +3 -3
  76. package/dist/docs/reference/channels.html +3 -3
  77. package/dist/docs/reference/cli.html +6 -6
  78. package/dist/docs/reference/connections.html +3 -3
  79. package/dist/docs/reference/hooks.html +5 -5
  80. package/dist/docs/reference/http-api.html +3 -3
  81. package/dist/docs/reference/instructions.html +3 -3
  82. package/dist/docs/reference/playground.html +3 -3
  83. package/dist/docs/reference/project-layout.html +3 -3
  84. package/dist/docs/reference/prompt.html +3 -3
  85. package/dist/docs/reference/schedules.html +3 -3
  86. package/dist/docs/reference/sessions.html +3 -3
  87. package/dist/docs/reference/skills.html +3 -3
  88. package/dist/docs/reference/subagents.html +3 -3
  89. package/dist/docs/reference/tools.html +5 -5
  90. package/dist/docs/scaffolding-agents.html +3 -3
  91. package/dist/docs/storage.html +5 -5
  92. package/dist/docs/templates/triage.html +3 -3
  93. package/dist/docs/troubleshooting.html +3 -3
  94. package/dist/index.d.ts +2 -2
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +2 -2
  97. package/dist/internal/auth.d.ts +4 -0
  98. package/dist/internal/auth.d.ts.map +1 -1
  99. package/dist/internal/auth.js +7 -0
  100. package/dist/internal/cli-ax.js +2 -2
  101. package/dist/internal/cli-deploy.d.ts.map +1 -1
  102. package/dist/internal/cli-deploy.js +38 -7
  103. package/dist/internal/deploy-client.d.ts +8 -0
  104. package/dist/internal/deploy-client.d.ts.map +1 -1
  105. package/dist/internal/deploy-client.js +5 -2
  106. package/dist/internal/discovery.d.ts.map +1 -1
  107. package/dist/internal/discovery.js +46 -9
  108. package/dist/internal/durable-session-store.d.ts +35 -23
  109. package/dist/internal/durable-session-store.d.ts.map +1 -1
  110. package/dist/internal/durable-session-store.js +71 -26
  111. package/dist/internal/host-otel.d.ts +25 -0
  112. package/dist/internal/host-otel.d.ts.map +1 -0
  113. package/dist/internal/host-otel.js +162 -0
  114. package/dist/internal/init-project.js +10 -10
  115. package/dist/internal/ledger-serving.d.ts +135 -67
  116. package/dist/internal/ledger-serving.d.ts.map +1 -1
  117. package/dist/internal/ledger-serving.js +326 -107
  118. package/dist/internal/otel/collector.d.ts +5 -0
  119. package/dist/internal/otel/collector.d.ts.map +1 -1
  120. package/dist/internal/otel/collector.js +68 -27
  121. package/dist/internal/sdk-runner.d.ts +1 -1
  122. package/dist/internal/sdk-runner.d.ts.map +1 -1
  123. package/dist/internal/sdk-runner.js +1 -1
  124. package/dist/internal/server.d.ts.map +1 -1
  125. package/dist/internal/server.js +3 -2
  126. package/dist/internal/session-engine.d.ts +23 -18
  127. package/dist/internal/session-engine.d.ts.map +1 -1
  128. package/dist/internal/session-engine.js +83 -32
  129. package/dist/kv/memory-kv.d.ts +8 -0
  130. package/dist/kv/memory-kv.d.ts.map +1 -1
  131. package/dist/kv/memory-kv.js +8 -0
  132. package/dist/ledger/janitor.d.ts +60 -0
  133. package/dist/ledger/janitor.d.ts.map +1 -0
  134. package/dist/ledger/janitor.js +137 -0
  135. package/dist/ledger/session-ledger.d.ts +132 -43
  136. package/dist/ledger/session-ledger.d.ts.map +1 -1
  137. package/dist/ledger/session-ledger.js +282 -50
  138. package/dist/ledger.d.ts +9 -8
  139. package/dist/ledger.d.ts.map +1 -1
  140. package/dist/ledger.js +7 -7
  141. package/dist/playground/assets/{index-D-DIYQzw.js → index-6wW6SAc4.js} +19 -19
  142. package/dist/playground/assets/index-CSRYDAFw.css +1 -0
  143. package/dist/playground/index.html +2 -2
  144. package/dist/storage-backends/cursor-hosted.d.ts +5 -0
  145. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  146. package/dist/storage-backends/cursor-hosted.js +6 -0
  147. package/dist/types.d.ts +100 -10
  148. package/dist/types.d.ts.map +1 -1
  149. package/docs/README.md +33 -106
  150. package/docs/guides/github.md +23 -18
  151. package/docs/guides/opentelemetry.md +30 -0
  152. package/docs/quickstart.md +89 -227
  153. package/docs/reference/agent-config.md +47 -0
  154. package/docs/reference/cli.md +2 -2
  155. package/docs/reference/hooks.md +1 -1
  156. package/docs/reference/tools.md +5 -4
  157. package/docs/storage.md +26 -9
  158. package/package.json +2 -2
  159. package/skills/otel/SKILL.md +20 -2
  160. package/src/channels/github/api.ts +122 -0
  161. package/src/channels/github/cursor-account.ts +23 -0
  162. package/src/channels/github/defaults.ts +1 -1
  163. package/src/channels/github/github-channel.ts +14 -1
  164. package/src/channels/github/progress.ts +84 -19
  165. package/src/channels/github/state.ts +14 -0
  166. package/src/channels/github/types.ts +7 -3
  167. package/src/channels.ts +38 -0
  168. package/src/index.ts +2 -0
  169. package/src/internal/auth.ts +10 -0
  170. package/src/internal/cli-ax.ts +2 -2
  171. package/src/internal/cli-deploy.ts +58 -3
  172. package/src/internal/deploy-client.ts +11 -0
  173. package/src/internal/discovery.ts +49 -0
  174. package/src/internal/durable-session-store.ts +66 -27
  175. package/src/internal/host-otel.ts +252 -0
  176. package/src/internal/init-project.ts +10 -10
  177. package/src/internal/ledger-serving.ts +439 -148
  178. package/src/internal/otel/collector.ts +135 -50
  179. package/src/internal/sdk-runner.ts +6 -0
  180. package/src/internal/server.ts +7 -2
  181. package/src/internal/session-engine.ts +127 -39
  182. package/src/kv/memory-kv.ts +8 -0
  183. package/src/ledger/janitor.ts +193 -0
  184. package/src/ledger/session-ledger.ts +372 -68
  185. package/src/ledger.ts +21 -6
  186. package/src/storage-backends/cursor-hosted.ts +17 -2
  187. package/src/types.ts +108 -10
  188. package/dist/docs/assets/chunks/@localSearchIndexroot.BZx4pmZL.js +0 -1
  189. package/dist/docs/assets/guides_opentelemetry.md.DmyUwC5R.js +0 -20
  190. package/dist/docs/assets/guides_opentelemetry.md.DmyUwC5R.lean.js +0 -1
  191. package/dist/docs/assets/index.md.CMc5FP7E.js +0 -25
  192. package/dist/docs/assets/index.md.CMc5FP7E.lean.js +0 -1
  193. package/dist/docs/assets/quickstart.md.rIbfahJM.lean.js +0 -1
  194. package/dist/playground/assets/index-DQTH622f.css +0 -1
  195. /package/dist/docs/assets/{reference_cli.md.DqEqQpGn.lean.js → reference_cli.md.BDmjPPAm.lean.js} +0 -0
  196. /package/dist/docs/assets/{reference_hooks.md.4cbRRIIu.lean.js → reference_hooks.md.DJE5DXcT.lean.js} +0 -0
  197. /package/dist/docs/assets/{reference_tools.md.lSrsTxYJ.lean.js → reference_tools.md.kJfJAP2m.lean.js} +0 -0
package/src/ledger.ts CHANGED
@@ -1,25 +1,40 @@
1
1
  /**
2
- * Session ledger — coordination only. The protocol library that drives
3
- * the `session/` and `ledger/` key families over a CAS-capable KV:
4
- * identity creation, lease claim/heartbeat/release, and the fenced
5
- * commit sequence. The durable inbox (pending events, mailbox payloads,
6
- * append/drain, the janitor) lands in a follow-up; see
7
- * `src/ledger/session-ledger.ts` for the trade-off this stage accepts.
2
+ * Session ledger — KV coordination with a durable inbox. The protocol
3
+ * library that drives the `session/`, `ledger/`, and `mailbox/` key
4
+ * families over a CAS-capable KV: identity creation, event append,
5
+ * lease claim/heartbeat/release, fenced commit, drain, the janitor
6
+ * loop, and the orphan sweep.
8
7
  */
9
8
 
9
+ export type {
10
+ JanitorClaimedSession,
11
+ JanitorRunResult,
12
+ LedgerJanitor,
13
+ LedgerJanitorOptions,
14
+ } from "./ledger/janitor.js";
15
+ export {
16
+ createLedgerJanitor,
17
+ DEFAULT_JANITOR_INTERVAL_MS,
18
+ } from "./ledger/janitor.js";
10
19
  export type {
11
20
  ClaimResult,
12
21
  CommitArgs,
13
22
  CommitResult,
23
+ DrainResult,
14
24
  EnsureSessionResult,
15
25
  HeartbeatResult,
26
+ LedgerEvent,
27
+ LedgerEventInput,
16
28
  LedgerLease,
17
29
  LedgerSnapshot,
18
30
  SessionIdentity,
19
31
  SessionLedgerKv,
20
32
  SessionLedgerOptions,
33
+ SweepOrphansArgs,
34
+ SweepOrphansResult,
21
35
  } from "./ledger/session-ledger.js";
22
36
  export {
37
+ DEFAULT_ORPHAN_TTL_MS,
23
38
  HEARTBEAT_INTERVAL_MS,
24
39
  LEASE_TTL_MS,
25
40
  LedgerCasExhaustedError,
@@ -129,8 +129,10 @@ type CursorHostedStorageMethods = Required<
129
129
  // AND version = expected`, conflict returns the current row (or
130
130
  // `current: null` when the row is gone).
131
131
  // - `POST /internal/agent-serve/storage/kv/list-keys`
132
- // `{ prefix }` → `{ keys }` ({@link KvListKeysResponse}) in ascending
133
- // key order (prefix scan on the `(deployment_id, key)` primary key).
132
+ // `{ prefix }` → `{ keys, truncated }` ({@link KvListKeysResponse}) in
133
+ // ascending key order (prefix scan on the `(deployment_id, key)`
134
+ // primary key). `truncated: true` means the scan hit the server's row
135
+ // cap and the list is incomplete; this client throws on it.
134
136
 
135
137
  /** Wire shape of the `get-with-version` route. `null` ⇒ JSON `undefined`. */
136
138
  export interface KvGetWithVersionResponse {
@@ -151,6 +153,11 @@ export interface KvCasResponse {
151
153
  /** Wire shape of the `list-keys` route. */
152
154
  export interface KvListKeysResponse {
153
155
  keys: string[];
156
+ /**
157
+ * Set when the scan hit the server's row cap and `keys` is incomplete.
158
+ * Additive: older servers omit it (treated as `false`).
159
+ */
160
+ truncated?: boolean;
154
161
  }
155
162
 
156
163
  function toCasResult(response: KvCasResponse): KvCasResult {
@@ -305,6 +312,14 @@ export function cursorHostedStorage(
305
312
  "/internal/agent-serve/storage/kv/list-keys",
306
313
  { prefix }
307
314
  );
315
+ if (result.truncated === true) {
316
+ // Callers (the ledger janitor above all) treat the result as
317
+ // the complete key set; a silently capped scan means silently
318
+ // unrecovered sessions. Fail loudly until pagination lands.
319
+ throw new Error(
320
+ `cursorHostedStorage: listKeys("${prefix}") exceeded the server's row cap and was truncated; the result is incomplete`
321
+ );
322
+ }
308
323
  return result.keys;
309
324
  },
310
325
  },
package/src/types.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * SDK as the execution harness.
9
9
  */
10
10
 
11
- import type { InteractionUpdate, SDKCustomTool } from "@cursor/sdk";
11
+ import type { InteractionUpdate, SDKCustomTool, ToolName } from "@cursor/sdk";
12
12
  import type { z } from "zod";
13
13
  import type { ABConfigFile } from "./ab.js";
14
14
  import type { OtelConfig, OtelDefinition } from "./otel.js";
@@ -206,6 +206,40 @@ export interface AgentConfig {
206
206
  * {@link BuiltinToolsConfig}.
207
207
  */
208
208
  builtinTools?: BuiltinToolsConfig;
209
+ /**
210
+ * Allowlist of built-in harness tools offered to the model
211
+ * (`AgentOptions.tools` on the SDK). Opt-in by design: unset keeps the
212
+ * model's full standard toolset, and once set the agent gets exactly
213
+ * what it names — nothing more, `[]` meaning no native built-in tools.
214
+ * There is deliberately no exclusion form: an agent that restricts
215
+ * tools states what it keeps, so tools the platform adds later stay
216
+ * off until someone opts in.
217
+ *
218
+ * `"mcp"` is always granted alongside a configured allowlist. It is
219
+ * transport, not capability: this kit's own server tools reach the
220
+ * model over the SDK custom-tool MCP path, so omitting it would
221
+ * silently strand `agent/tools/`. What MCP actually exposes stays
222
+ * governed by the second layer — the tools you author, the connections
223
+ * you declare, and the harness cwd's ambient `.cursor` config (point
224
+ * `local.cwd` outside checkouts whose MCP servers the agent must not
225
+ * see, and `local.sandbox` makes MCP calls fail closed).
226
+ *
227
+ * Names use the SDK's public tool vocabulary (`"shell"`, `"read"`,
228
+ * `"edit"`, `"grep"`, `"glob"`, `"ls"`, `"task"`, ...). `"shell"` is a
229
+ * capability group that also grants shell stdin writes — and is what
230
+ * `execution: "agent"` tool scripts run through, so an allowlist
231
+ * without it strands them (discovery warns). `"task"` gates subagents.
232
+ * Unknown names fail the turn (`ConfigurationError` at `Agent.create`).
233
+ *
234
+ * The allowlist states runtime-agnostic intent, but the SDK cannot
235
+ * enforce tool restrictions on cloud agents yet, and it must never
236
+ * silently not apply: a `runtime: "cloud"` agent that sets it fails at
237
+ * serve start (error diagnostic), and a hybrid agent's per-send cloud
238
+ * sessions are refused (the turn errors) rather than run unrestricted.
239
+ * Not a security boundary against the serve host: like `local.sandbox`,
240
+ * it only shapes what the model can call.
241
+ */
242
+ tools?: ToolName[];
209
243
  /**
210
244
  * How the serve host coordinates event delivery and turn execution. See
211
245
  * {@link AgentServingMode}. Defaults to `"resident"`; opt in to
@@ -220,14 +254,15 @@ export interface AgentConfig {
220
254
  * - `"resident"` (default): the in-process session engine owns delivery —
221
255
  * today's behavior, unchanged.
222
256
  * - `"ledger"`: every delivery coordinates through the KV session ledger
223
- * before its turn runs: session identity, a one-writer-per-session
224
- * lease with generation fencing, and a fenced commit sequence.
225
- * Requires a store with conditional writes (the `cas` group on
257
+ * before its turn runs: the event parks durably in the session mailbox
258
+ * (the source ack point moves after that write), a one-writer-per-session
259
+ * lease with generation fencing serializes turns, and drained batches
260
+ * commit through a fenced sequence. A delivery that finds the lease
261
+ * held walks away; the holder drains the parked event, and the janitor
262
+ * recovers sessions whose holder died. Requires a store with
263
+ * conditional writes and prefix listing (the `cas` group on
226
264
  * `defineStorage`, or an explicit CAS-capable override); startup fails
227
- * fast otherwise. This stage is coordination only — there is no
228
- * durable inbox yet, so an event arriving while the lease is held
229
- * waits in-process and a crash loses it exactly as resident serving
230
- * does. The durable mailbox lands in a follow-up.
265
+ * fast otherwise.
231
266
  */
232
267
  export type AgentServingMode = "resident" | "ledger";
233
268
 
@@ -506,6 +541,12 @@ export interface HostContext {
506
541
  * process.
507
542
  */
508
543
  files: HostFilesApi;
544
+ /**
545
+ * Author-facing OpenTelemetry metrics and session tags. Always present.
546
+ * Counters and histograms no-op when no meter is running. `setAttributes`
547
+ * still tags the open session when a collector is attached.
548
+ */
549
+ otel: HostOtelApi;
509
550
  }
510
551
 
511
552
  /** Host-facing JSON key-value API attached to {@link HostContext.kv}. */
@@ -706,6 +747,39 @@ export interface HostFilesApi {
706
747
  ): string | undefined;
707
748
  }
708
749
 
750
+ /** Attribute bag accepted by {@link HostOtelApi}. `undefined` values are dropped. */
751
+ export type HostOtelAttributes = Record<
752
+ string,
753
+ string | number | boolean | undefined
754
+ >;
755
+
756
+ /**
757
+ * Author-facing OpenTelemetry surface on {@link HostContext.otel}.
758
+ *
759
+ * Metrics and tags only — no custom spans, and no raw OTel `Meter` /
760
+ * `Tracer`. First-party names (`cursor.token.usage`, …) and join keys
761
+ * (`cursor.conversation.id`, `agent_sdk.agent`, …) are reserved.
762
+ */
763
+ export interface HostOtelApi {
764
+ /** True when a meter is running and `increment` / `record` export. */
765
+ readonly enabled: boolean;
766
+
767
+ /**
768
+ * Merge tags onto this host binding. On a session-bound host they join
769
+ * the open session span and later first-party metrics. Unbound tags
770
+ * stay on this host instance only.
771
+ */
772
+ setAttributes(attributes: HostOtelAttributes): void;
773
+
774
+ /** Add 1 to a counter. */
775
+ increment(name: string, attributes?: HostOtelAttributes): void;
776
+ /** Add `value` to a counter. */
777
+ increment(name: string, value: number, attributes?: HostOtelAttributes): void;
778
+
779
+ /** Record one histogram observation. */
780
+ record(name: string, value: number, attributes?: HostOtelAttributes): void;
781
+ }
782
+
709
783
  /** Runtime context handed to a tool's `execute`. */
710
784
  export interface ToolContext {
711
785
  /** Correlates with `actions.requested` / `action.result` stream events. */
@@ -743,6 +817,12 @@ export interface ToolContext {
743
817
  * `sessionId` (and `turnId` when known).
744
818
  */
745
819
  artifacts: ArtifactsApi;
820
+ /**
821
+ * Append a session event onto this call's in-flight turn. Same shape as a
822
+ * Task subagent stream (`parentCallId`, `subagent.called` /
823
+ * `subagent.completed`). Omitted for scratch `callTool` with no session.
824
+ */
825
+ emit?: (payload: SessionEventPayload) => void;
746
826
  }
747
827
 
748
828
  /**
@@ -1398,7 +1478,11 @@ export interface ChannelSession {
1398
1478
  */
1399
1479
  readonly coalesced?: boolean;
1400
1480
  readonly info: SessionInfo;
1401
- /** Replay recorded events from `startIndex`, then follow live (NDJSON). */
1481
+ /**
1482
+ * Replay recorded events from `startIndex`, then follow live (NDJSON).
1483
+ * A handle from `send()` defaults `startIndex` to this admission so a
1484
+ * resumed continuation does not replay earlier turns.
1485
+ */
1402
1486
  getEventStream(options?: {
1403
1487
  startIndex?: number;
1404
1488
  }): Promise<ReadableStream<Uint8Array>>;
@@ -1838,7 +1922,12 @@ export interface ChannelMeta {
1838
1922
  }
1839
1923
 
1840
1924
  export interface ChannelConfig<TState = JsonValue> {
1841
- /** Route auth chain. Defaults to `[localDevStrict()]`. */
1925
+ /**
1926
+ * Route auth chain. Defaults to `[localDevStrict()]`. Include
1927
+ * `publicEndpoint()` to serve this channel WITHOUT the platform alias
1928
+ * token on Cursor hosting (for webhook senders that cannot attach custom
1929
+ * headers — the handler must verify deliveries itself).
1930
+ */
1842
1931
  auth?: AuthPolicy[];
1843
1932
  routes?: ChannelRoute[];
1844
1933
  /**
@@ -2347,6 +2436,13 @@ export interface ResolvedAgent {
2347
2436
  * (`cwd` is absolute — relative paths resolved against the project root).
2348
2437
  */
2349
2438
  local?: AgentLocalOptions;
2439
+ /**
2440
+ * Built-in harness tool allowlist from {@link AgentConfig.tools}, with
2441
+ * the "mcp" transport grant injected. Named apart from {@link tools}
2442
+ * (the authored `agent/tools/` list). Applied to local turns; cloud
2443
+ * turns fail closed (cloud-runtime agents already fail discovery).
2444
+ */
2445
+ allowedTools?: ToolName[];
2350
2446
  /** Managed-hosting declarations from {@link AgentConfig.hosting}. */
2351
2447
  hosting?: AgentHostingOptions;
2352
2448
  /** Validated turn admission limits from {@link AgentConfig.concurrency}. */
@@ -2503,6 +2599,8 @@ export interface RunnerTurnRequest {
2503
2599
  workspaceDir: string;
2504
2600
  /** Run the local harness sandboxed ({@link AgentLocalOptions.sandbox}). */
2505
2601
  sandbox?: boolean;
2602
+ /** Built-in tool allowlist ({@link AgentConfig.tools}, resolved). */
2603
+ tools?: ToolName[];
2506
2604
  /** Absolute path for runner-owned durable state (conversation store). */
2507
2605
  runnerStateDir: string;
2508
2606
  prompt: string;