@cursor/july 0.1.80 → 0.1.82

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 (145) hide show
  1. package/AGENTS.md +0 -12
  2. package/dist/channels/github/cursor-account.d.ts +11 -0
  3. package/dist/channels/github/cursor-account.d.ts.map +1 -1
  4. package/dist/channels/github/cursor-account.js +13 -0
  5. package/dist/channels/github/github-channel.d.ts.map +1 -1
  6. package/dist/channels/github/github-channel.js +29 -1
  7. package/dist/channels/github/types.d.ts +8 -0
  8. package/dist/channels/github/types.d.ts.map +1 -1
  9. package/dist/channels/origin/origin-channel.d.ts.map +1 -1
  10. package/dist/channels/origin/origin-channel.js +32 -10
  11. package/dist/channels/origin/types.d.ts +7 -0
  12. package/dist/channels/origin/types.d.ts.map +1 -1
  13. package/dist/channels/slack/cursor-account.d.ts.map +1 -1
  14. package/dist/channels/slack/cursor-account.js +2 -2
  15. package/dist/channels/slack/dispatch.d.ts +3 -0
  16. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  17. package/dist/channels/slack/dispatch.js +18 -18
  18. package/dist/channels/slack/interactive.d.ts +2 -0
  19. package/dist/channels/slack/interactive.d.ts.map +1 -1
  20. package/dist/channels/slack/interactive.js +4 -16
  21. package/dist/channels/slack/slack-channel.d.ts +1 -1
  22. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  23. package/dist/channels/slack/slack-channel.js +21 -10
  24. package/dist/channels/slack/types.d.ts +7 -0
  25. package/dist/channels/slack/types.d.ts.map +1 -1
  26. package/dist/channels.d.ts.map +1 -1
  27. package/dist/channels.js +4 -0
  28. package/dist/continuation.d.ts +20 -0
  29. package/dist/continuation.d.ts.map +1 -0
  30. package/dist/continuation.js +18 -0
  31. package/dist/docs/404.html +1 -1
  32. package/dist/docs/ab.html +2 -2
  33. package/dist/docs/assets/{app.e4_wtjUS.js → app.BEHVaPKt.js} +1 -1
  34. package/dist/docs/assets/chunks/{@localSearchIndexroot.BGiMJpnL.js → @localSearchIndexroot.Vvio4stV.js} +1 -1
  35. package/dist/docs/assets/chunks/{VPLocalSearchBox.DbdzyEie.js → VPLocalSearchBox.D2-5PKih.js} +1 -1
  36. package/dist/docs/assets/chunks/{theme.D8HpLrLK.js → theme.uNqJ4MUO.js} +2 -2
  37. package/dist/docs/building-with-agents.html +2 -2
  38. package/dist/docs/concepts.html +2 -2
  39. package/dist/docs/deployment.html +2 -2
  40. package/dist/docs/evals.html +2 -2
  41. package/dist/docs/example-agents/approval-buddy.html +2 -2
  42. package/dist/docs/example-agents/benny.html +2 -2
  43. package/dist/docs/example-agents/bugbot.html +2 -2
  44. package/dist/docs/example-agents/codebase-wiki.html +2 -2
  45. package/dist/docs/example-agents/codeowners-review.html +2 -2
  46. package/dist/docs/example-agents/concierge.html +2 -2
  47. package/dist/docs/example-agents/fsd.html +2 -2
  48. package/dist/docs/example-agents/index.html +2 -2
  49. package/dist/docs/example-agents/knowledge-base.html +2 -2
  50. package/dist/docs/example-agents/oncall.html +2 -2
  51. package/dist/docs/example-agents/security-reviewer.html +2 -2
  52. package/dist/docs/example-agents/slack-agent.html +2 -2
  53. package/dist/docs/example-agents/weather-agent.html +2 -2
  54. package/dist/docs/guides/agent-to-agent.html +2 -2
  55. package/dist/docs/guides/cloud-runtime.html +2 -2
  56. package/dist/docs/guides/convert-automation.html +2 -2
  57. package/dist/docs/guides/github.html +2 -2
  58. package/dist/docs/guides/human-in-the-loop.html +2 -2
  59. package/dist/docs/guides/mcp-oauth.html +2 -2
  60. package/dist/docs/guides/opentelemetry.html +2 -2
  61. package/dist/docs/guides/slack.html +2 -2
  62. package/dist/docs/guides/webhooks.html +2 -2
  63. package/dist/docs/hillclimbing.html +2 -2
  64. package/dist/docs/index.html +2 -2
  65. package/dist/docs/quickstart.html +2 -2
  66. package/dist/docs/reference/agent-config.html +2 -2
  67. package/dist/docs/reference/artifacts.html +2 -2
  68. package/dist/docs/reference/channels.html +2 -2
  69. package/dist/docs/reference/cli.html +2 -2
  70. package/dist/docs/reference/connections.html +2 -2
  71. package/dist/docs/reference/hooks.html +2 -2
  72. package/dist/docs/reference/http-api.html +2 -2
  73. package/dist/docs/reference/instructions.html +2 -2
  74. package/dist/docs/reference/playground.html +2 -2
  75. package/dist/docs/reference/project-layout.html +2 -2
  76. package/dist/docs/reference/prompt.html +2 -2
  77. package/dist/docs/reference/schedules.html +2 -2
  78. package/dist/docs/reference/sessions.html +2 -2
  79. package/dist/docs/reference/skills.html +2 -2
  80. package/dist/docs/reference/subagents.html +2 -2
  81. package/dist/docs/reference/tools.html +2 -2
  82. package/dist/docs/scaffolding-agents.html +2 -2
  83. package/dist/docs/storage.html +2 -2
  84. package/dist/docs/templates/agentic-owners.html +2 -2
  85. package/dist/docs/templates/demo.html +2 -2
  86. package/dist/docs/templates/pr-autofixer.html +2 -2
  87. package/dist/docs/templates/security-reviewer.html +2 -2
  88. package/dist/docs/templates/triage.html +2 -2
  89. package/dist/docs/troubleshooting.html +2 -2
  90. package/dist/files.d.ts +9 -3
  91. package/dist/files.d.ts.map +1 -1
  92. package/dist/files.js +9 -3
  93. package/dist/index.d.ts +5 -1
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +4 -1
  96. package/dist/internal/continuation-channel.d.ts +29 -0
  97. package/dist/internal/continuation-channel.d.ts.map +1 -0
  98. package/dist/internal/continuation-channel.js +88 -0
  99. package/dist/internal/continuation-identity.d.ts +95 -0
  100. package/dist/internal/continuation-identity.d.ts.map +1 -0
  101. package/dist/internal/continuation-identity.js +445 -0
  102. package/dist/internal/deploy-manifest.d.ts +12 -2
  103. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  104. package/dist/internal/deploy-manifest.js +15 -7
  105. package/dist/internal/discovery.d.ts.map +1 -1
  106. package/dist/internal/discovery.js +32 -5
  107. package/dist/internal/server.d.ts.map +1 -1
  108. package/dist/internal/server.js +18 -8
  109. package/dist/internal/session-engine.d.ts +24 -0
  110. package/dist/internal/session-engine.d.ts.map +1 -1
  111. package/dist/internal/session-engine.js +104 -34
  112. package/dist/internal/session-store.d.ts.map +1 -1
  113. package/dist/internal/session-store.js +6 -0
  114. package/dist/internal/skills-sync.d.ts +25 -0
  115. package/dist/internal/skills-sync.d.ts.map +1 -0
  116. package/dist/internal/skills-sync.js +96 -0
  117. package/dist/playground/assets/{index-DJzcIeGt.css → index-ChETdG-_.css} +1 -1
  118. package/dist/playground/assets/{index-K3Sxyx0I.js → index-CkuIrhg4.js} +3 -3
  119. package/dist/playground/index.html +2 -2
  120. package/dist/types.d.ts +44 -0
  121. package/dist/types.d.ts.map +1 -1
  122. package/package.json +1 -1
  123. package/src/channels/github/cursor-account.ts +20 -0
  124. package/src/channels/github/github-channel.ts +52 -1
  125. package/src/channels/github/types.ts +8 -0
  126. package/src/channels/origin/origin-channel.ts +48 -10
  127. package/src/channels/origin/types.ts +7 -0
  128. package/src/channels/slack/cursor-account.ts +1 -0
  129. package/src/channels/slack/dispatch.ts +44 -2
  130. package/src/channels/slack/interactive.ts +5 -0
  131. package/src/channels/slack/slack-channel.ts +23 -2
  132. package/src/channels/slack/types.ts +7 -0
  133. package/src/channels.ts +7 -0
  134. package/src/continuation.ts +49 -0
  135. package/src/files.ts +10 -3
  136. package/src/index.ts +30 -1
  137. package/src/internal/continuation-channel.ts +129 -0
  138. package/src/internal/continuation-identity.ts +597 -0
  139. package/src/internal/deploy-manifest.ts +36 -3
  140. package/src/internal/discovery.ts +40 -2
  141. package/src/internal/server.ts +23 -9
  142. package/src/internal/session-engine.ts +132 -37
  143. package/src/internal/session-store.ts +6 -0
  144. package/src/internal/skills-sync.ts +107 -0
  145. package/src/types.ts +55 -0
