@codexhost/cli-darwin-x64 0.18.0-beta.3 → 0.18.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +102 -57
  4. package/app/console-web.js +168 -123
  5. package/app/desktop-controller.mjs +292 -117
  6. package/app/host-runtime.mjs +5875 -3270
  7. package/app/plugins/antigravity/plugin.mjs +796 -307
  8. package/app/plugins/claude-code/plugin.mjs +214 -103
  9. package/app/plugins/codebuddy/plugin.mjs +108 -63
  10. package/app/plugins/codex-usage/plugin.mjs +94 -49
  11. package/app/plugins/copilot/plugin.mjs +99 -54
  12. package/app/plugins/cursor-cli/plugin.mjs +122 -77
  13. package/app/plugins/deepseek-harness/plugin.mjs +125 -80
  14. package/app/plugins/devin/plugin.mjs +99 -54
  15. package/app/plugins/grok/plugin.mjs +105 -60
  16. package/app/plugins/hermes/plugin.mjs +86 -41
  17. package/app/plugins/kimi-code/plugin.mjs +103 -58
  18. package/app/plugins/kiro-cli/plugin.mjs +99 -54
  19. package/app/plugins/omp/plugin.mjs +90 -45
  20. package/app/plugins/opencode/plugin.mjs +87 -42
  21. package/app/plugins/pi/plugin.mjs +103 -58
  22. package/app/plugins/qoder/plugin.mjs +115 -70
  23. package/app/plugins/qoder-cn/plugin.mjs +115 -70
  24. package/app/plugins/qwen-code/plugin.mjs +110 -65
  25. package/app/plugins/workbuddy/plugin.mjs +108 -63
  26. package/app/plugins/zcode/plugin.mjs +91 -46
  27. package/app/renderer-extension.js +362 -299
  28. package/app/web/assets/index-C0aXz2jD.js +199 -0
  29. package/app/web/codex-agent.png +0 -0
  30. package/app/web/codexhost-settings.js +163 -118
  31. package/app/web/index.html +1 -1
  32. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  33. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +61 -61
  35. package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +8 -8
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -63
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +12 -12
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -13
  46. package/app/web/plugins.json +4 -0
  47. package/app/web/sw.js +1 -6
  48. package/app/web-modules/server.mjs +2443 -1345
  49. package/bin/codexhost +0 -0
  50. package/libexec/codexhost-shim +0 -0
  51. package/libexec/codexhost-updater +0 -0
  52. package/package.json +1 -1
  53. package/app/web/assets/index-aKvkfNJN.js +0 -199
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __codexhostCreateRequire } from "node:module"; const require = __codexhostCreateRequire(import.meta.url);
2
2
  var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
3
+ var __export = (target2, all) => {
4
4
  for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: true });
