@cursor/july 0.1.3 → 0.1.5

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 (141) hide show
  1. package/dist/bin/agent-serve.d.ts +1 -1
  2. package/dist/bin/agent-serve.js +40 -16
  3. package/dist/channels/slack/log.d.ts +1 -1
  4. package/dist/channels/slack/log.d.ts.map +1 -1
  5. package/dist/channels/slack/log.js +4 -5
  6. package/dist/channels/slack/setup.js +1 -1
  7. package/dist/channels/slack/socket-mode.d.ts.map +1 -1
  8. package/dist/channels/slack/socket-mode.js +10 -9
  9. package/dist/docs/404.html +2 -2
  10. package/dist/docs/ab.html +3 -3
  11. package/dist/docs/assets/{app.BR0RbIdx.js → app.DabPG-io.js} +1 -1
  12. package/dist/docs/assets/chunks/@localSearchIndexroot.QwK5BtEH.js +1 -0
  13. package/dist/docs/assets/chunks/{VPLocalSearchBox.qjsVTneI.js → VPLocalSearchBox.jmyr0bU0.js} +1 -1
  14. package/dist/docs/assets/chunks/{theme.2Kg8jIp_.js → theme.DysN9-VN.js} +2 -2
  15. package/dist/docs/assets/{index.md.m81y7TY7.js → index.md.Cylk70gg.js} +1 -1
  16. package/dist/docs/building-with-agents.html +3 -3
  17. package/dist/docs/concepts.html +3 -3
  18. package/dist/docs/deployment.html +3 -3
  19. package/dist/docs/evals.html +3 -3
  20. package/dist/docs/guides/agent-to-agent.html +3 -3
  21. package/dist/docs/guides/cloud-runtime.html +3 -3
  22. package/dist/docs/guides/github.html +3 -3
  23. package/dist/docs/guides/human-in-the-loop.html +3 -3
  24. package/dist/docs/guides/slack.html +3 -3
  25. package/dist/docs/guides/webhooks.html +3 -3
  26. package/dist/docs/hashmap.json +1 -1
  27. package/dist/docs/hillclimbing.html +3 -3
  28. package/dist/docs/index.html +5 -5
  29. package/dist/docs/quickstart.html +3 -3
  30. package/dist/docs/reference/agent-config.html +3 -3
  31. package/dist/docs/reference/channels.html +3 -3
  32. package/dist/docs/reference/cli.html +3 -3
  33. package/dist/docs/reference/connections.html +3 -3
  34. package/dist/docs/reference/hooks.html +3 -3
  35. package/dist/docs/reference/http-api.html +3 -3
  36. package/dist/docs/reference/instructions.html +3 -3
  37. package/dist/docs/reference/playground.html +3 -3
  38. package/dist/docs/reference/project-layout.html +3 -3
  39. package/dist/docs/reference/schedules.html +3 -3
  40. package/dist/docs/reference/sessions.html +3 -3
  41. package/dist/docs/reference/skills.html +3 -3
  42. package/dist/docs/reference/subagents.html +3 -3
  43. package/dist/docs/reference/tools.html +3 -3
  44. package/dist/docs/scaffolding-agents.html +3 -3
  45. package/dist/docs/storage.html +3 -3
  46. package/dist/docs/troubleshooting.html +3 -3
  47. package/dist/internal/ab-collector.js +3 -3
  48. package/dist/internal/ab-fold.js +1 -1
  49. package/dist/internal/cli-ax.d.ts +13 -5
  50. package/dist/internal/cli-ax.d.ts.map +1 -1
  51. package/dist/internal/cli-ax.js +41 -15
  52. package/dist/internal/cli-deploy.d.ts.map +1 -1
  53. package/dist/internal/cli-deploy.js +5 -2
  54. package/dist/internal/cli-github.js +13 -13
  55. package/dist/internal/cursor/account-mcp.js +3 -3
  56. package/dist/internal/cursor/backend-client.js +1 -1
  57. package/dist/internal/cursor/credentials.d.ts +5 -3
  58. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  59. package/dist/internal/cursor/credentials.js +9 -6
  60. package/dist/internal/cursor/github-credentials.js +3 -3
  61. package/dist/internal/cursor-event-relay.d.ts +4 -1
  62. package/dist/internal/cursor-event-relay.d.ts.map +1 -1
  63. package/dist/internal/cursor-event-relay.js +7 -1
  64. package/dist/internal/cursor-relay-core.d.ts +37 -2
  65. package/dist/internal/cursor-relay-core.d.ts.map +1 -1
  66. package/dist/internal/cursor-relay-core.js +91 -9
  67. package/dist/internal/cursor-slack-relay.d.ts +2 -2
  68. package/dist/internal/cursor-slack-relay.d.ts.map +1 -1
  69. package/dist/internal/cursor-slack-relay.js +5 -1
  70. package/dist/internal/distribution.d.ts +7 -0
  71. package/dist/internal/distribution.d.ts.map +1 -1
  72. package/dist/internal/distribution.js +7 -0
  73. package/dist/internal/docs-site.js +3 -3
  74. package/dist/internal/eval-run-store.d.ts.map +1 -1
  75. package/dist/internal/eval-run-store.js +8 -8
  76. package/dist/internal/github-fanout.js +2 -2
  77. package/dist/internal/host-platforms.js +5 -5
  78. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  79. package/dist/internal/mcp-endpoint.js +1 -1
  80. package/dist/internal/playground/toolchain.js +6 -6
  81. package/dist/internal/reminder-runner.d.ts.map +1 -1
  82. package/dist/internal/reminder-runner.js +11 -11
  83. package/dist/internal/resolve-prod-target.d.ts +2 -0
  84. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  85. package/dist/internal/resolve-prod-target.js +44 -21
  86. package/dist/internal/resolved-connections.js +5 -5
  87. package/dist/internal/schedule-runner.js +1 -1
  88. package/dist/internal/server.js +14 -14
  89. package/dist/internal/session-engine.d.ts.map +1 -1
  90. package/dist/internal/session-engine.js +13 -13
  91. package/dist/internal/sessions-client.d.ts +13 -0
  92. package/dist/internal/sessions-client.d.ts.map +1 -1
  93. package/dist/internal/sessions-client.js +25 -0
  94. package/dist/internal/storage-coordinator.js +6 -6
  95. package/dist/internal/update-check.d.ts +93 -0
  96. package/dist/internal/update-check.d.ts.map +1 -0
  97. package/dist/internal/update-check.js +431 -0
  98. package/dist/playground/assets/{index-D-vo2lV_.css → index-BEauYlII.css} +1 -1
  99. package/dist/playground/assets/index-BtM0wEGg.js +319 -0
  100. package/dist/playground/index.html +2 -2
  101. package/dist/types.d.ts +3 -1
  102. package/dist/types.d.ts.map +1 -1
  103. package/docs/README.md +0 -1
  104. package/package.json +2 -1
  105. package/skills/setup-slack/SKILL.md +1 -1
  106. package/src/bin/agent-serve.ts +42 -16
  107. package/src/channels/slack/log.ts +5 -5
  108. package/src/channels/slack/setup.ts +1 -1
  109. package/src/channels/slack/socket-mode.ts +11 -9
  110. package/src/internal/ab-collector.ts +3 -3
  111. package/src/internal/ab-fold.ts +1 -1
  112. package/src/internal/cli-ax.ts +55 -16
  113. package/src/internal/cli-deploy.ts +5 -2
  114. package/src/internal/cli-github.ts +13 -15
  115. package/src/internal/cursor/account-mcp.ts +3 -3
  116. package/src/internal/cursor/backend-client.ts +1 -1
  117. package/src/internal/cursor/credentials.ts +12 -7
  118. package/src/internal/cursor/github-credentials.ts +3 -3
  119. package/src/internal/cursor-event-relay.ts +11 -2
  120. package/src/internal/cursor-relay-core.ts +119 -11
  121. package/src/internal/cursor-slack-relay.ts +7 -3
  122. package/src/internal/distribution.ts +8 -0
  123. package/src/internal/docs-site.ts +3 -3
  124. package/src/internal/eval-run-store.ts +8 -10
  125. package/src/internal/github-fanout.ts +2 -2
  126. package/src/internal/host-platforms.ts +5 -5
  127. package/src/internal/mcp-endpoint.ts +1 -3
  128. package/src/internal/playground/toolchain.ts +6 -6
  129. package/src/internal/reminder-runner.ts +11 -17
  130. package/src/internal/resolve-prod-target.ts +55 -23
  131. package/src/internal/resolved-connections.ts +5 -5
  132. package/src/internal/schedule-runner.ts +1 -1
  133. package/src/internal/server.ts +14 -14
  134. package/src/internal/session-engine.ts +13 -15
  135. package/src/internal/sessions-client.ts +34 -0
  136. package/src/internal/storage-coordinator.ts +6 -6
  137. package/src/internal/update-check.ts +552 -0
  138. package/src/types.ts +3 -1
  139. package/dist/docs/assets/chunks/@localSearchIndexroot.DtIOQzGj.js +0 -1
  140. package/dist/playground/assets/index-x60b9q2j.js +0 -312
  141. /package/dist/docs/assets/{index.md.m81y7TY7.lean.js → index.md.Cylk70gg.lean.js} +0 -0