@@ -36,7 +36,7 @@ import { once } from "node:events";
36
36
  import { createServer, } from "node:http";
37
37
  import { join } from "node:path";
38
38
  import { dispatchDeploymentEvent, getDeploymentsChannelOptions, } from "../channels/deployments/deployments-channel.js";
39
- import { createCursorAccountGithubTokenResolver, cursorGithubPermissionsForChannel, getGithubCursorAccountRuntime, resolveCursorGithubCredentialScope, resolveCursorGithubPermissions, resolveCursorGithubProxyUrl, } from "../channels/github/cursor-account.js";
39
+ import { createCursorAccountGithubTokenResolver, createCursorGithubProxyHostResolver, cursorGithubPermissionsForChannel, getGithubCursorAccountRuntime, resolveCursorGithubCredentialScope, resolveCursorGithubPermissions, resolveCursorGithubProxyUrl, } from "../channels/github/cursor-account.js";
40
40
  import { findGitHubChannelTargets } from "../channels/github/forward.js";
41
41
  import { getOriginCursorAccountRuntime, parseCursorOriginRepoScope, } from "../channels/origin/cursor-account.js";
42
42
  import { findOriginChannelTargets } from "../channels/origin/origin-channel.js";
@@ -160,6 +160,10 @@ export function startServer(mounts_1) {
160
160
  ? undefined
161
161
  : requireCursorEventsAuth(effectiveCursorEvents, accountKey);
162
162
  let cursorGithubCredentials;
163
+ // Proxy-wired GitHub token resolver for `ctx.host.github` when no startup
164
+ // token mint runs (empty repo scope): host Octokit calls must route
165
+ // through github-proxy exactly like channel Octokit calls.
166
+ let hostGithubProxyResolver;
163
167
  if (cursorGithubTargets.length > 0) {
164
168
  const githubProxyRequested = options.cursorGithubProxy === true;
165
169
  const needsGithubAuth = cursorGithubConfig.scope !== undefined || githubProxyRequested;
@@ -235,18 +239,24 @@ export function startServer(mounts_1) {
235
239
  target.accountRuntime.credentials.bind(() => __awaiter(this, void 0, void 0, function* () { return cursorGithubAuth.apiKey; }));
236
240
  target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
237
241
  }
238
- logger(`[agent-sdk] GitHub auth: channel API calls route through ${githubProxyUrl} (repo scope per request)`);
242
+ // `ctx.host.github` gets the same proxy transport; without this it
243
+ // would fall back to ambient auth (env token / `gh`) or an
244
+ // unauthenticated Octokit, and every host GitHub call would 404.
245
+ hostGithubProxyResolver = createCursorGithubProxyHostResolver({
246
+ getApiKey: () => __awaiter(this, void 0, void 0, function* () { return cursorGithubAuth.apiKey; }),
247
+ transport: proxyTransport,
248
+ });
249
+ logger(`[agent-sdk] GitHub auth: channel and host API calls route through ${githubProxyUrl} (repo scope per request)`);
239
250
  }
240
251
  }