5
+ __defProp(target2, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
8
  // ../../harness-discovery/dist/environment.js
@@ -1119,8 +1119,8 @@ function defineLazy(object2, key, getter) {
1119
1119
  function objectClone(obj2) {
1120
1120
  return Object.create(Object.getPrototypeOf(obj2), Object.getOwnPropertyDescriptors(obj2));
1121
1121
  }
1122
- function assignProp(target, prop, value) {
1123
- Object.defineProperty(target, prop, {
1122
+ function assignProp(target2, prop, value) {
1123
+ Object.defineProperty(target2, prop, {
1124
1124
  value,
1125
1125
  writable: true,
1126
1126
  enumerable: true,
@@ -1303,35 +1303,35 @@ function normalizeParams(_params) {
1303
1303
  return params;
1304
1304
  }
1305
1305
  function createTransparentProxy(getter) {
1306
- let target;
1306
+ let target2;
1307
1307
  return new Proxy({}, {
1308
1308
  get(_, prop, receiver) {
1309
- target ?? (target = getter());
1310
- return Reflect.get(target, prop, receiver);
1309
+ target2 ?? (target2 = getter());
1310
+ return Reflect.get(target2, prop, receiver);
1311
1311
  },
1312
1312
  set(_, prop, value, receiver) {
1313
- target ?? (target = getter());
1314
- return Reflect.set(target, prop, value, receiver);
1313
+ target2 ?? (target2 = getter());
1314
+ return Reflect.set(target2, prop, value, receiver);
1315
1315
  },
1316
1316
  has(_, prop) {
1317
- target ?? (target = getter());
1318
- return Reflect.has(target, prop);
1317
+ target2 ?? (target2 = getter());
1318
+ return Reflect.has(target2, prop);
1319
1319
  },
1320
1320
  deleteProperty(_, prop) {
1321
- target ?? (target = getter());
1322
- return Reflect.deleteProperty(target, prop);
1321
+ target2 ?? (target2 = getter());
1322
+ return Reflect.deleteProperty(target2, prop);
1323
1323
  },
1324
1324
  ownKeys(_) {
1325
- target ?? (target = getter());
1326
- return Reflect.ownKeys(target);
1325
+ target2 ?? (target2 = getter());
1326
+ return Reflect.ownKeys(target2);
1327
1327
  },
1328
1328
  getOwnPropertyDescriptor(_, prop) {
1329
- target ?? (target = getter());
1330
- return Reflect.getOwnPropertyDescriptor(target, prop);
1329
+ target2 ?? (target2 = getter());
1330
+ return Reflect.getOwnPropertyDescriptor(target2, prop);
1331
1331
  },
1332
1332
  defineProperty(_, prop, descriptor) {
1333
- target ?? (target = getter());
1334
- return Reflect.defineProperty(target, prop, descriptor);
1333
+ target2 ?? (target2 = getter());
1334
+ return Reflect.defineProperty(target2, prop, descriptor);
1335
1335
  }
1336
1336
  });
1337
1337
  }
@@ -11783,15 +11783,15 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
11783
11783
 
11784
11784
  // ../../../node_modules/zod/v4/core/to-json-schema.js
11785
11785
  function initializeContext(params) {
11786
- let target = params?.target ?? "draft-2020-12";
11787
- if (target === "draft-4")
11788
- target = "draft-04";
11789
- if (target === "draft-7")
11790
- target = "draft-07";
11786
+ let target2 = params?.target ?? "draft-2020-12";
11787
+ if (target2 === "draft-4")
11788
+ target2 = "draft-04";
11789
+ if (target2 === "draft-7")
11790
+ target2 = "draft-07";
11791
11791
  return {
11792
11792
  processors: params.processors ?? {},
11793
11793
  metadataRegistry: params?.metadata ?? globalRegistry,
11794
- target,
11794
+ target: target2,
11795
11795
  unrepresentable: params?.unrepresentable ?? "throw",
11796
11796
  override: params?.override ?? (() => {
11797
11797
  }),
@@ -12133,8 +12133,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
12133
12133
  return finalize(ctx, schema);
12134
12134
  };
12135
12135
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
12136
- const { libraryOptions, target } = params ?? {};
12137
- const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
12136
+ const { libraryOptions, target: target2 } = params ?? {};
12137
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io, processors });
12138
12138
  process2(schema, ctx);
12139
12139
  extractDefs(ctx, schema);
12140
12140
  return finalize(ctx, schema);
@@ -13193,8 +13193,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
13193
13193
  catch(params) {
13194
13194
  return _catch2(this, params);
13195
13195
  },
13196
- pipe(target) {
13197
- return pipe(this, target);
13196
+ pipe(target2) {
13197
+ return pipe(this, target2);
13198
13198
  },
13199
13199
  readonly() {
13200
13200
  return readonly(this);
@@ -15424,15 +15424,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15424
15424
  threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
15425
15425
  }).strict().superRefine(({ threads }, context) => {
15426
15426
  const seen = /* @__PURE__ */ new Set();
15427
- for (const [index, thread] of threads.entries()) {
15428
- if (seen.has(thread.threadId)) {
15427
+ for (const [index, thread2] of threads.entries()) {
15428
+ if (seen.has(thread2.threadId)) {
15429
15429
  context.addIssue({
15430
15430
  code: "custom",
15431
15431
  message: "Thread ownership-list results must be unique",
15432
15432
  path: ["threads", index, "threadId"]
15433
15433
  });
15434
15434
  }
15435
- seen.add(thread.threadId);
15435
+ seen.add(thread2.threadId);
15436
15436
  }
15437
15437
  });
15438
15438
  var threadSteeringInspectParamsSchema = external_exports.object({
@@ -15641,13 +15641,18 @@ var clientChannelResponseSchema = external_exports.object({
15641
15641
  });
15642
15642
 
15643
15643
  // ../../shared-contracts/dist/thread-catalog.js
15644
- var threadCatalogReadParamsSchema = external_exports.object({ includeArchived: external_exports.boolean().optional() }).strict();
15644
+ var threadCatalogReadParamsSchema = external_exports.object({
15645
+ includeArchived: external_exports.boolean().optional(),
15646
+ /** Absent means first page; null means this branch is exhausted. Native cursors only. */
15647
+ officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
15648
+ }).strict();
15645
15649
  var threadCatalogReadResultSchema = external_exports.object({
15646
15650
  threads: external_exports.array(jsonObjectSchema),
15647
15651
  ownership: external_exports.array(threadOwnershipSchema),
15648
15652
  /** Known archived IDs, including visible local external records even when their rows are
15649
- * excluded. Native archived IDs are complete only when includeArchived is true. */
15650
- archivedThreadIds: external_exports.array(hostThreadIdSchema)
15653
+ * excluded. Native archived IDs describe only the returned page, never a complete set. */
15654
+ archivedThreadIds: external_exports.array(hostThreadIdSchema),
15655
+ officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
15651
15656
  }).strict();
15652
15657
 
15653
15658
  // ../../shared-contracts/dist/voice.js
@@ -15862,7 +15867,7 @@ var idleReleaseSettingsSchema = external_exports.strictObject({
15862
15867
  });
15863
15868
  var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
15864
15869
  enabled: false,
15865
- timeoutMinutes: 30
15870
+ timeoutMinutes: 10
15866
15871
  });
15867
15872
 
15868
15873
  // ../../shared-contracts/dist/harness-preferences.js
@@ -16765,6 +16770,44 @@ var remoteSshSetupParamsSchema = external_exports.object({
16765
16770
  }).strict();
16766
16771
  var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
16767
16772
 
16773
+ // ../../shared-contracts/dist/remote-sessions.js
16774
+ var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
16775
+ var identity = external_exports.string().min(1).max(1024);
16776
+ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16777
+ var thread = { ...target, threadId: identity };
16778
+ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16779
+ external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16780
+ external_exports.strictObject({
16781
+ kind: external_exports.literal("list"),
16782
+ ...target,
16783
+ cursor: external_exports.string().nullable(),
16784
+ archived: external_exports.boolean()
16785
+ }),
16786
+ external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16787
+ external_exports.strictObject({
16788
+ kind: external_exports.literal("prompt"),
16789
+ ...thread,
16790
+ epoch: identity,
16791
+ text: external_exports.string().min(1).max(8e3),
16792
+ requestId: identity.optional()
16793
+ }),
16794
+ external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
16795
+ external_exports.strictObject({
16796
+ kind: external_exports.literal("rename"),
16797
+ ...thread,
16798
+ epoch: identity,
16799
+ name: external_exports.string().min(1).max(512)
16800
+ }),
16801
+ external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread, epoch: identity, archived: external_exports.boolean() }),
16802
+ external_exports.strictObject({
16803
+ kind: external_exports.literal("respond"),
16804
+ ...thread,
16805
+ epoch: identity,
16806
+ requestId: external_exports.union([identity, external_exports.number().int()]),
16807
+ result: external_exports.record(external_exports.string(), external_exports.unknown())
16808
+ })
16809
+ ]);
16810
+
16768
16811
  // ../../shared-contracts/dist/remote-connections.js
16769
16812
  var hostId = external_exports.string().min(1).max(1024);
16770
16813
  var codexSshConnectionSchema = external_exports.object({
@@ -16785,7 +16828,9 @@ var codexSshDraftSchema = external_exports.strictObject({
16785
16828
  identity: external_exports.string().max(4096).nullable()
16786
16829
  });
16787
16830
  var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
16831
+ external_exports.strictObject({ action: external_exports.literal("session"), operation: remoteSessionOperationSchema }),
16788
16832
  external_exports.strictObject({ action: external_exports.literal("list") }),
16833
+ external_exports.strictObject({ action: external_exports.literal("catalog") }),
16789
16834
  external_exports.strictObject({
16790
16835
  action: external_exports.literal("read-thread"),
16791
16836
  hostId: hostId.refine((id) => id !== "local"),
@@ -17340,7 +17385,7 @@ var execute = promisify(execFile2);
17340
17385
  var ENDPOINT = "https://api2.cursor.sh/aiserver.v1.DashboardService/";
17341
17386
  var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
17342
17387
  var percent = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.min(100, value) : void 0;
17343
- function projectCursorAccountUsage(usage, identity, plan) {
17388
+ function projectCursorAccountUsage(usage, identity2, plan) {
17344
17389
  const data = record3(usage);
17345
17390
  const buckets = record3(data.planUsage);
17346
17391
  const usedPercent = percent(buckets.autoPercentUsed);
@@ -17350,7 +17395,7 @@ function projectCursorAccountUsage(usage, identity, plan) {
17350
17395
  const date5 = new Date(end);
17351
17396
  const resetsAt = Number.isFinite(date5.getTime()) && end > 0 ? date5.toISOString() : void 0;
17352
17397
  const apiPercent = percent(buckets.apiPercentUsed);
17353
- const email3 = record3(identity).email;
17398
+ const email3 = record3(identity2).email;
17354
17399
  const planName = record3(record3(plan).planInfo).planName;
17355
17400
  const result = harnessAccountSnapshotSchema.safeParse({
17356
17401
  ...typeof email3 === "string" && email3.trim() ? { email: email3 } : {},
@@ -17410,12 +17455,12 @@ async function fetchCursorAccount(input = {}) {
17410
17455
  });
17411
17456
  return response.ok ? response.json() : null;
17412
17457
  };
17413
- const [usage, identity, plan] = await Promise.all([
17458
+ const [usage, identity2, plan] = await Promise.all([
17414
17459
  request("GetCurrentPeriodUsage"),
17415
17460
  request("GetMe").catch(() => null),
17416
17461
  request("GetPlanInfo").catch(() => null)
17417
17462
  ]);
17418
- return projectCursorAccountUsage(usage, identity, plan);
17463
+ return projectCursorAccountUsage(usage, identity2, plan);
17419
17464
  } catch {
17420
17465
  return null;
17421
17466
  }
@@ -21479,11 +21524,11 @@ var AgentApp = class {
21479
21524
  [runAgentConnectHandlers](connection) {
21480
21525
  runConnectHandlers(connection, this.connectHandlers);
21481
21526
  }
21482
- connect(target, options = {}) {
21483
- return this.connectConnection(target, options).connection;
21527
+ connect(target2, options = {}) {
21528
+ return this.connectConnection(target2, options).connection;
21484
21529
  }
21485
- connectWith(target, op) {
21486
- const { rawConnection, connection } = this.connectConnection(target);
21530
+ connectWith(target2, op) {
21531
+ const { rawConnection, connection } = this.connectConnection(target2);
21487
21532
  return rawConnection.runUntil(() => op(connection.client));
21488
21533
  }
21489
21534
  /**
@@ -21524,22 +21569,22 @@ var AgentApp = class {
21524
21569
  registerAppNotification(this.builder, spec, (params, cx, signal) => agentNotificationContext(params, AgentContext.create(cx), signal), handler);
21525
21570
  return this;
21526
21571
  }
21527
- connectConnection(target, options = {}) {
21528
- if (isStream(target)) {
21529
- const state2 = this.openStreamConnection(target);
21572
+ connectConnection(target2, options = {}) {
21573
+ if (isStream(target2)) {
21574
+ const state2 = this.openStreamConnection(target2);
21530
21575
  if (!options.deferConnectHandlers) {
21531
21576
  this[runAgentConnectHandlers](state2.connection);
21532
21577
  }
21533
21578
  return state2;
21534
21579
  }
21535
21580
  const [thisStream, peerStream] = memoryStreamPair();
21536
- const peerRawConnection = target[appBuilder]().connect(peerStream, stableConnectionOptions);
21581
+ const peerRawConnection = target2[appBuilder]().connect(peerStream, stableConnectionOptions);
21537
21582
  const peerConnection = clientConnection(peerRawConnection);
21538
21583
  const state = this.openStreamConnection(thisStream);
21539
21584
  void state.rawConnection.closed.then(() => peerConnection.close());
21540
21585
  void peerRawConnection.closed.then(() => state.connection.close());
21541
21586
  try {
21542
- target[runClientConnectHandlers](peerConnection);
21587
+ target2[runClientConnectHandlers](peerConnection);
21543
21588
  this[runAgentConnectHandlers](state.connection);
21544
21589
  } catch (error51) {
21545
21590
  peerConnection.close(error51);
@@ -21579,11 +21624,11 @@ var ClientApp = class {
21579
21624
  [runClientConnectHandlers](connection) {
21580
21625
  runConnectHandlers(connection, this.connectHandlers);
21581
21626
  }
21582
- connect(target) {
21583
- return this.connectConnection(target).connection;
21627
+ connect(target2) {
21628
+ return this.connectConnection(target2).connection;
21584
21629
  }
21585
- connectWith(target, op) {
21586
- const { rawConnection, connection } = this.connectConnection(target);
21630
+ connectWith(target2, op) {
21631
+ const { rawConnection, connection } = this.connectConnection(target2);
21587
21632
  return rawConnection.runUntil(() => op(connection.agent));
21588
21633
  }
21589
21634
  /**
@@ -21624,20 +21669,20 @@ var ClientApp = class {
21624
21669
  registerAppNotification(this.builder, spec, (params, cx, signal) => clientNotificationContext(params, ClientContext.create(cx), signal), handler);
21625
21670
  return this;
21626
21671
  }
21627
- connectConnection(target) {
21628
- if (isStream(target)) {
21629
- const state2 = this.openStreamConnection(target);
21672
+ connectConnection(target2) {
21673
+ if (isStream(target2)) {
21674
+ const state2 = this.openStreamConnection(target2);
21630
21675
  this[runClientConnectHandlers](state2.connection);
21631
21676
  return state2;
21632
21677
  }
21633
21678
  const [thisStream, peerStream] = memoryStreamPair();
21634
- const peerRawConnection = target[appBuilder]().connect(peerStream, stableConnectionOptions);
21679
+ const peerRawConnection = target2[appBuilder]().connect(peerStream, stableConnectionOptions);
21635
21680
  const peerConnection = agentConnection(peerRawConnection);
21636
21681
  const state = this.openStreamConnection(thisStream);
21637
21682
  void state.rawConnection.closed.then(() => peerConnection.close());
21638
21683
  void peerRawConnection.closed.then(() => state.connection.close());
21639
21684
  try {
21640
- target[runAgentConnectHandlers](peerConnection);
21685
+ target2[runAgentConnectHandlers](peerConnection);
21641
21686
  this[runClientConnectHandlers](state.connection);
21642
21687
  } catch (error51) {
21643
21688
  peerConnection.close(error51);
@@ -23274,11 +23319,11 @@ function cursorSnapshot(sessionId, native, replay, nativeSubagentId) {
23274
23319
  if (groups.length !== native.length)
23275
23320
  throw new Error("Cursor replay/native turn count mismatch");
23276
23321
  const turns = groups.map((group, index) => {
23277
- const identity = native[index];
23278
- if (!identity || identity.text !== group.text)
23322
+ const identity2 = native[index];
23323
+ if (!identity2 || identity2.text !== group.text)
23279
23324
  throw new Error("Cursor replay/native prompt mismatch");
23280
23325
  const items = [];
23281
- const output = new CursorTurnOutput(hostTurnIdSchema.parse(identity.id), (event) => {
23326
+ const output = new CursorTurnOutput(hostTurnIdSchema.parse(identity2.id), (event) => {
23282
23327
  if (event.type === "item.completed")
23283
23328
  items.push(event.snapshot);
23284
23329
  }, index);
@@ -23292,11 +23337,11 @@ function cursorSnapshot(sessionId, native, replay, nativeSubagentId) {
23292
23337
  nativeTurnRef: nativeTurnRefSchema.parse({
23293
23338
  harnessId: "cursor-cli",
23294
23339
  nativeSessionId: sessionId,
23295
- nativeTurnKey: identity.id,
23340
+ nativeTurnKey: identity2.id,
23296
23341
  formatVersion: 1
23297
23342
  }),
23298
23343
  input: [{ type: "text", text: group.text }],
23299
- ...cursorForkAvailable() && (index === native.length - 1 || native[index + 1]?.rewindRoot) ? { checkpoint: cursorCheckpoint(sessionId, identity.id) } : {},
23344
+ ...cursorForkAvailable() && (index === native.length - 1 || native[index + 1]?.rewindRoot) ? { checkpoint: cursorCheckpoint(sessionId, identity2.id) } : {},
23300
23345
  items,
23301
23346
  outcome: {
23302
23347
  status: "unknown",
@@ -23580,13 +23625,13 @@ async function runCursorForkTerminal(options, sessionId, signal, rewind) {
23580
23625
 
23581
23626
  // dist/fork.js
23582
23627
  var retryableBackupCodes = /* @__PURE__ */ new Set([0, 5, 6]);
23583
- async function backupStore(source, target) {
23628
+ async function backupStore(source, target2) {
23584
23629
  for (let attempt = 1; ; attempt++) {
23585
23630
  const db = new DatabaseSync2(source, { readOnly: true });
23586
23631
  const wake = setInterval(() => {
23587
23632
  }, 10);
23588
23633
  try {
23589
- await backup(db, target);
23634
+ await backup(db, target2);
23590
23635
  return;
23591
23636
  } catch (error51) {
23592
23637
  const code = error51 && typeof error51 === "object" && "errcode" in error51 ? error51.errcode : -1;
@@ -23596,13 +23641,13 @@ async function backupStore(source, target) {
23596
23641
  clearInterval(wake);
23597
23642
  db.close();
23598
23643
  }
23599
- await rm2(target, { force: true });
23644
+ await rm2(target2, { force: true });
23600
23645
  await new Promise((resolve) => setTimeout(resolve, 50 * attempt));
23601
23646
  }
23602
23647
  }
23603
- async function copySnapshot(source, target) {
23604
- await backupStore(path8.join(source, "store.db"), path8.join(target, "store.db"));
23605
- await copyFile(path8.join(source, "meta.json"), path8.join(target, "meta.json"));
23648
+ async function copySnapshot(source, target2) {
23649
+ await backupStore(path8.join(source, "store.db"), path8.join(target2, "store.db"));
23650
+ await copyFile(path8.join(source, "meta.json"), path8.join(target2, "meta.json"));
23606
23651
  }
23607
23652
  function storeIdentity(directory, hashBlobs = true) {
23608
23653
  const db = new DatabaseSync2(path8.join(directory, "store.db"), { readOnly: true });
@@ -23645,11 +23690,11 @@ async function forkCursorSession(source, checkpoint, options, signal, forkOption
23645
23690
  signal.throwIfAborted();
23646
23691
  const sourceDirectory = cursorSessionDirectory(source.nativeSessionId, options.environment);
23647
23692
  const temporary = await mkdtemp2(path8.join(os3.tmpdir(), "codexhost-cursor-fork-"));
23648
- let target;
23693
+ let target2;
23649
23694
  let committed = false;
23650
23695
  const discard = async () => {
23651
- if (target && !committed)
23652
- await rm2(target, { recursive: true, force: true });
23696
+ if (target2 && !committed)
23697
+ await rm2(target2, { recursive: true, force: true });
23653
23698
  };
23654
23699
  try {
23655
23700
  const snapshotConfig = path8.join(temporary, "snapshot");
@@ -23720,8 +23765,8 @@ async function forkCursorSession(source, checkpoint, options, signal, forkOption
23720
23765
  if (!sourceUnchanged())
23721
23766
  throw new Error("Cursor source changed during fork");
23722
23767
  await mkdir(destination);
23723
- target = destination;
23724
- await copySnapshot(nativeFork, target);
23768
+ target2 = destination;
23769
+ await copySnapshot(nativeFork, target2);
23725
23770
  if (!sameTurns(readCursorNativeTurns(sessionId, options.cwd, options.environment), expected))
23726
23771
  throw new Error("Cursor fork history does not match source");
23727
23772
  return {
@@ -24965,15 +25010,15 @@ async function startBrokerLaunchAgent(harnessId, environment) {
24965
25010
  const uid = process.getuid?.();
24966
25011
  if (uid === void 0)
24967
25012
  return;
24968
- const target = `gui/${uid}/${harnessBrokerLaunchAgentLabel(harnessId)}`;
24969
- if (await runLaunchctl(["kickstart", target]))
25013
+ const target2 = `gui/${uid}/${harnessBrokerLaunchAgentLabel(harnessId)}`;
25014
+ if (await runLaunchctl(["kickstart", target2]))
24970
25015
  return;
24971
25016
  await runLaunchctl([
24972
25017
  "bootstrap",
24973
25018
  `gui/${uid}`,
24974
25019
  harnessBrokerLaunchAgentPlistPath(environment, harnessId)
24975
25020
  ]);
24976
- await runLaunchctl(["kickstart", target]);
25021
+ await runLaunchctl(["kickstart", target2]);
24977
25022
  }
24978
25023
  var BrokerConnection = class _BrokerConnection {
24979
25024
  #onClose;