@cursor/july 0.1.9 → 0.1.11

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 (200) hide show
  1. package/AGENTS.md +1 -0
  2. package/dist/bin/agent-serve.js +26 -3
  3. package/dist/channels/github/github-channel.d.ts.map +1 -1
  4. package/dist/channels/github/github-channel.js +2 -1
  5. package/dist/channels/github/types.d.ts +4 -0
  6. package/dist/channels/github/types.d.ts.map +1 -1
  7. package/dist/channels/slack/cursor-account.d.ts.map +1 -1
  8. package/dist/channels/slack/cursor-account.js +1 -1
  9. package/dist/channels/slack/dispatch.d.ts +13 -0
  10. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  11. package/dist/channels/slack/dispatch.js +36 -11
  12. package/dist/channels/slack/eval-directive.d.ts +63 -0
  13. package/dist/channels/slack/eval-directive.d.ts.map +1 -0
  14. package/dist/channels/slack/eval-directive.js +283 -0
  15. package/dist/channels/slack/index.d.ts +1 -0
  16. package/dist/channels/slack/index.d.ts.map +1 -1
  17. package/dist/channels/slack/index.js +1 -0
  18. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  19. package/dist/channels/slack/slack-channel.js +4 -2
  20. package/dist/channels/slack/types.d.ts +7 -0
  21. package/dist/channels/slack/types.d.ts.map +1 -1
  22. package/dist/connections.d.ts +10 -5
  23. package/dist/connections.d.ts.map +1 -1
  24. package/dist/connections.js +10 -5
  25. package/dist/docs/404.html +2 -2
  26. package/dist/docs/ab.html +4 -4
  27. package/dist/docs/assets/{app.Ciosf24M.js → app.BcXUGca7.js} +1 -1
  28. package/dist/docs/assets/chunks/@localSearchIndexroot.BIbvK8M1.js +1 -0
  29. package/dist/docs/assets/chunks/{VPLocalSearchBox.BcRDly7n.js → VPLocalSearchBox.CWur6XGZ.js} +1 -1
  30. package/dist/docs/assets/chunks/{theme.CMpbjdfx.js → theme.BnvulOX2.js} +2 -2
  31. package/dist/docs/assets/{deployment.md.DC5-ImcM.js → deployment.md.TecHo0_2.js} +3 -3
  32. package/dist/docs/assets/{deployment.md.DC5-ImcM.lean.js → deployment.md.TecHo0_2.lean.js} +1 -1
  33. package/dist/docs/assets/guides_mcp-oauth.md.DqmEOQY1.js +29 -0
  34. package/dist/docs/assets/guides_mcp-oauth.md.DqmEOQY1.lean.js +1 -0
  35. package/dist/docs/assets/{index.md.COiu-1jL.js → index.md.t0TM2Qzz.js} +3 -3
  36. package/dist/docs/assets/{index.md.COiu-1jL.lean.js → index.md.t0TM2Qzz.lean.js} +1 -1
  37. package/dist/docs/assets/{reference_cli.md.D189RBCH.js → reference_cli.md.B74NrVzb.js} +5 -4
  38. package/dist/docs/assets/{reference_cli.md.D189RBCH.lean.js → reference_cli.md.B74NrVzb.lean.js} +1 -1
  39. package/dist/docs/assets/{reference_connections.md.zaEYCLHT.js → reference_connections.md.CsSr3rDz.js} +9 -4
  40. package/dist/docs/assets/{reference_connections.md.zaEYCLHT.lean.js → reference_connections.md.CsSr3rDz.lean.js} +1 -1
  41. package/dist/docs/assets/reference_prompt.md.BaiweQxE.js +1 -0
  42. package/dist/docs/assets/reference_prompt.md.BaiweQxE.lean.js +1 -0
  43. package/dist/docs/assets/{reference_tools.md.CqgJroI0.js → reference_tools.md.BRSDnTbN.js} +16 -3
  44. package/dist/docs/assets/{reference_tools.md.CqgJroI0.lean.js → reference_tools.md.BRSDnTbN.lean.js} +1 -1
  45. package/dist/docs/assets/{troubleshooting.md.DkovjS7h.js → troubleshooting.md.CmQkmnzC.js} +1 -1
  46. package/dist/docs/assets/{troubleshooting.md.DkovjS7h.lean.js → troubleshooting.md.CmQkmnzC.lean.js} +1 -1
  47. package/dist/docs/building-with-agents.html +4 -4
  48. package/dist/docs/concepts.html +4 -4
  49. package/dist/docs/deployment.html +7 -7
  50. package/dist/docs/evals.html +4 -4
  51. package/dist/docs/example-agents/approval-buddy.html +4 -4
  52. package/dist/docs/example-agents/benny.html +4 -4
  53. package/dist/docs/example-agents/bugbot.html +4 -4
  54. package/dist/docs/example-agents/codebase-wiki.html +4 -4
  55. package/dist/docs/example-agents/codeowners-review.html +4 -4
  56. package/dist/docs/example-agents/concierge.html +4 -4
  57. package/dist/docs/example-agents/fsd.html +4 -4
  58. package/dist/docs/example-agents/index.html +4 -4
  59. package/dist/docs/example-agents/knowledge-base.html +4 -4
  60. package/dist/docs/example-agents/oncall.html +4 -4
  61. package/dist/docs/example-agents/security-reviewer.html +4 -4
  62. package/dist/docs/example-agents/slack-agent.html +4 -4
  63. package/dist/docs/example-agents/weather-agent.html +4 -4
  64. package/dist/docs/guides/agent-to-agent.html +4 -4
  65. package/dist/docs/guides/cloud-runtime.html +4 -4
  66. package/dist/docs/guides/github.html +4 -4
  67. package/dist/docs/guides/human-in-the-loop.html +4 -4
  68. package/dist/docs/guides/mcp-oauth.html +53 -0
  69. package/dist/docs/guides/slack.html +4 -4
  70. package/dist/docs/guides/webhooks.html +4 -4
  71. package/dist/docs/hashmap.json +1 -1
  72. package/dist/docs/hillclimbing.html +4 -4
  73. package/dist/docs/index.html +6 -6
  74. package/dist/docs/quickstart.html +4 -4
  75. package/dist/docs/reference/agent-config.html +4 -4
  76. package/dist/docs/reference/channels.html +4 -4
  77. package/dist/docs/reference/cli.html +8 -7
  78. package/dist/docs/reference/connections.html +13 -8
  79. package/dist/docs/reference/hooks.html +4 -4
  80. package/dist/docs/reference/http-api.html +4 -4
  81. package/dist/docs/reference/instructions.html +4 -4
  82. package/dist/docs/reference/playground.html +4 -4
  83. package/dist/docs/reference/project-layout.html +4 -4
  84. package/dist/docs/reference/prompt.html +33 -0
  85. package/dist/docs/reference/schedules.html +4 -4
  86. package/dist/docs/reference/sessions.html +4 -4
  87. package/dist/docs/reference/skills.html +5 -5
  88. package/dist/docs/reference/subagents.html +4 -4
  89. package/dist/docs/reference/tools.html +20 -7
  90. package/dist/docs/scaffolding-agents.html +4 -4
  91. package/dist/docs/storage.html +4 -4
  92. package/dist/docs/troubleshooting.html +5 -5
  93. package/dist/evals.d.ts +39 -0
  94. package/dist/evals.d.ts.map +1 -1
  95. package/dist/index.d.ts +3 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +2 -1
  98. package/dist/internal/cli-ax.d.ts.map +1 -1
  99. package/dist/internal/cli-ax.js +7 -4
  100. package/dist/internal/cli-mcp-oauth.d.ts +16 -0
  101. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -0
  102. package/dist/internal/cli-mcp-oauth.js +194 -0
  103. package/dist/internal/cli-mcp.d.ts +4 -1
  104. package/dist/internal/cli-mcp.d.ts.map +1 -1
  105. package/dist/internal/cli-mcp.js +19 -1
  106. package/dist/internal/corp-ca.d.ts +9 -0
  107. package/dist/internal/corp-ca.d.ts.map +1 -0
  108. package/dist/internal/corp-ca.js +44 -0
  109. package/dist/internal/cursor/account-mcp.d.ts +17 -4
  110. package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
  111. package/dist/internal/cursor/account-mcp.js +105 -17
  112. package/dist/internal/discovery.d.ts.map +1 -1
  113. package/dist/internal/discovery.js +64 -10
  114. package/dist/internal/distribution.d.ts.map +1 -1
  115. package/dist/internal/distribution.js +1 -0
  116. package/dist/internal/logs-client.js +1 -1
  117. package/dist/internal/mcp-host.d.ts.map +1 -1
  118. package/dist/internal/mcp-host.js +49 -26
  119. package/dist/internal/mcp-oauth.d.ts +88 -0
  120. package/dist/internal/mcp-oauth.d.ts.map +1 -0
  121. package/dist/internal/mcp-oauth.js +385 -0
  122. package/dist/internal/resolved-connections.d.ts +6 -0
  123. package/dist/internal/resolved-connections.d.ts.map +1 -1
  124. package/dist/internal/resolved-connections.js +10 -3
  125. package/dist/internal/sdk-runner.d.ts +9 -0
  126. package/dist/internal/sdk-runner.d.ts.map +1 -1
  127. package/dist/internal/sdk-runner.js +28 -2
  128. package/dist/internal/server.d.ts.map +1 -1
  129. package/dist/internal/server.js +24 -6
  130. package/dist/internal/session-engine.d.ts +30 -10
  131. package/dist/internal/session-engine.d.ts.map +1 -1
  132. package/dist/internal/session-engine.js +166 -74
  133. package/dist/internal/sessions-client.d.ts +16 -2
  134. package/dist/internal/sessions-client.d.ts.map +1 -1
  135. package/dist/internal/sessions-client.js +30 -13
  136. package/dist/internal/storage-coordinator.d.ts +11 -0
  137. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  138. package/dist/internal/storage-coordinator.js +30 -0
  139. package/dist/internal/stream-progress.d.ts.map +1 -1
  140. package/dist/internal/stream-progress.js +8 -4
  141. package/dist/internal/turn-governor.d.ts +54 -0
  142. package/dist/internal/turn-governor.d.ts.map +1 -0
  143. package/dist/internal/turn-governor.js +111 -0
  144. package/dist/playground/assets/{index-C0-QEG4O.js → index-BIGLubwK.js} +46 -46
  145. package/dist/playground/assets/{index-z3JY9O2x.css → index-C17ZQKDG.css} +1 -1
  146. package/dist/playground/index.html +2 -2
  147. package/dist/prompt.d.ts +39 -0
  148. package/dist/prompt.d.ts.map +1 -0
  149. package/dist/prompt.js +70 -0
  150. package/dist/storage-backends/cursor-hosted.d.ts +10 -0
  151. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  152. package/dist/storage-backends/cursor-hosted.js +14 -0
  153. package/dist/types.d.ts +93 -5
  154. package/dist/types.d.ts.map +1 -1
  155. package/dist/types.js +6 -0
  156. package/docs/README.md +4 -0
  157. package/docs/deployment.md +6 -1
  158. package/docs/guides/mcp-oauth.md +157 -0
  159. package/docs/reference/cli.md +30 -0
  160. package/docs/reference/connections.md +32 -2
  161. package/docs/reference/prompt.md +47 -0
  162. package/docs/reference/tools.md +21 -0
  163. package/docs/troubleshooting.md +11 -0
  164. package/package.json +9 -2
  165. package/skills/create-agent/SKILL.md +7 -3
  166. package/skills/framework-map/SKILL.md +1 -0
  167. package/skills/mcp-auth/SKILL.md +138 -0
  168. package/src/bin/agent-serve.ts +30 -3
  169. package/src/channels/github/github-channel.ts +2 -0
  170. package/src/channels/github/types.ts +4 -0
  171. package/src/channels/slack/cursor-account.ts +2 -0
  172. package/src/channels/slack/dispatch.ts +49 -0
  173. package/src/channels/slack/eval-directive.ts +348 -0
  174. package/src/channels/slack/index.ts +1 -0
  175. package/src/channels/slack/slack-channel.ts +3 -0
  176. package/src/channels/slack/types.ts +7 -0
  177. package/src/connections.ts +10 -5
  178. package/src/evals.ts +43 -0
  179. package/src/index.ts +3 -0
  180. package/src/internal/cli-ax.ts +10 -4
  181. package/src/internal/cli-mcp-oauth.ts +254 -0
  182. package/src/internal/cli-mcp.ts +25 -2
  183. package/src/internal/cursor/account-mcp.ts +153 -41
  184. package/src/internal/discovery.ts +70 -8
  185. package/src/internal/distribution.ts +1 -0
  186. package/src/internal/logs-client.ts +1 -1
  187. package/src/internal/mcp-host.ts +33 -9
  188. package/src/internal/mcp-oauth.ts +496 -0
  189. package/src/internal/resolved-connections.ts +20 -5
  190. package/src/internal/sdk-runner.ts +37 -1
  191. package/src/internal/server.ts +28 -6
  192. package/src/internal/session-engine.ts +192 -76
  193. package/src/internal/sessions-client.ts +51 -15
  194. package/src/internal/storage-coordinator.ts +36 -0
  195. package/src/internal/stream-progress.ts +8 -0
  196. package/src/internal/turn-governor.ts +145 -0
  197. package/src/prompt.ts +83 -0
  198. package/src/storage-backends/cursor-hosted.ts +21 -0
  199. package/src/types.ts +92 -6
  200. package/dist/docs/assets/chunks/@localSearchIndexroot.D154Detj.js +0 -1
