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

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 +188 -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.2",
4
4
  "kind": "npm",
5
5
  "minNodeMajor": 20,
6
- "builtAt": "2026-09-24T06:58:50.872Z"
6
+ "builtAt": "2026-09-26T08:10:48.454Z"
7
7
  }
package/lib/cli.mjs CHANGED
@@ -3965,6 +3965,60 @@ var init_host_action_device_descriptors = __esm({
3965
3965
  "additionalProperties": false
3966
3966
  }
3967
3967
  },
3968
+ {
3969
+ "name": "device_configure",
3970
+ "description": `Read or set a controlled simulator's environment: light/dark appearance, system text size, simulated GPS location, iOS location clear, or an Android fold posture. Requires device_request_control before changing anything. Use kind=get to read current appearance, text size, available text-size values, and the emulator's posture ids; location and current posture cannot be read reliably. Android does not support clear_location. See read_manual({ domain: "product", topic: "devices" }).`,
3971
+ "inputSchema": {
3972
+ "type": "object",
3973
+ "properties": {
3974
+ "description": {
3975
+ "type": "string",
3976
+ "minLength": 1,
3977
+ "maxLength": 160,
3978
+ "description": "Short explanation of this step for the user watching, in the conversation's language (e.g. 'Open the profile tab'). Shown in place of refs and coordinates."
3979
+ },
3980
+ "device": {
3981
+ "description": "Device id or name from device_list. Optional while this session controls exactly one; required once it holds more. Use device_request_control to be granted another.",
3982
+ "type": "string"
3983
+ },
3984
+ "kind": {
3985
+ "type": "string",
3986
+ "enum": ["get", "appearance", "text_size", "location", "clear_location", "posture"]
3987
+ },
3988
+ "appearance": {
3989
+ "description": "Required for kind=appearance.",
3990
+ "type": "string",
3991
+ "enum": ["light", "dark"]
3992
+ },
3993
+ "textSize": {
3994
+ "description": "Required for kind=text_size. Use one of textSizeOptions returned by kind=get; iOS category or Android scale string.",
3995
+ "type": "string",
3996
+ "minLength": 1,
3997
+ "maxLength": 40
3998
+ },
3999
+ "latitude": {
4000
+ "description": "Required for kind=location. Decimal degrees.",
4001
+ "type": "number",
4002
+ "minimum": -90,
4003
+ "maximum": 90
4004
+ },
4005
+ "longitude": {
4006
+ "description": "Required for kind=location. Decimal degrees.",
4007
+ "type": "number",
4008
+ "minimum": -180,
4009
+ "maximum": 180
4010
+ },
4011
+ "postureId": {
4012
+ "description": "Required for kind=posture; first get this device's available ids.",
4013
+ "type": "integer",
4014
+ "minimum": 1,
4015
+ "maximum": 9007199254740991
4016
+ }
4017
+ },
4018
+ "required": ["description", "kind"],
4019
+ "additionalProperties": false
4020
+ }
4021
+ },
3968
4022
  {
3969
4023
  "name": "device_release",
3970
4024
  "description": "Let go of a device this session controls, once you are done with it \u2014 the close-tab of device_request_control. Call it at the end of every device task rather than leaving a simulator running. Default puts the device back the way it was found: a simulator or emulator SuperOne started is shut down, one the user already had running is left running and only unbound, a real phone is only ever disconnected. shutdown=true stops any device that can stop. Afterwards the other device_* tools fail with NO_DEVICE for it until device_request_control grants it again.",
@@ -10239,7 +10293,7 @@ async function openCodexAppServer(opts) {
10239
10293
  stderrBuf = (stderrBuf + chunk).slice(-MAX_STDERR_CHARS);
10240
10294
  });
10241
10295
  const rl = createInterface({ input: child.stdout });
10242
- const pending = /* @__PURE__ */ new Map();
10296
+ const pending2 = /* @__PURE__ */ new Map();
10243
10297
  const notificationWaiters = [];
10244
10298
  const notificationQueue = [];
10245
10299
  let nextId = 1;
@@ -10259,11 +10313,11 @@ async function openCodexAppServer(opts) {
10259
10313
  }
10260
10314
  };
