@super-one/cli 0.69.0-alpha → 0.69.0-alpha.1

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 (3) hide show
  1. package/MANIFEST.json +2 -2
  2. package/lib/cli.mjs +133 -162
  3. package/package.json +1 -1
package/MANIFEST.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@super-one/cli",
3
- "version": "0.69.0-alpha",
3
+ "version": "0.69.0-alpha.1",
4
4
  "kind": "npm",
5
5
  "minNodeMajor": 20,
6
- "builtAt": "2026-09-24T06:58:50.872Z"
6
+ "builtAt": "2026-09-25T17:08:46.529Z"
7
7
  }
package/lib/cli.mjs CHANGED
@@ -10239,7 +10239,7 @@ async function openCodexAppServer(opts) {
10239
10239
  stderrBuf = (stderrBuf + chunk).slice(-MAX_STDERR_CHARS);
10240
10240
  });
10241
10241
  const rl = createInterface({ input: child.stdout });
10242
- const pending = /* @__PURE__ */ new Map();
10242
+ const pending2 = /* @__PURE__ */ new Map();
10243
10243
  const notificationWaiters = [];
10244
10244
  const notificationQueue = [];
10245
10245
  let nextId = 1;
@@ -10259,11 +10259,11 @@ async function openCodexAppServer(opts) {
10259
10259
  }
10260
10260
  };