@@ -7,7 +7,7 @@
7
7
  * event handlers and hooks.
8
8
  */
9
9
  import { SlackAskDedupeStore, SlackNudgeStore } from "../channels/slack/nudge-store.js";
10
- import { type AgentProject, type ApprovalDecision, type AuthContext, type CallToolOptions, type ChannelDefinition, type ChannelSession, type HostContext, type HttpChannelDefinition, type PendingApproval, type ReceiveInput, type SendMessageOptions, type SessionEvent, type SessionInfo, type SessionRecord, type SessionSummary, type ToolCallOutcome, type TurnOutcome } from "../types.js";
10
+ import { type AgentProject, type ApprovalDecision, type AuthContext, type CallToolOptions, type ChannelDefinition, type ChannelSession, type HostContext, type HttpChannelDefinition, type PendingApproval, type ReceiveInput, type SendMessageOptions, type SessionEvent, type SessionInfo, type SessionListSource, type SessionRecord, type SessionSummary, type ToolCallOutcome, type TurnOutcome } from "../types.js";
11
11
  import { type ABSnapshot } from "./ab-snapshot.js";
12
12
  import { type HostPlatforms } from "./host-platforms.js";
13
13
  import type { AgentRunner } from "./sdk-runner.js";
@@ -110,6 +110,8 @@ export declare class SessionEngine {
110
110
  private readonly turnAborts;
111
111
  /** Serializes turn admission per session (latest follow-up wins). */
112
112
  private readonly admissionChains;
113
+ /** FIFO turn slots under `concurrency.maxRunningTurns` (unlimited when unset). */
114
+ private readonly turnGovernor;
113
115
  /**
114
116
  * Per-session coalesce queue for `admission: "coalesce"` (Slack). Drained
115
117
  * into one follow-up turn when the active turn finishes without interrupt.
@@ -129,6 +131,7 @@ export declare class SessionEngine {
129
131
  private readonly approvals;
130
132
  private readonly abCollector;
131
133
  private reminderApi;
134
+ private evalsApi;
132
135
  private readonly kvApi;
133
136
  /** Serve-time resolved connections (see {@link setResolvedConnections}). */
134
137
  private resolvedConnections;
@@ -140,11 +143,13 @@ export declare class SessionEngine {
140
143
  * (`ctx.host.mcp`, always loopback).
141
144
  */
142
145
  setResolvedConnections(connections: EngineResolvedConnection[]): void;
143
- /** Shared host services (MCP / GitHub / Slack / reminders / kv / Slack nudges). */
146
+ /** Shared host services (MCP / GitHub / Slack / reminders / evals / kv / Slack nudges). */
144
147
  get host(): HostContext;
145
148
  private slackNudgeHostApi;
146
149
  /** Attach the serve-host reminder API (called from startServer). */
147
150
  setReminders(api: HostContext["reminders"]): void;
151
+ /** Attach the serve-host playground evals API (called from startServer). */
152
+ setEvals(api: HostContext["evals"]): void;
148
153
  /**
149
154
  * Start or resume a session on a channel. When `continuationToken`
150
155
  * addresses an existing session this is a follow-up turn; otherwise a new
@@ -234,14 +239,7 @@ export declare class SessionEngine {
234
239
  private scaffoldDir;
235
240
  private executeTurn;
236
241
  private buildTurnRequest;
237
- /**
238
- * MCP servers for a turn: authored concrete connections plus resolved
239
- * serve-time resolved connections (peers, Cursor account bridge).
240
- * Resolved connections pick their URL by runtime — loopback for local
241
- * turns, `cloudUrl` for cloud turns — and are omitted from cloud turns
242
- * when no cloud URL exists unless a `servers` filter requires the bridge
243
- * (see {@link assertCloudCanHonorAccountServersFilters}).
244
- */
242
+ /** Authored + resolved MCP servers for a turn; skips `hostOnly`. */
245
243
  private buildMcpServers;
246
244
  private buildCustomTools;
247
245
  /**
@@ -300,10 +298,32 @@ export declare class SessionEngine {
300
298
  * observability surface across every principal (channel-driven runs,
301
299
  * schedule/task sessions, other callers). The route auth chain still
302
300
  * gates who may call this at all.
301
+ *
302
+ * When the project uses `cursorHostedStorage`, prefers durable Bugbot rows
303
+ * (merged with any newer local records not flushed yet). Falls back to the
304
+ * local `--state-root` store when the sink is unavailable.
303
305
  */
304
306
  listSessions(caller: AuthContext | null, options?: {
305
307
  includeAll?: boolean;
306
308
  }): Promise<SessionSummary[]>;
309
+ /**
310
+ * Same as {@link listSessions}, plus which store answered
311
+ * (`cursor-hosted` = durable DB via the control-plane proxy; `local` =
312
+ * `--state-root`).
313
+ */
314
+ listSessionsWithSource(caller: AuthContext | null, options?: {
315
+ includeAll?: boolean;
316
+ }): Promise<{
317
+ sessions: SessionSummary[];
318
+ source: SessionListSource;
319
+ }>;
320
+ /**
321
+ * Durable sink rows plus local records (local wins on the same id when
322
+ * newer — covers debounce windows that have not flushed yet). Newest
323
+ * `updatedAt` first.
324
+ */
325
+ private mergeStoredAndLocalSessions;
326
+ private summarizeSessionRecords;
307
327
  /**
308
328
  * Fold durable session streams into per-session A/B assignments and
309
329
  * aggregate arm metrics (`GET /v1/abs`). Collector-independent: always
@@ -1 +1 @@
1
- {"version":3,"file":"session-engine.d.ts","sourceRoot":"","sources":["../../src/internal/session-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,EACL,mBAAmB,EACnB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACr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A4F5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,4BAA4B;YAqBtB,gCAAgC;IAyB9C;;;;;OAKG;YACW,kBAAkB;IAYhC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAO/C;IAED,yEAAyE;IACnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3B;CACF"}
@@ -51,6 +51,7 @@ import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections
51
51
  import { SessionStore } from "./session-store.js";
52
52
  import { StorageCoordinator } from "./storage-coordinator.js";
53
53
  import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
54
+ import { TurnGovernor } from "./turn-governor.js";
54
55
  import { buildAgentsMdContent, isNestedInGitRepo, materializeWorkspace, writeWorkspaceFiles, } from "./workspace.js";
55
56
  export const HTTP_CHANNEL_ID = "http";
56
57
  export { SCHEDULE_CHANNEL_PREFIX } from "./prompt-context.js";
@@ -143,6 +144,7 @@ export class SessionEngine {
143
144
  this.stateRoot = options.stateRoot;
144
145
  this.runner = options.runner;
145
146
  this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : (() => { });
147
+ this.turnGovernor = new TurnGovernor(options.project.agent.concurrency);
146
148
  this.sessions = new SessionStore(join(options.stateRoot, "sessions"));
147
149
  this.nudgeStore = new SlackNudgeStore(join(options.stateRoot, "slack-nudges"));
148
150
  this.askDedupe = new SlackAskDedupeStore(join(options.stateRoot, "slack-asks"));
@@ -186,13 +188,14 @@ export class SessionEngine {
186
188
  });
187
189
  }
188
190
  }
189
- /** Shared host services (MCP / GitHub / Slack / reminders / kv / Slack nudges). */
191
+ /** Shared host services (MCP / GitHub / Slack / reminders / evals / kv / Slack nudges). */
190
192
  get host() {
191
193
  return {
192
194
  mcp: this.mcpHost,
193
195
  github: this.platforms.github,
194
196
  slack: this.platforms.slack,
195
197
  reminders: this.reminderApi,
198
+ evals: this.evalsApi,
196
199
  kv: this.kvApi,
197
200
  slackNudges: this.slackNudgeHostApi(),
198
201
  };
@@ -212,6 +215,10 @@ export class SessionEngine {
212
215
  setReminders(api) {
213
216
  this.reminderApi = api;
214
217
  }
218
+ /** Attach the serve-host playground evals API (called from startServer). */
219
+ setEvals(api) {
220
+ this.evalsApi = api;
221
+ }
215
222
  // ==========================================================================
216
223
  // Sending messages
217
224
  // ==========================================================================
@@ -520,11 +527,8 @@ export class SessionEngine {
520
527
  turnId,
521
528
  data: { text: message },
522
529
  });
523
- yield this.appendEvent(sessionId, {
524
- type: "turn.started",
525
- turnId,
526
- data: {},
527
- });
530
+ // `turn.started` is appended by executeTurn once the turn holds a
531
+ // governor slot; saturated engines emit `turn.queued` first.
528
532
  const abort = new AbortController();
529
533
  this.turnAborts.set(sessionId, abort);
530
534
  // Lifecycle promise includes post-turn coalesce drain so waiters and
@@ -707,54 +711,77 @@ export class SessionEngine {
707
711
  }
708
712
  };
709
713
  const mapper = new TurnEventMapper(emit);
714
+ // Take a turn slot before any work happens. When every slot is busy the
715
+ // turn waits FIFO — durable `turn.queued` marks the wait — and a
716
+ // preempting follow-up (or interrupt) resolves the wait as cancelled
717
+ // without the turn ever running.
718
+ const permit = yield this.turnGovernor.acquire({
719
+ sessionId,
720
+ signal,
721
+ onQueued: (position) => {
722
+ var _a;
723
+ const maxRunningTurns = (_a = this.turnGovernor.maxRunningTurns) !== null && _a !== void 0 ? _a : 0;
724
+ emit({ type: "turn.queued", data: { position, maxRunningTurns } });
725
+ this.logger(`[session] ${sessionId} ${turnId} queued at position ${position} (${maxRunningTurns} turn slot(s) busy)`);
726
+ },
727
+ });
710
728
  let outcome;
711
- try {
712
- // Scaffold agent files into the session workspace even when the harness
713
- // cwd is overridden (e.g. a PR worktree). A/B variant instruction
714
- // overlays are applied via agentForSession.
715
- const agent = this.agentForSession(record);
716
- yield materializeWorkspace({
717
- agent,
718
- workspaceDir,
719
- seed: isFirstTurn,
720
- });
721
- const pendingFiles = record.pendingWorkspaceFiles;
722
- if (pendingFiles !== undefined && Object.keys(pendingFiles).length > 0) {
723
- yield writeWorkspaceFiles(harnessCwd, pendingFiles);
724
- yield this.updateRecord(sessionId, (current) => {
725
- const { pendingWorkspaceFiles: _cleared } = current, rest = __rest(current, ["pendingWorkspaceFiles"]);
726
- return rest;
729
+ if (permit === undefined) {
730
+ // Preempted while waiting for a slot; settle as an interrupted turn.
731
+ outcome = { status: "cancelled" };
732
+ }
733
+ else {
734
+ emit({ type: "turn.started", data: {} });
735
+ try {
736
+ // Scaffold agent files into the session workspace even when the harness
737
+ // cwd is overridden (e.g. a PR worktree). A/B variant instruction
738
+ // overlays are applied via agentForSession.
739
+ const agent = this.agentForSession(record);
740
+ yield materializeWorkspace({
741
+ agent,
742
+ workspaceDir,
743
+ seed: isFirstTurn,
727
744
  });
728
- }
729
- // The harness only loads the scaffolded AGENTS.md when the session
730
- // workspace is its own project root. With a per-session cwd override
731
- // (PR worktree) the scaffold lands elsewhere, and a workspace nested
732
- // inside a git repo re-roots harness rules at that repo — in both
733
- // cases deliver instructions inline on the first turn instead.
734
- const instructionsInvisibleToHarness = isFirstTurn &&
735
- (record.workspaceOverride !== undefined ||
736
- (yield isNestedInGitRepo(harnessCwd)));
737
- const request = this.buildTurnRequest(record, agent, turnId, message, isFirstTurn, instructionsInvisibleToHarness, emit, (update) => __awaiter(this, void 0, void 0, function* () {
738
- mapper.handleUpdate(update);
739
- // Yield so the HTTP NDJSON writer can flush tool start/result
740
- // events while sibling parallel tools are still executing.
741
- if (update.type === "tool-call-started" ||
742
- update.type === "tool-call-completed" ||
743
- // Nested subagent progress (newer SDKs); string check keeps
744
- // typecheck green against older published `@cursor/sdk` pins.
745
- update.type === "tool-call-delta") {
746
- yield yieldEventLoop();
745
+ const pendingFiles = record.pendingWorkspaceFiles;
746
+ if (pendingFiles !== undefined &&
747
+ Object.keys(pendingFiles).length > 0) {
748
+ yield writeWorkspaceFiles(harnessCwd, pendingFiles);
749
+ yield this.updateRecord(sessionId, (current) => {
750
+ const { pendingWorkspaceFiles: _cleared } = current, rest = __rest(current, ["pendingWorkspaceFiles"]);
751
+ return rest;
752
+ });
747
753
  }
748
- }), signal);
749
- outcome = yield this.runner.runTurn(request);
750
- }
751
- catch (error) {
752
- this.approvals.cancelSession(sessionId, "deny");
753
- outcome = { status: "error", errorMessage: describeError(error) };
754
- }
755
- finally {
756
- this.approvals.cancelSession(sessionId, "deny");
757
- yield this.clearPendingApprovals(sessionId);
754
+ // The harness only loads the scaffolded AGENTS.md when the session
755
+ // workspace is its own project root. With a per-session cwd override
756
+ // (PR worktree) the scaffold lands elsewhere, and a workspace nested
757
+ // inside a git repo re-roots harness rules at that repo — in both
758
+ // cases deliver instructions inline on the first turn instead.
759
+ const instructionsInvisibleToHarness = isFirstTurn &&
760
+ (record.workspaceOverride !== undefined ||
761
+ (yield isNestedInGitRepo(harnessCwd)));
762
+ const request = this.buildTurnRequest(record, agent, turnId, message, isFirstTurn, instructionsInvisibleToHarness, emit, (update) => __awaiter(this, void 0, void 0, function* () {
763
+ mapper.handleUpdate(update);
764
+ // Yield so the HTTP NDJSON writer can flush tool start/result
765
+ // events while sibling parallel tools are still executing.
766
+ if (update.type === "tool-call-started" ||
767
+ update.type === "tool-call-completed" ||
768
+ // Nested subagent progress (newer SDKs); string check keeps
769
+ // typecheck green against older published `@cursor/sdk` pins.
770
+ update.type === "tool-call-delta") {
771
+ yield yieldEventLoop();
772
+ }
773
+ }), signal);
774
+ outcome = yield this.runner.runTurn(request);
775
+ }
776
+ catch (error) {
777
+ this.approvals.cancelSession(sessionId, "deny");
778
+ outcome = { status: "error", errorMessage: describeError(error) };
779
+ }
780
+ finally {
781
+ permit.release();
782
+ this.approvals.cancelSession(sessionId, "deny");
783
+ yield this.clearPendingApprovals(sessionId);
784
+ }
758
785
  }
759
786
  mapper.finish();
760
787
  if (mapper.title !== undefined) {
@@ -867,34 +894,37 @@ export class SessionEngine {
867
894
  });
868
895
  }) });
869
896
  }
870
- /**
871
- * MCP servers for a turn: authored concrete connections plus resolved
872
- * serve-time resolved connections (peers, Cursor account bridge).
873
- * Resolved connections pick their URL by runtime — loopback for local
874
- * turns, `cloudUrl` for cloud turns — and are omitted from cloud turns
875
- * when no cloud URL exists unless a `servers` filter requires the bridge
876
- * (see {@link assertCloudCanHonorAccountServersFilters}).
877
- */
897
+ /** Authored + resolved MCP servers for a turn; skips `hostOnly`. */
878
898
  buildMcpServers(runtime) {
899
+ const hostOnlyNames = new Set(this.project.agent.connections
900
+ .filter((connection) => connection.hostOnly === true)
901
+ .map((connection) => connection.name));
879
902
  assertCloudCanHonorAccountServersFilters({
880
903
  runtime,
881
- resolvedConnections: this.resolvedConnections,
904
+ resolvedConnections: this.resolvedConnections.filter((resolved) => !hostOnlyNames.has(resolved.name)),
882
905
  });
883
906
  const servers = {};
884
907
  for (const connection of this.project.agent.connections) {
908
+ if (hostOnlyNames.has(connection.name)) {
909
+ continue;
910
+ }
885
911
  if (isSymbolicConnectionTransport(connection.transport)) {
886
912
  continue;
887
913
  }
888
914
  servers[connection.name] = connection.transport;
889
915
  }
890
916
  for (const resolved of this.resolvedConnections) {
917
+ if (hostOnlyNames.has(resolved.name)) {
918
+ continue;
919
+ }
891
920
  const url = runtime === "cloud" ? resolved.cloudUrl : resolved.localUrl;
892
921
  if (url === undefined) {
893
922
  continue;
894
923
  }
895
- servers[resolved.name] = Object.assign({ url }, (resolved.headers === undefined
896
- ? {}
897
- : { headers: resolved.headers }));
924
+ servers[resolved.name] = {
925
+ url,
926
+ headers: resolved.headers,
927
+ };
898
928
  }
899
929
  return servers;
900
930
  }
@@ -1361,22 +1391,84 @@ export class SessionEngine {
1361
1391
  * observability surface across every principal (channel-driven runs,
1362
1392
  * schedule/task sessions, other callers). The route auth chain still
1363
1393
  * gates who may call this at all.
1394
+ *
1395
+ * When the project uses `cursorHostedStorage`, prefers durable Bugbot rows
1396
+ * (merged with any newer local records not flushed yet). Falls back to the
1397
+ * local `--state-root` store when the sink is unavailable.
1364
1398
  */
1365
1399
  listSessions(caller, options) {
1400
+ return __awaiter(this, void 0, void 0, function* () {
1401
+ return (yield this.listSessionsWithSource(caller, options)).sessions;
1402
+ });
1403
+ }
1404
+ /**
1405
+ * Same as {@link listSessions}, plus which store answered
1406
+ * (`cursor-hosted` = durable DB via the control-plane proxy; `local` =
1407
+ * `--state-root`).
1408
+ */
1409
+ listSessionsWithSource(caller, options) {
1366
1410
  return __awaiter(this, void 0, void 0, function* () {
1367
1411
  var _a;
1368
- const includeAll = (_a = options === null || options === void 0 ? void 0 : options.includeAll) !== null && _a !== void 0 ? _a : false;
1412
+ var _b;
1413
+ const includeAll = (_b = options === null || options === void 0 ? void 0 : options.includeAll) !== null && _b !== void 0 ? _b : false;
1414
+ if (((_a = this.storage) === null || _a === void 0 ? void 0 : _a.isCursorHosted) === true) {
1415
+ try {
1416
+ const records = yield this.mergeStoredAndLocalSessions();
1417
+ return {
1418
+ sessions: this.summarizeSessionRecords(records, caller, includeAll),
1419
+ source: "cursor-hosted",
1420
+ };
1421
+ }
1422
+ catch (error) {
1423
+ this.logger(`[agentkit] cursor-hosted session list failed; falling back to local: ${describeError(error)}`);
1424
+ }
1425
+ }
1369
1426
  const records = yield this.sessions.list();
1370
- return records
1371
- .filter((record) => includeAll || samePrincipal(record.auth, caller))
1372
- .map((record) => {
1373
- const externalUrl = externalUrlForSession(record);
1374
- return Object.assign(Object.assign(Object.assign({ sessionId: record.sessionId, channelId: record.channelId, mode: record.mode }, (record.title === undefined ? {} : { title: record.title })), { turnCount: record.turnCount, running: this.activeTurns.has(record.sessionId) ||
1375
- this.pendingTurns.has(record.sessionId), createdAt: record.createdAt, updatedAt: record.updatedAt, continuationToken: record.continuationKey === null
1376
- ? null
1377
- : formatContinuationToken(record.channelId, record.continuationKey) }), (externalUrl === undefined ? {} : { externalUrl }));
1378
- })
1379
- .reverse();
1427
+ // Local store is createdAt-asc; reverse so newest created leads.
1428
+ return {
1429
+ sessions: this.summarizeSessionRecords([...records].reverse(), caller, includeAll),
1430
+ source: "local",
1431
+ };
1432
+ });
1433
+ }
1434
+ /**
1435
+ * Durable sink rows plus local records (local wins on the same id when
1436
+ * newer — covers debounce windows that have not flushed yet). Newest
1437
+ * `updatedAt` first.
1438
+ */
1439
+ mergeStoredAndLocalSessions() {
1440
+ return __awaiter(this, void 0, void 0, function* () {
1441
+ const storage = this.storage;
1442
+ if (storage === undefined) {
1443
+ throw new Error("storage is not configured");
1444
+ }
1445
+ const stored = yield storage.listSessionsFromSink();
1446
+ const local = yield this.sessions.list();
1447
+ const byId = new Map();
1448
+ for (const record of stored) {
1449
+ byId.set(record.sessionId, record);
1450
+ }
1451
+ for (const record of local) {
1452
+ const existing = byId.get(record.sessionId);
1453
+ if (existing === undefined ||
1454
+ record.updatedAt.localeCompare(existing.updatedAt) >= 0) {
1455
+ byId.set(record.sessionId, record);
1456
+ }
1457
+ }
1458
+ return [...byId.values()].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
1459
+ });
1460
+ }
1461
+ summarizeSessionRecords(records, caller, includeAll) {
1462
+ return records
1463
+ .filter((record) => includeAll || samePrincipal(record.auth, caller))
1464
+ .map((record) => {
1465
+ const externalUrl = externalUrlForSession(record);
1466
+ return Object.assign(Object.assign(Object.assign({ sessionId: record.sessionId, channelId: record.channelId, mode: record.mode }, (record.title === undefined ? {} : { title: record.title })), { turnCount: record.turnCount, running: this.activeTurns.has(record.sessionId) ||
1467
+ this.pendingTurns.has(record.sessionId), queued: this.turnGovernor.limited
1468
+ ? this.turnGovernor.isQueued(record.sessionId)
1469
+ : undefined, createdAt: record.createdAt, updatedAt: record.updatedAt, continuationToken: record.continuationKey === null
1470
+ ? null
1471
+ : formatContinuationToken(record.channelId, record.continuationKey) }), (externalUrl === undefined ? {} : { externalUrl }));
1380
1472
  });
1381
1473
  }
1382
1474
  /**
@@ -3,13 +3,23 @@
3
3
  *
4
4
  * Customer-facing errors never include hosting URLs or infra jargon.
5
5
  */
6
- import type { SessionEvent, SessionSummary } from "../types.js";
6
+ import type { SessionEvent, SessionListSource, SessionSummary } from "../types.js";
7
7
  import { type RequestAuth } from "./request-headers.js";
8
+ export interface ListedSessions {
9
+ sessions: SessionSummary[];
10
+ /** Present when the server reports which store answered. */
11
+ source?: SessionListSource;
12
+ }
8
13
  export declare function listSessions(args: {
9
14
  baseUrl: string;
10
15
  auth?: RequestAuth;
11
16
  fetchImpl?: typeof fetch;
12
17
  }): Promise<SessionSummary[]>;
18
+ export declare function listSessionsWithSource(args: {
19
+ baseUrl: string;
20
+ auth?: RequestAuth;
21
+ fetchImpl?: typeof fetch;
22
+ }): Promise<ListedSessions>;
13
23
  export declare function fetchSessionEvents(args: {
14
24
  baseUrl: string;
15
25
  sessionId: string;
@@ -29,6 +39,10 @@ export declare function resolvePreviousSessionId(args: {
29
39
  auth?: RequestAuth;
30
40
  fetchImpl?: typeof fetch;
31
41
  }): Promise<string | undefined>;
42
+ /** Human label for {@link SessionListSource} in CLI output. */
43
+ export declare function formatSessionListSource(source: SessionListSource): string;
32
44
  /** Format a sessions table (id, channel, mode, turns, running, updated). */
33
- export declare function formatSessionsTable(sessions: SessionSummary[]): string;
45
+ export declare function formatSessionsTable(sessions: SessionSummary[], options?: {
46
+ source?: SessionListSource;
47
+ }): string;
34
48
  //# sourceMappingURL=sessions-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sessions-client.d.ts","sourceRoot":"","sources":["../../src/internal/sessions-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE7E,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA8B5B;AAED,wBAAsB,kBAAkB,CA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E,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,OAAO,CAAC,cAAc,CAAC,CAiC1B;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAuE1B;AAiCD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAClC,cAAc,GAAG,SAAS,CAU5B;AAED,+DAA+D;AAC/D,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO9B;AAED,+DAA+D;AAC/D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAIzE;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,cAAc,EAAE,EAC1B,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAAE,GACvC,MAAM,CAkBR"}
@@ -15,6 +15,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  import { sanitizeCustomerError } from "./logs-client.js";
16
16
  import { mergeRequestHeaders } from "./request-headers.js";
17
17
  export function listSessions(args) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ return (yield listSessionsWithSource(args)).sessions;
20
+ });
21
+ }
22
+ export function listSessionsWithSource(args) {
18
23
  return __awaiter(this, void 0, void 0, function* () {
19
24
  var _a;
20
25
  const baseUrl = args.baseUrl.replace(/\/$/, "");
@@ -32,17 +37,19 @@ export function listSessions(args) {
32
37
  throw new Error(`Could not list sessions (HTTP ${resp.status}).`);
33
38
  }
34
39
  const body = (yield resp.json());
35
- if (!Array.isArray(body.sessions)) {
36
- return [];
37
- }
38
- const out = [];
39
- for (const row of body.sessions) {
40
- const parsed = parseSessionSummary(row);
41
- if (parsed !== undefined) {
42
- out.push(parsed);
40
+ const sessions = [];
41
+ if (Array.isArray(body.sessions)) {
42
+ for (const row of body.sessions) {
43
+ const parsed = parseSessionSummary(row);
44
+ if (parsed !== undefined) {
45
+ sessions.push(parsed);
46
+ }
43
47
  }
44
48
  }
45
- return out;
49
+ const source = body.source === "cursor-hosted" || body.source === "local"
50
+ ? body.source
51
+ : undefined;
52
+ return source === undefined ? { sessions } : { sessions, source };
46
53
  });
47
54
  }
48
55
  export function fetchSessionEvents(args) {
@@ -136,6 +143,7 @@ function parseSessionSummary(value) {
136
143
  title: typeof row.title === "string" ? row.title : undefined,
137
144
  turnCount: typeof row.turnCount === "number" ? row.turnCount : 0,
138
145
  running: row.running === true,
146
+ queued: typeof row.queued === "boolean" ? row.queued : undefined,
139
147
  createdAt: typeof row.createdAt === "string" ? row.createdAt : "",
140
148
  updatedAt: typeof row.updatedAt === "string" ? row.updatedAt : "",
141
149
  continuationToken,
@@ -167,10 +175,19 @@ export function resolvePreviousSessionId(args) {
167
175
  return (_a = pickPreviousSession(sessions)) === null || _a === void 0 ? void 0 : _a.sessionId;
168
176
  });
169
177
  }
178
+ /** Human label for {@link SessionListSource} in CLI output. */
179
+ export function formatSessionListSource(source) {
180
+ return source === "cursor-hosted"
181
+ ? "Listing from cursor-hosted storage (durable DB)."
182
+ : "Listing from local session store.";
183
+ }
170
184
  /** Format a sessions table (id, channel, mode, turns, running, updated). */
171
- export function formatSessionsTable(sessions) {
185
+ export function formatSessionsTable(sessions, options) {
186
+ const sourceLine = (options === null || options === void 0 ? void 0 : options.source) === undefined
187
+ ? ""
188
+ : `${formatSessionListSource(options.source)}\n`;
172
189
  if (sessions.length === 0) {
173
- return "No sessions.\n";
190
+ return `${sourceLine}No sessions.\n`;
174
191
  }
175
192
  const header = ["SESSION", "CHANNEL", "MODE", "TURNS", "RUNNING", "UPDATED"];
176
193
  const rows = sessions.map((s) => [
@@ -178,10 +195,10 @@ export function formatSessionsTable(sessions) {
178
195
  s.channelId,
179
196
  s.mode,
180
197
  String(s.turnCount),
181
- s.running ? "yes" : "no",
198
+ s.queued === true ? "queued" : s.running ? "yes" : "no",
182
199
  s.updatedAt,
183
200
  ]);
184
- return `${renderTable(header, rows)}\n`;
201
+ return `${sourceLine}${renderTable(header, rows)}\n`;
185
202
  }
186
203
  function renderTable(header, rows) {
187
204
  const widths = header.map((h, i) => Math.max(h.length, ...rows.map((row) => { var _a; return ((_a = row[i]) !== null && _a !== void 0 ? _a : "").length; })));
@@ -73,12 +73,23 @@ export declare class StorageCoordinator {
73
73
  private deleteOp;
74
74
  /** Whether the sink can serve the startup bulk restore (`list`). */
75
75
  get canBulkRestore(): boolean;
76
+ /**
77
+ * True when the authored sink is `cursorHostedStorage` (Bugbot via the
78
+ * control-plane proxy). `GET /v1/sessions` prefers this durable list.
79
+ */
80
+ get isCursorHosted(): boolean;
76
81
  /**
77
82
  * Saved session records for this agent (startup restore). Errors are
78
83
  * logged and read as "nothing saved" — a broken store must never block
79
84
  * serve start.
80
85
  */
81
86
  listSessions(): Promise<SessionRecord[]>;
87
+ /**
88
+ * Session records from the sink for the sessions API. Unlike
89
+ * {@link listSessions}, missing `list` or a thrown sink error **propagates**
90
+ * so the caller can fall back to the local session store.
91
+ */
92
+ listSessionsFromSink(): Promise<SessionRecord[]>;
82
93
  /**
83
94
  * Saved event stream for one session: chunk values concatenated in key
84
95
  * order (chunks are keyed by their first event's index, zero-padded, so
@@ -1 +1 @@
1
- {"version":3,"file":"storage-coordinator.d.ts","sourceRoot":"","sources":["../../src/internal/storage-coordinator.ts"],"names":[],"mappings":"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