241
252
  }
242
253
  const resolvedCursorGithubCredentials = cursorGithubCredentials;
243
- const hostPlatforms = createHostPlatforms(resolvedCursorGithubCredentials === undefined
254
+ const hostGithubToken = hostGithubProxyResolver !== null && hostGithubProxyResolver !== void 0 ? hostGithubProxyResolver : (resolvedCursorGithubCredentials === undefined
255
+ ? undefined
256
+ : createCursorAccountGithubTokenResolver(() => resolvedCursorGithubCredentials.getToken()));
257
+ const hostPlatforms = createHostPlatforms(hostGithubToken === undefined
244
258
  ? {}
245
- : {
246
- githubCredentials: {
247
- token: createCursorAccountGithubTokenResolver(() => resolvedCursorGithubCredentials.getToken()),
248
- },
249
- });
259
+ : { githubCredentials: { token: hostGithubToken } });
250
260
  if (playground) {
251
261
  // Auto-build dist/playground when missing (monorepo / source checkout).
252
262
  // Published installs already ship the bundle; vite may be absent there.
@@ -121,6 +121,8 @@ export declare class SessionEngine {
121
121
  private readonly restoreInFlight;
122
122
  /** Once-per-process cache for the A/B snapshot backfill (see abSnapshot). */
123
123
  private restoredAbSnapshot;
124
+ /** In-flight skills → deployment store sync (see ensureCloudSkillsSynced). */
125
+ private cloudSkillsSync;
124
126
  private readonly runner;
125
127
  private readonly logger;
126
128
  private readonly logs;
@@ -260,6 +262,9 @@ export declare class SessionEngine {
260
262
  * Start or resume a session on a channel. When `continuationToken`
261
263
  * addresses an existing session this is a follow-up turn; otherwise a new
262
264
  * session is created (keyed by the provided token, or a fresh one).
265
+ *
266
+ * v2 (`/v2` selectors) refuses `continuationToken` and looks
267
+ * up `(agentId, cKey)` from a mailbox stamp or structured claim.
263
268
  */
264
269
  send(channelId: string, message: string, options?: EngineSendOptions): Promise<ChannelSession>;
265
270
  /** Whether a continuation token already maps to a session on this channel. */
@@ -367,6 +372,25 @@ export declare class SessionEngine {
367
372
  /** Directory that receives AGENTS.md / skills / agent tools. */
368
373
  private scaffoldDir;
369
374
  private executeTurn;
375
+ /**
376
+ * Sync authored skills onto the deployment store at `skills/<name>/…`
377
+ * before the first cloud prompt, so `--agent-store-skills-dir` and the
378
+ * first-turn S3 scan can discover them. False when the sync fails: the
379
+ * turn then runs without store skills rather than pointing discovery at
380
+ * paths that do not exist.
381
+ *
382
+ * With skills authored, every first cloud turn re-copies the authored
383
+ * bytes and the memo only dedupes concurrent first turns. The mount is
384
+ * writable from cloud sessions, so a once-per-process copy would let one
385
+ * session's edits masquerade as agent definition for every later session
386
+ * until the engine restarts; re-syncing keeps the store true to discovery
387
+ * the same way local materialization always rewrites skills. Without
388
+ * skills the sync is best-effort stale cleanup and one attempt per
389
+ * process is enough, success or not — a deployment without the files
390
+ * surface must not fail and log on every new session for a feature it
391
+ * does not use.
392
+ */
393
+ private ensureCloudSkillsSynced;
370
394
  private buildTurnRequest;
371
395
  /**
372
396
  * Connection names a cloud turn can only reach through the host connection
@@ -1 +1 @@
1
- {"version":3,"file":"session-engine.d.ts","sourceRoot":"","sources":["../../src/internal/session-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAShD,OAAO,EACL,mBAAmB,EACnB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAIxB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAG1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EAKjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEn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;;;;;;;;;OAWG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB3C;YAEa,cAAc;IA4F5B;;;;;;;;OAQG;IACG,mBAAmB,CACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMpC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,4BAA4B;IAqBpC,OAAO,CAAC,kBAAkB;YAkBZ,gCAAgC;YAgBhC,sBAAsB;YAWtB,yBAAyB;IAmBvC;;;;;OAKG;YACW,kBAAkB;IAYhC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAO/C;IAED,2EAA2E;IAC3E,mBAAmB,IAAI,mBAAmB,CAEzC;IAED,yEAAyE;IACnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAc3B;CACF;AAgCD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,KAAK,EAAE,SAAS,GAAG,SAAS,GAC3B,SAAS,GAAG,SAAS,CAuBvB"}
@@ -22,7 +22,7 @@ import { SLACK_CHANNEL_ID } from "../channels/slack/constants.js";
22
22
  import { materializeSlackNudgeCarrier } from "../channels/slack/nudge-carrier.js";
23
23
  import { SlackAskDedupeStore, SlackNudgeStore, } from "../channels/slack/nudge-store.js";
24
24
  import { resolveDedicatedSlackHostBinding } from "../channels/slack/slack-channel.js";
25
- import { isCursorHostedFilesAvailable } from "../files-backends/cursor-hosted.js";
25
+ import { cursorHostedFiles, isCursorHostedFilesAvailable, } from "../files-backends/cursor-hosted.js";
26
26
  import { DEFAULT_MODEL, DIRECT_TOOL_CALL_CHANNEL_ID, isHostOauthConnectionTransport, isSymbolicConnectionTransport, } from "../types.js";
27
27
  import { ABCollector } from "./ab-collector.js";
28
28
  import { foldABStream } from "./ab-fold.js";
@@ -33,6 +33,8 @@ import { ArtifactsStore } from "./artifacts-store.js";
33
33
  import { SessionAuthError, samePrincipal } from "./auth.js";
34
34
  import { mergeCloudOptions, resolveSessionRuntime } from "./cloud-merge.js";
35
35
  import { applyCloudUsageToEvents, cloudSdkAgentIdFromEvents, isUnpricedCompletedTurn, mapSdkTokenUsage, } from "./cloud-turn-cost.js";
36
+ import { applyAgentContinuationDefaults, channelContinuationIdentity, httpContinuationIdentity, } from "./continuation-channel.js";
37
+ import { continuationSource, resolveV2Key, V2EngineError, } from "./continuation-identity.js";
36
38
  import { isDevMode } from "./dev-mode.js";
37
39
  import { EventLogStore } from "./event-log.js";
38
40
  import { TurnEventMapper } from "./event-mapper.js";
@@ -49,6 +51,7 @@ import { buildSessionContextBlock, SCHEDULE_CHANNEL_PREFIX, } from "./prompt-con
49
51
  import { assertCloudCanHonorAccountServersFilters } from "./resolved-connections.js";
50
52
  import { sessionExternalLinks } from "./session-links.js";
51
53
  import { SessionStore } from "./session-store.js";
54
+ import { syncSkillsToStore } from "./skills-sync.js";
52
55
  import { StorageCoordinator } from "./storage-coordinator.js";
53
56
  import { normalizeToolResult, toolCallErrorMessage } from "./tool-result.js";
54
57
  import { estimateTurnCostFromApi, roundCostUsd, } from "./turn-cost.js";
@@ -152,6 +155,7 @@ export class SessionEngine {
152
155
  /** Deduped in-flight cloud cost backfills, keyed by session id. */
153
156
  this.cloudCostBackfill = new Map();
154
157
  this.project = options.project;
158
+ applyAgentContinuationDefaults(this.project);
155
159
  this.stateRoot = options.stateRoot;
156
160
  this.runner = options.runner;
157
161
  this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : (() => { });
@@ -454,19 +458,37 @@ export class SessionEngine {
454
458
  * Start or resume a session on a channel. When `continuationToken`
455
459
  * addresses an existing session this is a follow-up turn; otherwise a new
456
460
  * session is created (keyed by the provided token, or a fresh one).
461
+ *
462
+ * v2 (`/v2` selectors) refuses `continuationToken` and looks
463
+ * up `(agentId, cKey)` from a mailbox stamp or structured claim.
457
464
  */
458
465
  send(channelId_1, message_1) {
459
466
  return __awaiter(this, arguments, void 0, function* (channelId, message, options = {}) {
460
467
  var _a;
461
468
  var _b, _c, _d, _e, _f;
462
- const auth = (_b = options.auth) !== null && _b !== void 0 ? _b : null;
463
- let existing = options.continuationToken === undefined
469
+ const identity = channelId === HTTP_CHANNEL_ID
470
+ ? httpContinuationIdentity(this.project.httpChannel)
471
+ : channelContinuationIdentity(this.channelsById.get(channelId));
472
+ let sendOptions = options;
473
+ let skipContinuationLookup = false;
474
+ if (continuationSource(identity) === "control-plane") {
475
+ if (options.continuationToken !== undefined) {
476
+ throw new V2EngineError("v2: do not pass continuationToken; use mailboxContinuation or claim");
477
+ }
478
+ const cKey = resolveV2Key(identity, options);
479
+ sendOptions = Object.assign(Object.assign({}, options), { continuationToken: cKey });
480
+ skipContinuationLookup = cKey.startsWith("evt:");
481
+ }
482
+ const auth = (_b = sendOptions.auth) !== null && _b !== void 0 ? _b : null;
483
+ let existing = skipContinuationLookup || sendOptions.continuationToken === undefined
464
484
  ? undefined
465
- : yield this.sessions.findByContinuation(channelId, options.continuationToken);
466
- if (existing === undefined && options.continuationToken !== undefined) {
485
+ : yield this.sessions.findByContinuation(channelId, sendOptions.continuationToken);
486
+ if (existing === undefined &&
487
+ !skipContinuationLookup &&
488
+ sendOptions.continuationToken !== undefined) {
467
489
  // Local miss: the session may live only in the storage sink (it
468
490
  // fell outside the startup restore window, or restore is lazy-only).
469
- existing = yield this.restoreSessionByContinuation(channelId, options.continuationToken);
491
+ existing = yield this.restoreSessionByContinuation(channelId, sendOptions.continuationToken);
470
492
  }
471
493
  if (existing !== undefined) {
472
494
  if (!samePrincipal(existing.auth, auth)) {
@@ -475,51 +497,52 @@ export class SessionEngine {
475
497
  // Refresh harness cwd when the caller supplies a newer worktree (e.g. PR
476
498
  // synchronize). Leave the durable continuation key unchanged.
477
499
  let record = existing;
478
- const refreshWorkspace = options.workspaceDir !== undefined &&
479
- options.workspaceDir !== existing.workspaceOverride;
500
+ const refreshWorkspace = sendOptions.workspaceDir !== undefined &&
501
+ sendOptions.workspaceDir !== existing.workspaceOverride;
480
502
  if (refreshWorkspace ||
481
- options.workspaceFiles !== undefined ||
482
- options.images !== undefined) {
503
+ sendOptions.workspaceFiles !== undefined ||
504
+ sendOptions.images !== undefined) {
483
505
  record = yield this.updateRecord(existing.sessionId, (current) => (Object.assign(Object.assign({}, current), { workspaceOverride: refreshWorkspace
484
- ? options.workspaceDir
485
- : current.workspaceOverride, pendingWorkspaceFiles: mergePendingWorkspaceFiles(current.pendingWorkspaceFiles, options.workspaceFiles), pendingImages: mergePendingImages(current.pendingImages, options.images) })));
506
+ ? sendOptions.workspaceDir
507
+ : current.workspaceOverride, pendingWorkspaceFiles: mergePendingWorkspaceFiles(current.pendingWorkspaceFiles, sendOptions.workspaceFiles), pendingImages: mergePendingImages(current.pendingImages, sendOptions.images) })));
486
508
  }
487
509
  // Refresh the cloud attach the same way: a follow-up send carries the
488
510
  // caller's CURRENT cloud options (e.g. a PR attach re-derived per wake),
489
511
  // and the first send's snapshot must not pin this session's turns to a
490
512
  // stale repo/prUrl for the session's lifetime.
491
- if (options.cloud !== undefined &&
492
- JSON.stringify(options.cloud) !== JSON.stringify(record.cloudOverride)) {
493
- record = yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { cloudOverride: options.cloud })));
513
+ if (sendOptions.cloud !== undefined &&
514
+ JSON.stringify(sendOptions.cloud) !==
515
+ JSON.stringify(record.cloudOverride)) {
516
+ record = yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { cloudOverride: sendOptions.cloud })));
494
517
  }
495
518
  // Refresh wake-derived channel state (GitHub headSha / refs) without
496
519
  // wiping sticky fields. Null patch values are skipped.
497
- if (options.refreshState !== undefined) {
498
- record = yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { channelState: mergeChannelStateSkipNull(current.channelState, options.refreshState) })));
520
+ if (sendOptions.refreshState !== undefined) {
521
+ record = yield this.updateRecord(record.sessionId, (current) => (Object.assign(Object.assign({}, current), { channelState: mergeChannelStateSkipNull(current.channelState, sendOptions.refreshState) })));
499
522
  }
500
523
  const since = (yield this.logs.get(record.sessionId)).count;
501
- const coalesced = yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_c = options.admission) !== null && _c !== void 0 ? _c : "preempt" }, (options.coalesceSourceTs === undefined
524
+ const coalesced = yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_c = sendOptions.admission) !== null && _c !== void 0 ? _c : "preempt" }, (sendOptions.coalesceSourceTs === undefined
502
525
  ? {}
503
- : { sourceTs: options.coalesceSourceTs })));
526
+ : { sourceTs: sendOptions.coalesceSourceTs })));
504
527
  return this.channelSession(record.sessionId, record, false, coalesced, since);
