codexuse-cli 6.2.0 → 6.2.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.
package/dist/index.js CHANGED
@@ -2099,7 +2099,8 @@ function getActiveOffer() {
2099
2099
  productPermalink: "codex-use",
2100
2100
  checkoutBaseUrl: "https://hweihwang.gumroad.com/l/codex-use",
2101
2101
  trialEnabled: true,
2102
- trialDays: 7
2102
+ trialDays: 7,
2103
+ maxActivations: 5
2103
2104
  };
2104
2105
  }
2105
2106
  function buildCheckoutUrl(offer2, options) {
@@ -2248,7 +2249,6 @@ var DEFAULT_AUTO_ROLL_ENABLED = false;
2248
2249
  var DEFAULT_AUTO_ROLL_REARM_REMAINING_THRESHOLD = 15;
2249
2250
  var DEFAULT_AUTO_ROLL_SWITCH_REMAINING_THRESHOLD = 5;
2250
2251
  var DEFAULT_LAUNCH_OFFICIAL_CODEX_WHEN_CLOSED_ON_AUTO_ROLL = false;
2251
- var DEFAULT_HANDOFF_RUNNING_THREADS_ON_ACCOUNT_SWITCH = false;
2252
2252
  var DEFAULT_AUTO_ROLL_PRIORITY_ORDER = [];
2253
2253
  var DEFAULT_LOW_REMAINING_NOTIFICATION_ENABLED = false;
2254
2254
  var DEFAULT_LOW_REMAINING_NOTIFICATION_THRESHOLD = 1;
@@ -2356,7 +2356,6 @@ function normalizeAutoRollSettings(raw) {
2356
2356
  rearmRemainingThreshold: normalizedRearm,
2357
2357
  switchRemainingThreshold: normalizedSwitch,
2358
2358
  launchOfficialCodexWhenClosedOnAutoRoll: raw?.launchOfficialCodexWhenClosedOnAutoRoll === true ? true : DEFAULT_LAUNCH_OFFICIAL_CODEX_WHEN_CLOSED_ON_AUTO_ROLL,
2359
- handoffRunningThreadsOnAccountSwitch: raw?.handoffRunningThreadsOnAccountSwitch === true ? true : DEFAULT_HANDOFF_RUNNING_THREADS_ON_ACCOUNT_SWITCH,
2360
2359
  priorityOrder: sanitizeAutoRollPriorityOrder(raw?.priorityOrder),
2361
2360
  excludedAccountKeys: sanitizeAutoRollExcludedAccountKeys(
2362
2361
  raw?.excludedAccountKeys
@@ -2371,6 +2370,21 @@ function normalizeAutoRollSettings(raw) {
2371
2370
  return normalized;
2372
2371
  }
2373
2372
 
2373
+ // ../../packages/contracts/src/work/types.ts
2374
+ function createDefaultWorkState() {
2375
+ return {
2376
+ version: 1,
2377
+ plannerProfileName: null,
2378
+ profilePolicies: {},
2379
+ projectsByPath: {},
2380
+ jobsById: {},
2381
+ requestJobIds: {},
2382
+ plansById: {},
2383
+ configMigrationVersion: 0,
2384
+ restartRequiredProfiles: []
2385
+ };
2386
+ }
2387
+
2374
2388
  // ../../packages/runtime-app-state/src/storage/documents.ts
2375
2389
  var import_node_fs2 = require("fs");
2376
2390
  var import_node_fs3 = require("fs");
@@ -2411,12 +2425,12 @@ async function openLockDatabase(databasePath) {
2411
2425
  throw error;
2412
2426
  }
2413
2427
  }
2414
- async function acquireCrossProcessFileLockTransaction(filePath, mode) {
2428
+ async function acquireCrossProcessFileLockTransaction(filePath, mode, busyTimeoutMs = mode === "write" ? 1e3 : 0) {
2415
2429
  const databasePath = `${import_node_path.default.resolve(filePath)}.codexuse-lock.sqlite`;
2416
2430
  let database = null;
2417
2431
  try {
2418
2432
  database = await openLockDatabase(databasePath);
2419
- database.exec(`PRAGMA busy_timeout = ${mode === "write" ? 1e3 : 0};`);
2433
+ database.exec(`PRAGMA busy_timeout = ${Math.max(0, Math.trunc(busyTimeoutMs))};`);
2420
2434
  database.exec("CREATE TABLE IF NOT EXISTS codexuse_file_lock (id INTEGER PRIMARY KEY);");
2421
2435
  if (mode === "write") {
2422
2436
  database.exec("BEGIN EXCLUSIVE;");
@@ -2445,8 +2459,8 @@ async function acquireCrossProcessFileLockTransaction(filePath, mode) {
2445
2459
  }
2446
2460
  };
2447
2461
  }
2448
- async function acquireCrossProcessFileLock(filePath) {
2449
- return acquireCrossProcessFileLockTransaction(filePath, "write");
2462
+ async function acquireCrossProcessFileLock(filePath, options = {}) {
2463
+ return acquireCrossProcessFileLockTransaction(filePath, "write", options.busyTimeoutMs);
2450
2464
  }
2451
2465
  async function acquireCrossProcessFileReadLock(filePath) {
2452
2466
  return acquireCrossProcessFileLockTransaction(filePath, "read");
@@ -3465,7 +3479,6 @@ function createDefaultAppState() {
3465
3479
  rearmRemainingThreshold: 15,
3466
3480
  switchRemainingThreshold: 5,
3467
3481
  launchOfficialCodexWhenClosedOnAutoRoll: false,
3468
- handoffRunningThreadsOnAccountSwitch: false,
3469
3482
  priorityOrder: [],
3470
3483
  excludedAccountKeys: [],
3471
3484
  lowRemainingNotificationEnabled: false,
@@ -3556,6 +3569,7 @@ function createDefaultAppState() {
3556
3569
  profileDashboard: {
3557
3570
  customGroupsByAccountKey: {}
3558
3571
  },
3572
+ work: createDefaultWorkState(),
3559
3573
  skills: {
3560
3574
  sources: [],
3561
3575
  installsBySlug: {}
@@ -3600,6 +3614,12 @@ function asStringArray(value3) {
3600
3614
  return [normalized];
3601
3615
  });
3602
3616
  }
3617
+ function normalizeAutoRollActivityKind(value3) {
3618
+ if (value3 === "official-codex-handoff") {
3619
+ return "official-codex-activation";
3620
+ }
3621
+ return value3 === "profile-switch" || value3 === "auth-verified" || value3 === "official-codex-activation" || value3 === "official-codex-restart" || value3 === "reset-window-activation" || value3 === "low-remaining-alert" ? value3 : "auto-roll-eval";
3622
+ }
3603
3623
  function asStringRecord(value3) {
3604
3624
  if (!isRecord2(value3)) {
3605
3625
  return {};
@@ -3658,7 +3678,6 @@ function normalizeOfficialCodexQolSettings(value3) {
3658
3678
  scrollRestoreEnabled: value3.scrollRestoreEnabled === true,
3659
3679
  conversationTimelineEnabled: value3.conversationTimelineEnabled === true,
3660
3680
  inCodexStatusEnabled: value3.inCodexStatusEnabled !== false,
3661
- handoffChipEnabled: value3.handoffChipEnabled !== false,
3662
3681
  actionTargets,
3663
3682
  providerStatus,
3664
3683
  overlayAutoRollEnabled: typeof value3.overlayAutoRollEnabled === "boolean" ? value3.overlayAutoRollEnabled : null
@@ -4202,6 +4221,7 @@ function normalizeAppState(raw) {
4202
4221
  const next = deepMerge(defaults, raw);
4203
4222
  const merged = next;
4204
4223
  merged.schemaVersion = 1;
4224
+ merged.work = isRecord2(raw.work) ? deepMerge(createDefaultWorkState(), raw.work) : createDefaultWorkState();
4205
4225
  merged.trialExperience = normalizeTrialExperience(raw.trialExperience);
4206
4226
  merged.autoRoll = normalizeAutoRollSettings(rawAutoRoll);
4207
4227
  if (!isRecord2(merged.officialCodex)) {
@@ -4224,10 +4244,11 @@ function normalizeAppState(raw) {
4224
4244
  );
4225
4245
  merged.officialCodex.lastActivationStatus = asString(merged.officialCodex.lastActivationStatus);
4226
4246
  merged.officialCodex.lastActivationReason = asString(merged.officialCodex.lastActivationReason);
4227
- merged.officialCodex.activity = Array.isArray(merged.officialCodex.activity) ? merged.officialCodex.activity.filter((entry) => isRecord2(entry)).map((entry) => ({
4247
+ const rawOfficialCodexActivity = Array.isArray(rawOfficialCodex?.activity) ? rawOfficialCodex.activity : [];
4248
+ merged.officialCodex.activity = rawOfficialCodexActivity.length > 0 ? rawOfficialCodexActivity.filter(isRecord2).map((entry) => ({
4228
4249
  id: asString(entry.id) ?? "",
4229
4250
  at: asString(entry.at) ?? (/* @__PURE__ */ new Date(0)).toISOString(),
4230
- kind: entry.kind === "auto-roll-eval" || entry.kind === "profile-switch" || entry.kind === "auth-verified" || entry.kind === "official-codex-activation" || entry.kind === "official-codex-restart" || entry.kind === "official-codex-handoff" || entry.kind === "reset-window-activation" || entry.kind === "low-remaining-alert" ? entry.kind : "auto-roll-eval",
4251
+ kind: normalizeAutoRollActivityKind(entry.kind),
4231
4252
  status: asString(entry.status) ?? "unknown",
4232
4253
  reason: asString(entry.reason),
4233
4254
  decisionId: asString(entry.decisionId),
@@ -4336,7 +4357,7 @@ function normalizeAppState(raw) {
4336
4357
  merged.officialCodex.relayProfilesById
4337
4358
  );
4338
4359
  merged.officialCodex.desktopLlmEnabled = rawOfficialCodex?.desktopLlmEnabled === true;
4339
- const rawActivationDebt = isRecord2(merged.officialCodex.pendingActivationDebt) ? merged.officialCodex.pendingActivationDebt : null;
4360
+ const rawActivationDebt = isRecord2(rawOfficialCodex?.pendingActivationDebt) ? rawOfficialCodex.pendingActivationDebt : null;
4340
4361
  if (rawActivationDebt) {
4341
4362
  const debt = rawActivationDebt;
4342
4363
  const targetProfileName = asString(debt.targetProfileName);
@@ -4349,23 +4370,17 @@ function normalizeAppState(raw) {
4349
4370
  decisionId: asString(debt.decisionId),
4350
4371
  attempts: asNumberOrNull(debt.attempts) ?? 0,
4351
4372
  lastReason: asString(debt.lastReason),
4352
- handoffReason: debt.handoffReason === "manual" || debt.handoffReason === "auto-roll" ? debt.handoffReason : null,
4353
- handoffThreadIds: asStringArray(debt.handoffThreadIds),
4354
- handoffSentThreadIds: asStringArray(debt.handoffSentThreadIds),
4355
- sourceActiveThreadIds: asStringArray(debt.sourceActiveThreadIds),
4356
- sourceCompletedThreadIds: asStringArray(
4357
- debt.sourceCompletedThreadIds
4373
+ activationSource: debt.activationSource === "manual" || debt.activationSource === "auto-roll" ? debt.activationSource : debt.handoffReason === "manual" ? "manual" : "auto-roll",
4374
+ blockingThreadIds: asStringArray(
4375
+ debt.blockingThreadIds ?? debt.sourceActiveThreadIds
4358
4376
  ),
4359
- sourceActiveTurnIdsByThreadId: asStringRecord(
4360
- debt.sourceActiveTurnIdsByThreadId
4377
+ completedBlockingThreadIds: asStringArray(
4378
+ debt.completedBlockingThreadIds ?? debt.sourceCompletedThreadIds
4361
4379
  ),
4362
- sourceCaptureState: debt.sourceCaptureState === "attaching" || debt.sourceCaptureState === "attached" || debt.sourceCaptureState === "failed" ? debt.sourceCaptureState : null,
4363
- handoffClientUserMessageIdsByThreadId: asStringRecord(
4364
- debt.handoffClientUserMessageIdsByThreadId
4380
+ blockingTurnIdsByThreadId: asStringRecord(
4381
+ debt.blockingTurnIdsByThreadId ?? debt.sourceActiveTurnIdsByThreadId
4365
4382
  ),
4366
- handoffTurnIdsByThreadId: asStringRecord(
4367
- debt.handoffTurnIdsByThreadId
4368
- )
4383
+ sourceListenerState: debt.sourceListenerState === "attaching" || debt.sourceListenerState === "attached" || debt.sourceListenerState === "failed" ? debt.sourceListenerState : debt.sourceCaptureState === "attaching" || debt.sourceCaptureState === "attached" || debt.sourceCaptureState === "failed" ? debt.sourceCaptureState : null
4369
4384
  } : null;
4370
4385
  } else {
4371
4386
  merged.officialCodex.pendingActivationDebt = null;
@@ -5146,7 +5161,6 @@ var CLOUD_SYNC_RUNTIME_SETTING_KEYS = /* @__PURE__ */ new Set([
5146
5161
  "officialCodexScrollRestoreEnabled",
5147
5162
  "officialCodexConversationTimelineEnabled",
5148
5163
  "officialCodexInCodexStatusEnabled",
5149
- "officialCodexHandoffChipEnabled",
5150
5164
  "officialCodexRelayMode",
5151
5165
  "officialCodexRelayProfileId",
5152
5166
  "officialCodexModelWhitelistUnlockEnabled",
@@ -5293,7 +5307,6 @@ async function writeCodexSettingsJsonRaw(payload) {
5293
5307
  rearmRemainingThreshold: autoRoll.rearmRemainingThreshold,
5294
5308
  switchRemainingThreshold: autoRoll.switchRemainingThreshold,
5295
5309
  launchOfficialCodexWhenClosedOnAutoRoll: autoRoll.launchOfficialCodexWhenClosedOnAutoRoll,
5296
- handoffRunningThreadsOnAccountSwitch: autoRoll.handoffRunningThreadsOnAccountSwitch,
5297
5310
  priorityOrder: autoRoll.priorityOrder,
5298
5311
  excludedAccountKeys: autoRoll.excludedAccountKeys,
5299
5312
  lowRemainingNotificationEnabled: autoRoll.lowRemainingNotificationEnabled,
@@ -23753,17 +23766,10 @@ var RPC_METHODS = {
23753
23766
  autoRollResolveDecision: "autoRoll.resolveDecision",
23754
23767
  officialCodexActivate: "officialCodex.activate",
23755
23768
  officialCodexInstances: "officialCodex.instances",
23756
- officialCodexLaunchProfile: "officialCodex.launchProfile",
23757
- officialCodexFocusProfile: "officialCodex.focusProfile",
23769
+ accountsOpen: "accounts.open",
23758
23770
  officialCodexStopProfile: "officialCodex.stopProfile",
23759
23771
  officialCodexRestartProfile: "officialCodex.restartProfile",
23760
- officialCodexUseProfile: "officialCodex.useProfile",
23761
- officialCodexLaunchProfiles: "officialCodex.launchProfiles",
23762
- officialCodexStopProfiles: "officialCodex.stopProfiles",
23763
23772
  officialCodexActivateProfiles: "officialCodex.activateProfiles",
23764
- officialCodexPrepareDraftHandoff: "officialCodex.prepareDraftHandoff",
23765
- officialCodexOpenWorkspace: "officialCodex.openWorkspace",
23766
- officialCodexOpenDevTools: "officialCodex.openDevTools",
23767
23773
  officialCodexApplyQol: "officialCodex.applyQol",
23768
23774
  officialCodexApplyPower: "officialCodex.applyPower",
23769
23775
  officialCodexRefreshBridgeCapabilities: "officialCodex.refreshBridgeCapabilities",
@@ -23803,7 +23809,27 @@ var RPC_METHODS = {
23803
23809
  accountPoolClearSession: "accountPool.clearSession",
23804
23810
  accountPoolListRecentRequests: "accountPool.listRecentRequests",
23805
23811
  accountPoolTestModels: "accountPool.testModels",
23806
- accountPoolTestResponse: "accountPool.testResponse"
23812
+ accountPoolTestResponse: "accountPool.testResponse",
23813
+ workGetSnapshot: "work.getSnapshot",
23814
+ workOpenFolder: "work.openFolder",
23815
+ workOpenWindows: "work.openWindows",
23816
+ workStartPlan: "work.startPlan",
23817
+ workOpenPlan: "work.openPlan",
23818
+ workRemovePlan: "work.removePlan",
23819
+ workSetPlanner: "work.setPlanner",
23820
+ workUpdateProfilePolicy: "work.updateProfilePolicy",
23821
+ workAuthorizeProject: "work.authorizeProject",
23822
+ workProjectPreview: "work.project.preview",
23823
+ workDelegate: "work.delegate",
23824
+ workAction: "work.action",
23825
+ workDiffReview: "work.diff.review",
23826
+ workHistoryList: "work.history.list",
23827
+ workHistoryOpen: "work.history.open",
23828
+ workConfigGet: "work.config.get",
23829
+ workConfigSaveShared: "work.config.saveShared",
23830
+ workConfigSaveOverride: "work.config.saveOverride",
23831
+ workConfigResetOverride: "work.config.resetOverride",
23832
+ workConfigReconcileExternal: "work.config.reconcileExternal"
23807
23833
  };
23808
23834
  var RPC_CHANNELS = {
23809
23835
  runtimeProvidersUpdated: "runtime.providersUpdated",
@@ -23814,7 +23840,8 @@ var RPC_CHANNELS = {
23814
23840
  autoRollDecision: "autoRoll.decision",
23815
23841
  officialCodexActivationProgress: "officialCodex.activationProgress",
23816
23842
  officialCodexActivityUpdated: "officialCodex.activityUpdated",
23817
- officialCodexStatusUpdated: "officialCodex.statusUpdated"
23843
+ officialCodexStatusUpdated: "officialCodex.statusUpdated",
23844
+ workUpdated: "work.updated"
23818
23845
  };
23819
23846
 
23820
23847
  // ../../packages/contracts/src/filesystem.ts
@@ -23899,8 +23926,14 @@ var DesktopRpcRequestBody = Schema_exports.Union([
23899
23926
  tagRequestBody(RPC_METHODS.runtimeRefreshProviders, Schema_exports.Struct({})),
23900
23927
  // Desktop dashboard/runtime methods
23901
23928
  tagRequestBody(RPC_METHODS.appStateGet, Schema_exports.Struct({})),
23902
- tagRequestBody(RPC_METHODS.appStatePatch, Schema_exports.Struct({ patch: Schema_exports.Unknown })),
23903
- tagRequestBody(RPC_METHODS.trialExperienceStart, Schema_exports.Struct({ interactiveAt: Schema_exports.Number })),
23929
+ tagRequestBody(
23930
+ RPC_METHODS.appStatePatch,
23931
+ Schema_exports.Struct({ patch: Schema_exports.Unknown })
23932
+ ),
23933
+ tagRequestBody(
23934
+ RPC_METHODS.trialExperienceStart,
23935
+ Schema_exports.Struct({ interactiveAt: Schema_exports.Number })
23936
+ ),
23904
23937
  tagRequestBody(RPC_METHODS.appSettingsGet, Schema_exports.Struct({})),
23905
23938
  tagRequestBody(
23906
23939
  RPC_METHODS.appSettingsUpdate,
@@ -23921,21 +23954,27 @@ var DesktopRpcRequestBody = Schema_exports.Union([
23921
23954
  tagRequestBody(
23922
23955
  RPC_METHODS.codexConfigGet,
23923
23956
  Schema_exports.Struct({
23924
- codexHomePath: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null]))
23957
+ codexHomePath: Schema_exports.optional(
23958
+ Schema_exports.Union([Schema_exports.String, Schema_exports.Null])
23959
+ )
23925
23960
  })
23926
23961
  ),
23927
23962
  tagRequestBody(
23928
23963
  RPC_METHODS.codexConfigSaveRaw,
23929
23964
  Schema_exports.Struct({
23930
23965
  content: Schema_exports.String,
23931
- codexHomePath: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null]))
23966
+ codexHomePath: Schema_exports.optional(
23967
+ Schema_exports.Union([Schema_exports.String, Schema_exports.Null])
23968
+ )
23932
23969
  })
23933
23970
  ),
23934
23971
  tagRequestBody(
23935
23972
  RPC_METHODS.codexConfigUpdate,
23936
23973
  Schema_exports.Struct({
23937
23974
  updates: Schema_exports.Unknown,
23938
- codexHomePath: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null]))
23975
+ codexHomePath: Schema_exports.optional(
23976
+ Schema_exports.Union([Schema_exports.String, Schema_exports.Null])
23977
+ )
23939
23978
  })
23940
23979
  ),
23941
23980
  tagRequestBody(
@@ -23943,7 +23982,9 @@ var DesktopRpcRequestBody = Schema_exports.Union([
23943
23982
  Schema_exports.Struct({
23944
23983
  binaryPath: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null])),
23945
23984
  args: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null])),
23946
- codexHomePath: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null]))
23985
+ codexHomePath: Schema_exports.optional(
23986
+ Schema_exports.Union([Schema_exports.String, Schema_exports.Null])
23987
+ )
23947
23988
  })
23948
23989
  ),
23949
23990
  tagRequestBody(RPC_METHODS.codexRuntimeUpdate, Schema_exports.Struct({})),
@@ -23988,8 +24029,6 @@ var DesktopRpcRequestBody = Schema_exports.Union([
23988
24029
  reason: Schema_exports.optional(
23989
24030
  Schema_exports.Union([Schema_exports.Literal("manual"), Schema_exports.Literal("auto-roll")])
23990
24031
  ),
23991
- carryDraft: Schema_exports.optional(Schema_exports.Boolean),
23992
- continueThreadId: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null])),
23993
24032
  forceAdopt: Schema_exports.optional(Schema_exports.Boolean),
23994
24033
  launchIfNotRunning: Schema_exports.optional(Schema_exports.Boolean),
23995
24034
  awaitCodexFollowUp: Schema_exports.optional(Schema_exports.Boolean)
@@ -24071,21 +24110,16 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24071
24110
  RPC_METHODS.autoRollResolveDecision,
24072
24111
  Schema_exports.Struct({
24073
24112
  id: TrimmedNonEmptyString,
24074
- action: Schema_exports.Union([Schema_exports.Literal("accept"), Schema_exports.Literal("cancel")])
24113
+ action: Schema_exports.Union([
24114
+ Schema_exports.Literal("accept"),
24115
+ Schema_exports.Literal("cancel")
24116
+ ])
24075
24117
  })
24076
24118
  ),
24077
24119
  tagRequestBody(RPC_METHODS.officialCodexActivate, Schema_exports.Struct({})),
24078
24120
  tagRequestBody(RPC_METHODS.officialCodexInstances, Schema_exports.Struct({})),
24079
24121
  tagRequestBody(
24080
- RPC_METHODS.officialCodexLaunchProfile,
24081
- Schema_exports.Struct({
24082
- name: TrimmedNonEmptyString,
24083
- desiredQolSettings: Schema_exports.optional(Schema_exports.Unknown),
24084
- desiredPowerSettings: Schema_exports.optional(Schema_exports.Unknown)
24085
- })
24086
- ),
24087
- tagRequestBody(
24088
- RPC_METHODS.officialCodexFocusProfile,
24122
+ RPC_METHODS.accountsOpen,
24089
24123
  Schema_exports.Struct({
24090
24124
  name: TrimmedNonEmptyString,
24091
24125
  desiredQolSettings: Schema_exports.optional(Schema_exports.Unknown),
@@ -24104,26 +24138,6 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24104
24138
  desiredPowerSettings: Schema_exports.optional(Schema_exports.Unknown)
24105
24139
  })
24106
24140
  ),
24107
- tagRequestBody(
24108
- RPC_METHODS.officialCodexUseProfile,
24109
- Schema_exports.Struct({
24110
- name: TrimmedNonEmptyString,
24111
- desiredQolSettings: Schema_exports.optional(Schema_exports.Unknown),
24112
- desiredPowerSettings: Schema_exports.optional(Schema_exports.Unknown)
24113
- })
24114
- ),
24115
- tagRequestBody(
24116
- RPC_METHODS.officialCodexLaunchProfiles,
24117
- Schema_exports.Struct({
24118
- names: Schema_exports.Array(TrimmedNonEmptyString),
24119
- desiredQolSettings: Schema_exports.optional(Schema_exports.Unknown),
24120
- desiredPowerSettings: Schema_exports.optional(Schema_exports.Unknown)
24121
- })
24122
- ),
24123
- tagRequestBody(
24124
- RPC_METHODS.officialCodexStopProfiles,
24125
- Schema_exports.Struct({ names: Schema_exports.Array(TrimmedNonEmptyString) })
24126
- ),
24127
24141
  tagRequestBody(
24128
24142
  RPC_METHODS.officialCodexActivateProfiles,
24129
24143
  Schema_exports.Struct({
@@ -24131,28 +24145,6 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24131
24145
  desiredPowerSettings: Schema_exports.optional(Schema_exports.Unknown)
24132
24146
  })
24133
24147
  ),
24134
- tagRequestBody(
24135
- RPC_METHODS.officialCodexPrepareDraftHandoff,
24136
- Schema_exports.Struct({
24137
- sourceProfileName: TrimmedNonEmptyString,
24138
- targetProfileName: TrimmedNonEmptyString,
24139
- desiredQolSettings: Schema_exports.optional(Schema_exports.Unknown),
24140
- desiredPowerSettings: Schema_exports.optional(Schema_exports.Unknown)
24141
- })
24142
- ),
24143
- tagRequestBody(
24144
- RPC_METHODS.officialCodexOpenWorkspace,
24145
- Schema_exports.Struct({
24146
- profileName: TrimmedNonEmptyString,
24147
- editor: TrimmedNonEmptyString
24148
- })
24149
- ),
24150
- tagRequestBody(
24151
- RPC_METHODS.officialCodexOpenDevTools,
24152
- Schema_exports.Struct({
24153
- profileName: TrimmedNonEmptyString
24154
- })
24155
- ),
24156
24148
  tagRequestBody(
24157
24149
  RPC_METHODS.officialCodexApplyQol,
24158
24150
  Schema_exports.Struct({
@@ -24293,7 +24285,10 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24293
24285
  ),
24294
24286
  tagRequestBody(
24295
24287
  RPC_METHODS.desktopLlmSetRoutePublished,
24296
- Schema_exports.Struct({ publicSlug: TrimmedNonEmptyString, published: Schema_exports.Boolean })
24288
+ Schema_exports.Struct({
24289
+ publicSlug: TrimmedNonEmptyString,
24290
+ published: Schema_exports.Boolean
24291
+ })
24297
24292
  ),
24298
24293
  tagRequestBody(
24299
24294
  RPC_METHODS.desktopLlmProbeRoute,
@@ -24334,16 +24329,102 @@ var DesktopRpcRequestBody = Schema_exports.Union([
24334
24329
  tagRequestBody(
24335
24330
  RPC_METHODS.desktopLlmRuntimeControl,
24336
24331
  Schema_exports.Struct({
24337
- action: Schema_exports.Union([
24338
- Schema_exports.Literal("drain"),
24339
- Schema_exports.Literal("resume")
24340
- ])
24332
+ action: Schema_exports.Union([Schema_exports.Literal("drain"), Schema_exports.Literal("resume")])
24341
24333
  })
24342
24334
  ),
24343
24335
  tagRequestBody(RPC_METHODS.cliInfo, Schema_exports.Struct({})),
24344
24336
  tagRequestBody(RPC_METHODS.cliStatus, Schema_exports.Struct({})),
24345
24337
  tagRequestBody(RPC_METHODS.cliCheckFreshness, Schema_exports.Struct({})),
24346
- tagRequestBody(RPC_METHODS.cliUpdateGlobal, Schema_exports.Struct({}))
24338
+ tagRequestBody(RPC_METHODS.cliUpdateGlobal, Schema_exports.Struct({})),
24339
+ tagRequestBody(RPC_METHODS.workGetSnapshot, Schema_exports.Struct({})),
24340
+ tagRequestBody(RPC_METHODS.workStartPlan, Schema_exports.Struct({ input: Schema_exports.Unknown })),
24341
+ tagRequestBody(RPC_METHODS.workOpenPlan, Schema_exports.Struct({ planId: TrimmedNonEmptyString })),
24342
+ tagRequestBody(RPC_METHODS.workRemovePlan, Schema_exports.Struct({ planId: TrimmedNonEmptyString })),
24343
+ tagRequestBody(RPC_METHODS.workOpenWindows, Schema_exports.Struct({ jobId: TrimmedNonEmptyString })),
24344
+ tagRequestBody(RPC_METHODS.workOpenFolder, Schema_exports.Struct({
24345
+ profileName: TrimmedNonEmptyString,
24346
+ folderPath: TrimmedNonEmptyString
24347
+ })),
24348
+ tagRequestBody(
24349
+ RPC_METHODS.workSetPlanner,
24350
+ Schema_exports.Struct({ profileName: TrimmedNonEmptyString })
24351
+ ),
24352
+ tagRequestBody(
24353
+ RPC_METHODS.workUpdateProfilePolicy,
24354
+ Schema_exports.Struct({
24355
+ profileName: TrimmedNonEmptyString,
24356
+ patch: Schema_exports.Unknown
24357
+ })
24358
+ ),
24359
+ tagRequestBody(
24360
+ RPC_METHODS.workAuthorizeProject,
24361
+ Schema_exports.Struct({ permission: Schema_exports.Unknown })
24362
+ ),
24363
+ tagRequestBody(
24364
+ RPC_METHODS.workProjectPreview,
24365
+ Schema_exports.Struct({ repositoryPath: TrimmedNonEmptyString })
24366
+ ),
24367
+ tagRequestBody(
24368
+ RPC_METHODS.workDelegate,
24369
+ Schema_exports.Struct({ input: Schema_exports.Unknown })
24370
+ ),
24371
+ tagRequestBody(
24372
+ RPC_METHODS.workAction,
24373
+ Schema_exports.Struct({ input: Schema_exports.Unknown })
24374
+ ),
24375
+ tagRequestBody(
24376
+ RPC_METHODS.workDiffReview,
24377
+ Schema_exports.Struct({
24378
+ jobId: TrimmedNonEmptyString,
24379
+ offset: Schema_exports.optional(Schema_exports.Number),
24380
+ diffHash: Schema_exports.optional(Schema_exports.String)
24381
+ })
24382
+ ),
24383
+ tagRequestBody(
24384
+ RPC_METHODS.workHistoryList,
24385
+ Schema_exports.Struct({ input: Schema_exports.Unknown })
24386
+ ),
24387
+ tagRequestBody(
24388
+ RPC_METHODS.workHistoryOpen,
24389
+ Schema_exports.Struct({
24390
+ profileName: TrimmedNonEmptyString,
24391
+ threadId: TrimmedNonEmptyString
24392
+ })
24393
+ ),
24394
+ tagRequestBody(
24395
+ RPC_METHODS.workConfigGet,
24396
+ Schema_exports.Struct({
24397
+ profileName: Schema_exports.optional(Schema_exports.Union([Schema_exports.String, Schema_exports.Null]))
24398
+ })
24399
+ ),
24400
+ tagRequestBody(
24401
+ RPC_METHODS.workConfigSaveShared,
24402
+ Schema_exports.Struct({
24403
+ content: Schema_exports.String,
24404
+ expectedRevision: TrimmedNonEmptyString
24405
+ })
24406
+ ),
24407
+ tagRequestBody(
24408
+ RPC_METHODS.workConfigSaveOverride,
24409
+ Schema_exports.Struct({
24410
+ profileName: TrimmedNonEmptyString,
24411
+ content: Schema_exports.String,
24412
+ expectedRevision: Schema_exports.optional(
24413
+ Schema_exports.Union([Schema_exports.String, Schema_exports.Null])
24414
+ )
24415
+ })
24416
+ ),
24417
+ tagRequestBody(
24418
+ RPC_METHODS.workConfigResetOverride,
24419
+ Schema_exports.Struct({ profileName: TrimmedNonEmptyString })
24420
+ ),
24421
+ tagRequestBody(
24422
+ RPC_METHODS.workConfigReconcileExternal,
24423
+ Schema_exports.Struct({
24424
+ profileName: TrimmedNonEmptyString,
24425
+ expectedRevision: TrimmedNonEmptyString
24426
+ })
24427
+ )
24347
24428
  ]);
24348
24429
  var DesktopRpcRequest = Schema_exports.Struct({
24349
24430
  id: TrimmedNonEmptyString,
@@ -24401,6 +24482,10 @@ var RpcPushOfficialCodexStatusUpdated = makeRpcPushSchema(
24401
24482
  RPC_CHANNELS.officialCodexStatusUpdated,
24402
24483
  Schema_exports.Unknown
24403
24484
  );
24485
+ var RpcPushWorkUpdated = makeRpcPushSchema(
24486
+ RPC_CHANNELS.workUpdated,
24487
+ Schema_exports.Unknown
24488
+ );
24404
24489
  var RpcPushChannelSchema = Schema_exports.Literals([
24405
24490
  RPC_CHANNELS.runtimeProvidersUpdated,
24406
24491
  RPC_CHANNELS.profilesSwitched,
@@ -24410,7 +24495,8 @@ var RpcPushChannelSchema = Schema_exports.Literals([
24410
24495
  RPC_CHANNELS.autoRollDecision,
24411
24496
  RPC_CHANNELS.officialCodexActivationProgress,
24412
24497
  RPC_CHANNELS.officialCodexActivityUpdated,
24413
- RPC_CHANNELS.officialCodexStatusUpdated
24498
+ RPC_CHANNELS.officialCodexStatusUpdated,
24499
+ RPC_CHANNELS.workUpdated
24414
24500
  ]);
24415
24501
  var RpcPush = Schema_exports.Union([
24416
24502
  RpcPushRuntimeProvidersUpdated,
@@ -24421,7 +24507,8 @@ var RpcPush = Schema_exports.Union([
24421
24507
  RpcPushAutoRollDecision,
24422
24508
  RpcPushOfficialCodexActivationProgress,
24423
24509
  RpcPushOfficialCodexActivityUpdated,
24424
- RpcPushOfficialCodexStatusUpdated
24510
+ RpcPushOfficialCodexStatusUpdated,
24511
+ RpcPushWorkUpdated
24425
24512
  ]);
24426
24513
  var RpcPushEnvelopeBase = Schema_exports.Struct({
24427
24514
  type: Schema_exports.Literal("push"),
@@ -26998,7 +27085,7 @@ function createBridgeSnapshotExpression() {
26998
27085
  capabilities: {
26999
27086
  health: healthReady,
27000
27087
  snapshot: commandReady("snapshot"),
27001
- draft: commandReady("setDraft"),
27088
+ draft: false,
27002
27089
  qol: commandReady("applyQol"),
27003
27090
  power: commandReady("applyPower"),
27004
27091
  modelWhitelist: commandReady("applyPower"),
@@ -27025,114 +27112,6 @@ function createBridgeSnapshotExpression() {
27025
27112
  return snapshot;
27026
27113
  })()`;
27027
27114
  }
27028
- function createBridgeSetDraftPromptExpression(prompt) {
27029
- return `(() => {
27030
- const prompt = ${JSON.stringify(prompt)};
27031
- const visible = (element) => {
27032
- if (!element || !(element instanceof HTMLElement)) return false;
27033
- const style = window.getComputedStyle(element);
27034
- const rect = element.getBoundingClientRect();
27035
- return style.visibility !== "hidden" &&
27036
- style.display !== "none" &&
27037
- rect.width > 0 &&
27038
- rect.height > 0 &&
27039
- !element.hasAttribute("disabled") &&
27040
- element.getAttribute("aria-disabled") !== "true";
27041
- };
27042
- const dispatchInput = (element) => {
27043
- try {
27044
- element.dispatchEvent(new InputEvent("input", {
27045
- bubbles: true,
27046
- cancelable: true,
27047
- inputType: "insertText",
27048
- data: prompt
27049
- }));
27050
- } catch {
27051
- element.dispatchEvent(new Event("input", { bubbles: true }));
27052
- }
27053
- element.dispatchEvent(new Event("change", { bubbles: true }));
27054
- };
27055
- const setNativeValue = (element, value) => {
27056
- const proto = Object.getPrototypeOf(element);
27057
- const descriptor = proto ? Object.getOwnPropertyDescriptor(proto, "value") : null;
27058
- if (descriptor?.set) {
27059
- descriptor.set.call(element, value);
27060
- } else {
27061
- element.value = value;
27062
- }
27063
- };
27064
- const selectors = [
27065
- "textarea",
27066
- "input[type='text']",
27067
- "[contenteditable='true']",
27068
- "[role='textbox']"
27069
- ];
27070
- const candidates = selectors.flatMap((selector) =>
27071
- Array.from(document.querySelectorAll(selector))
27072
- ).filter(visible);
27073
- const emptyPreferred = candidates.find((element) => {
27074
- const value = element instanceof HTMLTextAreaElement || element instanceof HTMLInputElement
27075
- ? element.value
27076
- : element.textContent;
27077
- return !String(value ?? "").trim();
27078
- });
27079
- const target = emptyPreferred ?? candidates[0] ?? null;
27080
- if (!target) {
27081
- return {
27082
- status: "not-found",
27083
- reason: "composer-not-found",
27084
- route: window.location.pathname + window.location.search + window.location.hash
27085
- };
27086
- }
27087
- target.focus();
27088
- if (target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement) {
27089
- setNativeValue(target, prompt);
27090
- dispatchInput(target);
27091
- return {
27092
- status: "inserted",
27093
- reason: null,
27094
- route: window.location.pathname + window.location.search + window.location.hash
27095
- };
27096
- }
27097
- const selection = window.getSelection();
27098
- if (selection) {
27099
- const range = document.createRange();
27100
- range.selectNodeContents(target);
27101
- selection.removeAllRanges();
27102
- selection.addRange(range);
27103
- }
27104
- const inserted = document.execCommand?.("insertText", false, prompt);
27105
- if (!inserted) {
27106
- target.textContent = prompt;
27107
- }
27108
- dispatchInput(target);
27109
- return {
27110
- status: "inserted",
27111
- reason: null,
27112
- route: window.location.pathname + window.location.search + window.location.hash
27113
- };
27114
- })()`;
27115
- }
27116
- function createBridgeReadComposerExpression() {
27117
- return `(() => {
27118
- const visible = (element) => {
27119
- if (!element || !(element instanceof HTMLElement)) return false;
27120
- const style = window.getComputedStyle(element);
27121
- const rect = element.getBoundingClientRect();
27122
- return style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
27123
- };
27124
- const valueOf = (element) =>
27125
- element instanceof HTMLTextAreaElement || element instanceof HTMLInputElement
27126
- ? element.value
27127
- : element.textContent;
27128
- const candidates = ["textarea", "input[type='text']", "[contenteditable='true']", "[role='textbox']"]
27129
- .flatMap((selector) => Array.from(document.querySelectorAll(selector)))
27130
- .filter(visible);
27131
- const filled = candidates.find((element) => String(valueOf(element) ?? "").trim());
27132
- const target = filled ?? candidates[0] ?? null;
27133
- return { text: target ? String(valueOf(target) ?? "") : "" };
27134
- })()`;
27135
- }
27136
27115
  function buildInCodexStatusOverlayCssRules() {
27137
27116
  const id2 = "#codexuse-profile-menu-section";
27138
27117
  return [
@@ -27160,8 +27139,6 @@ function buildInCodexStatusOverlayCssRules() {
27160
27139
  `${id2} .codexuse-meter[data-tone="critical"] > i{background:var(--cu-crit);}`,
27161
27140
  // Hangs under the account it acts on. It used to be a full-width bold blue
27162
27141
  // row between two accounts, louder than either and owned by neither.
27163
- `${id2} button.codexuse-handoff-button{width:calc(100% - 17px);margin:1px 0 2px 17px;overflow:hidden;padding:3px 8px;color:var(--cu-muted);font-size:11px;text-overflow:ellipsis;white-space:nowrap;}`,
27164
- `${id2} button.codexuse-handoff-button:hover,${id2} button.codexuse-handoff-button:focus-visible{color:var(--cu-accent);}`,
27165
27142
  `${id2} .codexuse-decision{margin:3px 4px 5px;padding:8px;border:1px solid color-mix(in srgb,var(--cu-low) 38%,transparent);border-radius:8px;background:color-mix(in srgb,var(--cu-low) 8%,transparent);}`,
27166
27143
  `${id2} .codexuse-decision-title{font-size:12px;font-weight:600;line-height:16px;}`,
27167
27144
  `${id2} .codexuse-decision-detail{margin-top:2px;color:var(--cu-muted);font-size:11px;line-height:15px;}`,
@@ -27193,16 +27170,12 @@ function createBridgeApplyQolExpression(settings) {
27193
27170
  const scrollRestoreEnabled = ${JSON.stringify(settings.scrollRestoreEnabled === true)};
27194
27171
  const conversationTimelineEnabled = ${JSON.stringify(settings.conversationTimelineEnabled === true)};
27195
27172
  const inCodexStatusEnabled = ${JSON.stringify(settings.inCodexStatusEnabled === true)};
27196
- const handoffEnabled = ${JSON.stringify(settings.handoffChipEnabled !== false)};
27197
27173
  const accountActionMode = ${JSON.stringify(
27198
27174
  settings.overlayAccountActionMode === "shared-switch" ? "shared-switch" : "isolated-open"
27199
27175
  )};
27200
27176
  let currentAutoRollDecision = ${JSON.stringify(settings.autoRollDecision ?? null)};
27201
27177
  let currentOverlayAutoRollEnabled = ${JSON.stringify(
27202
27178
  typeof settings.overlayAutoRollEnabled === "boolean" ? settings.overlayAutoRollEnabled : null
27203
- )};
27204
- let currentOverlayRunningThreadHandoffEnabled = ${JSON.stringify(
27205
- typeof settings.overlayRunningThreadHandoffEnabled === "boolean" ? settings.overlayRunningThreadHandoffEnabled : null
27206
27179
  )};
27207
27180
  let currentWideViewEnabled = wideViewEnabled;
27208
27181
  let currentScrollRestoreEnabled = scrollRestoreEnabled;
@@ -27232,8 +27205,8 @@ function createBridgeApplyQolExpression(settings) {
27232
27205
  const profileMenuId = "codexuse-profile-menu-section";
27233
27206
  const legacySettingsId = "codexuse-settings-section";
27234
27207
  const legacyStatusId = "codexuse-status-pill";
27235
- const legacyHandoffId = "codexuse-handoff-chip";
27236
- const legacyHandoffPickerId = "codexuse-handoff-picker";
27208
+ const legacyContinuationId = "codexuse-handoff-chip";
27209
+ const legacyContinuationPickerId = "codexuse-handoff-picker";
27237
27210
  // Codex desktop is a SPA whose URL never changes per thread; key scroll
27238
27211
  // state by the open conversation id so each chat restores independently.
27239
27212
  const route = () => {
@@ -27613,7 +27586,6 @@ function createBridgeApplyQolExpression(settings) {
27613
27586
  try {
27614
27587
  const actionMessage =
27615
27588
  action === "switch" ? "Switching\u2026"
27616
- : action === "continue" ? "Moving thread\u2026"
27617
27589
  : action === "auto-roll-accept" ? "Switching\u2026"
27618
27590
  : action === "auto-roll-cancel" ? "Staying here"
27619
27591
  : action === "setting" ? "Saving\u2026"
@@ -27674,9 +27646,6 @@ function createBridgeApplyQolExpression(settings) {
27674
27646
  if (typeof result.overlayAutoRollEnabled === "boolean") {
27675
27647
  currentOverlayAutoRollEnabled = result.overlayAutoRollEnabled;
27676
27648
  }
27677
- if (typeof result.overlayRunningThreadHandoffEnabled === "boolean") {
27678
- currentOverlayRunningThreadHandoffEnabled = result.overlayRunningThreadHandoffEnabled;
27679
- }
27680
27649
  if (result.providerStatus && typeof result.providerStatus.publishedModelCount === "number") {
27681
27650
  customModelCount = Math.max(0, Math.floor(result.providerStatus.publishedModelCount));
27682
27651
  }
@@ -27696,8 +27665,8 @@ function createBridgeApplyQolExpression(settings) {
27696
27665
  };
27697
27666
  const renderProfileMenu = () => {
27698
27667
  document.getElementById(legacyStatusId)?.remove();
27699
- document.getElementById(legacyHandoffId)?.remove();
27700
- document.getElementById(legacyHandoffPickerId)?.remove();
27668
+ document.getElementById(legacyContinuationId)?.remove();
27669
+ document.getElementById(legacyContinuationPickerId)?.remove();
27701
27670
  document.getElementById(legacySettingsId)?.remove();
27702
27671
  const previous = document.getElementById(profileMenuId);
27703
27672
  const threadId = activeThreadId();
@@ -27715,12 +27684,9 @@ function createBridgeApplyQolExpression(settings) {
27715
27684
  const renderKey = JSON.stringify({
27716
27685
  targets: allTargets,
27717
27686
  canonicalSyncLine: currentCanonicalSyncLine,
27718
- handoffEnabled,
27719
- hasThread: Boolean(threadId),
27720
27687
  customModelCount,
27721
27688
  currentAutoRollDecision,
27722
27689
  currentOverlayAutoRollEnabled,
27723
- currentOverlayRunningThreadHandoffEnabled,
27724
27690
  currentWideViewEnabled,
27725
27691
  currentScrollRestoreEnabled,
27726
27692
  currentConversationTimelineEnabled,
@@ -27904,23 +27870,6 @@ function createBridgeApplyQolExpression(settings) {
27904
27870
  row.setAttribute("aria-disabled", "true");
27905
27871
  }
27906
27872
  section.appendChild(row);
27907
- if (canSwitch && handoffEnabled && threadId) {
27908
- const handoffButton = document.createElement("button");
27909
- handoffButton.type = "button";
27910
- handoffButton.className = "codexuse-handoff-button";
27911
- handoffButton.setAttribute("role", "menuitem");
27912
- // Names its own target, so a row sandwiched between two profiles can
27913
- // never be read as belonging to the wrong one.
27914
- handoffButton.textContent = "\u21B3 Continue this thread in " + label.textContent;
27915
- handoffButton.setAttribute("aria-label", "Continue this thread in " + label.textContent);
27916
- handoffButton.addEventListener("click", (event) => {
27917
- event.preventDefault();
27918
- event.stopPropagation();
27919
- setMenuButtonsDisabled(true);
27920
- requestAction("continue", target);
27921
- }, true);
27922
- section.appendChild(handoffButton);
27923
- }
27924
27873
  });
27925
27874
  const appendSettingRow = (item) => {
27926
27875
  const row = document.createElement("button");
@@ -27969,14 +27918,6 @@ function createBridgeApplyQolExpression(settings) {
27969
27918
  enabled: currentOverlayAutoRollEnabled,
27970
27919
  }]
27971
27920
  : []),
27972
- ...(typeof currentOverlayRunningThreadHandoffEnabled === "boolean"
27973
- ? [{
27974
- key: "runningThreadHandoff",
27975
- label: "Continue running threads",
27976
- detail: "Move active work after a switch",
27977
- enabled: currentOverlayRunningThreadHandoffEnabled,
27978
- }]
27979
- : []),
27980
27921
  {
27981
27922
  key: "wideView",
27982
27923
  label: "Wide conversations",
@@ -28045,11 +27986,11 @@ function createBridgeApplyQolExpression(settings) {
28045
27986
  return element?.id === profileMenuId ||
28046
27987
  element?.id === legacySettingsId ||
28047
27988
  element?.id === legacyStatusId ||
28048
- element?.id === legacyHandoffId ||
28049
- element?.id === legacyHandoffPickerId ||
27989
+ element?.id === legacyContinuationId ||
27990
+ element?.id === legacyContinuationPickerId ||
28050
27991
  element?.classList?.contains(timelineClass) ||
28051
27992
  Boolean(element?.closest?.(
28052
- "." + timelineClass + ",#" + profileMenuId + ",#" + legacySettingsId + ",#" + legacyStatusId + ",#" + legacyHandoffId + ",#" + legacyHandoffPickerId
27993
+ "." + timelineClass + ",#" + profileMenuId + ",#" + legacySettingsId + ",#" + legacyStatusId + ",#" + legacyContinuationId + ",#" + legacyContinuationPickerId
28053
27994
  ));
28054
27995
  };
28055
27996
  const isVisualOnlyMutation = (mutation) => {
@@ -28071,8 +28012,8 @@ function createBridgeApplyQolExpression(settings) {
28071
28012
  document.getElementById(profileMenuId)?.remove();
28072
28013
  document.getElementById(legacySettingsId)?.remove();
28073
28014
  document.getElementById(legacyStatusId)?.remove();
28074
- document.getElementById(legacyHandoffId)?.remove();
28075
- document.getElementById(legacyHandoffPickerId)?.remove();
28015
+ document.getElementById(legacyContinuationId)?.remove();
28016
+ document.getElementById(legacyContinuationPickerId)?.remove();
28076
28017
  };
28077
28018
  } else {
28078
28019
  document.querySelectorAll("." + timelineClass).forEach((node) => node.remove());
@@ -28080,8 +28021,8 @@ function createBridgeApplyQolExpression(settings) {
28080
28021
  document.getElementById(profileMenuId)?.remove();
28081
28022
  document.getElementById(legacySettingsId)?.remove();
28082
28023
  document.getElementById(legacyStatusId)?.remove();
28083
- document.getElementById(legacyHandoffId)?.remove();
28084
- document.getElementById(legacyHandoffPickerId)?.remove();
28024
+ document.getElementById(legacyContinuationId)?.remove();
28025
+ document.getElementById(legacyContinuationPickerId)?.remove();
28085
28026
  }
28086
28027
 
28087
28028
  state.wideViewEnabled = wideViewEnabled;
@@ -29304,22 +29245,6 @@ function normalizeBridgeSnapshot(value3) {
29304
29245
  relayStatus: normalizeRelayStatus(record2.relayStatus)
29305
29246
  };
29306
29247
  }
29307
- function normalizeDraftPromptInsertionResult(value3) {
29308
- if (!value3 || typeof value3 !== "object") {
29309
- return {
29310
- status: "failed",
29311
- reason: "invalid-bridge-result",
29312
- route: null
29313
- };
29314
- }
29315
- const record2 = value3;
29316
- const status = record2.status === "inserted" || record2.status === "not-found" || record2.status === "unavailable" || record2.status === "failed" ? record2.status : "failed";
29317
- return {
29318
- status,
29319
- reason: sanitizeUserFacingError(record2.reason),
29320
- route: typeof record2.route === "string" ? record2.route : null
29321
- };
29322
- }
29323
29248
  function normalizeQolScriptResult(value3, settings) {
29324
29249
  if (!value3 || typeof value3 !== "object") {
29325
29250
  return {
@@ -29423,18 +29348,16 @@ function normalizeOfficialCodexQolSettings2(value3) {
29423
29348
  scrollRestoreEnabled: value3.scrollRestoreEnabled === true,
29424
29349
  conversationTimelineEnabled: value3.conversationTimelineEnabled === true,
29425
29350
  inCodexStatusEnabled: value3.inCodexStatusEnabled !== false,
29426
- handoffChipEnabled: value3.handoffChipEnabled !== false,
29427
29351
  actionTargets,
29428
29352
  providerStatus,
29429
29353
  canonicalSyncLine: typeof value3.canonicalSyncLine === "string" && value3.canonicalSyncLine.trim() ? value3.canonicalSyncLine.trim().slice(0, 40) : null,
29430
29354
  autoRollDecision: normalizeOverlayAutoRollDecision(value3.autoRollDecision),
29431
29355
  overlayAutoRollEnabled: typeof value3.overlayAutoRollEnabled === "boolean" ? value3.overlayAutoRollEnabled : null,
29432
- overlayRunningThreadHandoffEnabled: typeof value3.overlayRunningThreadHandoffEnabled === "boolean" ? value3.overlayRunningThreadHandoffEnabled : null,
29433
29356
  overlayAccountActionMode: value3.overlayAccountActionMode === "shared-switch" || value3.overlayAccountActionMode === "isolated-open" ? value3.overlayAccountActionMode : null
29434
29357
  };
29435
29358
  }
29436
29359
  function hasActiveQolSettings(settings) {
29437
- return settings.wideViewEnabled || settings.scrollRestoreEnabled || settings.conversationTimelineEnabled || settings.inCodexStatusEnabled || settings.handoffChipEnabled === false;
29360
+ return settings.wideViewEnabled || settings.scrollRestoreEnabled || settings.conversationTimelineEnabled || settings.inCodexStatusEnabled;
29438
29361
  }
29439
29362
  function hasActivePowerSettings(settings) {
29440
29363
  return settings.relayMode !== "off" || settings.modelWhitelistUnlockEnabled || settings.pluginMarketplaceUnlockEnabled || settings.forcePluginInstallEnabled;
@@ -29550,7 +29473,6 @@ function createBridgeInstallExpression() {
29550
29473
  state.commands = {
29551
29474
  health: true,
29552
29475
  snapshot: true,
29553
- setDraft: true,
29554
29476
  sendMessage: true,
29555
29477
  applyQol: true,
29556
29478
  applyPower: true
@@ -30610,11 +30532,11 @@ async function startOfficialCodexBridgeActionListenerOnce(args2) {
30610
30532
  if (!id2 || !rememberBridgeActionId(id2)) {
30611
30533
  return;
30612
30534
  }
30613
- const action = payload.action === "continue" || payload.action === "switch" || payload.action === "auto-roll" || payload.action === "auto-roll-accept" || payload.action === "auto-roll-cancel" || payload.action === "restart" || payload.action === "setting" ? payload.action : null;
30535
+ const action = payload.action === "switch" || payload.action === "auto-roll" || payload.action === "auto-roll-accept" || payload.action === "auto-roll-cancel" || payload.action === "restart" || payload.action === "setting" ? payload.action : null;
30614
30536
  if (!action) {
30615
30537
  return;
30616
30538
  }
30617
- const settingKey = payload.settingKey === "autoRoll" || payload.settingKey === "runningThreadHandoff" || payload.settingKey === "wideView" || payload.settingKey === "scrollRestore" || payload.settingKey === "conversationTimeline" || payload.settingKey === "handoffChip" ? payload.settingKey : null;
30539
+ const settingKey = payload.settingKey === "autoRoll" || payload.settingKey === "wideView" || payload.settingKey === "scrollRestore" || payload.settingKey === "conversationTimeline" ? payload.settingKey : null;
30618
30540
  const settingValue = typeof payload.settingValue === "boolean" ? payload.settingValue : null;
30619
30541
  if (action === "setting" && (!settingKey || settingValue === null)) {
30620
30542
  return;
@@ -31105,6 +31027,25 @@ function enqueueProfileAction(profileName, work) {
31105
31027
  });
31106
31028
  return run2;
31107
31029
  }
31030
+ var LAUNCH_LOCK_NAME = ".codexuse-launch.lock";
31031
+ var LAUNCH_LOCK_WAIT_MS = 6e4;
31032
+ async function withProfileLaunchFileLock(profileHome, work, options) {
31033
+ const accountKey = options.profileKey?.trim();
31034
+ const lockPath = accountKey ? import_node_path12.default.join(resolveProfileCodexHomesRoot(), ".launch-locks", (0, import_node_crypto11.createHash)("sha256").update(accountKey).digest("hex")) : import_node_path12.default.join(profileHome, LAUNCH_LOCK_NAME);
31035
+ const deadline = Date.now() + (options.waitMs ?? LAUNCH_LOCK_WAIT_MS);
31036
+ for (; ; ) {
31037
+ const release = await acquireCrossProcessFileLock(lockPath, { busyTimeoutMs: 0 });
31038
+ if (release) {
31039
+ try {
31040
+ return await work();
31041
+ } finally {
31042
+ await release();
31043
+ }
31044
+ }
31045
+ if (Date.now() >= deadline) return options.onBusy();
31046
+ await sleep3(250);
31047
+ }
31048
+ }
31108
31049
  async function readProcessRows() {
31109
31050
  const result2 = await runCommand2(
31110
31051
  "/bin/ps",
@@ -31865,128 +31806,6 @@ async function verifyCurrentManagedProfileProof(instance, runtime, candidate, op
31865
31806
  });
31866
31807
  return migrated;
31867
31808
  }
31868
- async function resolveOfficialCodexBridgeTarget(args2) {
31869
- const existing = args2.state.officialCodex.instancesByProfileName[args2.profileName] ?? null;
31870
- if (existing) {
31871
- const runtime = await resolveInstanceRuntimeState({
31872
- instance: existing,
31873
- candidate: args2.candidate,
31874
- rows: args2.rows
31875
- });
31876
- const verified = await verifyCurrentManagedProfileProof(
31877
- existing,
31878
- runtime,
31879
- args2.candidate,
31880
- { requireCdpBrowser: true }
31881
- );
31882
- if (verified) {
31883
- return { instance: verified, runtime, managed: true };
31884
- }
31885
- }
31886
- const runningManagedPids = /* @__PURE__ */ new Set();
31887
- for (const instance of Object.values(
31888
- args2.state.officialCodex.instancesByProfileName
31889
- )) {
31890
- if (instance.profileName === args2.profileName) {
31891
- continue;
31892
- }
31893
- const runtime = await resolveInstanceRuntimeState({
31894
- instance,
31895
- candidate: args2.candidate,
31896
- rows: args2.rows
31897
- });
31898
- const verified = runtime.running ? await verifyCurrentManagedProfileProof(
31899
- instance,
31900
- runtime,
31901
- args2.candidate,
31902
- { requireCdpBrowser: true }
31903
- ) : null;
31904
- if (verified?.pid) {
31905
- runningManagedPids.add(verified.pid);
31906
- }
31907
- }
31908
- const candidates = [];
31909
- for (const row of args2.rows) {
31910
- if (!isMainProcessRow(row, args2.candidate) || runningManagedPids.has(row.pid)) {
31911
- continue;
31912
- }
31913
- const cdpPort = parseRemoteDebuggingPort(row.args);
31914
- if (!cdpPort) {
31915
- continue;
31916
- }
31917
- const appServerPid = findAppServerPid(args2.rows, row.pid);
31918
- candidates.push({
31919
- row,
31920
- cdpPort,
31921
- appServerPid,
31922
- hint: await describeUnmanagedProfileHint(appServerPid)
31923
- });
31924
- }
31925
- const target = candidates.find(
31926
- (entry) => entry.hint.profileName === args2.profileName && entry.hint.profileMatchSource === "profile-home"
31927
- ) ?? null;
31928
- if (!target) {
31929
- return null;
31930
- }
31931
- if (!target.appServerPid || !target.row.startedAt || !await attestOfficialCodexProcessEpoch({
31932
- candidate: args2.candidate,
31933
- pid: target.row.pid,
31934
- appServerPid: target.appServerPid,
31935
- startedAt: target.row.startedAt,
31936
- cdpPort: target.cdpPort
31937
- })) {
31938
- return null;
31939
- }
31940
- const now2 = Date.now();
31941
- const bridge = bridgeStateUnattached(target.cdpPort, now2);
31942
- const observed = {
31943
- profileName: args2.profileName,
31944
- profileKey: existing?.profileKey ?? null,
31945
- profileMatchSource: target.hint.profileMatchSource,
31946
- processProofVersion: MANAGED_PROCESS_PROOF_VERSION,
31947
- profileHome: existing?.profileHome ?? null,
31948
- appPath: args2.candidate.appPath,
31949
- bundleId: args2.candidate.bundleId,
31950
- pid: target.row.pid,
31951
- appServerPid: target.appServerPid,
31952
- launchedAt: target.row.startedAt,
31953
- lastVerifiedAt: now2,
31954
- lastStatus: "observed-unmanaged",
31955
- lastError: null,
31956
- ...bridge,
31957
- bridgeStatus: existing?.bridgeStatus ?? bridge.bridgeStatus,
31958
- bridgeLastCheckedAt: existing?.bridgeLastCheckedAt ?? bridge.bridgeLastCheckedAt,
31959
- bridgeError: existing?.bridgeError ?? bridge.bridgeError,
31960
- bridgeVersion: existing?.bridgeVersion ?? bridge.bridgeVersion,
31961
- bridgeRoute: existing?.bridgeRoute ?? bridge.bridgeRoute,
31962
- bridgeDevToolsUrl: existing?.bridgeDevToolsUrl ?? bridge.bridgeDevToolsUrl,
31963
- bridgeCapabilities: existing?.bridgeCapabilities ?? bridge.bridgeCapabilities,
31964
- bridgeActiveThreadId: existing?.bridgeActiveThreadId ?? bridge.bridgeActiveThreadId,
31965
- bridgeActiveThreadTitle: existing?.bridgeActiveThreadTitle ?? bridge.bridgeActiveThreadTitle,
31966
- bridgeActiveThreadUpdatedAt: existing?.bridgeActiveThreadUpdatedAt ?? bridge.bridgeActiveThreadUpdatedAt,
31967
- bridgeComposerText: existing?.bridgeComposerText ?? bridge.bridgeComposerText,
31968
- bridgeWorkspacePath: existing?.bridgeWorkspacePath ?? bridge.bridgeWorkspacePath,
31969
- bridgeModel: existing?.bridgeModel ?? bridge.bridgeModel,
31970
- bridgeActivityState: existing?.bridgeActivityState ?? bridge.bridgeActivityState,
31971
- bridgeQol: existing?.bridgeQol ?? bridge.bridgeQol,
31972
- bridgePower: existing?.bridgePower ?? bridge.bridgePower,
31973
- bridgeRelayStatus: existing?.bridgeRelayStatus ?? bridge.bridgeRelayStatus,
31974
- desiredQolSettings: existing?.desiredQolSettings ?? null,
31975
- desiredPowerSettings: existing?.desiredPowerSettings ?? null
31976
- };
31977
- if (!existing || existing.pid !== observed.pid || existing.appServerPid !== observed.appServerPid || existing.cdpPort !== observed.cdpPort || existing.lastStatus !== observed.lastStatus) {
31978
- await patchManagedInstance(observed);
31979
- }
31980
- return {
31981
- managed: false,
31982
- runtime: {
31983
- running: true,
31984
- appServerPid: target.appServerPid,
31985
- startedAt: target.row.startedAt
31986
- },
31987
- instance: observed
31988
- };
31989
- }
31990
31809
  var devToolsActivePortPaths = (appUserDataDir) => {
31991
31810
  const roots = appUserDataDir ? [appUserDataDir] : [
31992
31811
  import_node_path12.default.join((0, import_node_os4.homedir)(), "Library", "Application Support", "OpenAI", "Codex"),
@@ -32073,6 +31892,10 @@ async function openCodexWithProfileHome(candidate, profileHome, profileName, pre
32073
31892
  `CODEX_SQLITE_HOME=${sqliteHome}`,
32074
31893
  "--env",
32075
31894
  `CODEX_TELEMETRY_LABEL=${telemetryLabel}`,
31895
+ ...Object.entries(options.environment ?? {}).flatMap(([key, value3]) => [
31896
+ "--env",
31897
+ `${key}=${value3}`
31898
+ ]),
32076
31899
  "--args",
32077
31900
  ...appUserDataDir ? [`--user-data-dir=${appUserDataDir}`] : [],
32078
31901
  "--remote-debugging-port=0",
@@ -32359,7 +32182,7 @@ function resolveOfficialCodexLaunchConfiguration(profileHome, options = {}) {
32359
32182
  };
32360
32183
  }
32361
32184
  function resolveOfficialCodexThreadSqliteHome(profileHome) {
32362
- return profileHome === SHARED_CODEX_HOME ? resolveCodexSqliteHomeDir(profileHome) : profileHome;
32185
+ return profileHome;
32363
32186
  }
32364
32187
  function sharedCodexLaunchOptions(useDefaultUserData, profileIdentity) {
32365
32188
  const userDataDir = !useDefaultUserData && profileIdentity ? import_node_path12.default.join(
@@ -32524,39 +32347,6 @@ async function reconcileSharedManagedWindowAfterLaunch(args2) {
32524
32347
  }
32525
32348
  return null;
32526
32349
  }
32527
- async function readSharedComposerDraft(debuggerUrl) {
32528
- try {
32529
- const value3 = await evaluateCdpExpression(
32530
- debuggerUrl,
32531
- createBridgeReadComposerExpression()
32532
- );
32533
- const text = value3 && typeof value3 === "object" && "text" in value3 ? value3.text : null;
32534
- return typeof text === "string" ? text : "";
32535
- } catch {
32536
- return "";
32537
- }
32538
- }
32539
- async function restoreSharedComposerDraft(debuggerUrl, prompt) {
32540
- if (!prompt.trim()) {
32541
- return;
32542
- }
32543
- for (let attempt = 0; attempt < 8; attempt += 1) {
32544
- await new Promise((resolve2) => setTimeout(resolve2, 400));
32545
- try {
32546
- const result2 = await evaluateOfficialCodexBridgeCommand(
32547
- debuggerUrl,
32548
- "setDraft",
32549
- createBridgeSetDraftPromptExpression(prompt),
32550
- false
32551
- );
32552
- const status = result2 && typeof result2 === "object" && "status" in result2 ? result2.status : null;
32553
- if (status === "inserted") {
32554
- return;
32555
- }
32556
- } catch {
32557
- }
32558
- }
32559
- }
32560
32350
  function isSharedHomeMainProcessRow(row, candidate) {
32561
32351
  const managedRoots = [
32562
32352
  resolveProfileCodexHomesRoot(),
@@ -34519,15 +34309,11 @@ async function applySharedLaunchFollowUp(args2) {
34519
34309
  ].filter((key) => renderer[key] !== true).join(",")}`
34520
34310
  };
34521
34311
  }
34522
- if (args2.carryDraft && args2.carriedDraft.trim()) {
34523
- await restoreSharedComposerDraft(debuggerUrl, args2.carriedDraft);
34524
- }
34525
34312
  const [finalAccount, snapshot2] = await Promise.all([
34526
34313
  readTargetAccount(),
34527
34314
  readSharedBridgeSnapshot(debuggerUrl)
34528
34315
  ]);
34529
- const expectedDraft = args2.carryDraft && args2.carriedDraft.trim() ? args2.carriedDraft : "";
34530
- if (!finalAccount || !officialCodexExpectedAccountMatches(args2.expectedAccount, finalAccount) || !snapshot2 || snapshot2.activeThreadId !== null || (snapshot2.composerText ?? "") !== expectedDraft) {
34316
+ if (!finalAccount || !officialCodexExpectedAccountMatches(args2.expectedAccount, finalAccount) || !snapshot2 || snapshot2.activeThreadId !== null || (snapshot2.composerText ?? "") !== "") {
34531
34317
  return { verified: false, reason: "renderer-postcondition-unverified" };
34532
34318
  }
34533
34319
  return { verified: true, reason: null };
@@ -34570,9 +34356,8 @@ function liveRendererEvidenceVerified(args2) {
34570
34356
  }
34571
34357
  const evidence = args2.value && typeof args2.value === "object" ? args2.value : {};
34572
34358
  const sourceThreadEvicted = evidence.sourceThreadEvicted === true && evidence.activeThreadId === null && args2.snapshot.activeThreadId === null && (!args2.sourceThreadId || args2.snapshot.activeThreadId !== args2.sourceThreadId);
34573
- const composerSafe = args2.carryDraft ? !args2.sourceDraft || args2.snapshot.composerText !== args2.sourceDraft : !args2.snapshot.composerText;
34574
34359
  return Boolean(
34575
- evidence.status === "observed" && evidence.displayedAccountMatched === true && evidence.workspaceMatched === true && evidence.threadSurfaceReady === true && evidence.rateSurfaceReady === true && evidence.composerReady === true && sourceThreadEvicted && composerSafe
34360
+ evidence.status === "observed" && evidence.displayedAccountMatched === true && evidence.workspaceMatched === true && evidence.threadSurfaceReady === true && evidence.rateSurfaceReady === true && evidence.composerReady === true && sourceThreadEvicted && !args2.snapshot.composerText
34576
34361
  );
34577
34362
  }
34578
34363
  async function attemptOfficialCodexManagedLiveLogin(args2) {
@@ -34676,7 +34461,7 @@ async function attemptOfficialCodexManagedLiveLogin(args2) {
34676
34461
  sourceAccountThreadIds: sourceSurface.accountThreadIds,
34677
34462
  sourceRateResponseSignature: sourceSurface.accountRateSignature,
34678
34463
  sourceRateSurfaceSignature: sourceSurface.rateSignature,
34679
- clearComposer: args2.options.carryDraft !== true
34464
+ clearComposer: true
34680
34465
  }),
34681
34466
  false
34682
34467
  );
@@ -34685,9 +34470,7 @@ async function attemptOfficialCodexManagedLiveLogin(args2) {
34685
34470
  verified: liveRendererEvidenceVerified({
34686
34471
  value: value3,
34687
34472
  snapshot: snapshot2,
34688
- sourceThreadId: sourceSnapshot.activeThreadId,
34689
- sourceDraft: args2.sourceDraft,
34690
- carryDraft: args2.options.carryDraft === true
34473
+ sourceThreadId: sourceSnapshot.activeThreadId
34691
34474
  }),
34692
34475
  snapshot: snapshot2
34693
34476
  };
@@ -34720,13 +34503,6 @@ async function attemptOfficialCodexManagedLiveLogin(args2) {
34720
34503
  })) {
34721
34504
  return null;
34722
34505
  }
34723
- if (args2.options.carryDraft && args2.sourceDraft.trim()) {
34724
- await restoreSharedComposerDraft(args2.debuggerUrl, args2.sourceDraft);
34725
- const restoredSnapshot = await readSharedBridgeSnapshot(args2.debuggerUrl);
34726
- if (restoredSnapshot?.composerText !== args2.sourceDraft) {
34727
- return null;
34728
- }
34729
- }
34730
34506
  const bridge = await refreshAdoptedSharedWindow(profileName);
34731
34507
  if (bridge?.bridgeStatus !== "healthy") {
34732
34508
  return null;
@@ -34799,6 +34575,22 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
34799
34575
  };
34800
34576
  }
34801
34577
  let rows = await readProcessRows();
34578
+ const instances = (await updateAppState((current) => current, {
34579
+ mode: "replace",
34580
+ cloneCurrent: false
34581
+ })).officialCodex.instancesByProfileName;
34582
+ for (const instance of Object.values(instances)) {
34583
+ if (instance.profileName !== options.profileName && (!options.profileKey || instance.profileKey !== options.profileKey)) continue;
34584
+ const row = rows.find((entry) => entry.pid === instance.pid);
34585
+ if (!row || isSharedHomeMainProcessRow(row, candidate)) continue;
34586
+ if ((await resolveInstanceRuntimeState({ instance, candidate, rows })).running) {
34587
+ return {
34588
+ status: "failed",
34589
+ reason: `This account already has an isolated Codex window under profile '${instance.profileName}'. Open that window instead.`,
34590
+ pid: instance.pid
34591
+ };
34592
+ }
34593
+ }
34802
34594
  await hydrateSharedHomeCdpWindow(rows, candidate);
34803
34595
  if (expectedWindowPreflight && !sharedWindowTopologyMatches(
34804
34596
  expectedWindowPreflight,
@@ -34840,8 +34632,6 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
34840
34632
  pid: null
34841
34633
  };
34842
34634
  }
34843
- let carriedDraft = "";
34844
- const needsBridgeAutomation = options.carryDraft === true;
34845
34635
  if (driveTarget) {
34846
34636
  const managedTarget = driveTarget;
34847
34637
  const mainRow = rows.find((row) => row.pid === managedTarget.pid) ?? null;
@@ -34958,11 +34748,6 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
34958
34748
  } catch {
34959
34749
  }
34960
34750
  }
34961
- if (liveAutomationEligible && options.carryDraft && target?.webSocketDebuggerUrl) {
34962
- carriedDraft = await readSharedComposerDraft(
34963
- target.webSocketDebuggerUrl
34964
- );
34965
- }
34966
34751
  if (liveAutomationEligible && target?.webSocketDebuggerUrl && options.liveLoginCredentials) {
34967
34752
  const live = await attemptOfficialCodexManagedLiveLogin({
34968
34753
  candidate,
@@ -34971,7 +34756,6 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
34971
34756
  startedAt: mainRow.startedAt,
34972
34757
  debuggerUrl: target.webSocketDebuggerUrl,
34973
34758
  sourceSnapshot: snapshot2,
34974
- sourceDraft: carriedDraft,
34975
34759
  options
34976
34760
  });
34977
34761
  if (live) {
@@ -35052,7 +34836,7 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
35052
34836
  if (!driveTarget && plainSharedRows.length > 0 && options.forceAdopt !== true) {
35053
34837
  return {
35054
34838
  status: "skipped",
35055
- reason: options.accountChanged === true || needsBridgeAutomation ? "plain-window-requires-take-control" : "same-account-plain-window",
34839
+ reason: options.accountChanged === true ? "plain-window-requires-take-control" : "same-account-plain-window",
35056
34840
  pid: plainSharedRows[0]?.pid ?? null,
35057
34841
  closedPreviousWindow,
35058
34842
  suppressPlainReopen: closedPreviousWindow
@@ -35485,8 +35269,6 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
35485
35269
  }
35486
35270
  const followUp = await applySharedLaunchFollowUp({
35487
35271
  cdpPort: finalCdpPort,
35488
- carriedDraft,
35489
- carryDraft: options.carryDraft === true,
35490
35272
  expectedAccount: options.expectedAccount ?? null,
35491
35273
  allowOnboardingOverride: true
35492
35274
  });
@@ -35752,8 +35534,6 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
35752
35534
  }
35753
35535
  const followUp = await applySharedLaunchFollowUp({
35754
35536
  cdpPort,
35755
- carriedDraft,
35756
- carryDraft: options.carryDraft === true,
35757
35537
  expectedAccount: options.expectedAccount ?? null,
35758
35538
  allowOnboardingOverride: false
35759
35539
  });
@@ -35840,7 +35620,7 @@ async function applyOfficialCodexLiveAccountSwitchOnce(options = {}, takeoverTra
35840
35620
  }
35841
35621
  }
35842
35622
  function applyOfficialCodexLiveAccountSwitch(options = {}) {
35843
- return enqueueProfileAction("shared-window", async () => {
35623
+ return enqueueProfileAction("shared-window", () => withProfileLaunchFileLock(resolveDefaultCodexHomeDir(), async () => {
35844
35624
  const operationId = (0, import_node_crypto11.randomUUID)();
35845
35625
  let result2 = await applyOfficialCodexLiveAccountSwitchOnce(options, {
35846
35626
  operationId,
@@ -35874,7 +35654,10 @@ function applyOfficialCodexLiveAccountSwitch(options = {}) {
35874
35654
  });
35875
35655
  }
35876
35656
  return { ...result2, closedPreviousWindow };
35877
- });
35657
+ }, {
35658
+ profileKey: options.profileKey,
35659
+ onBusy: () => ({ status: "failed", reason: "launch-in-progress", pid: null, closedPreviousWindow: false })
35660
+ }));
35878
35661
  }
35879
35662
  function toIso2(value3) {
35880
35663
  return typeof value3 === "number" && Number.isFinite(value3) ? new Date(value3).toISOString() : null;
@@ -36118,93 +35901,28 @@ async function getOfficialCodexProfileInstances(options = {}) {
36118
35901
  unmanaged
36119
35902
  };
36120
35903
  }
36121
- async function setOfficialCodexProfileDraftPrompt(profileName, prompt) {
36122
- const normalizedProfileName = profileName.trim();
36123
- const normalizedPrompt = prompt.trim();
36124
- if (!normalizedProfileName || !normalizedPrompt) {
36125
- return {
36126
- status: "unavailable",
36127
- reason: "missing-profile-or-prompt",
36128
- route: null
36129
- };
36130
- }
36131
- if (process.platform !== "darwin") {
36132
- return {
36133
- status: "unavailable",
36134
- reason: "unsupported-platform",
36135
- route: null
36136
- };
36137
- }
36138
- try {
36139
- const [state, { candidate }, rows] = await Promise.all([
36140
- getAppState(),
36141
- resolveCodexAppTarget(),
36142
- readProcessRows()
36143
- ]);
36144
- if (!candidate) {
36145
- return {
36146
- status: "unavailable",
36147
- reason: "codex-app-not-found",
36148
- route: null
36149
- };
36150
- }
36151
- const bridgeTarget = await resolveOfficialCodexBridgeTarget({
36152
- profileName: normalizedProfileName,
36153
- state,
36154
- candidate,
36155
- rows
36156
- });
36157
- if (!bridgeTarget?.instance.cdpPort) {
36158
- return {
36159
- status: "unavailable",
36160
- reason: "target-instance-not-running",
36161
- route: null
36162
- };
36163
- }
36164
- const targets = await readCdpTargets(bridgeTarget.instance.cdpPort);
36165
- const target = pickCodexCdpTarget(targets);
36166
- if (!target?.webSocketDebuggerUrl) {
36167
- return {
36168
- status: "unavailable",
36169
- reason: "cdp-target-not-found",
36170
- route: null
36171
- };
36172
- }
36173
- const listenerAttached = await startOfficialCodexBridgeActionListener({
36174
- profileName: normalizedProfileName,
36175
- cdpPort: bridgeTarget.instance.cdpPort,
36176
- debuggerUrl: target.webSocketDebuggerUrl,
36177
- processEpoch: notificationProcessEpochFromInstance(bridgeTarget.instance)
36178
- });
36179
- if (!listenerAttached) {
36180
- return {
36181
- status: "failed",
36182
- reason: "bridge-listener-attach-failed",
36183
- route: null
36184
- };
36185
- }
36186
- const result2 = await evaluateOfficialCodexBridgeCommand(
36187
- target.webSocketDebuggerUrl,
36188
- "setDraft",
36189
- createBridgeSetDraftPromptExpression(normalizedPrompt),
36190
- false
36191
- );
36192
- return normalizeDraftPromptInsertionResult(result2);
36193
- } catch (error) {
36194
- return {
36195
- status: "failed",
36196
- reason: sanitizeUserFacingError(error) ?? "draft-insertion-failed",
36197
- route: null
36198
- };
36199
- }
36200
- }
36201
35904
  function launchOfficialCodexProfileInstance(options) {
36202
35905
  return enqueueProfileAction(
36203
35906
  options.profileName,
36204
35907
  () => launchOfficialCodexProfileInstanceWithRetries(options)
36205
35908
  );
36206
35909
  }
36207
- async function launchOfficialCodexProfileInstanceWithRetries(options) {
35910
+ function launchOfficialCodexProfileInstanceWithRetries(options) {
35911
+ return withProfileLaunchFileLock(
35912
+ options.profileHome,
35913
+ () => launchOfficialCodexProfileInstanceUnlocked(options),
35914
+ {
35915
+ profileKey: options.profileKey,
35916
+ onBusy: () => ({
35917
+ status: "failed",
35918
+ profileName: options.profileName,
35919
+ instance: null,
35920
+ reason: "launch-in-progress"
35921
+ })
35922
+ }
35923
+ );
35924
+ }
35925
+ async function launchOfficialCodexProfileInstanceUnlocked(options) {
36208
35926
  let launched = await launchOfficialCodexProfileInstanceOnce(options);
36209
35927
  for (let attempt = 1; attempt < LAUNCH_VERIFY_RETRIES; attempt += 1) {
36210
35928
  if (launched.status !== "failed" || launched.reason !== "app-server-not-verified") {
@@ -36249,7 +35967,25 @@ async function launchOfficialCodexProfileInstanceOnce(options) {
36249
35967
  if (staleLaunchPids.length > 0) {
36250
35968
  launchBaselineMainPids = (await readProcessRows()).filter((row) => isMainProcessRow(row, candidate)).map((row) => row.pid);
36251
35969
  }
36252
- const existing = await readManagedInstance(options.profileName);
35970
+ const instances = (await updateAppState((current) => current, {
35971
+ mode: "replace",
35972
+ cloneCurrent: false
35973
+ })).officialCodex.instancesByProfileName;
35974
+ if (options.profileKey) {
35975
+ for (const instance of Object.values(instances)) {
35976
+ if (instance.profileName === options.profileName || instance.profileKey !== options.profileKey) continue;
35977
+ const runtime = await resolveInstanceRuntimeState({ instance, candidate, rows: await readProcessRows() });
35978
+ if (runtime.running) {
35979
+ return {
35980
+ status: "failed",
35981
+ profileName: options.profileName,
35982
+ instance: managedInstanceToPayload(instance, true, runtime.appServerPid, runtime.startedAt),
35983
+ reason: `This account already has a Codex window under profile '${instance.profileName}'. Open that profile instead.`
35984
+ };
35985
+ }
35986
+ }
35987
+ }
35988
+ const existing = instances[options.profileName] ?? null;
36253
35989
  const desiredQolSettings = resolveDesiredQolSettings({
36254
35990
  requested: options.desiredQolSettings,
36255
35991
  existing: existing?.desiredQolSettings
@@ -36342,7 +36078,10 @@ async function launchOfficialCodexProfileInstanceOnce(options) {
36342
36078
  candidate,
36343
36079
  options.profileHome,
36344
36080
  options.profileName,
36345
- new Set(launchBaselineMainPids)
36081
+ new Set(launchBaselineMainPids),
36082
+ {
36083
+ environment: options.environment
36084
+ }
36346
36085
  );
36347
36086
  if (launch.pid !== null && launch.startedAt !== null && launch.cdpPort !== null) {
36348
36087
  launchedProcess = {
@@ -39064,6 +38803,19 @@ var ProfileManager = class {
39064
38803
  const workspace = this.resolveWorkspaceIdentity(data, resolvedMetadata);
39065
38804
  const workspaceId = workspace.id || DEFAULT_WORKSPACE_ID;
39066
38805
  const workspaceName = workspace.name ?? null;
38806
+ const identityKey = this.resolveProfileIdentityFromData(null, data, resolvedMetadata);
38807
+ if (identityKey && (!existingRecord || identityKey !== this.resolveProfileIdentityFromRecord(existingRecord) || workspaceId !== this.normalizeWorkspaceId(existingRecord.workspaceId) || this.resolveAuthMethod(data) !== this.resolveAuthMethod(existingRecord.data))) {
38808
+ const duplicate = await this.getProfileRowByIdentityAndWorkspace(
38809
+ identityKey,
38810
+ workspaceId,
38811
+ { authMethod: this.resolveAuthMethod(data) }
38812
+ );
38813
+ if (duplicate && duplicate.name !== resolvedName) {
38814
+ throw new Error(
38815
+ `Account is already saved as profile '${duplicate.name}'. Switch to or delete that profile before creating another.`
38816
+ );
38817
+ }
38818
+ }
39067
38819
  if (!data.workspace_id) {
39068
38820
  data.workspace_id = workspaceId;
39069
38821
  }
@@ -40467,27 +40219,6 @@ var ProfileManager = class {
40467
40219
  const description = this.describeActiveAuth(authData);
40468
40220
  const normalizedProfile = description.normalized;
40469
40221
  normalizedProfile.created_at = normalizedProfile.created_at ?? (/* @__PURE__ */ new Date()).toISOString();
40470
- const identityKey = this.resolveProfileIdentityFromData(
40471
- null,
40472
- normalizedProfile,
40473
- description.metadata
40474
- );
40475
- const workspace = this.resolveWorkspaceIdentity(
40476
- normalizedProfile,
40477
- description.metadata
40478
- );
40479
- if (identityKey) {
40480
- const duplicate = await this.getProfileRowByIdentityAndWorkspace(
40481
- identityKey,
40482
- workspace.id ?? DEFAULT_WORKSPACE_ID,
40483
- { authMethod: this.resolveAuthMethod(normalizedProfile) }
40484
- );
40485
- if (duplicate && duplicate.name !== profileName) {
40486
- throw new Error(
40487
- `Account is already saved as profile '${duplicate.name}'. Switch to or delete that profile before creating another.`
40488
- );
40489
- }
40490
- }
40491
40222
  await this.persistProfileRecord(
40492
40223
  profileName,
40493
40224
  normalizedProfile,
@@ -40560,20 +40291,6 @@ var ProfileManager = class {
40560
40291
  `Active Codex login is for a different OpenAI identity than profile '${profileName}'. Create a new profile for that login instead.`
40561
40292
  );
40562
40293
  }
40563
- if (existingIdentity && normalized.workspace_id) {
40564
- const targetWorkspaceId = normalized.workspace_id;
40565
- const currentWorkspaceId = currentWorkspace.id ?? DEFAULT_WORKSPACE_ID;
40566
- if (targetWorkspaceId !== currentWorkspaceId) {
40567
- const duplicate = await this.getProfileRowByIdentityAndWorkspace(existingIdentity, targetWorkspaceId, {
40568
- authMethod: this.resolveAuthMethod(existing)
40569
- });
40570
- if (duplicate && duplicate.name !== profileName) {
40571
- throw new Error(
40572
- `Account is already saved as profile '${duplicate.name}'. Switch to or delete that profile before creating another.`
40573
- );
40574
- }
40575
- }
40576
- }
40577
40294
  const { profile: merged, metadata } = this.mergeProfileRecords(existing, normalized);
40578
40295
  delete merged.tokenAlert;
40579
40296
  await this.persistProfileRecord(profileName, merged, metadata);
@@ -43553,8 +43270,137 @@ function normalizeRawMessage(rawMessage) {
43553
43270
  }
43554
43271
  return cleaned;
43555
43272
  }
43273
+ var KNOWN_ERRORS = {
43274
+ "desktop-llm-route-bound-running": {
43275
+ message: "This model is used by an open Codex window.",
43276
+ recovery: "Close that window, then save again."
43277
+ },
43278
+ "desktop-llm-route-bound": {
43279
+ message: "This model is used by an account.",
43280
+ recovery: "Change that account's model first."
43281
+ },
43282
+ "desktop-llm-provider-bound": {
43283
+ message: "This provider is used by an account.",
43284
+ recovery: "Remove or change that account first."
43285
+ },
43286
+ "desktop-llm-route-slug-collision": {
43287
+ message: "Another model already uses that name.",
43288
+ recovery: "Choose a different name."
43289
+ },
43290
+ "desktop-llm-route-not-verified": {
43291
+ message: "This model has not been tested yet.",
43292
+ recovery: "Test the model, then use it."
43293
+ },
43294
+ "desktop-llm-credential-missing": {
43295
+ message: "This provider has no API key.",
43296
+ recovery: "Add the key under Settings, Model Providers."
43297
+ },
43298
+ "desktop-llm-provider-credential-missing": {
43299
+ message: "This provider has no API key.",
43300
+ recovery: "Add the key under Settings, Model Providers."
43301
+ },
43302
+ "external-profile-not-ready": {
43303
+ message: "This account's model is not ready.",
43304
+ recovery: "Finish its setup under Settings, Model Providers."
43305
+ },
43306
+ "external-profile-route-not-ready": {
43307
+ message: "This account's model is not ready.",
43308
+ recovery: "Finish its setup under Settings, Model Providers."
43309
+ },
43310
+ "quit-custom-provider-profile-before-change": {
43311
+ message: "This account's Codex window is open.",
43312
+ recovery: "Close the window, then make the change."
43313
+ },
43314
+ "quit-managed-profile-before-native-restore": {
43315
+ message: "This account's Codex window is open.",
43316
+ recovery: "Close the window, then restore its settings."
43317
+ },
43318
+ "profile-name-already-used": {
43319
+ message: "Another account already uses that name.",
43320
+ recovery: "Choose a different name."
43321
+ },
43322
+ "unverified-official-codex-window": {
43323
+ message: "A Codex window is open that CodexUse cannot confirm belongs to this account.",
43324
+ recovery: "Close that window, then open the account again."
43325
+ },
43326
+ "multiple-official-app-variants-running": {
43327
+ message: "More than one version of the Codex app is running.",
43328
+ recovery: "Quit the extra one, then try again."
43329
+ },
43330
+ "previous-instance-still-running": {
43331
+ message: "The previous Codex window is still closing.",
43332
+ recovery: "Wait a moment, then try again."
43333
+ },
43334
+ "launch-in-progress": {
43335
+ message: "This account is already opening.",
43336
+ recovery: "Wait for its window to appear."
43337
+ },
43338
+ "official-codex-app-not-found": {
43339
+ message: "The Codex app is not installed on this Mac.",
43340
+ recovery: "Install Codex, then try again."
43341
+ },
43342
+ "work-config-invalid-toml": {
43343
+ message: "The settings are not valid TOML. Nothing was changed.",
43344
+ recovery: "Fix the syntax, then save again."
43345
+ },
43346
+ "work-config-secret": {
43347
+ message: "Settings cannot contain API keys, tokens, or passwords.",
43348
+ recovery: "Remove the secret, then save again."
43349
+ },
43350
+ "work-config-planner-tools-managed": {
43351
+ message: "CodexUse manages the codexuse_work tool entry.",
43352
+ recovery: "Remove that entry, then save again."
43353
+ },
43354
+ "work-config-shared-stale": {
43355
+ message: "The shared settings changed after you opened them.",
43356
+ recovery: "Reload, then apply your change again."
43357
+ },
43358
+ "work-config-override-stale": {
43359
+ message: "This account's settings changed after you opened them.",
43360
+ recovery: "Reload, then apply your change again."
43361
+ },
43362
+ "work-config-external-changed": {
43363
+ message: "This account's Codex settings were changed outside CodexUse.",
43364
+ recovery: "Open the account, review the outside changes, and import them first."
43365
+ },
43366
+ "work-config-external-review-stale": {
43367
+ message: "The outside settings changed after you reviewed them.",
43368
+ recovery: "Reload and review them again."
43369
+ },
43370
+ "work-config-changed-during-save": {
43371
+ message: "The settings changed while saving. Nothing was applied.",
43372
+ recovery: "Reload, then save again."
43373
+ },
43374
+ "work-config-write-not-confirmed": {
43375
+ message: "CodexUse wrote the settings but could not read them back.",
43376
+ recovery: "Reload to check what was saved."
43377
+ },
43378
+ "Enable third-party providers before authorizing a custom-provider worker.": {
43379
+ message: "Allow third-party providers for this folder before using a custom-model worker.",
43380
+ recovery: "Turn on the allowance in the folder's options, then start again."
43381
+ }
43382
+ };
43383
+ function findKnownError(cleaned) {
43384
+ for (const [key, entry] of Object.entries(KNOWN_ERRORS)) {
43385
+ const matches = key.includes(" ") ? cleaned.includes(key) : new RegExp(`(^|[^a-z0-9-])${key}([^a-z0-9-]|$)`).test(cleaned);
43386
+ if (matches) {
43387
+ return entry;
43388
+ }
43389
+ }
43390
+ return null;
43391
+ }
43556
43392
  function resolveCategory(cleaned, options) {
43557
43393
  const lower = cleaned.toLowerCase();
43394
+ const known = findKnownError(cleaned);
43395
+ if (known) {
43396
+ return {
43397
+ code: "ERR_ACTION_REQUIRED",
43398
+ title: "Something needs to change first",
43399
+ message: known.message,
43400
+ recovery: known.recovery,
43401
+ retryable: true
43402
+ };
43403
+ }
43558
43404
  if (options.notFoundFallback && (lower.includes("enoent") || lower.includes("not found"))) {
43559
43405
  return {
43560
43406
  code: "ERR_NOT_FOUND",
@@ -43569,7 +43415,7 @@ function resolveCategory(cleaned, options) {
43569
43415
  code: "ERR_RATE_LIMIT",
43570
43416
  title: "Rate limit reached",
43571
43417
  message: "The provider is rate limited right now.",
43572
- recovery: "Wait a moment, switch profiles, or try again.",
43418
+ recovery: "Wait a moment, open another account, or try again.",
43573
43419
  retryable: true
43574
43420
  };
43575
43421
  }
@@ -43596,7 +43442,7 @@ function resolveCategory(cleaned, options) {
43596
43442
  code: "ERR_AUTH",
43597
43443
  title: "Sign-in expired",
43598
43444
  message: "This account needs to sign in again.",
43599
- recovery: "Reconnect the profile, then retry the action.",
43445
+ recovery: "Reconnect the account, then retry the action.",
43600
43446
  retryable: true
43601
43447
  };
43602
43448
  }
@@ -43632,7 +43478,7 @@ function resolveCategory(cleaned, options) {
43632
43478
  code: "ERR_PROVIDER",
43633
43479
  title: "Provider request failed",
43634
43480
  message: "The AI provider rejected or failed the request.",
43635
- recovery: "Try again, or switch the active profile or model.",
43481
+ recovery: "Try again, open another account, or change the model.",
43636
43482
  retryable: true
43637
43483
  };
43638
43484
  }
@@ -43902,7 +43748,6 @@ async function coordinateOfficialCodexProfileSwitch(options) {
43902
43748
  }
43903
43749
  }
43904
43750
  const transition = await applyOfficialCodexLiveAccountSwitch({
43905
- carryDraft: options.carryDraft === true,
43906
43751
  profileName: targetProfileName,
43907
43752
  profileKey: options.targetProfileKey ?? null,
43908
43753
  desiredQolSettings: options.desiredQolSettings,
@@ -44650,7 +44495,7 @@ async function coordinateCliOfficialCodexProfileSwitch(options) {
44650
44495
  actor: "cli",
44651
44496
  expectedSourceProfileName,
44652
44497
  standingTakeControlConsent: await readStandingTakeControlConsent(),
44653
- // ceiling: CLI cannot own persisted live-login expiry maintenance; upgrade when a resident backend handoff is available.
44498
+ // ceiling: CLI cannot own persisted live-login expiry maintenance; upgrade when a resident backend recovery process is available.
44654
44499
  allowLiveLogin: false
44655
44500
  })
44656
44501
  );
@@ -44710,42 +44555,6 @@ async function coordinateCliOfficialCodexProfileSwitch(options) {
44710
44555
  configureOfficialCodexBridgeNotificationHandler(null);
44711
44556
  }
44712
44557
  }
44713
- async function prepareCliManagedDraftHandoff(manager, sourceProfileName, targetProfile) {
44714
- const sourceProfile = await getManagedProfileByName(
44715
- manager,
44716
- sourceProfileName
44717
- );
44718
- if (!sourceProfile) {
44719
- return;
44720
- }
44721
- const sourceRuntimeName = managedProfileRuntimeName(sourceProfile);
44722
- const targetRuntimeName = managedProfileRuntimeName(targetProfile);
44723
- const instances = await getOfficialCodexProfileInstances({
44724
- profileNames: [sourceRuntimeName, targetRuntimeName]
44725
- });
44726
- const source = instances.instances.find(
44727
- (instance) => instance.profileName === sourceRuntimeName && instance.running
44728
- );
44729
- if (!source) {
44730
- return;
44731
- }
44732
- const sourceContext = [
44733
- source.bridgeActiveThreadTitle ? `Source task: ${source.bridgeActiveThreadTitle}` : null,
44734
- source.bridgeActiveThreadId ? `Source task ID: ${source.bridgeActiveThreadId}` : null,
44735
- source.bridgeComposerText?.trim() ? `Visible draft:
44736
- ${source.bridgeComposerText.trim()}` : null
44737
- ].filter((line) => Boolean(line));
44738
- if (sourceContext.length === 0) {
44739
- return;
44740
- }
44741
- await setOfficialCodexProfileDraftPrompt(
44742
- targetRuntimeName,
44743
- [
44744
- "Continue the same Codex task after this profile switch.",
44745
- ...sourceContext
44746
- ].join("\n\n").slice(0, 2e4)
44747
- );
44748
- }
44749
44558
  async function coordinateCliManagedProfileSwitch(options) {
44750
44559
  const targetProfile = await getManagedProfileByName(
44751
44560
  options.profileManager,
@@ -44804,17 +44613,6 @@ async function coordinateCliManagedProfileSwitch(options) {
44804
44613
  mechanism = "relaunch";
44805
44614
  }
44806
44615
  await persistLastProfileName(targetProfile.name);
44807
- if (options.carryDraft && current.name && current.name !== targetProfile.name) {
44808
- await prepareCliManagedDraftHandoff(
44809
- options.profileManager,
44810
- current.name,
44811
- targetProfile
44812
- ).catch((error) => {
44813
- console.warn(
44814
- `Could not prepare profile handoff: ${error instanceof Error ? error.message : String(error)}`
44815
- );
44816
- });
44817
- }
44818
44616
  return {
44819
44617
  sourceProfileName: current.name,
44820
44618
  targetProfileName: targetProfile.name,
@@ -44837,17 +44635,6 @@ async function coordinateCliManagedProfileSwitch(options) {
44837
44635
  const managedOutcome = { ...outcome, sourceProfileName: current.name };
44838
44636
  if (managedOutcome.authStatus !== "not-started") {
44839
44637
  await persistLastProfileName(targetProfile.name);
44840
- if (options.carryDraft && currentProfile?.kind === "custom" && current.name && current.name !== targetProfile.name) {
44841
- await prepareCliManagedDraftHandoff(
44842
- options.profileManager,
44843
- current.name,
44844
- targetProfile
44845
- ).catch((error) => {
44846
- console.warn(
44847
- `Could not prepare profile handoff: ${error instanceof Error ? error.message : String(error)}`
44848
- );
44849
- });
44850
- }
44851
44638
  }
44852
44639
  return managedOutcome;
44853
44640
  }
@@ -45038,8 +44825,7 @@ async function runAutoRollPass(manager, options) {
45038
44825
  synchronizeApp: options.synchronizeOfficialCodex,
45039
44826
  launchIfNotRunning: options.launchOfficialCodexWhenClosed === true,
45040
44827
  explicitTakeControl: options.takeControl === true,
45041
- readStandingTakeControlConsent: async () => (await readAppSettings()).officialCodexAutoControlEnabled === true,
45042
- carryDraft: true
44828
+ readStandingTakeControlConsent: async () => (await readAppSettings()).officialCodexAutoControlEnabled === true
45043
44829
  });
45044
44830
  await recordCliCoordinatedOutcome(
45045
44831
  outcome,
@@ -45199,8 +44985,7 @@ async function handleProfileCommand(args2, version) {
45199
44985
  synchronizeApp: activation.synchronize,
45200
44986
  launchIfNotRunning: activation.launch,
45201
44987
  explicitTakeControl: takeControl,
45202
- readStandingTakeControlConsent: async () => (await readAppSettings()).officialCodexAutoControlEnabled === true,
45203
- carryDraft: true
44988
+ readStandingTakeControlConsent: async () => (await readAppSettings()).officialCodexAutoControlEnabled === true
45204
44989
  });
45205
44990
  await recordCliCoordinatedOutcome(
45206
44991
  outcome,
@@ -46540,7 +46325,7 @@ async function ensureCliStorageReady() {
46540
46325
  }
46541
46326
 
46542
46327
  // src/app/main.ts
46543
- var VERSION = true ? "6.2.0" : "0.0.0";
46328
+ var VERSION = true ? "6.2.1" : "0.0.0";
46544
46329
  async function runCli() {
46545
46330
  const args2 = process.argv.slice(2);
46546
46331
  if (args2.length === 0) {