@@ -109,11 +109,11 @@ export async function ensureDocsSiteBundle(
109
109
  const toolchain = resolveDocsToolchain();
110
110
  if (toolchain === undefined) {
111
111
  logger(
112
- "[agent-serve] docs site missing and vitepress toolchain unavailable; /docs will show a build hint"
112
+ "[agentkit] docs site missing and vitepress toolchain unavailable; /docs will show a build hint"
113
113
  );
114
114
  return;
115
115
  }
116
- logger("[agent-serve] building docs site (vitepress)...");
116
+ logger("[agentkit] building docs site (vitepress)...");
117
117
  const code = await new Promise<number>((resolve, reject) => {
118
118
  const child = spawn(
119
119
  process.execPath,
@@ -131,7 +131,7 @@ export async function ensureDocsSiteBundle(
131
131
  "docs vitepress build finished but dist/docs/index.html is missing"
132
132
  );
133
133
  }
134
- logger("[agent-serve] docs site build complete");
134
+ logger("[agentkit] docs site build complete");
135
135
  }
136
136
 
137
137
  interface DocsToolchain {
@@ -185,7 +185,7 @@ export class EvalRunStore {
185
185
  await this.pruneOldRuns(config);
186
186
  await this.enqueuePersist(snapshot, this.resolvePersist(config));
187
187
  this.logger(
188
- `[agent-serve] eval run ${runId}: starting ${cases.length} case(s)`
188
+ `[agentkit] eval run ${runId}: starting ${cases.length} case(s)`
189
189
  );
190
190
 
191
191
  void this.execute(runId, {
@@ -235,7 +235,7 @@ export class EvalRunStore {
235
235
  const loaded = await persist.load({ projectRoot: this.projectRoot });
236
236
  if (!Array.isArray(loaded)) {
237
237
  this.logger(
238
- "[agent-serve] eval persistRuns.load() did not return an array; ignoring"
238
+ "[agentkit] eval persistRuns.load() did not return an array; ignoring"
239
239
  );
240
240
  this.hydrated = true;
241
241
  return;
@@ -262,12 +262,12 @@ export class EvalRunStore {
262
262
  }
263
263
  await this.pruneOldRuns(config);
264
264
  this.logger(
265
- `[agent-serve] hydrated ${this.runs.size} playground eval run(s) from persistRuns`
265
+ `[agentkit] hydrated ${this.runs.size} playground eval run(s) from persistRuns`
266
266
  );
267
267
  } catch (error) {
268
268
  const message = error instanceof Error ? error.message : String(error);
269
269
  this.logger(
270
- `[agent-serve] failed to hydrate playground eval runs: ${message}`
270
+ `[agentkit] failed to hydrate playground eval runs: ${message}`
271
271
  );
272
272
  } finally {
273
273
  this.hydrated = true;
@@ -319,7 +319,7 @@ export class EvalRunStore {
319
319
  } catch (error) {
320
320
  const message = error instanceof Error ? error.message : String(error);
321
321
  this.logger(
322
- `[agent-serve] persistRuns.save(${run.runId}) failed: ${message}`
322
+ `[agentkit] persistRuns.save(${run.runId}) failed: ${message}`
323
323
  );
324
324
  }
325
325
  }
@@ -335,9 +335,7 @@ export class EvalRunStore {
335
335
  await persist.delete(runId, { projectRoot: this.projectRoot });
336
336
  } catch (error) {
337
337
  const message = error instanceof Error ? error.message : String(error);
338
- this.logger(
339
- `[agent-serve] persistRuns.delete(${runId}) failed: ${message}`
340
- );
338
+ this.logger(`[agentkit] persistRuns.delete(${runId}) failed: ${message}`);
341
339
  }
342
340
  }
343
341
 
@@ -422,7 +420,7 @@ export class EvalRunStore {
422
420
  run.finishedAt = new Date().toISOString();
423
421
  await this.enqueuePersist(run, this.resolvePersist(opts.config));
424
422
  this.logger(
425
- `[agent-serve] eval run ${runId}: done — ${run.summary.passed} passed, ${run.summary.failed} failed`
423
+ `[agentkit] eval run ${runId}: done — ${run.summary.passed} passed, ${run.summary.failed} failed`
426
424
  );
427
425
  } catch (error) {
428
426
  const run = this.runs.get(runId);
@@ -433,7 +431,7 @@ export class EvalRunStore {
433
431
  run.finishedAt = new Date().toISOString();
434
432
  run.error = error instanceof Error ? error.message : String(error);
435
433
  await this.enqueuePersist(run, this.resolvePersist(opts.config));
436
- this.logger(`[agent-serve] eval run ${runId}: failed — ${run.error}`);
434
+ this.logger(`[agentkit] eval run ${runId}: failed — ${run.error}`);
437
435
  } finally {
438
436
  if (this.activeRunId === runId) {
439
437
  this.activeRunId = undefined;
@@ -136,14 +136,14 @@ export async function fanoutDelivery(
136
136
  });
137
137
  if (!response.ok) {
138
138
  log(
139
- `[agent-serve] delivery to ${label} failed: HTTP ${response.status}\n`
139
+ `[agentkit] delivery to ${label} failed: HTTP ${response.status}\n`
140
140
  );
141
141
  return;
142
142
  }
143
143
  delivered.push(label);
144
144
  } catch (error) {
145
145
  log(
146
- `[agent-serve] delivery to ${label} failed: ${
146
+ `[agentkit] delivery to ${label} failed: ${
147
147
  error instanceof Error ? error.message : String(error)
148
148
  }\n`
149
149
  );
@@ -114,7 +114,7 @@ export async function warmupHostGitHubAuth(options: {
114
114
  const source = options.authSource ?? (await resolveHostGitHubAuthSource());
115
115
  if (source === "unavailable") {
116
116
  options.logger(
117
- "[agent-serve] GitHub auth: unavailable (set GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY + GITHUB_APP_INSTALLATION_ID, or GITHUB_TOKEN / GH_TOKEN, or run `gh auth login`)"
117
+ "[agentkit] GitHub auth: unavailable (set GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY + GITHUB_APP_INSTALLATION_ID, or GITHUB_TOKEN / GH_TOKEN, or run `gh auth login`)"
118
118
  );
119
119
  return source;
120
120
  }
@@ -125,7 +125,7 @@ export async function warmupHostGitHubAuth(options: {
125
125
  exportedGhToken = await ensureGhCliTokenEnv();
126
126
  } catch (error) {
127
127
  options.logger(
128
- `[agent-serve] GitHub auth: failed to export GH_TOKEN for gh CLI: ${
128
+ `[agentkit] GitHub auth: failed to export GH_TOKEN for gh CLI: ${
129
129
  error instanceof Error ? error.message : String(error)
130
130
  }`
131
131
  );
@@ -143,16 +143,16 @@ export async function warmupHostGitHubAuth(options: {
143
143
  ? "GITHUB_TOKEN/GH_TOKEN"
144
144
  : "gh auth token";
145
145
  if (options.github === undefined) {
146
- options.logger(`[agent-serve] GitHub auth: ${label}`);
146
+ options.logger(`[agentkit] GitHub auth: ${label}`);
147
147
  return source;
148
148
  }
149
149
 
150
150
  try {
151
151
  await options.github.getOctokit();
152
- options.logger(`[agent-serve] GitHub auth: ${label}`);
152
+ options.logger(`[agentkit] GitHub auth: ${label}`);
153
153
  } catch (error) {
154
154
  options.logger(
155
- `[agent-serve] GitHub auth: ${label} resolved but Octokit warmup failed: ${
155
+ `[agentkit] GitHub auth: ${label} resolved but Octokit warmup failed: ${
156
156
  error instanceof Error ? error.message : String(error)
157
157
  }`
158
158
  );
@@ -106,9 +106,7 @@ export async function handleStatelessMcpRequest(args: {
106
106
  // so closing in `finally` never truncates a streamed response.
107
107
  return await transport.handleRequest(args.request);
108
108
  } catch (error) {
109
- logger(
110
- `[agent-serve] ${args.label} request failed: ${describeError(error)}`
111
- );
109
+ logger(`[agentkit] ${args.label} request failed: ${describeError(error)}`);
112
110
  return new Response(
113
111
  JSON.stringify({
114
112
  jsonrpc: "2.0",
@@ -121,7 +121,7 @@ export async function runPlaygroundBuild(
121
121
  "playground vite toolchain unavailable (need playground/ sources and the vite package)"
122
122
  );
123
123
  }
124
- logger("[agent-serve] building playground (vite)...");
124
+ logger("[agentkit] building playground (vite)...");
125
125
  const code = await spawnVite(toolchain, ["build", "--config", VITE_CONFIG], {
126
126
  env: process.env,
127
127
  });
@@ -133,7 +133,7 @@ export async function runPlaygroundBuild(
133
133
  "playground vite build finished but dist/playground/index.html is missing"
134
134
  );
135
135
  }
136
- logger("[agent-serve] playground build complete");
136
+ logger("[agentkit] playground build complete");
137
137
  }
138
138
 
139
139
  /**
@@ -149,7 +149,7 @@ export async function ensurePlaygroundBundle(
149
149
  }
150
150
  if (resolvePlaygroundToolchain() === undefined) {
151
151
  logger(
152
- "[agent-serve] playground bundle missing and vite toolchain unavailable; /playground will show a build hint"
152
+ "[agentkit] playground bundle missing and vite toolchain unavailable; /playground will show a build hint"
153
153
  );
154
154
  return;
155
155
  }
@@ -215,7 +215,7 @@ export function startPlaygroundDevServer(options: {
215
215
  child.stderr?.on("data", (chunk: Buffer) => {
216
216
  const text = chunk.toString().trimEnd();
217
217
  if (text !== "") {
218
- logger(`[agent-serve] playground: ${text}`);
218
+ logger(`[agentkit] playground: ${text}`);
219
219
  }
220
220
  });
221
221
 
@@ -225,7 +225,7 @@ export function startPlaygroundDevServer(options: {
225
225
  return;
226
226
  }
227
227
  logger(
228
- `[agent-serve] playground spawn failed: ${err.message} — static /playground still served when built`
228
+ `[agentkit] playground spawn failed: ${err.message} — static /playground still served when built`
229
229
  );
230
230
  });
231
231
  child.on("exit", (code, signal) => {
@@ -234,7 +234,7 @@ export function startPlaygroundDevServer(options: {
234
234
  }
235
235
  if (code !== 0 && code !== null) {
236
236
  logger(
237
- `[agent-serve] playground exited (code ${code}${
237
+ `[agentkit] playground exited (code ${code}${
238
238
  signal ? `, signal ${signal}` : ""
239
239
  }) — static /playground still served when built`
240
240
  );
@@ -143,7 +143,7 @@ export class ReminderRunner {
143
143
  }
144
144
  if (restored > 0 || disarmedOrphan > 0) {
145
145
  this.logger(
146
- `[agent-serve] reminders: restored ${restored} armed reminder(s)` +
146
+ `[agentkit] reminders: restored ${restored} armed reminder(s)` +
147
147
  (disarmedOrphan > 0
148
148
  ? `; disarmed ${disarmedOrphan} without live handlers`
149
149
  : "")
@@ -174,14 +174,12 @@ export class ReminderRunner {
174
174
  }
175
175
  } catch (error) {
176
176
  const message = error instanceof Error ? error.message : String(error);
177
- this.logger(
178
- `[agent-serve] reminders: storage hydrate failed: ${message}`
179
- );
177
+ this.logger(`[agentkit] reminders: storage hydrate failed: ${message}`);
180
178
  return;
181
179
  }
182
180
  if (hydrated > 0) {
183
181
  this.logger(
184
- `[agent-serve] reminders: hydrated ${hydrated} reminder(s) from storage`
182
+ `[agentkit] reminders: hydrated ${hydrated} reminder(s) from storage`
185
183
  );
186
184
  }
187
185
  }
@@ -366,7 +364,7 @@ export class ReminderRunner {
366
364
  const timer = setTimeout(() => {
367
365
  void this.fire(record.id).catch(async (error) => {
368
366
  this.logger(
369
- `[agent-serve] reminder "${record.id}" fire failed: ${
367
+ `[agentkit] reminder "${record.id}" fire failed: ${
370
368
  error instanceof Error ? error.message : String(error)
371
369
  }`
372
370
  );
@@ -384,7 +382,7 @@ export class ReminderRunner {
384
382
  await this.afterFire(current, "skip");
385
383
  } catch (rescheduleError) {
386
384
  this.logger(
387
- `[agent-serve] reminder "${record.id}" reschedule after failure failed: ${
385
+ `[agentkit] reminder "${record.id}" reschedule after failure failed: ${
388
386
  rescheduleError instanceof Error
389
387
  ? rescheduleError.message
390
388
  : String(rescheduleError)
@@ -447,7 +445,7 @@ export class ReminderRunner {
447
445
  }
448
446
  } catch (error) {
449
447
  this.logger(
450
- `[agent-serve] reminder "${id}" until() failed: ${
448
+ `[agentkit] reminder "${id}" until() failed: ${
451
449
  error instanceof Error ? error.message : String(error)
452
450
  }`
453
451
  );
@@ -460,7 +458,7 @@ export class ReminderRunner {
460
458
  if (record.busyPolicy === "skipIfBusy") {
461
459
  await this.afterFire(record, "skip");
462
460
  this.logger(
463
- `[agent-serve] reminder "${id}" (${record.purpose}) skipped: session busy`
461
+ `[agentkit] reminder "${id}" (${record.purpose}) skipped: session busy`
464
462
  );
465
463
  return { outcome: "fired", reason: "skipped_busy" };
466
464
  }
@@ -488,7 +486,7 @@ export class ReminderRunner {
488
486
  if (latest !== undefined && latest.status === "armed") {
489
487
  await this.disarm(latest, "run_stop");
490
488
  this.logger(
491
- `[agent-serve] reminder "${id}" (${record.purpose}) disarmed: run_stop`
489
+ `[agentkit] reminder "${id}" (${record.purpose}) disarmed: run_stop`
492
490
  );
493
491
  return { outcome: "fired", reason: "run_stop" };
494
492
  }
@@ -503,15 +501,11 @@ export class ReminderRunner {
503
501
 
504
502
  if (result.action === "skip") {
505
503
  await this.afterFire(latest, "skip", result.reschedule);
506
- this.logger(
507
- `[agent-serve] reminder "${id}" (${record.purpose}) skipped`
508
- );
504
+ this.logger(`[agentkit] reminder "${id}" (${record.purpose}) skipped`);
509
505
  return { outcome: "fired", reason: "skipped" };
510
506
  }
511
507
  await this.afterFire(latest, "delivered", result.reschedule);
512
- this.logger(
513
- `[agent-serve] reminder "${id}" (${record.purpose}) delivered`
514
- );
508
+ this.logger(`[agentkit] reminder "${id}" (${record.purpose}) delivered`);
515
509
  return { outcome: "fired", reason: "delivered" };
516
510
  } finally {
517
511
  this.firing.delete(id);
@@ -613,7 +607,7 @@ export class ReminderRunner {
613
607
  return { action: "delivered" };
614
608
  } catch (retryError) {
615
609
  this.logger(
616
- `[agent-serve] reminder "${record.id}" followup failed after wait: ${
610
+ `[agentkit] reminder "${record.id}" followup failed after wait: ${
617
611
  retryError instanceof Error
618
612
  ? retryError.message
619
613
  : String(retryError)
@@ -37,6 +37,8 @@ export interface ResolveProdTargetOptions {
37
37
  apiKey?: string;
38
38
  fetchImpl?: typeof fetch;
39
39
  err?: (text: string) => void;
40
+ /** Test seam for reachability-retry backoff. */
41
+ sleep?: (ms: number) => Promise<void>;
40
42
  }
41
43
 
42
44
  export interface ResolvedProdTarget {
@@ -68,35 +70,59 @@ export async function resolveProdTarget(
68
70
  );
69
71
  }
70
72
 
71
- let detail: DeploymentDetail;
72
- try {
73
- detail = await auth.client.getDeployment({
74
- teamId: auth.teamId,
75
- slug,
76
- });
77
- } catch (error) {
78
- if (error instanceof DeployApiError) {
73
+ // A hibernated engine can briefly omit engineAccess while getPod fails
74
+ // during wake. Retry a few times before surfacing "not reachable yet".
75
+ const maxReachabilityAttempts = 5;
76
+ const sleep = options.sleep ?? sleepMs;
77
+ let detail: DeploymentDetail | undefined;
78
+ for (let attempt = 0; attempt < maxReachabilityAttempts; attempt++) {
79
+ try {
80
+ detail = await auth.client.getDeployment({
81
+ teamId: auth.teamId,
82
+ slug,
83
+ });
84
+ } catch (error) {
85
+ if (error instanceof DeployApiError) {
86
+ throw new Error(
87
+ `Deployment "${slug}" (team ${auth.teamId}): ${error.message}`
88
+ );
89
+ }
90
+ throw error;
91
+ }
92
+
93
+ // `degraded` still serves the previous ACTIVE engine; allow runtime access
94
+ // when the control plane minted engineAccess for it.
95
+ const statusOk =
96
+ detail.status === "running" || detail.status === "degraded";
97
+ if (!statusOk) {
98
+ const lastError =
99
+ detail.lastError === null || detail.lastError === undefined
100
+ ? ""
101
+ : ` ${sanitizeCustomerFacingDetail(detail.lastError)}`;
79
102
  throw new Error(
80
- `Deployment "${slug}" (team ${auth.teamId}): ${error.message}`
103
+ `Deployment "${slug}" is ${detail.status}, not running.${lastError}\n` +
104
+ `Deploy or wait: \`${CLI} deploy --slug ${slug}\` / \`${CLI} deployment ${slug}\``
81
105
  );
82
106
  }
83
- throw error;
107
+ if (detail.engineAccess !== null && detail.engineAccess !== undefined) {
108
+ break;
109
+ }
110
+ if (attempt + 1 < maxReachabilityAttempts) {
111
+ if (attempt === 0) {
112
+ err(
113
+ `${stderrPalette().dim(
114
+ `Deployment "${slug}" is waking; waiting for engine access…`
115
+ )}\n`
116
+ );
117
+ }
118
+ await sleep(1000 * (attempt + 1));
119
+ }
84
120
  }
85
121
 
86
- // `degraded` still serves the previous ACTIVE engine; allow runtime access
87
- // when the control plane minted engineAccess for it.
88
- const access = detail.engineAccess;
89
- const statusOk = detail.status === "running" || detail.status === "degraded";
90
- if (!statusOk) {
91
- const lastError =
92
- detail.lastError === null || detail.lastError === undefined
93
- ? ""
94
- : ` ${sanitizeCustomerFacingDetail(detail.lastError)}`;
95
- throw new Error(
96
- `Deployment "${slug}" is ${detail.status}, not running.${lastError}\n` +
97
- `Deploy or wait: \`${CLI} deploy --slug ${slug}\` / \`${CLI} deployment ${slug}\``
98
- );
122
+ if (detail === undefined) {
123
+ throw new Error(`Deployment "${slug}" lookup failed.`);
99
124
  }
125
+ const access = detail.engineAccess;
100
126
  if (access === null || access === undefined) {
101
127
  throw new Error(
102
128
  `Deployment "${slug}" is ${detail.status} but is not reachable yet. ` +
@@ -126,6 +152,12 @@ function sanitizeCustomerFacingDetail(message: string): string {
126
152
  .replace(/\bcursorvm\.com\b/gi, "host");
127
153
  }
128
154
 
155
+ function sleepMs(ms: number): Promise<void> {
156
+ return new Promise((resolve) => {
157
+ setTimeout(resolve, ms);
158
+ });
159
+ }
160
+
129
161
  /** Resolve the deployment slug the same way `deploy` does for a single dir. */
130
162
  export function resolveProdSlug(options: {
131
163
  dir: string;
@@ -42,7 +42,7 @@ export function validateMountConnectionsConfig(args: {
42
42
  return;
43
43
  }
44
44
  throw new Error(
45
- `[agent-serve] agent "${label}" has Cursor account MCP connections with \`servers\` filters (${filteredRefs
45
+ `[agentkit] agent "${label}" has Cursor account MCP connections with \`servers\` filters (${filteredRefs
46
46
  .map((ref) => ref.name)
47
47
  .join(
48
48
  ", "
@@ -67,7 +67,7 @@ export function assertCloudCanHonorAccountServersFilters(args: {
67
67
  return;
68
68
  }
69
69
  throw new Error(
70
- `[agent-serve] cloud turn cannot honor Cursor account \`servers\` filters (${blocked
70
+ `[agentkit] cloud turn cannot honor Cursor account \`servers\` filters (${blocked
71
71
  .map((connection) => connection.name)
72
72
  .join(
73
73
  ", "
@@ -82,7 +82,7 @@ export function assertAccountConnectionsNotAnonymous(args: {
82
82
  }): void {
83
83
  if (args.allowAnonymous === true && args.hasAccountConnections) {
84
84
  throw new Error(
85
- "[agent-serve] --allow-anonymous cannot be used with Cursor account MCP connections (defineConnection({ cursorAccount: true })); use --bearer-token or remove the account MCP connections."
85
+ "[agentkit] --allow-anonymous cannot be used with Cursor account MCP connections (defineConnection({ cursorAccount: true })); use --bearer-token or remove the account MCP connections."
86
86
  );
87
87
  }
88
88
  }
@@ -113,7 +113,7 @@ export function resolveMountConnections(args: {
113
113
  resolved.push(...peers);
114
114
  if (cloudCapable && args.publicUrl === undefined) {
115
115
  args.logger(
116
- `[agent-serve] warning: agent "${label}" has peer MCP connections (${peers
116
+ `[agentkit] warning: agent "${label}" has peer MCP connections (${peers
117
117
  .map((peer) => peer.name)
118
118
  .join(
119
119
  ", "
@@ -136,7 +136,7 @@ export function resolveMountConnections(args: {
136
136
  args.accountBridge.logPreflight(args.accountRefs);
137
137
  if (cloudCapable && args.publicUrl === undefined) {
138
138
  args.logger(
139
- `[agent-serve] agent "${label}": cloud-runtime turns omit the account bridge without --public-url (cloud agents fall back to the account's native connectors).`
139
+ `[agentkit] agent "${label}": cloud-runtime turns omit the account bridge without --public-url (cloud agents fall back to the account's native connectors).`
140
140
  );
141
141
  }
142
142
  }
@@ -90,7 +90,7 @@ export class ScheduleRunner {
90
90
  if (schedule.cron.matches(now)) {
91
91
  void this.dispatch(schedule.name).catch((error) => {
92
92
  this.logger(
93
- `[agent-serve] schedule "${schedule.name}" dispatch failed: ${
93
+ `[agentkit] schedule "${schedule.name}" dispatch failed: ${
94
94
  error instanceof Error ? error.message : String(error)
95
95
  }`
96
96
  );
@@ -234,12 +234,12 @@ export async function startServer(
234
234
  );
235
235
  }
236
236
  logger(
237
- "[agent-serve] warning: --allow-anonymous-cursor-github — every admitted HTTP caller can drive sessions holding the signed-in account's repo-scoped GitHub credential; serve this only behind a trusted boundary (e.g. an SSO proxy)"
237
+ "[agentkit] warning: --allow-anonymous-cursor-github — every admitted HTTP caller can drive sessions holding the signed-in account's repo-scoped GitHub credential; serve this only behind a trusted boundary (e.g. an SSO proxy)"
238
238
  );
239
239
  }
240
240
  if (cursorGithubConfig.scope.permissions === "contents-write") {
241
241
  logger(
242
- '[agent-serve] warning: Cursor GitHub credentials include contents:write — the host holds a push-capable token shared with model-driven tools and untrusted webhook content; prefer permissions: "pr-write" unless this agent must push code'
242
+ '[agentkit] warning: Cursor GitHub credentials include contents:write — the host holds a push-capable token shared with model-driven tools and untrusted webhook content; prefer permissions: "pr-write" unless this agent must push code'
243
243
  );
244
244
  }
245
245
  const provider = new CursorGithubCredentialProvider({
@@ -281,7 +281,7 @@ export async function startServer(
281
281
  }
282
282
  if (options.allowAnonymous === true) {
283
283
  logger(
284
- "[agent-serve] warning: --allow-anonymous admits every HTTP caller as the same principal; use only on a trusted network (e.g. Tailscale) and prefer --bearer-token for shared hosts"
284
+ "[agentkit] warning: --allow-anonymous admits every HTTP caller as the same principal; use only on a trusted network (e.g. Tailscale) and prefer --bearer-token for shared hosts"
285
285
  );
286
286
  }
287
287
  const runner =
@@ -430,7 +430,7 @@ export async function startServer(
430
430
  await definition.onStart(startArgs);
431
431
  } catch (error) {
432
432
  logger(
433
- `[agent-serve] channel "${channel.id}" onStart failed: ${
433
+ `[agentkit] channel "${channel.id}" onStart failed: ${
434
434
  error instanceof Error
435
435
  ? (error.stack ?? error.message)
436
436
  : String(error)
@@ -744,7 +744,7 @@ export async function startServer(
744
744
  await stop();
745
745
  } catch (error) {
746
746
  logger(
747
- `[agent-serve] channel onStop failed: ${
747
+ `[agentkit] channel onStop failed: ${
748
748
  error instanceof Error
749
749
  ? (error.stack ?? error.message)
750
750
  : String(error)
@@ -1331,7 +1331,7 @@ function requireCursorEventsAuth(
1331
1331
  const apiKey = (config.apiKey ?? accountKey?.apiKey ?? "").trim();
1332
1332
  if (apiKey === "") {
1333
1333
  throw new Error(
1334
- `[agent-serve] --cursor-events (serve({ cursorEvents })) requires a signed-in Cursor account: the SCM event stream is read as the host's user. ${SIGN_IN_HINT}`
1334
+ `[agentkit] --cursor-events (serve({ cursorEvents })) requires a signed-in Cursor account: the SCM event stream is read as the host's user. ${SIGN_IN_HINT}`
1335
1335
  );
1336
1336
  }
1337
1337
  return {
@@ -1367,7 +1367,7 @@ function startCursorEventRelay(input: {
1367
1367
  );
1368
1368
  if (repos.length === 0) {
1369
1369
  logger(
1370
- "[agent-serve] cursor-events: no repos configured (pass --repo owner/name); relay disabled"
1370
+ "[agentkit] cursor-events: no repos configured (pass --repo owner/name); relay disabled"
1371
1371
  );
1372
1372
  return undefined;
1373
1373
  }
@@ -1375,7 +1375,7 @@ function startCursorEventRelay(input: {
1375
1375
  const events = [...new Set(githubTargets.flatMap((target) => target.events))];
1376
1376
  if (events.length === 0) {
1377
1377
  logger(
1378
- "[agent-serve] cursor-events: no mounted agent declares a github channel; relay disabled"
1378
+ "[agentkit] cursor-events: no mounted agent declares a github channel; relay disabled"
1379
1379
  );
1380
1380
  return undefined;
1381
1381
  }
@@ -1419,13 +1419,13 @@ function startCursorEventRelay(input: {
1419
1419
  .map((target) => `${target.slug || "default"}:${target.status}`)
1420
1420
  .join(", ");
1421
1421
  logger(
1422
- `[agent-serve] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`
1422
+ `[agentkit] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`
1423
1423
  );
1424
1424
  },
1425
1425
  });
1426
1426
  relay.start();
1427
1427
  logger(
1428
- `[agent-serve] cursor-events: relaying ${events.length} event kind(s) for ${repos.join(", ")} from ${auth.baseUrl}`
1428
+ `[agentkit] cursor-events: relaying ${events.length} event kind(s) for ${repos.join(", ")} from ${auth.baseUrl}`
1429
1429
  );
1430
1430
  return relay;
1431
1431
  }
@@ -1611,7 +1611,7 @@ async function startCursorSlackRelay(input: {
1611
1611
  channelId: target.channelId,
1612
1612
  });
1613
1613
  logger(
1614
- `[agent-serve] cursor-slack: dispatching ${formatCursorSlackEventLog(envelope)} → ${target.runtime.slug || "default"}`
1614
+ `[agentkit] cursor-slack: dispatching ${formatCursorSlackEventLog(envelope)} → ${target.runtime.slug || "default"}`
1615
1615
  );
1616
1616
  await dispatchCursorSlackEnvelope({
1617
1617
  runtime: target.accountRuntime,
@@ -1639,7 +1639,7 @@ async function startCursorSlackRelay(input: {
1639
1639
 
1640
1640
  relay.start();
1641
1641
  logger(
1642
- `[agent-serve] cursor-slack: relaying Slack for ${targets
1642
+ `[agentkit] cursor-slack: relaying Slack for ${targets
1643
1643
  .map(
1644
1644
  (target) => `${target.agentName} (${target.runtime.slug || "default"})`
1645
1645
  )
@@ -1735,7 +1735,7 @@ async function handleRequest(
1735
1735
  response = errorResponse(403, "forbidden", error.message);
1736
1736
  } else {
1737
1737
  logger(
1738
- `[agent-serve] request failed: ${
1738
+ `[agentkit] request failed: ${
1739
1739
  error instanceof Error
1740
1740
  ? (error.stack ?? error.message)
1741
1741
  : String(error)
@@ -1749,7 +1749,7 @@ async function handleRequest(
1749
1749
  await writeFetchResponse(response, res, method);
1750
1750
  } catch (error) {
1751
1751
  logger(
1752
- `[agent-serve] response write failed: ${
1752
+ `[agentkit] response write failed: ${
1753
1753
  error instanceof Error ? error.message : String(error)
1754
1754
  }`
1755
1755
  );