10261
10315
  const failAll = (err) => {
10262
- for (const [, p3] of pending) {
10316
+ for (const [, p3] of pending2) {
10263
10317
  clearTimeout(p3.timer);
10264
10318
  p3.reject(err);
10265
10319
  }
10266
- pending.clear();
10320
+ pending2.clear();
10267
10321
  while (notificationWaiters.length) {
10268
10322
  const w3 = notificationWaiters.shift();
10269
10323
  clearTimeout(w3.timer);
@@ -10363,9 +10417,9 @@ async function openCodexAppServer(opts) {
10363
10417
  }
10364
10418
  if (rec.id != null && (typeof rec.id === "number" || typeof rec.id === "string")) {
10365
10419
  const id = typeof rec.id === "number" ? rec.id : Number(rec.id);
10366
- const waiter = pending.get(id);
10420
+ const waiter = pending2.get(id);
10367
10421
  if (!waiter) continue;
10368
- pending.delete(id);
10422
+ pending2.delete(id);
10369
10423
  clearTimeout(waiter.timer);
10370
10424
  if (rec.error) {
10371
10425
  const errObj = rec.error;
@@ -10403,14 +10457,14 @@ async function openCodexAppServer(opts) {
10403
10457
  }
10404
10458
  const id = nextId++;
10405
10459
  const timer = setTimeout(() => {
10406
- pending.delete(id);
10460
+ pending2.delete(id);
10407
10461
  reject(new Error(`Codex app-server ${method} timed out after ${timeoutMs}ms`));
10408
10462
  }, timeoutMs);
10409
- pending.set(id, { resolve: resolve17, reject, timer });
10463
+ pending2.set(id, { resolve: resolve17, reject, timer });
10410
10464
  try {
10411
10465
  writeLine({ jsonrpc: "2.0", id, method, params: params ?? {} });
10412
10466
  } catch (err) {
10413
- pending.delete(id);
10467
+ pending2.delete(id);
10414
10468
  clearTimeout(timer);
10415
10469
  reject(safePublicError("Codex app-server write failed", err));
10416
10470
  }
@@ -11217,9 +11271,9 @@ var init_account_manager = __esm({
11217
11271
  type,
11218
11272
  ...type === "chatgpt" ? { useHostedLoginSuccessPage: true, appBrand: "chatgpt" } : {}
11219
11273
  }));
11220
- const pending = { accountId: id, connection };
11221
- this.pending.set(result.loginId, pending);
11222
- void this.wait(result.loginId, pending);
11274
+ const pending2 = { accountId: id, connection };
11275
+ this.pending.set(result.loginId, pending2);
11276
+ void this.wait(result.loginId, pending2);
11223
11277
  return { ...result, accountId: id };
11224
11278
  } catch (error51) {
11225
11279
  this.failed.add(id);
@@ -11230,53 +11284,53 @@ var init_account_manager = __esm({
11230
11284
  this.starting = false;
11231
11285
  }
11232
11286
  }
11233
- async wait(loginId, pending) {
11287
+ async wait(loginId, pending2) {
11234
11288
  const deadline = Date.now() + 15 * 6e4;
11235
11289
  const timeout = setTimeout(() => {
11236
11290
  void this.cancel(loginId).catch(() => {
11237
11291
  });
11238
- this.failed.add(pending.accountId);
11292
+ this.failed.add(pending2.accountId);
11239
11293
  }, 15 * 6e4);
11240
11294
  timeout.unref?.();
11241
11295
  try {
11242
- while (this.pending.get(loginId) === pending && Date.now() < deadline) {
11243
- const notification = await pending.connection.nextNotification();
11296
+ while (this.pending.get(loginId) === pending2 && Date.now() < deadline) {
11297
+ const notification = await pending2.connection.nextNotification();
11244
11298
  if (!notification) throw new Error("Login connection closed");
11245
11299
  if (notification?.method !== "account/login/completed" || notification.params.loginId !== loginId) continue;
11246
11300
  if (notification.params.success !== true) throw new Error("Sign-in failed");
11247
- const status = parseAccountStatus(await pending.connection.request("account/read", { refreshToken: false }));
11301
+ const status = parseAccountStatus(await pending2.connection.request("account/read", { refreshToken: false }));
11248
11302
  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));
11303
+ if (this.pending.get(loginId) !== pending2) return;
11304
+ this.store.update(pending2.accountId, status);
11305
+ this.store.invalidateCredentials(pending2.accountId);
11306
+ this.changed(codexAccountProviderId(pending2.accountId));
11253
11307
  return;
11254
11308
  }
11255
- if (this.pending.get(loginId) === pending) this.failed.add(pending.accountId);
11309
+ if (this.pending.get(loginId) === pending2) this.failed.add(pending2.accountId);
11256
11310
  } catch {
11257
- this.failed.add(pending.accountId);
11311
+ this.failed.add(pending2.accountId);
11258
11312
  } finally {
11259
11313
  clearTimeout(timeout);
11260
- if (this.pending.get(loginId) === pending) this.pending.delete(loginId);
11261
- await pending.connection.close().catch(() => {
11314
+ if (this.pending.get(loginId) === pending2) this.pending.delete(loginId);
11315
+ await pending2.connection.close().catch(() => {
11262
11316
  });
11263
11317
  }
11264
11318
  }
11265
11319
  async cancel(loginId) {
11266
- const pending = this.pending.get(loginId);
11267
- if (!pending) return;
11320
+ const pending2 = this.pending.get(loginId);
11321
+ if (!pending2) return;
11268
11322
  this.pending.delete(loginId);
11269
11323
  try {
11270
- await pending.connection.request("account/login/cancel", { loginId });
11324
+ await pending2.connection.request("account/login/cancel", { loginId });
11271
11325
  } finally {
11272
- await pending.connection.close();
11326
+ await pending2.connection.close();
11273
11327
  }
11274
11328
  }
11275
11329
  async logout(providerId) {
11276
11330
  const id = codexAccountId(providerId) ?? codexAccountId(this.store.defaultProviderId()) ?? CODEX_CLI_ACCOUNT_ID;
11277
11331
  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);
11332
+ for (const [loginId, pending2] of this.pending) {
11333
+ if (pending2.accountId === id) await this.cancel(loginId);
11280
11334
  }
11281
11335
  const selected = codexAccountProviderId(id);
11282
11336
  const connection = await this.open(selected);
@@ -11438,6 +11492,7 @@ var init_superone_host_owned_tools = __esm({
11438
11492
  "device_snapshot",
11439
11493
  "device_query",
11440
11494
  "device_act",
11495
+ "device_configure",
11441
11496
  "device_run",
11442
11497
  "device_wait_for",
11443
11498
  "device_release"
@@ -13596,7 +13651,7 @@ async function fetchClaudeModels(opts) {
13596
13651
  };
13597
13652
  let q2;
13598
13653
  try {
13599
- q2 = (opts.queryFn ?? sdkQuery3)({ prompt: "hi", options });
13654
+ q2 = (opts.queryFn ?? sdkQuery3)({ prompt: CLAUDE_METADATA_PROBE_PROMPT, options });
13600
13655
  const models = await withTimeout(
13601
13656
  (async () => {
13602
13657
  await q2.initializationResult();
@@ -13629,12 +13684,13 @@ function withTimeout(promise2, ms2) {
13629
13684
  );
13630
13685
  });
13631
13686
  }
13632
- var MODEL_NAME_RE, DEFAULT_PROBE_TIMEOUT_MS;
13687
+ var CLAUDE_METADATA_PROBE_PROMPT, MODEL_NAME_RE, DEFAULT_PROBE_TIMEOUT_MS;
13633
13688
  var init_fetch_models = __esm({
13634
13689
  "../../packages/claude/src/fetch-models.ts"() {
13635
13690
  "use strict";
13636
13691
  init_resolve_sdk_binary();
13637
13692
  init_root_permission_guard();
13693
+ CLAUDE_METADATA_PROBE_PROMPT = "/help";
13638
13694
  MODEL_NAME_RE = /^(\w+ [\d.]+)(?:\s+with\s+(\w+)\s+context)?/;
13639
13695
  DEFAULT_PROBE_TIMEOUT_MS = 2e4;
13640
13696
  }
@@ -14915,6 +14971,20 @@ var init_session_title = __esm({
14915
14971
  }
14916
14972
  });
14917
14973
 
14974
+ // ../../packages/shared/src/host-wake.ts
14975
+ function isModelOnlyHostWake(text2) {
14976
+ return MODEL_ONLY_WAKE.test(text2.trimStart());
14977
+ }
14978
+ var MODEL_ONLY_WAKE;
14979
+ var init_host_wake = __esm({
14980
+ "../../packages/shared/src/host-wake.ts"() {
14981
+ "use strict";
14982
+ MODEL_ONLY_WAKE = new RegExp(
14983
+ '^(?:<task_notification source="(?:browser_download|artifact_sync)"|A collaboration mailbox message is ready\\.|A user-approved collaboration link is active with SuperOne session )'
14984
+ );
14985
+ }
14986
+ });
14987
+
14918
14988
  // ../../packages/runtime/src/session/host-action-store.ts
14919
14989
  import { createHash as createHash2, randomBytes as randomBytes2, randomUUID as randomUUID4, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
14920
14990
  function hashToken(token) {
@@ -15633,15 +15703,6 @@ var init_host_action_store = __esm({
15633
15703
  }
15634
15704
  });
15635
15705
 
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
15706
  // ../../packages/runtime/src/session/runtime-policy.ts
15646
15707
  function getRuntimeIdleTimeoutMs(activeRuntimeCount) {
15647
15708
  if (activeRuntimeCount <= 4) return TWENTY_MINUTES_MS;
@@ -15764,10 +15825,9 @@ var init_session_runtime = __esm({
15764
15825
  init_message_catalog();
15765
15826
  init_miniapp_prompt_tags();
15766
15827
  init_session_title();
15828
+ init_host_wake();
15767
15829
  init_host_action_store();
15768
- init_types();
15769
15830
  init_runtime_policy();
15770
- init_types();
15771
15831
  DEFAULT_AGENTS_CONFIRM_TIMEOUT_MS = 10 * 6e4;
15772
15832
  SessionRuntime = class {
15773
15833
  constructor(store, events, leases, environmentId, turnRunner, opts) {
@@ -15777,7 +15837,6 @@ var init_session_runtime = __esm({
15777
15837
  this.environmentId = environmentId;
15778
15838
  this.turnRunner = turnRunner;
15779
15839
  this.defaultApiProviderId = opts?.defaultApiProviderId;
15780
- this.permissionTimeoutMs = opts?.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
15781
15840
  this.agentsConfirmTimeoutMs = opts?.agentsConfirmTimeoutMs ?? DEFAULT_AGENTS_CONFIRM_TIMEOUT_MS;
15782
15841
  this.hostActions = opts?.hostActions ?? null;
15783
15842
  this.hydrateFromStore();
@@ -15812,14 +15871,13 @@ var init_session_runtime = __esm({
15812
15871
  disposing = false;
15813
15872
  /**
15814
15873
  * Active permission waiters keyed by interactionId.
15815
- * respondPermission resolves these; timeout/abort/close deny them.
15874
+ * respondPermission resolves these; abort/close deny them.
15816
15875
  */
15817
15876
  permissionWaiters = /* @__PURE__ */ new Map();
15818
15877
  questionWaiters = /* @__PURE__ */ new Map();
15819
15878
  planWaiters = /* @__PURE__ */ new Map();
15820
15879
  agentsConfirmWaiters = /* @__PURE__ */ new Map();
15821
15880
  defaultApiProviderId;
15822
- permissionTimeoutMs;
15823
15881
  agentsConfirmTimeoutMs;
15824
15882
  hostActions;
15825
15883
  /** Live waiters for requestHostAction terminal settlement. */
@@ -16428,6 +16486,7 @@ var init_session_runtime = __esm({
16428
16486
  return { delivered: true };
16429
16487
  }
16430
16488
  appendUserMessage(session, opts) {
16489
+ if (opts.source === "task-notification" && isModelOnlyHostWake(opts.text)) return;
16431
16490
  const userBlock = {
16432
16491
  id: randomUUID5(),
16433
16492
  role: "user",
@@ -16656,7 +16715,7 @@ var init_session_runtime = __esm({
16656
16715
  this.aborts.delete(sessionId);
16657
16716
  session.closed = true;
16658
16717
  session.status = "ended";
16659
- this.rejectPendingPermission(session, "aborted");
16718
+ this.rejectPendingPermission(session);
16660
16719
  this.cancelHostActionsForSession(sessionId, "session_closed");
16661
16720
  session.updatedAt = Date.now();
16662
16721
  this.persist(session);
@@ -17084,11 +17143,11 @@ var init_session_runtime = __esm({
17084
17143
  generation: input.generation,
17085
17144
  holderClientId: input.client.clientSessionId
17086
17145
  });
17087
- const pending = session.pendingInteraction;
17088
- if (!pending || pending.interactionId !== input.interactionId) {
17146
+ const pending2 = session.pendingInteraction;
17147
+ if (!pending2 || pending2.interactionId !== input.interactionId) {
17089
17148
  throw Object.assign(new Error("no matching pending permission"), { code: "failed_precondition" });
17090
17149
  }
17091
- if (pending.kind === "session_agents_confirm") {
17150
+ if (pending2.kind === "session_agents_confirm") {
17092
17151
  const waiter2 = this.agentsConfirmWaiters.get(input.interactionId);
17093
17152
  if (!waiter2 || waiter2.sessionId !== input.sessionId) {
17094
17153
  throw Object.assign(new Error("no matching pending agents confirm"), {
@@ -17106,7 +17165,7 @@ var init_session_runtime = __esm({
17106
17165
  });
17107
17166
  return;
17108
17167
  }
17109
- if (pending.kind && pending.kind !== "permission") {
17168
+ if (pending2.kind && pending2.kind !== "permission") {
17110
17169
  throw Object.assign(new Error("no matching pending permission"), { code: "failed_precondition" });
17111
17170
  }
17112
17171
  const waiter = this.permissionWaiters.get(input.interactionId);
@@ -17143,7 +17202,7 @@ var init_session_runtime = __esm({
17143
17202
  );
17144
17203
  }
17145
17204
  if (session.pendingInteraction) {
17146
- this.rejectPendingPermission(session, "aborted");
17205
+ this.rejectPendingPermission(session);
17147
17206
  }
17148
17207
  const interaction = {
17149
17208
  interactionId: `sessionagents_${Date.now()}_${randomUUID5().slice(0, 8)}`,
@@ -17269,11 +17328,11 @@ var init_session_runtime = __esm({
17269
17328
  }
17270
17329
  /**
17271
17330
  * Block the turn until the control-lease holder responds, or until
17272
- * timeout / abort / session close. Always emits a durable permission event.
17331
+ * abort / session close. Always emits a durable permission event.
17273
17332
  */
17274
17333
  waitForPermissionDecision(session, interaction, signal, requestId) {
17275
17334
  if (session.pendingInteraction) {
17276
- this.rejectPendingPermission(session, "aborted");
17335
+ this.rejectPendingPermission(session);
17277
17336
  }
17278
17337
  return new Promise((resolve17) => {
17279
17338
  let settled = false;
@@ -17289,11 +17348,7 @@ var init_session_runtime = __esm({
17289
17348
  const settle = (result) => {
17290
17349
  if (settled) return;
17291
17350
  settled = true;
17292
- const waiter = this.permissionWaiters.get(interaction.interactionId);
17293
- if (waiter) {
17294
- clearTimeout(waiter.timer);
17295
- this.permissionWaiters.delete(interaction.interactionId);
17296
- }
17351
+ this.permissionWaiters.delete(interaction.interactionId);
17297
17352
  if (session.pendingInteraction?.interactionId === interaction.interactionId) {
17298
17353
  session.pendingInteraction = null;
17299
17354
  session.updatedAt = Date.now();
@@ -17308,12 +17363,6 @@ var init_session_runtime = __esm({
17308
17363
  decision: result.clientDecision ?? result.decision
17309
17364
  }
17310
17365
  });
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
17366
  } else {
17318
17367
  this.events.appendSession({
17319
17368
  sessionId: session.sessionId,
@@ -17323,13 +17372,9 @@ var init_session_runtime = __esm({
17323
17372
  }
17324
17373
  resolve17(result.decision);
17325
17374
  };
17326
- const timer = setTimeout(() => {
17327
- settle({ decision: "deny", reason: "timeout" });
17328
- }, this.permissionTimeoutMs);
17329
17375
  this.permissionWaiters.set(interaction.interactionId, {
17330
17376
  sessionId: session.sessionId,
17331
- settle,
17332
- timer
17377
+ settle
17333
17378
  });
17334
17379
  if (signal.aborted) {
17335
17380
  settle({ decision: "deny", reason: "aborted" });
@@ -17345,59 +17390,55 @@ var init_session_runtime = __esm({
17345
17390
  });
17346
17391
  }
17347
17392
  /** 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 });
17393
+ rejectPendingPermission(session) {
17394
+ const pending2 = session.pendingInteraction;
17395
+ if (!pending2) return;
17396
+ if (pending2.kind === "question") {
17397
+ const qw = this.questionWaiters.get(pending2.interactionId);
17398
+ if (qw) qw.settle({ answers: {}, reason: "aborted" });
17354
17399
  else session.pendingInteraction = null;
17355
17400
  return;
17356
17401
  }
17357
- if (pending.kind === "plan") {
17358
- const pw = this.planWaiters.get(pending.interactionId);
17359
- if (pw) pw.settle({ decision: "reject", reason });
17402
+ if (pending2.kind === "plan") {
17403
+ const pw = this.planWaiters.get(pending2.interactionId);
17404
+ if (pw) pw.settle({ decision: "reject", reason: "aborted" });
17360
17405
  else session.pendingInteraction = null;
17361
17406
  return;
17362
17407
  }
17363
- if (pending.kind === "session_agents_confirm") {
17364
- const aw = this.agentsConfirmWaiters.get(pending.interactionId);
17365
- if (aw) aw.settle({ action: "cancel", reason });
17408
+ if (pending2.kind === "session_agents_confirm") {
17409
+ const aw = this.agentsConfirmWaiters.get(pending2.interactionId);
17410
+ if (aw) aw.settle({ action: "cancel", reason: "aborted" });
17366
17411
  else session.pendingInteraction = null;
17367
17412
  return;
17368
17413
  }
17369
- const waiter = this.permissionWaiters.get(pending.interactionId);
17414
+ const waiter = this.permissionWaiters.get(pending2.interactionId);
17370
17415
  if (waiter) {
17371
- waiter.settle({ decision: "deny", reason });
17416
+ waiter.settle({ decision: "deny", reason: "aborted" });
17372
17417
  } else {
17373
17418
  session.pendingInteraction = null;
17374
17419
  }
17375
17420
  }
17376
17421
  waitForQuestionDecision(session, interaction, signal, requestId) {
17377
17422
  if (session.pendingInteraction) {
17378
- this.rejectPendingPermission(session, "aborted");
17423
+ this.rejectPendingPermission(session);
17379
17424
  }
17380
- const pending = { ...interaction, kind: "question" };
17425
+ const pending2 = { ...interaction, kind: "question" };
17381
17426
  return new Promise((resolve17) => {
17382
17427
  let settled = false;
17383
- session.pendingInteraction = pending;
17428
+ session.pendingInteraction = pending2;
17384
17429
  session.updatedAt = Date.now();
17385
17430
  this.persist(session);
17386
17431
  this.events.appendSession({
17387
17432
  sessionId: session.sessionId,
17388
17433
  eventType: SESSION_DURABLE_EVENT.questionRequested,
17389
- payload: pending,
17434
+ payload: pending2,
17390
17435
  causationRequestId: requestId
17391
17436
  });
17392
17437
  const settle = (result) => {
17393
17438
  if (settled) return;
17394
17439
  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) {
17440
+ this.questionWaiters.delete(pending2.interactionId);
17441
+ if (session.pendingInteraction?.interactionId === pending2.interactionId) {
17401
17442
  session.pendingInteraction = null;
17402
17443
  session.updatedAt = Date.now();
17403
17444
  this.persist(session);
@@ -17406,30 +17447,20 @@ var init_session_runtime = __esm({
17406
17447
  this.events.appendSession({
17407
17448
  sessionId: session.sessionId,
17408
17449
  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 }
17450
+ payload: { interactionId: pending2.interactionId, answers: result.answers }
17416
17451
  });
17417
17452
  } else {
17418
17453
  this.events.appendSession({
17419
17454
  sessionId: session.sessionId,
17420
17455
  eventType: SESSION_DURABLE_EVENT.questionAborted,
17421
- payload: { interactionId: pending.interactionId }
17456
+ payload: { interactionId: pending2.interactionId }
17422
17457
  });
17423
17458
  }
17424
17459
  resolve17(result.answers);
17425
17460
  };
17426
- const timer = setTimeout(() => {
17427
- settle({ answers: {}, reason: "timeout" });
17428
- }, this.permissionTimeoutMs);
17429
- this.questionWaiters.set(pending.interactionId, {
17461
+ this.questionWaiters.set(pending2.interactionId, {
17430
17462
  sessionId: session.sessionId,
17431
- settle,
17432
- timer
17463
+ settle
17433
17464
  });
17434
17465
  if (signal.aborted) {
17435
17466
  settle({ answers: {}, reason: "aborted" });
@@ -17446,29 +17477,25 @@ var init_session_runtime = __esm({
17446
17477
  }
17447
17478
  waitForPlanDecision(session, interaction, signal, requestId) {
17448
17479
  if (session.pendingInteraction) {
17449
- this.rejectPendingPermission(session, "aborted");
17480
+ this.rejectPendingPermission(session);
17450
17481
  }
17451
- const pending = { ...interaction, kind: "plan" };
17482
+ const pending2 = { ...interaction, kind: "plan" };
17452
17483
  return new Promise((resolve17) => {
17453
17484
  let settled = false;
17454
- session.pendingInteraction = pending;
17485
+ session.pendingInteraction = pending2;
17455
17486
  session.updatedAt = Date.now();
17456
17487
  this.persist(session);
17457
17488
  this.events.appendSession({
17458
17489
  sessionId: session.sessionId,
17459
17490
  eventType: SESSION_DURABLE_EVENT.planRequested,
17460
- payload: pending,
17491
+ payload: pending2,
17461
17492
  causationRequestId: requestId
17462
17493
  });
17463
17494
  const settle = (result) => {
17464
17495
  if (settled) return;
17465
17496
  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) {
17497
+ this.planWaiters.delete(pending2.interactionId);
17498
+ if (session.pendingInteraction?.interactionId === pending2.interactionId) {
17472
17499
  session.pendingInteraction = null;
17473
17500
  session.updatedAt = Date.now();
17474
17501
  this.persist(session);
@@ -17478,33 +17505,23 @@ var init_session_runtime = __esm({
17478
17505
  sessionId: session.sessionId,
17479
17506
  eventType: SESSION_DURABLE_EVENT.planResponded,
17480
17507
  payload: {
17481
- interactionId: pending.interactionId,
17508
+ interactionId: pending2.interactionId,
17482
17509
  decision: result.decision,
17483
17510
  options: result.options
17484
17511
  }
17485
17512
  });
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
17513
  } else {
17493
17514
  this.events.appendSession({
17494
17515
  sessionId: session.sessionId,
17495
17516
  eventType: SESSION_DURABLE_EVENT.planAborted,
17496
- payload: { interactionId: pending.interactionId, decision: "reject" }
17517
+ payload: { interactionId: pending2.interactionId, decision: "reject" }
17497
17518
  });
17498
17519
  }
17499
17520
  resolve17({ decision: result.decision, options: result.options });
17500
17521
  };
17501
- const timer = setTimeout(() => {
17502
- settle({ decision: "reject", reason: "timeout" });
17503
- }, this.permissionTimeoutMs);
17504
- this.planWaiters.set(pending.interactionId, {
17522
+ this.planWaiters.set(pending2.interactionId, {
17505
17523
  sessionId: session.sessionId,
17506
- settle,
17507
- timer
17524
+ settle
17508
17525
  });
17509
17526
  if (signal.aborted) {
17510
17527
  settle({ decision: "reject", reason: "aborted" });
@@ -18701,7 +18718,7 @@ var init_relay_identify = __esm({
18701
18718
 
18702
18719
  // ../../packages/shared/src/platform-registry/types.ts
18703
18720
  var CONSUMER_TASK;
18704
- var init_types2 = __esm({
18721
+ var init_types = __esm({
18705
18722
  "../../packages/shared/src/platform-registry/types.ts"() {
18706
18723
  "use strict";
18707
18724
  CONSUMER_TASK = {
@@ -20132,9 +20149,9 @@ var init_platform_registry = __esm({
20132
20149
  "use strict";
20133
20150
  init_relay_identify();
20134
20151
  init_protocols();
20135
- init_types2();
20152
+ init_types();
20136
20153
  init_protocols();
20137
- init_types2();
20154
+ init_types();
20138
20155
  init_capabilities2();
20139
20156
  init_claude_env();
20140
20157
  init_merge();
@@ -64641,6 +64658,23 @@ var init_cursor_store = __esm({
64641
64658
  }
64642
64659
  });
64643
64660
 
64661
+ // ../../packages/cursor/src/cursor-sdk.ts
64662
+ function loadCursorSdk() {
64663
+ pending ??= import("@cursor/sdk").then((sdk) => loaded = sdk);
64664
+ return pending;
64665
+ }
64666
+ function isCursorSdkError(error51, name) {
64667
+ return loaded !== null && error51 instanceof loaded[name];
64668
+ }
64669
+ var pending, loaded;
64670
+ var init_cursor_sdk = __esm({
64671
+ "../../packages/cursor/src/cursor-sdk.ts"() {
64672
+ "use strict";
64673
+ pending = null;
64674
+ loaded = null;
64675
+ }
64676
+ });
64677
+
64644
64678
  // ../../packages/shared/src/model-option-params.ts
64645
64679
  function parseCatalogContextWindow(raw) {
64646
64680
  if (!raw) return null;
@@ -64691,33 +64725,30 @@ var init_cursor_model_selection = __esm({
64691
64725
  });
64692
64726
 
64693
64727
  // ../../packages/cursor/src/cursor-client.ts
64694
- import { Agent as Agent2, Cursor } from "@cursor/sdk";
64695
64728
  var init_cursor_client = __esm({
64696
64729
  "../../packages/cursor/src/cursor-client.ts"() {
64697
64730
  "use strict";
64731
+ init_cursor_sdk();
64698
64732
  init_cursor_config();
64699
64733
  init_cursor_model_selection();
64700
64734
  }
64701
64735
  });
64702
64736
 
64703
64737
  // ../../packages/cursor/src/cursor-cloud.ts
64704
- import {
64705
- Agent as Agent3,
64706
- Cursor as Cursor2
64707
- } from "@cursor/sdk";
64708
64738
  var init_cursor_cloud = __esm({
64709
64739
  "../../packages/cursor/src/cursor-cloud.ts"() {
64710
64740
  "use strict";
64741
+ init_cursor_sdk();
64711
64742
  init_cursor_config();
64712
64743
  init_cursor_store();
64713
64744
  }
64714
64745
  });
64715
64746
 
64716
64747
  // ../../packages/cursor/src/cursor-sdk-auth.ts
64717
- import { Cursor as Cursor3 } from "@cursor/sdk";
64718
64748
  var init_cursor_sdk_auth = __esm({
64719
64749
  "../../packages/cursor/src/cursor-sdk-auth.ts"() {
64720
64750
  "use strict";
64751
+ init_cursor_sdk();
64721
64752
  }
64722
64753
  });
64723
64754
 
@@ -64756,9 +64787,7 @@ var init_cursor_local_options = __esm({
64756
64787
  });
64757
64788
 
64758
64789
  // ../../packages/cursor/src/cursor-network-retry.ts
64759
- import { NetworkError } from "@cursor/sdk";
64760
64790
  function isCursorRetryableNetworkError(error51) {
64761
- if (error51 instanceof NetworkError) return error51.isRetryable;
64762
64791
  if (!error51 || typeof error51 !== "object") return false;
64763
64792
  const name = "name" in error51 ? String(error51.name) : "";
64764
64793
  if (name !== "NetworkError") return false;
@@ -64842,14 +64871,8 @@ var init_cursor_sdk_trace = __esm({
64842
64871
  });
64843
64872
 
64844
64873
  // ../../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
64874
  function formatCursorError(error51) {
64852
- if (error51 instanceof IntegrationNotConnectedError) {
64875
+ if (isCursorSdkError(error51, "IntegrationNotConnectedError")) {
64853
64876
  return new CursorIntegrationError(
64854
64877
  `${error51.message} Connect ${error51.provider} at ${error51.helpUrl} then retry.`,
64855
64878
  { provider: error51.provider, helpUrl: error51.helpUrl }
@@ -64877,9 +64900,10 @@ async function createCursorRuntime(opts) {
64877
64900
  "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
64901
  );
64879
64902
  }
64903
+ const { Agent: Agent2, Cursor } = await loadCursorSdk();
64880
64904
  if (plan.config.useHttp1ForAgent != null) {
64881
64905
  try {
64882
- Cursor4.configure({ local: { useHttp1ForAgent: plan.config.useHttp1ForAgent } });
64906
+ Cursor.configure({ local: { useHttp1ForAgent: plan.config.useHttp1ForAgent } });
64883
64907
  } catch (error51) {
64884
64908
  log2.debug("[CursorRuntime] Cursor.configure useHttp1ForAgent failed:", error51);
64885
64909
  }
@@ -64931,7 +64955,7 @@ async function createCursorRuntime(opts) {
64931
64955
  }, opts.sessionId);
64932
64956
  const openAgent = (sandbox) => withCursorPlatformLookup(async () => {
64933
64957
  if (opts.providerSessionId) {
64934
- return Agent4.resume(opts.providerSessionId, {
64958
+ return Agent2.resume(opts.providerSessionId, {
64935
64959
  apiKey,
64936
64960
  ...model ? { model } : {},
64937
64961
  ...agentName ? { name: agentName } : {},
@@ -64954,7 +64978,7 @@ async function createCursorRuntime(opts) {
64954
64978
  });
64955
64979
  }
64956
64980
  if (isCloud) {
64957
- return Agent4.create({
64981
+ return Agent2.create({
64958
64982
  apiKey,
64959
64983
  ...model ? { model } : {},
64960
64984
  ...agentName ? { name: agentName } : {},
@@ -64963,7 +64987,7 @@ async function createCursorRuntime(opts) {
64963
64987
  cloud: buildCloudOptions(config2)
64964
64988
  });
64965
64989
  }
64966
- return Agent4.create({
64990
+ return Agent2.create({
64967
64991
  apiKey,
64968
64992
  model,
64969
64993
  ...agentName ? { name: agentName } : {},
@@ -65146,7 +65170,7 @@ ${text2}` : text2;
65146
65170
  try {
65147
65171
  run = await agent.send(userMessage2, sendOptions);
65148
65172
  } catch (error51) {
65149
- if (error51 instanceof AgentBusyError && !sendOpts?.force && !isCloud) {
65173
+ if (isCursorSdkError(error51, "AgentBusyError") && !sendOpts?.force && !isCloud) {
65150
65174
  log2.warn("[CursorRuntime] AgentBusyError \u2014 retrying with local.force");
65151
65175
  tracer.runtime("agent_busy_retry", {
65152
65176
  message: error51 instanceof Error ? error51.message : String(error51)
@@ -65317,6 +65341,7 @@ var init_cursor_runtime = __esm({
65317
65341
  "../../packages/cursor/src/cursor-runtime.ts"() {
65318
65342
  "use strict";
65319
65343
  init_superone_system_prompt();
65344
+ init_cursor_sdk();
65320
65345
  init_cursor_config();
65321
65346
  init_cursor_local_options();
65322
65347
  init_cursor_network_retry();
@@ -65349,10 +65374,10 @@ var init_cursor_runtime = __esm({
65349
65374
  });
65350
65375
 
65351
65376
  // ../../packages/cursor/src/cursor-workspace-prewarm.ts
65352
- import { createAgentPlatform } from "@cursor/sdk";
65353
65377
  var init_cursor_workspace_prewarm = __esm({
65354
65378
  "../../packages/cursor/src/cursor-workspace-prewarm.ts"() {
65355
65379
  "use strict";
65380
+ init_cursor_sdk();
65356
65381
  init_cursor_sdk_trace();
65357
65382
  init_cursor_local_options();
65358
65383
  init_cursor_platform_binaries();
@@ -65500,6 +65525,7 @@ var init_src5 = __esm({
65500
65525
  init_cursor_event_map();
65501
65526
  init_cursor_store();
65502
65527
  init_cursor_client();
65528
+ init_cursor_sdk();
65503
65529
  init_cursor_model_selection();
65504
65530
  init_cursor_cloud();
65505
65531
  init_cursor_sdk_auth();
@@ -73417,8 +73443,8 @@ import { fileURLToPath } from "node:url";
73417
73443
  function resolveCliReleaseVersion() {
73418
73444
  const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
73419
73445
  if (fromEnv) return fromEnv;
73420
- if ("0.69.0-alpha".trim()) {
73421
- return "0.69.0-alpha".trim();
73446
+ if ("0.69.0-alpha.2".trim()) {
73447
+ return "0.69.0-alpha.2".trim();
73422
73448
  }
73423
73449
  const fromDist = readDistManifestVersion();
73424
73450
  if (fromDist) return fromDist;
@@ -102413,10 +102439,10 @@ init_environment();
102413
102439
  // ../../packages/shared/src/environment/draft-content.ts
102414
102440
  function hasPersistableDraftContent(draft) {
102415
102441
  if (draft.text.trim() || draft.attachments?.length) return true;
102416
- const pending = [draft.docJson];
102442
+ const pending2 = [draft.docJson];
102417
102443
  const seen = /* @__PURE__ */ new Set();
102418
- while (pending.length) {
102419
- const node = pending.pop();
102444
+ while (pending2.length) {
102445
+ const node = pending2.pop();
102420
102446
  if (!node || typeof node !== "object") continue;
102421
102447
  if (seen.has(node)) continue;
102422
102448
  seen.add(node);
@@ -102424,7 +102450,7 @@ function hasPersistableDraftContent(draft) {
102424
102450
  if (type === "text" && typeof text2 === "string" && text2.trim()) return true;
102425
102451
  const value = type === "pasteChip" ? attrs?.text : type === "mention" ? attrs?.value : null;
102426
102452
  if (typeof value === "string" && value.trim()) return true;
102427
- if (Array.isArray(content)) pending.push(...content);
102453
+ if (Array.isArray(content)) pending2.push(...content);
102428
102454
  }
102429
102455
  return false;
102430
102456
  }
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.2",
4
4
  "description": "SuperOne headless node CLI — remote execution environment (RPC, workspaces, sessions).",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",