505
528
  }
506
529
  const now = new Date().toISOString();
507
- const channelState = this.initialChannelState(channelId, options.state);
508
- const purpose = options.purpose === "eval" ? "eval" : "live";
530
+ const channelState = this.initialChannelState(channelId, sendOptions.state);
531
+ const purpose = sendOptions.purpose === "eval" ? "eval" : "live";
509
532
  let record = {
510
533
  sessionId: newSessionId(),
511
534
  channelId,
512
- mode: (_d = options.mode) !== null && _d !== void 0 ? _d : "chat",
535
+ mode: (_d = sendOptions.mode) !== null && _d !== void 0 ? _d : "chat",
513
536
  purpose,
514
- continuationKey: (_e = options.continuationToken) !== null && _e !== void 0 ? _e : newContinuationKey(),
537
+ continuationKey: (_e = sendOptions.continuationToken) !== null && _e !== void 0 ? _e : newContinuationKey(),
515
538
  auth,
516
- title: options.title,
539
+ title: sendOptions.title,
517
540
  channelState,
518
- workspaceOverride: options.workspaceDir,
519
- pendingWorkspaceFiles: options.workspaceFiles,
520
- pendingImages: options.images,
521
- cloudOverride: options.cloud,
522
- sdkAgentId: options.sdkAgentId,
541
+ workspaceOverride: sendOptions.workspaceDir,
542
+ pendingWorkspaceFiles: sendOptions.workspaceFiles,
543
+ pendingImages: sendOptions.images,
544
+ cloudOverride: sendOptions.cloud,
545
+ sdkAgentId: sendOptions.sdkAgentId,
523
546
  turnCount: 0,
524
547
  createdAt: now,
525
548
  updatedAt: now,
@@ -532,9 +555,9 @@ export class SessionEngine {
532
555
  });