10261
10261
  const failAll = (err) => {
10262
- for (const [, p3] of pending) {
10262
+ for (const [, p3] of pending2) {
10263
10263
  clearTimeout(p3.timer);
10264
10264
  p3.reject(err);
10265
10265
  }
10266
- pending.clear();
10266
+ pending2.clear();
10267
10267
  while (notificationWaiters.length) {
10268
10268
  const w3 = notificationWaiters.shift();
10269
10269
  clearTimeout(w3.timer);
@@ -10363,9 +10363,9 @@ async function openCodexAppServer(opts) {
10363
10363
  }
10364
10364
  if (rec.id != null && (typeof rec.id === "number" || typeof rec.id === "string")) {
10365
10365
  const id = typeof rec.id === "number" ? rec.id : Number(rec.id);
10366
- const waiter = pending.get(id);
10366
+ const waiter = pending2.get(id);
10367
10367
  if (!waiter) continue;
10368
- pending.delete(id);
10368
+ pending2.delete(id);
10369
10369
  clearTimeout(waiter.timer);
10370
10370
  if (rec.error) {
10371
10371
  const errObj = rec.error;
@@ -10403,14 +10403,14 @@ async function openCodexAppServer(opts) {
10403
10403
  }
10404
10404
  const id = nextId++;
10405
10405
  const timer = setTimeout(() => {
10406
- pending.delete(id);
10406
+ pending2.delete(id);
10407
10407
  reject(new Error(`Codex app-server ${method} timed out after ${timeoutMs}ms`));
10408
10408
  }, timeoutMs);
10409
- pending.set(id, { resolve: resolve17, reject, timer });
10409
+ pending2.set(id, { resolve: resolve17, reject, timer });
10410
10410
  try {
10411
10411
  writeLine({ jsonrpc: "2.0", id, method, params: params ?? {} });
10412
10412
  } catch (err) {
10413
- pending.delete(id);
10413
+ pending2.delete(id);
10414
10414
  clearTimeout(timer);
10415
10415
  reject(safePublicError("Codex app-server write failed", err));
10416
10416
  }
@@ -11217,9 +11217,9 @@ var init_account_manager = __esm({
11217
11217
  type,
11218
11218
  ...type === "chatgpt" ? { useHostedLoginSuccessPage: true, appBrand: "chatgpt" } : {}
11219
11219
  }));
11220
- const pending = { accountId: id, connection };
11221
- this.pending.set(result.loginId, pending);
11222
- void this.wait(result.loginId, pending);
11220
+ const pending2 = { accountId: id, connection };
11221
+ this.pending.set(result.loginId, pending2);
11222
+ void this.wait(result.loginId, pending2);
11223
11223
  return { ...result, accountId: id };
11224
11224
  } catch (error51) {
11225
11225
  this.failed.add(id);
@@ -11230,53 +11230,53 @@ var init_account_manager = __esm({
11230
11230
  this.starting = false;
11231
11231
  }
11232
11232
  }
11233
- async wait(loginId, pending) {
11233
+ async wait(loginId, pending2) {
11234
11234
  const deadline = Date.now() + 15 * 6e4;
11235
11235
  const timeout = setTimeout(() => {
11236
11236
  void this.cancel(loginId).catch(() => {
11237
11237
  });
11238
- this.failed.add(pending.accountId);
11238
+ this.failed.add(pending2.accountId);
11239
11239
  }, 15 * 6e4);
11240
11240
  timeout.unref?.();
11241
11241
  try {
11242
- while (this.pending.get(loginId) === pending && Date.now() < deadline) {
11243
- const notification = await pending.connection.nextNotification();
11242
+ while (this.pending.get(loginId) === pending2 && Date.now() < deadline) {
11243
+ const notification = await pending2.connection.nextNotification();
11244
11244
  if (!notification) throw new Error("Login connection closed");
11245
11245
  if (notification?.method !== "account/login/completed" || notification.params.loginId !== loginId) continue;
11246
11246
  if (notification.params.success !== true) throw new Error("Sign-in failed");
11247
- const status = parseAccountStatus(await pending.connection.request("account/read", { refreshToken: false }));
11247
+ const status = parseAccountStatus(await pending2.connection.request("account/read", { refreshToken: false }));
11248
11248
  if (!status.signedIn) throw new Error("Sign-in did not complete");
11249
- if (this.pending.get(loginId) !== pending) return;
11250
- this.store.update(pending.accountId, status);
11251
- this.store.invalidateCredentials(pending.accountId);
11252
- this.changed(codexAccountProviderId(pending.accountId));
11249
+ if (this.pending.get(loginId) !== pending2) return;
11250
+ this.store.update(pending2.accountId, status);
11251
+ this.store.invalidateCredentials(pending2.accountId);
11252
+ this.changed(codexAccountProviderId(pending2.accountId));
11253
11253
  return;
11254
11254
  }
11255
- if (this.pending.get(loginId) === pending) this.failed.add(pending.accountId);
11255
+ if (this.pending.get(loginId) === pending2) this.failed.add(pending2.accountId);
11256
11256
  } catch {
11257
- this.failed.add(pending.accountId);
11257
+ this.failed.add(pending2.accountId);
11258
11258
  } finally {
11259
11259
  clearTimeout(timeout);
11260
- if (this.pending.get(loginId) === pending) this.pending.delete(loginId);
11261
- await pending.connection.close().catch(() => {
11260
+ if (this.pending.get(loginId) === pending2) this.pending.delete(loginId);
11261
+ await pending2.connection.close().catch(() => {
11262
11262
  });
11263
11263
  }
11264
11264
  }
11265
11265
  async cancel(loginId) {
11266
- const pending = this.pending.get(loginId);
11267
- if (!pending) return;
11266
+ const pending2 = this.pending.get(loginId);
11267
+ if (!pending2) return;
11268
11268
  this.pending.delete(loginId);
11269
11269
  try {
11270
- await pending.connection.request("account/login/cancel", { loginId });
11270
+ await pending2.connection.request("account/login/cancel", { loginId });
11271
11271
  } finally {
11272
- await pending.connection.close();
11272
+ await pending2.connection.close();
11273
11273
  }
11274
11274
  }
11275
11275
  async logout(providerId) {
11276
11276
  const id = codexAccountId(providerId) ?? codexAccountId(this.store.defaultProviderId()) ?? CODEX_CLI_ACCOUNT_ID;
11277
11277
  this.revisions.set(id, (this.revisions.get(id) ?? 0) + 1);
11278
- for (const [loginId, pending] of this.pending) {
11279
- if (pending.accountId === id) await this.cancel(loginId);
11278
+ for (const [loginId, pending2] of this.pending) {
11279
+ if (pending2.accountId === id) await this.cancel(loginId);
11280
11280
  }
11281
11281
  const selected = codexAccountProviderId(id);
11282
11282
  const connection = await this.open(selected);
@@ -13596,7 +13596,7 @@ async function fetchClaudeModels(opts) {
13596
13596
  };
13597
13597
  let q2;
13598
13598
  try {
13599
- q2 = (opts.queryFn ?? sdkQuery3)({ prompt: "hi", options });
13599
+ q2 = (opts.queryFn ?? sdkQuery3)({ prompt: CLAUDE_METADATA_PROBE_PROMPT, options });
13600
13600
  const models = await withTimeout(
13601
13601
  (async () => {
13602
13602
  await q2.initializationResult();
@@ -13629,12 +13629,13 @@ function withTimeout(promise2, ms2) {
13629
13629
  );
13630
13630
  });
13631
13631
  }
13632
- var MODEL_NAME_RE, DEFAULT_PROBE_TIMEOUT_MS;
13632
+ var CLAUDE_METADATA_PROBE_PROMPT, MODEL_NAME_RE, DEFAULT_PROBE_TIMEOUT_MS;
13633
13633
  var init_fetch_models = __esm({
13634
13634
  "../../packages/claude/src/fetch-models.ts"() {
13635
13635
  "use strict";
13636
13636
  init_resolve_sdk_binary();
13637
13637
  init_root_permission_guard();
13638
+ CLAUDE_METADATA_PROBE_PROMPT = "/help";
13638
13639
  MODEL_NAME_RE = /^(\w+ [\d.]+)(?:\s+with\s+(\w+)\s+context)?/;
13639
13640
  DEFAULT_PROBE_TIMEOUT_MS = 2e4;
13640
13641
  }
@@ -14915,6 +14916,20 @@ var init_session_title = __esm({
14915
14916
  }
14916
14917
  });
14917
14918
 
14919
+ // ../../packages/shared/src/host-wake.ts
14920
+ function isModelOnlyHostWake(text2) {
14921
+ return MODEL_ONLY_WAKE.test(text2.trimStart());
14922
+ }
14923
+ var MODEL_ONLY_WAKE;
14924
+ var init_host_wake = __esm({
14925
+ "../../packages/shared/src/host-wake.ts"() {
14926
+ "use strict";
14927
+ MODEL_ONLY_WAKE = new RegExp(
14928
+ '^(?:<task_notification source="(?:browser_download|artifact_sync)"|A collaboration mailbox message is ready\\.|A user-approved collaboration link is active with SuperOne session )'
14929
+ );
14930
+ }
14931
+ });
14932
+
14918
14933
  // ../../packages/runtime/src/session/host-action-store.ts
14919
14934
  import { createHash as createHash2, randomBytes as randomBytes2, randomUUID as randomUUID4, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
14920
14935
  function hashToken(token) {
@@ -15633,15 +15648,6 @@ var init_host_action_store = __esm({
15633
15648
  }
15634
15649
  });
15635
15650
 
15636
- // ../../packages/runtime/src/session/types.ts
15637
- var DEFAULT_PERMISSION_TIMEOUT_MS;
15638
- var init_types = __esm({
15639
- "../../packages/runtime/src/session/types.ts"() {
15640
- "use strict";
15641
- DEFAULT_PERMISSION_TIMEOUT_MS = 6e4;
15642
- }
15643
- });
15644
-
15645
15651
  // ../../packages/runtime/src/session/runtime-policy.ts
15646
15652
  function getRuntimeIdleTimeoutMs(activeRuntimeCount) {
15647
15653
  if (activeRuntimeCount <= 4) return TWENTY_MINUTES_MS;
@@ -15764,10 +15770,9 @@ var init_session_runtime = __esm({
15764
15770
  init_message_catalog();
15765
15771
  init_miniapp_prompt_tags();
15766
15772
  init_session_title();
15773
+ init_host_wake();
15767
15774
  init_host_action_store();
15768
- init_types();
15769
15775
  init_runtime_policy();
15770
- init_types();
15771
15776
  DEFAULT_AGENTS_CONFIRM_TIMEOUT_MS = 10 * 6e4;
15772
15777
  SessionRuntime = class {
15773
15778
  constructor(store, events, leases, environmentId, turnRunner, opts) {
@@ -15777,7 +15782,6 @@ var init_session_runtime = __esm({
15777
15782
  this.environmentId = environmentId;
15778
15783
  this.turnRunner = turnRunner;
15779
15784
  this.defaultApiProviderId = opts?.defaultApiProviderId;
15780
- this.permissionTimeoutMs = opts?.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
15781
15785
  this.agentsConfirmTimeoutMs = opts?.agentsConfirmTimeoutMs ?? DEFAULT_AGENTS_CONFIRM_TIMEOUT_MS;
15782
15786
  this.hostActions = opts?.hostActions ?? null;
15783
15787
  this.hydrateFromStore();
@@ -15812,14 +15816,13 @@ var init_session_runtime = __esm({
15812
15816
  disposing = false;
15813
15817
  /**
15814
15818
  * Active permission waiters keyed by interactionId.
15815
- * respondPermission resolves these; timeout/abort/close deny them.
15819
+ * respondPermission resolves these; abort/close deny them.
15816
15820
  */
15817
15821
  permissionWaiters = /* @__PURE__ */ new Map();
15818
15822
  questionWaiters = /* @__PURE__ */ new Map();
15819
15823
  planWaiters = /* @__PURE__ */ new Map();
15820
15824
  agentsConfirmWaiters = /* @__PURE__ */ new Map();
15821
15825
  defaultApiProviderId;
15822
- permissionTimeoutMs;
15823
15826
  agentsConfirmTimeoutMs;
15824
15827
  hostActions;
15825
15828
  /** Live waiters for requestHostAction terminal settlement. */
@@ -16428,6 +16431,7 @@ var init_session_runtime = __esm({
16428
16431
  return { delivered: true };
16429
16432
  }
16430
16433
  appendUserMessage(session, opts) {
16434
+ if (opts.source === "task-notification" && isModelOnlyHostWake(opts.text)) return;
16431
16435
  const userBlock = {
16432
16436
  id: randomUUID5(),
16433
16437
  role: "user",
@@ -16656,7 +16660,7 @@ var init_session_runtime = __esm({
16656
16660
  this.aborts.delete(sessionId);
16657
16661
  session.closed = true;
16658
16662
  session.status = "ended";
16659
- this.rejectPendingPermission(session, "aborted");
16663
+ this.rejectPendingPermission(session);
16660
16664
  this.cancelHostActionsForSession(sessionId, "session_closed");
16661
16665
  session.updatedAt = Date.now();
16662
16666
  this.persist(session);
@@ -17084,11 +17088,11 @@ var init_session_runtime = __esm({
17084
17088
  generation: input.generation,
17085
17089
  holderClientId: input.client.clientSessionId
17086
17090
  });
17087
- const pending = session.pendingInteraction;
17088
- if (!pending || pending.interactionId !== input.interactionId) {
17091
+ const pending2 = session.pendingInteraction;
17092
+ if (!pending2 || pending2.interactionId !== input.interactionId) {
17089
17093
  throw Object.assign(new Error("no matching pending permission"), { code: "failed_precondition" });
17090
17094
  }
17091
- if (pending.kind === "session_agents_confirm") {
17095
+ if (pending2.kind === "session_agents_confirm") {
17092
17096
  const waiter2 = this.agentsConfirmWaiters.get(input.interactionId);
17093
17097
  if (!waiter2 || waiter2.sessionId !== input.sessionId) {
17094
17098
  throw Object.assign(new Error("no matching pending agents confirm"), {
@@ -17106,7 +17110,7 @@ var init_session_runtime = __esm({
17106
17110
  });
17107
17111
  return;
17108
17112
  }
17109
- if (pending.kind && pending.kind !== "permission") {
17113
+ if (pending2.kind && pending2.kind !== "permission") {
17110
17114
  throw Object.assign(new Error("no matching pending permission"), { code: "failed_precondition" });
17111
17115
  }
17112
17116
  const waiter = this.permissionWaiters.get(input.interactionId);
@@ -17143,7 +17147,7 @@ var init_session_runtime = __esm({
17143
17147
  );
17144
17148
  }
17145
17149
  if (session.pendingInteraction) {
17146
- this.rejectPendingPermission(session, "aborted");
17150
+ this.rejectPendingPermission(session);
17147
17151
  }
17148
17152
  const interaction = {
17149
17153
  interactionId: `sessionagents_${Date.now()}_${randomUUID5().slice(0, 8)}`,
@@ -17269,11 +17273,11 @@ var init_session_runtime = __esm({
17269
17273
  }
17270
17274
  /**
17271
17275
  * Block the turn until the control-lease holder responds, or until
17272
- * timeout / abort / session close. Always emits a durable permission event.
17276
+ * abort / session close. Always emits a durable permission event.
17273
17277
  */
17274
17278
  waitForPermissionDecision(session, interaction, signal, requestId) {
17275
17279
  if (session.pendingInteraction) {
17276
- this.rejectPendingPermission(session, "aborted");
17280
+ this.rejectPendingPermission(session);
17277
17281
  }
17278
17282
  return new Promise((resolve17) => {
17279
17283
  let settled = false;
@@ -17289,11 +17293,7 @@ var init_session_runtime = __esm({
17289
17293
  const settle = (result) => {
17290
17294
  if (settled) return;
17291
17295
  settled = true;
17292
- const waiter = this.permissionWaiters.get(interaction.interactionId);
17293
- if (waiter) {
17294
- clearTimeout(waiter.timer);
17295
- this.permissionWaiters.delete(interaction.interactionId);
17296
- }
17296
+ this.permissionWaiters.delete(interaction.interactionId);
17297
17297
  if (session.pendingInteraction?.interactionId === interaction.interactionId) {
17298
17298
  session.pendingInteraction = null;
17299
17299
  session.updatedAt = Date.now();
@@ -17308,12 +17308,6 @@ var init_session_runtime = __esm({
17308
17308
  decision: result.clientDecision ?? result.decision
17309
17309
  }
17310
17310
  });
17311
- } else if (result.reason === "timeout") {
17312
- this.events.appendSession({
17313
- sessionId: session.sessionId,
17314
- eventType: SESSION_DURABLE_EVENT.permissionTimeout,
17315
- payload: { interactionId: interaction.interactionId, decision: "deny" }
17316
- });
17317
17311
  } else {
17318
17312
  this.events.appendSession({
17319
17313
  sessionId: session.sessionId,
@@ -17323,13 +17317,9 @@ var init_session_runtime = __esm({
17323
17317
  }
17324
17318
  resolve17(result.decision);
17325
17319
  };
17326
- const timer = setTimeout(() => {
17327
- settle({ decision: "deny", reason: "timeout" });
17328
- }, this.permissionTimeoutMs);
17329
17320
  this.permissionWaiters.set(interaction.interactionId, {
17330
17321
  sessionId: session.sessionId,
17331
- settle,
17332
- timer
17322
+ settle
17333
17323
  });
17334
17324
  if (signal.aborted) {
17335
17325
  settle({ decision: "deny", reason: "aborted" });
@@ -17345,59 +17335,55 @@ var init_session_runtime = __esm({
17345
17335
  });
17346
17336
  }
17347
17337
  /** Deny and clear any active permission waiter for this session. */
17348
- rejectPendingPermission(session, reason) {
17349
- const pending = session.pendingInteraction;
17350
- if (!pending) return;
17351
- if (pending.kind === "question") {
17352
- const qw = this.questionWaiters.get(pending.interactionId);
17353
- if (qw) qw.settle({ answers: {}, reason });
17338
+ rejectPendingPermission(session) {
17339
+ const pending2 = session.pendingInteraction;
17340
+ if (!pending2) return;
17341
+ if (pending2.kind === "question") {
17342
+ const qw = this.questionWaiters.get(pending2.interactionId);
17343
+ if (qw) qw.settle({ answers: {}, reason: "aborted" });
17354
17344
  else session.pendingInteraction = null;
17355
17345
  return;
17356
17346
  }
17357
- if (pending.kind === "plan") {
17358
- const pw = this.planWaiters.get(pending.interactionId);
17359
- if (pw) pw.settle({ decision: "reject", reason });
17347
+ if (pending2.kind === "plan") {
17348
+ const pw = this.planWaiters.get(pending2.interactionId);
17349
+ if (pw) pw.settle({ decision: "reject", reason: "aborted" });
17360
17350
  else session.pendingInteraction = null;
17361
17351
  return;
17362
17352
  }
17363
- if (pending.kind === "session_agents_confirm") {
17364
- const aw = this.agentsConfirmWaiters.get(pending.interactionId);
17365
- if (aw) aw.settle({ action: "cancel", reason });
17353
+ if (pending2.kind === "session_agents_confirm") {
17354
+ const aw = this.agentsConfirmWaiters.get(pending2.interactionId);
17355
+ if (aw) aw.settle({ action: "cancel", reason: "aborted" });
17366
17356
  else session.pendingInteraction = null;
17367
17357
  return;
17368
17358
  }
17369
- const waiter = this.permissionWaiters.get(pending.interactionId);
17359
+ const waiter = this.permissionWaiters.get(pending2.interactionId);
17370
17360
  if (waiter) {
17371
- waiter.settle({ decision: "deny", reason });
17361
+ waiter.settle({ decision: "deny", reason: "aborted" });
17372
17362
  } else {
17373
17363
  session.pendingInteraction = null;
17374
17364
  }
17375
17365
  }
17376
17366
  waitForQuestionDecision(session, interaction, signal, requestId) {
17377
17367
  if (session.pendingInteraction) {
17378
- this.rejectPendingPermission(session, "aborted");
17368
+ this.rejectPendingPermission(session);
17379
17369
  }
17380
- const pending = { ...interaction, kind: "question" };
17370
+ const pending2 = { ...interaction, kind: "question" };
17381
17371
  return new Promise((resolve17) => {
17382
17372
  let settled = false;
17383
- session.pendingInteraction = pending;
17373
+ session.pendingInteraction = pending2;
17384
17374
  session.updatedAt = Date.now();
17385
17375
  this.persist(session);
17386
17376
  this.events.appendSession({
17387
17377
  sessionId: session.sessionId,
17388
17378
  eventType: SESSION_DURABLE_EVENT.questionRequested,
17389
- payload: pending,
17379
+ payload: pending2,
17390
17380
  causationRequestId: requestId
17391
17381
  });
17392
17382
  const settle = (result) => {
17393
17383
  if (settled) return;
17394
17384
  settled = true;
17395
- const waiter = this.questionWaiters.get(pending.interactionId);
17396
- if (waiter) {
17397
- clearTimeout(waiter.timer);
17398
- this.questionWaiters.delete(pending.interactionId);
17399
- }
17400
- if (session.pendingInteraction?.interactionId === pending.interactionId) {
17385
+ this.questionWaiters.delete(pending2.interactionId);
17386
+ if (session.pendingInteraction?.interactionId === pending2.interactionId) {
17401
17387
  session.pendingInteraction = null;
17402
17388
  session.updatedAt = Date.now();
17403
17389
  this.persist(session);
@@ -17406,30 +17392,20 @@ var init_session_runtime = __esm({
17406
17392
  this.events.appendSession({
17407
17393
  sessionId: session.sessionId,
17408
17394
  eventType: SESSION_DURABLE_EVENT.questionResponded,
17409
- payload: { interactionId: pending.interactionId, answers: result.answers }
17410
- });
17411
- } else if (result.reason === "timeout") {
17412
- this.events.appendSession({
17413
- sessionId: session.sessionId,
17414
- eventType: SESSION_DURABLE_EVENT.questionTimeout,
17415
- payload: { interactionId: pending.interactionId }
17395
+ payload: { interactionId: pending2.interactionId, answers: result.answers }
17416
17396
  });
17417
17397
  } else {
17418
17398
  this.events.appendSession({
17419
17399
  sessionId: session.sessionId,
17420
17400
  eventType: SESSION_DURABLE_EVENT.questionAborted,
17421
- payload: { interactionId: pending.interactionId }
17401
+ payload: { interactionId: pending2.interactionId }
17422
17402
  });
17423
17403
  }
17424
17404
  resolve17(result.answers);
17425
17405
  };
17426
- const timer = setTimeout(() => {
17427
- settle({ answers: {}, reason: "timeout" });
17428
- }, this.permissionTimeoutMs);
17429
- this.questionWaiters.set(pending.interactionId, {
17406
+ this.questionWaiters.set(pending2.interactionId, {
17430
17407
  sessionId: session.sessionId,
17431
- settle,
17432
- timer
17408
+ settle
17433
17409
  });
17434
17410
  if (signal.aborted) {
17435
17411
  settle({ answers: {}, reason: "aborted" });
@@ -17446,29 +17422,25 @@ var init_session_runtime = __esm({
17446
17422
  }
17447
17423
  waitForPlanDecision(session, interaction, signal, requestId) {
17448
17424
  if (session.pendingInteraction) {
17449
- this.rejectPendingPermission(session, "aborted");
17425
+ this.rejectPendingPermission(session);
17450
17426
  }
17451
- const pending = { ...interaction, kind: "plan" };
17427
+ const pending2 = { ...interaction, kind: "plan" };
17452
17428
  return new Promise((resolve17) => {
17453
17429
  let settled = false;
17454
- session.pendingInteraction = pending;
17430
+ session.pendingInteraction = pending2;
17455
17431
  session.updatedAt = Date.now();
17456
17432
  this.persist(session);
17457
17433
  this.events.appendSession({
17458
17434
  sessionId: session.sessionId,
17459
17435
  eventType: SESSION_DURABLE_EVENT.planRequested,
17460
- payload: pending,
17436
+ payload: pending2,
17461
17437
  causationRequestId: requestId
17462
17438
  });
17463
17439
  const settle = (result) => {
17464
17440
  if (settled) return;
17465
17441
  settled = true;
17466
- const waiter = this.planWaiters.get(pending.interactionId);
17467
- if (waiter) {
17468
- clearTimeout(waiter.timer);
17469
- this.planWaiters.delete(pending.interactionId);
17470
- }
17471
- if (session.pendingInteraction?.interactionId === pending.interactionId) {
17442
+ this.planWaiters.delete(pending2.interactionId);
17443
+ if (session.pendingInteraction?.interactionId === pending2.interactionId) {
17472
17444
  session.pendingInteraction = null;
17473
17445
  session.updatedAt = Date.now();
17474
17446
  this.persist(session);
@@ -17478,33 +17450,23 @@ var init_session_runtime = __esm({
17478
17450
  sessionId: session.sessionId,
17479
17451
  eventType: SESSION_DURABLE_EVENT.planResponded,
17480
17452
  payload: {
17481
- interactionId: pending.interactionId,
17453
+ interactionId: pending2.interactionId,
17482
17454
  decision: result.decision,
17483
17455
  options: result.options
17484
17456
  }
17485
17457
  });
17486
- } else if (result.reason === "timeout") {
17487
- this.events.appendSession({
17488
- sessionId: session.sessionId,
17489
- eventType: SESSION_DURABLE_EVENT.planTimeout,
17490
- payload: { interactionId: pending.interactionId, decision: "reject" }
17491
- });
17492
17458
  } else {
17493
17459
  this.events.appendSession({
17494
17460
  sessionId: session.sessionId,
17495
17461
  eventType: SESSION_DURABLE_EVENT.planAborted,
17496
- payload: { interactionId: pending.interactionId, decision: "reject" }
17462
+ payload: { interactionId: pending2.interactionId, decision: "reject" }
17497
17463
  });
17498
17464
  }
17499
17465
  resolve17({ decision: result.decision, options: result.options });
17500
17466
  };
17501
- const timer = setTimeout(() => {
17502
- settle({ decision: "reject", reason: "timeout" });
17503
- }, this.permissionTimeoutMs);
17504
- this.planWaiters.set(pending.interactionId, {
17467
+ this.planWaiters.set(pending2.interactionId, {
17505
17468
  sessionId: session.sessionId,
17506
- settle,
17507
- timer
17469
+ settle
17508
17470
  });
17509
17471
  if (signal.aborted) {
17510
17472
  settle({ decision: "reject", reason: "aborted" });
@@ -18701,7 +18663,7 @@ var init_relay_identify = __esm({
18701
18663
 
18702
18664
  // ../../packages/shared/src/platform-registry/types.ts
18703
18665
  var CONSUMER_TASK;
18704
- var init_types2 = __esm({
18666
+ var init_types = __esm({
18705
18667
  "../../packages/shared/src/platform-registry/types.ts"() {
18706
18668
  "use strict";
18707
18669
  CONSUMER_TASK = {
@@ -20132,9 +20094,9 @@ var init_platform_registry = __esm({
20132
20094
  "use strict";
20133
20095
  init_relay_identify();
20134
20096
  init_protocols();
20135
- init_types2();
20097
+ init_types();
20136
20098
  init_protocols();
20137
- init_types2();
20099
+ init_types();
20138
20100
  init_capabilities2();
20139
20101
  init_claude_env();
20140
20102
  init_merge();
@@ -64641,6 +64603,23 @@ var init_cursor_store = __esm({
64641
64603
  }
64642
64604
  });
64643
64605
 
64606
+ // ../../packages/cursor/src/cursor-sdk.ts
64607
+ function loadCursorSdk() {
64608
+ pending ??= import("@cursor/sdk").then((sdk) => loaded = sdk);
64609
+ return pending;
64610
+ }
64611
+ function isCursorSdkError(error51, name) {
64612
+ return loaded !== null && error51 instanceof loaded[name];
64613
+ }
64614
+ var pending, loaded;
64615
+ var init_cursor_sdk = __esm({
64616
+ "../../packages/cursor/src/cursor-sdk.ts"() {
64617
+ "use strict";
64618
+ pending = null;
64619
+ loaded = null;
64620
+ }
64621
+ });
64622
+
64644
64623
  // ../../packages/shared/src/model-option-params.ts
64645
64624
  function parseCatalogContextWindow(raw) {
64646
64625
  if (!raw) return null;
@@ -64691,33 +64670,30 @@ var init_cursor_model_selection = __esm({
64691
64670
  });
64692
64671
 
64693
64672
  // ../../packages/cursor/src/cursor-client.ts
64694
- import { Agent as Agent2, Cursor } from "@cursor/sdk";
64695
64673
  var init_cursor_client = __esm({
64696
64674
  "../../packages/cursor/src/cursor-client.ts"() {
64697
64675
  "use strict";
64676
+ init_cursor_sdk();
64698
64677
  init_cursor_config();
64699
64678
  init_cursor_model_selection();
64700
64679
  }
64701
64680
  });
64702
64681
 
64703
64682
  // ../../packages/cursor/src/cursor-cloud.ts
64704
- import {
64705
- Agent as Agent3,
64706
- Cursor as Cursor2
64707
- } from "@cursor/sdk";
64708
64683
  var init_cursor_cloud = __esm({
64709
64684
  "../../packages/cursor/src/cursor-cloud.ts"() {
64710
64685
  "use strict";
64686
+ init_cursor_sdk();
64711
64687
  init_cursor_config();
64712
64688
  init_cursor_store();
64713
64689
  }
64714
64690
  });
64715
64691
 
64716
64692
  // ../../packages/cursor/src/cursor-sdk-auth.ts
64717
- import { Cursor as Cursor3 } from "@cursor/sdk";
64718
64693
  var init_cursor_sdk_auth = __esm({
64719
64694
  "../../packages/cursor/src/cursor-sdk-auth.ts"() {
64720
64695
  "use strict";
64696
+ init_cursor_sdk();
64721
64697
  }
64722
64698
  });
64723
64699
 
@@ -64756,9 +64732,7 @@ var init_cursor_local_options = __esm({
64756
64732
  });
64757
64733
 
64758
64734
  // ../../packages/cursor/src/cursor-network-retry.ts
64759
- import { NetworkError } from "@cursor/sdk";
64760
64735
  function isCursorRetryableNetworkError(error51) {
64761
- if (error51 instanceof NetworkError) return error51.isRetryable;
64762
64736
  if (!error51 || typeof error51 !== "object") return false;
64763
64737
  const name = "name" in error51 ? String(error51.name) : "";
64764
64738
  if (name !== "NetworkError") return false;
@@ -64842,14 +64816,8 @@ var init_cursor_sdk_trace = __esm({
64842
64816
  });
64843
64817
 
64844
64818
  // ../../packages/cursor/src/cursor-runtime.ts
64845
- import {
64846
- Agent as Agent4,
64847
- AgentBusyError,
64848
- Cursor as Cursor4,
64849
- IntegrationNotConnectedError
64850
- } from "@cursor/sdk";
64851
64819
  function formatCursorError(error51) {
64852
- if (error51 instanceof IntegrationNotConnectedError) {
64820
+ if (isCursorSdkError(error51, "IntegrationNotConnectedError")) {
64853
64821
  return new CursorIntegrationError(
64854
64822
  `${error51.message} Connect ${error51.provider} at ${error51.helpUrl} then retry.`,
64855
64823
  { provider: error51.provider, helpUrl: error51.helpUrl }
@@ -64877,9 +64845,10 @@ async function createCursorRuntime(opts) {
64877
64845
  "Cursor User API Key missing. Create one at https://cursor.com/dashboard/api, set it on the Cursor provider, or export CURSOR_API_KEY."
64878
64846
  );
64879
64847
  }
64848
+ const { Agent: Agent2, Cursor } = await loadCursorSdk();
64880
64849
  if (plan.config.useHttp1ForAgent != null) {
64881
64850
  try {
64882
- Cursor4.configure({ local: { useHttp1ForAgent: plan.config.useHttp1ForAgent } });
64851
+ Cursor.configure({ local: { useHttp1ForAgent: plan.config.useHttp1ForAgent } });
64883
64852
  } catch (error51) {
64884
64853
  log2.debug("[CursorRuntime] Cursor.configure useHttp1ForAgent failed:", error51);
64885
64854
  }
@@ -64931,7 +64900,7 @@ async function createCursorRuntime(opts) {
64931
64900
  }, opts.sessionId);
64932
64901
  const openAgent = (sandbox) => withCursorPlatformLookup(async () => {
64933
64902
  if (opts.providerSessionId) {
64934
- return Agent4.resume(opts.providerSessionId, {
64903
+ return Agent2.resume(opts.providerSessionId, {
64935
64904
  apiKey,
64936
64905
  ...model ? { model } : {},
64937
64906
  ...agentName ? { name: agentName } : {},
@@ -64954,7 +64923,7 @@ async function createCursorRuntime(opts) {
64954
64923
  });
64955
64924
  }
64956
64925
  if (isCloud) {
64957
- return Agent4.create({
64926
+ return Agent2.create({
64958
64927
  apiKey,
64959
64928
  ...model ? { model } : {},
64960
64929
  ...agentName ? { name: agentName } : {},
@@ -64963,7 +64932,7 @@ async function createCursorRuntime(opts) {
64963
64932
  cloud: buildCloudOptions(config2)
64964
64933
  });
64965
64934
  }
64966
- return Agent4.create({
64935
+ return Agent2.create({
64967
64936
  apiKey,
64968
64937
  model,
64969
64938
  ...agentName ? { name: agentName } : {},
@@ -65146,7 +65115,7 @@ ${text2}` : text2;
65146
65115
  try {
65147
65116
  run = await agent.send(userMessage2, sendOptions);
65148
65117
  } catch (error51) {
65149
- if (error51 instanceof AgentBusyError && !sendOpts?.force && !isCloud) {
65118
+ if (isCursorSdkError(error51, "AgentBusyError") && !sendOpts?.force && !isCloud) {
65150
65119
  log2.warn("[CursorRuntime] AgentBusyError \u2014 retrying with local.force");
65151
65120
  tracer.runtime("agent_busy_retry", {
65152
65121
  message: error51 instanceof Error ? error51.message : String(error51)
@@ -65317,6 +65286,7 @@ var init_cursor_runtime = __esm({
65317
65286
  "../../packages/cursor/src/cursor-runtime.ts"() {
65318
65287
  "use strict";
65319
65288
  init_superone_system_prompt();
65289
+ init_cursor_sdk();
65320
65290
  init_cursor_config();
65321
65291
  init_cursor_local_options();
65322
65292
  init_cursor_network_retry();
@@ -65349,10 +65319,10 @@ var init_cursor_runtime = __esm({
65349
65319
  });
65350
65320
 
65351
65321
  // ../../packages/cursor/src/cursor-workspace-prewarm.ts
65352
- import { createAgentPlatform } from "@cursor/sdk";
65353
65322
  var init_cursor_workspace_prewarm = __esm({
65354
65323
  "../../packages/cursor/src/cursor-workspace-prewarm.ts"() {
65355
65324
  "use strict";
65325
+ init_cursor_sdk();
65356
65326
  init_cursor_sdk_trace();
65357
65327
  init_cursor_local_options();
65358
65328
  init_cursor_platform_binaries();
@@ -65500,6 +65470,7 @@ var init_src5 = __esm({
65500
65470
  init_cursor_event_map();
65501
65471
  init_cursor_store();
65502
65472
  init_cursor_client();
65473
+ init_cursor_sdk();
65503
65474
  init_cursor_model_selection();
65504
65475
  init_cursor_cloud();
65505
65476
  init_cursor_sdk_auth();
@@ -73417,8 +73388,8 @@ import { fileURLToPath } from "node:url";
73417
73388
  function resolveCliReleaseVersion() {
73418
73389
  const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
73419
73390
  if (fromEnv) return fromEnv;
73420
- if ("0.69.0-alpha".trim()) {
73421
- return "0.69.0-alpha".trim();
73391
+ if ("0.69.0-alpha.1".trim()) {
73392
+ return "0.69.0-alpha.1".trim();
73422
73393
  }
73423
73394
  const fromDist = readDistManifestVersion();
73424
73395
  if (fromDist) return fromDist;
@@ -102413,10 +102384,10 @@ init_environment();
102413
102384
  // ../../packages/shared/src/environment/draft-content.ts
102414
102385
  function hasPersistableDraftContent(draft) {
102415
102386
  if (draft.text.trim() || draft.attachments?.length) return true;
102416
- const pending = [draft.docJson];
102387
+ const pending2 = [draft.docJson];
102417
102388
  const seen = /* @__PURE__ */ new Set();
102418
- while (pending.length) {
102419
- const node = pending.pop();
102389
+ while (pending2.length) {
102390
+ const node = pending2.pop();
102420
102391
  if (!node || typeof node !== "object") continue;
102421
102392
  if (seen.has(node)) continue;
102422
102393
  seen.add(node);
@@ -102424,7 +102395,7 @@ function hasPersistableDraftContent(draft) {
102424
102395
  if (type === "text" && typeof text2 === "string" && text2.trim()) return true;
102425
102396
  const value = type === "pasteChip" ? attrs?.text : type === "mention" ? attrs?.value : null;
102426
102397
  if (typeof value === "string" && value.trim()) return true;
102427
- if (Array.isArray(content)) pending.push(...content);
102398
+ if (Array.isArray(content)) pending2.push(...content);
102428
102399
  }
102429
102400
  return false;
102430
102401
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-one/cli",
3
- "version": "0.69.0-alpha",
3
+ "version": "0.69.0-alpha.1",
4
4
  "description": "SuperOne headless node CLI — remote execution environment (RPC, workspaces, sessions).",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",