533
556
  record = yield this.enrollABs(record);
534
557
  const since = (yield this.logs.get(record.sessionId)).count;
535
- yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_f = options.admission) !== null && _f !== void 0 ? _f : "preempt" }, (options.coalesceSourceTs === undefined
558
+ yield this.startTurn(record.sessionId, message, Object.assign({ admission: (_f = sendOptions.admission) !== null && _f !== void 0 ? _f : "preempt" }, (sendOptions.coalesceSourceTs === undefined
536
559
  ? {}
537
- : { sourceTs: options.coalesceSourceTs })));
560
+ : { sourceTs: sendOptions.coalesceSourceTs })));
538
561
  return this.channelSession(record.sessionId, record, true, false, since);
539
562
  });
540
563
  }
@@ -1270,6 +1293,45 @@ export class SessionEngine {
1270
1293
  return Object.assign(Object.assign(Object.assign({}, outcome), (finalResult === undefined ? {} : { result: finalResult })), (finalUsage === undefined ? {} : { usage: finalUsage }));
1271
1294
  });
1272
1295
  }
1296
+ /**
1297
+ * Sync authored skills onto the deployment store at `skills/<name>/…`
1298
+ * before the first cloud prompt, so `--agent-store-skills-dir` and the
1299
+ * first-turn S3 scan can discover them. False when the sync fails: the
1300
+ * turn then runs without store skills rather than pointing discovery at
1301
+ * paths that do not exist.
1302
+ *
1303
+ * With skills authored, every first cloud turn re-copies the authored
1304
+ * bytes and the memo only dedupes concurrent first turns. The mount is
1305
+ * writable from cloud sessions, so a once-per-process copy would let one
1306
+ * session's edits masquerade as agent definition for every later session
1307
+ * until the engine restarts; re-syncing keeps the store true to discovery
1308
+ * the same way local materialization always rewrites skills. Without
1309
+ * skills the sync is best-effort stale cleanup and one attempt per
1310
+ * process is enough, success or not — a deployment without the files
1311
+ * surface must not fail and log on every new session for a feature it
1312
+ * does not use.
1313
+ */
1314
+ ensureCloudSkillsSynced() {
1315
+ if (this.cloudSkillsSync !== undefined) {
1316
+ return this.cloudSkillsSync;
1317
+ }
1318
+ const skills = this.project.agent.skills;
1319
+ let sync = syncSkillsToStore({
1320
+ sink: cursorHostedFiles(),
1321
+ agentName: this.project.name,
1322
+ skills,
1323
+ }).then(() => true, (error) => {
1324
+ this.logger(`[skills] deployment store sync failed: ${error instanceof Error ? error.message : String(error)}`);
1325
+ return false;
1326
+ });
1327
+ if (skills.length > 0) {
1328
+ sync = sync.finally(() => {
1329
+ this.cloudSkillsSync = undefined;
1330
+ });
1331
+ }
1332
+ this.cloudSkillsSync = sync;
1333
+ return sync;
1334
+ }
1273
1335
  buildTurnRequest(record, agent, turnId, prompt, isFirstTurn, instructionsInvisibleToHarness, emit, onUpdate, signal, images) {
1274
1336
  return __awaiter(this, void 0, void 0, function* () {
1275
1337
  var _a, _b, _c;
@@ -1315,8 +1377,9 @@ export class SessionEngine {
1315
1377
  if (isFirstTurn) {
1316
1378
  if (runtime === "cloud") {
1317
1379
  // Cloud VMs have no materialized workspace: ship the full context,
1318
- // including agent tool script bodies. On hosted deployments the
1319
- // shared memory journal is on the store mount say where. When the
1380
+ // including agent tool script bodies. On hosted deployments authored
1381
+ // skills land on the store mount for native discovery, and the
1382
+ // shared memory journal is on that mount too — say where. When the
1320
1383
  // turn carries the session-bound server-tool MCP endpoint, the
1321
1384
  // preamble catalogs server tools under that MCP server name *before*
1322
1385
  // the agent-tool "write the script if missing" recipe, so a model
@@ -1327,7 +1390,14 @@ export class SessionEngine {
1327
1390
  ? undefined
1328
1391
  : SERVER_TOOLS_MCP_SERVER_NAME,
1329
1392
  });
1330
- const memorySection = isCursorHostedFilesAvailable()
1393
+ const hosted = isCursorHostedFilesAvailable();
1394
+ // Synced whenever hosted, not just when skills exist: removing the
1395
+ // last skill has to delete its store copies too. Discovery is native
1396
+ // (`--agent-store-skills-dir`); this only has to land the bytes.
1397
+ if (hosted) {
1398
+ yield this.ensureCloudSkillsSynced();
1399
+ }
1400
+ const memorySection = hosted
1331
1401
  ? `\n\n${buildCloudMemorySection(this.project.name)}`
1332
1402
  : "";
1333
1403
  turnPrompt = `${preamble}${memorySection}\n\n${turnPrompt}`;
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/internal/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,qBAAa,YAAY;IAKX,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;IAC1D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;IAC/D,OAAO,CAAC,QAAQ,CAA4B;IAE5C,YAA6B,WAAW,EAAE,MAAM,EAAI;IAEpD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKpC;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtC;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,iBAAiB;YAIX,OAAO;YAmBP,cAAc;YAKd,UAAU;IAcxB,OAAO,CAAC,WAAW;IASb,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAc/D;IAEK,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAKrC;IAEK,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMpC;IAEK,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB/C;CACF"}
1
+ {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/internal/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,qBAAa,YAAY;IAKX,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;IAC1D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;IAC/D,OAAO,CAAC,QAAQ,CAA4B;IAE5C,YAA6B,WAAW,EAAE,MAAM,EAAI;IAEpD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKpC;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtC;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,iBAAiB;YASX,OAAO;YAmBP,cAAc;YAKd,UAAU;IAcxB,OAAO,CAAC,WAAW;IASb,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAc/D;IAEK,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAKrC;IAEK,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMpC;IAEK,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB/C;CACF"}
@@ -18,6 +18,7 @@ import { randomBytes } from "node:crypto";
18
18
  import { mkdir, readdir, readFile, rename, writeFile } from "node:fs/promises";
19
19
  import { join } from "node:path";
20
20
  import { isSafeSessionId } from "./auth.js";
21
+ import { isV2DurableContinuationKey } from "./continuation-identity.js";
21
22
  export class SessionStore {
22
23
  constructor(sessionsDir) {
23
24
  this.sessionsDir = sessionsDir;
@@ -40,6 +41,11 @@ export class SessionStore {
40
41
  return join(this.sessionDir(sessionId), "session.json");
41
42
  }
42
43
  continuationKeyOf(channelId, key) {
44
+ // v2 index is (agentId, cKey). This store is already per-agent, so drop
45
+ // channelId for `cont:` / `evt:` keys. v1 stays `{channelId}\n{token}`.
46
+ if (isV2DurableContinuationKey(key)) {
47
+ return `\0v2\n${key}`;
48
+ }
43
49
  return `${channelId}\n${key}`;
44
50
  }
45
51
  hydrate() {
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Sync authored skills into the deployment's Agent Store so cloud-runtime
3
+ * turns discover them natively. The engine writes through the hosted sink
4
+ * at store-root `skills/<name>/…`; the cloud VM is launched with
5
+ * `--agent-store-skills-dir /cursor/stores/deployment/skills` and walks that
6
+ * directory the same way it walks a user store.
7
+ */
8
+ import { type FileSink } from "../files.js";
9
+ import type { DiscoveredSkill } from "../types.js";
10
+ /**
11
+ * Mirror the agent's skills onto the store: write every SKILL.md (with the
12
+ * same generated frontmatter local materialization uses) plus sibling files,
13
+ * and delete keys no authored skill claims so redeploys drop removed skills.
14
+ *
15
+ * Everything loads and validates before the store is touched, and writes
16
+ * land before stale deletes, so a failed sync never leaves a gap a
17
+ * concurrent cloud reader could see.
18
+ */
19
+ export declare function syncSkillsToStore(args: {
20
+ sink: FileSink;
21
+ /** Sweeps leftover keys from the pre-native `agentkit/v1/{agent}/skills/` prefix. */
22
+ agentName: string;
23
+ skills: readonly DiscoveredSkill[];
24
+ }): Promise<void>;
25
+ //# sourceMappingURL=skills-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-sync.d.ts","sourceRoot":"","sources":["../../src/internal/skills-sync.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AAQpE;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CACpC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhB"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Sync authored skills into the deployment's Agent Store so cloud-runtime
3
+ * turns discover them natively. The engine writes through the hosted sink
4
+ * at store-root `skills/<name>/…`; the cloud VM is launched with
5
+ * `--agent-store-skills-dir /cursor/stores/deployment/skills` and walks that
6
+ * directory the same way it walks a user store.
7
+ */
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ import { readFile } from "node:fs/promises";
18
+ import { posix } from "node:path";
19
+ import { agentStoreKeys, FileConflictError } from "../files.js";
20
+ import { STORAGE_KEY_ROOT } from "../storage.js";
21
+ import { buildSkillMd } from "./workspace.js";
22
+ /** Pre-native layout. Deleted on every sync so a rolled-forward deploy does not leave undiscoverable copies. */
23
+ function legacySkillsPrefix(agent) {
24
+ return `${STORAGE_KEY_ROOT}/${agent}/skills/`;
25
+ }
26
+ /**
27
+ * Mirror the agent's skills onto the store: write every SKILL.md (with the
28
+ * same generated frontmatter local materialization uses) plus sibling files,
29
+ * and delete keys no authored skill claims so redeploys drop removed skills.
30
+ *
31
+ * Everything loads and validates before the store is touched, and writes
32
+ * land before stale deletes, so a failed sync never leaves a gap a
33
+ * concurrent cloud reader could see.
34
+ */
35
+ export function syncSkillsToStore(args) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const desired = new Map();
38
+ for (const skill of args.skills) {
39
+ const key = (relPath) => agentStoreKeys.skillFile(skill.name, relPath);
40
+ desired.set(key("SKILL.md"), Buffer.from(buildSkillMd(skill), "utf8"));
41
+ for (const [relPath, source] of Object.entries(skill.files)) {
42
+ desired.set(key(storeRelPath(relPath)), yield sourceBytes(source));
43
+ }
44
+ }
45
+ yield Promise.all([...desired].map(([key, body]) => putLastWriterWins(args.sink, key, body)));
46
+ const [existing, leftover] = yield Promise.all([
47
+ args.sink.list(agentStoreKeys.skillsPrefix()),
48
+ args.sink.list(legacySkillsPrefix(args.agentName)),
49
+ ]);
50
+ yield Promise.all([...existing.filter((entry) => !desired.has(entry.key)), ...leftover].map((entry) => args.sink.delete(entry.key)));
51
+ });
52
+ }
53
+ /**
54
+ * Same refusals as local materialization's `resolveInside`: a rel that
55
+ * escapes the skill directory or would not round-trip through the FUSE
56
+ * mount (`..`, `.`, `//`, absolute) fails the sync, exactly as it fails a
57
+ * local turn's workspace write. Backslashes are refused too — the store
58
+ * normalizes `\` to `/` on write, so the stored key would differ from the
59
+ * desired one and the stale pass would delete the file it just wrote.
60
+ */
61
+ function storeRelPath(relPath) {
62
+ if (relPath.includes("\0") ||
63
+ relPath.includes("\\") ||
64
+ posix.isAbsolute(relPath) ||
65
+ relPath.endsWith("/") ||
66
+ relPath.split("/").some((seg) => seg === ".." || seg === ".") ||
67
+ posix.normalize(relPath) !== relPath) {
68
+ throw new Error(`Refusing skill file path "${relPath}" (must be a normalized relative path)`);
69
+ }
70
+ return relPath;
71
+ }
72
+ /**
73
+ * Last writer wins. A raced conditional put (dual engine pods during a
74
+ * deploy rollover) clears the sink's cached etag, so one retry re-learns
75
+ * the current version and lands.
76
+ */
77
+ function putLastWriterWins(sink, key, body) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ try {
80
+ yield sink.put(key, body);
81
+ }
82
+ catch (error) {
83
+ if (!(error instanceof FileConflictError)) {
84
+ throw error;
85
+ }
86
+ yield sink.put(key, body);
87
+ }
88
+ });
89
+ }
90
+ function sourceBytes(source) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return "contents" in source
93
+ ? Buffer.from(source.contents, "utf8")
94
+ : readFile(source.sourcePath);
95
+ });
96
+ }