@liberseek/boft-cli-win32-arm64 0.7.8 → 0.7.9

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.
@@ -24,7 +24,8 @@
24
24
  "cursor-cli",
25
25
  "qoder",
26
26
  "qoder-cn",
27
- "kimi-code"
27
+ "kimi-code",
28
+ "zcode"
28
29
  ];
29
30
  var DEFAULT_RENDERER_AGENTS = KNOWN_RENDERER_AGENTS;
30
31
  function defaultIdFactory(sequence) {
@@ -166,6 +167,8 @@
166
167
  else if (agent === "qoder-cn") delete state.qoderCnModel;
167
168
  if (agent === "kimi-code" && model) state.kimiCodeModel = model;
168
169
  else if (agent === "kimi-code") delete state.kimiCodeModel;
170
+ if (agent === "zcode" && model) state.zcodeModel = model;
171
+ else if (agent === "zcode") delete state.zcodeModel;
169
172
  if (agent === "pi" && thinkingOptionId) state.piThinkingOptionId = thinkingOptionId;
170
173
  else if (agent === "pi") delete state.piThinkingOptionId;
171
174
  if (agent === "claude-code" && thinkingOptionId) {
@@ -202,6 +205,9 @@
202
205
  if (agent === "kimi-code" && thinkingOptionId) {
203
206
  state.kimiCodeThinkingOptionId = thinkingOptionId;
204
207
  } else if (agent === "kimi-code") delete state.kimiCodeThinkingOptionId;
208
+ if (agent === "zcode" && thinkingOptionId) {
209
+ state.zcodeThinkingOptionId = thinkingOptionId;
210
+ } else if (agent === "zcode") delete state.zcodeThinkingOptionId;
205
211
  if (agent !== "codex") {
206
212
  const permissionModeByAgent = {};
207
213
  for (const candidate of [
@@ -220,7 +226,8 @@
220
226
  "cursor-cli",
221
227
  "qoder",
222
228
  "qoder-cn",
223
- "kimi-code"
229
+ "kimi-code",
230
+ "zcode"
224
231
  ]) {
225
232
  const current = state.permissionModeByAgent?.[candidate];
226
233
  if (candidate !== agent && current) permissionModeByAgent[candidate] = current;
@@ -252,6 +259,7 @@
252
259
  if (agent === "qoder") return state.qoderModel;
253
260
  if (agent === "qoder-cn") return state.qoderCnModel;
254
261
  if (agent === "kimi-code") return state.kimiCodeModel;
262
+ if (agent === "zcode") return state.zcodeModel;
255
263
  return void 0;
256
264
  }
257
265
  thinkingOptionForAgent(composer, agent) {
@@ -269,6 +277,7 @@
269
277
  if (agent === "qoder") return state.qoderThinkingOptionId;
270
278
  if (agent === "qoder-cn") return state.qoderCnThinkingOptionId;
271
279
  if (agent === "kimi-code") return state.kimiCodeThinkingOptionId;
280
+ if (agent === "zcode") return state.zcodeThinkingOptionId;
272
281
  return void 0;
273
282
  }
274
283
  permissionModeForAgent(composer, agent) {
@@ -300,6 +309,7 @@
300
309
  else if (agent === "qoder") state.qoderModel = model;
301
310
  else if (agent === "qoder-cn") state.qoderCnModel = model;
302
311
  else if (agent === "kimi-code") state.kimiCodeModel = model;
312
+ else if (agent === "zcode") state.zcodeModel = model;
303
313
  else state.antigravityModel = model;
304
314
  return state;
305
315
  }
@@ -365,6 +375,10 @@
365
375
  state.kimiCodeThinkingOptionId = thinkingOptionId;
366
376
  } else if (agent === "kimi-code") {
367
377
  delete state.kimiCodeThinkingOptionId;
378
+ } else if (agent === "zcode" && thinkingOptionId) {
379
+ state.zcodeThinkingOptionId = thinkingOptionId;
380
+ } else if (agent === "zcode") {
381
+ delete state.zcodeThinkingOptionId;
368
382
  }
369
383
  return state;
370
384
  }
@@ -453,6 +467,214 @@
453
467
  }
454
468
  };
455
469
 
470
+ // src/codex-ssh-adapter.ts
471
+ var record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
472
+ function createCodexSshClient(ownerWindow) {
473
+ function request(operation, params, signal) {
474
+ const bridge = ownerWindow.electronBridge;
475
+ if (!bridge?.sendMessageFromView)
476
+ return Promise.reject(new Error("Codex SSH settings are unavailable in this window"));
477
+ if (signal?.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
478
+ return new Promise((resolve, reject) => {
479
+ const requestId = ownerWindow.crypto.randomUUID();
480
+ const finish = (error51, value) => {
481
+ ownerWindow.clearTimeout(timer);
482
+ ownerWindow.removeEventListener("message", receive);
483
+ signal?.removeEventListener("abort", abort);
484
+ if (error51) reject(error51);
485
+ else resolve(value);
486
+ };
487
+ const abort = () => finish(new DOMException("Aborted", "AbortError"));
488
+ const receive = (event) => {
489
+ const message = event.data;
490
+ if (!record(message) || message.type !== "fetch-response" || message.requestId !== requestId)
491
+ return;
492
+ if (message.responseType !== "success" || typeof message.status !== "number" || message.status < 200 || message.status >= 300 || typeof message.bodyJsonString !== "string") {
493
+ finish(new Error("Codex SSH request failed; check the native Connections settings"));
494
+ return;
495
+ }
496
+ try {
497
+ finish(null, JSON.parse(message.bodyJsonString));
498
+ } catch {
499
+ finish(new Error("Invalid Codex SSH response"));
500
+ }
501
+ };
502
+ const timer = ownerWindow.setTimeout(
503
+ () => finish(new Error("Codex SSH request timed out; refresh before retrying")),
504
+ 15e3
505
+ );
506
+ ownerWindow.addEventListener("message", receive);
507
+ signal?.addEventListener("abort", abort, { once: true });
508
+ try {
509
+ Promise.resolve(
510
+ bridge.sendMessageFromView({
511
+ type: "fetch",
512
+ requestId,
513
+ method: "POST",
514
+ url: `vscode://codex/${operation}`,
515
+ body: JSON.stringify(params),
516
+ reportUploadProgress: false
517
+ })
518
+ ).catch((error51) => finish(error51));
519
+ } catch (error51) {
520
+ finish(error51);
521
+ }
522
+ });
523
+ }
524
+ async function list(signal) {
525
+ const result = await request("refresh-remote-connections", {}, signal);
526
+ if (!record(result) || !Array.isArray(result.remoteConnections))
527
+ throw new Error("Invalid Codex SSH connection list");
528
+ return result.remoteConnections.filter(
529
+ (item) => !(record(item) && ["wsl", "remote-control"].includes(String(item.source)))
530
+ ).map((item) => {
531
+ if (!record(item) || typeof item.hostId !== "string" || typeof item.displayName !== "string" || !["codex-managed", "discovered"].includes(String(item.source)) || typeof item.sshHost !== "string" || typeof item.autoConnect !== "boolean" || !(item.sshAlias == null || typeof item.sshAlias === "string") || !(item.identity == null || typeof item.identity === "string") || !(item.sshPort == null || Number.isInteger(item.sshPort) && Number(item.sshPort) > 0 && Number(item.sshPort) <= 65535)) {
532
+ throw new Error(
533
+ "This Codex version uses an unsupported SSH configuration; open native settings"
534
+ );
535
+ }
536
+ return {
537
+ ...item,
538
+ sshAlias: item.sshAlias ?? null,
539
+ identity: item.identity ?? null,
540
+ sshPort: item.sshPort ?? null
541
+ };
542
+ });
543
+ }
544
+ function saved(connection) {
545
+ return {
546
+ hostId: connection.hostId,
547
+ displayName: connection.displayName,
548
+ source: connection.source,
549
+ alias: connection.sshAlias,
550
+ hostname: connection.source === "discovered" ? null : connection.sshHost,
551
+ sshPort: connection.source === "discovered" ? null : connection.sshPort,
552
+ identity: connection.source === "discovered" ? null : connection.identity,
553
+ ...connection.connectionAnalyticsId ? { connectionAnalyticsId: connection.connectionAnalyticsId } : {}
554
+ };
555
+ }
556
+ async function mutate(previous, draft, signal) {
557
+ const current = await list(signal);
558
+ if (previous) {
559
+ const latest = current.find((item) => item.hostId === previous.hostId);
560
+ if (!latest || JSON.stringify(saved(latest)) !== JSON.stringify(saved(previous))) {
561
+ throw new Error("This connection changed in Codex. Refresh and edit it again.");
562
+ }
563
+ }
564
+ const next = current.filter((item) => item.hostId !== previous?.hostId).map(saved);
565
+ if (draft) {
566
+ const hostname3 = draft.hostname.trim();
567
+ const displayName = draft.displayName.trim();
568
+ if (!displayName || !hostname3 || hostname3.startsWith("-") || /\s/u.test(hostname3) || draft.sshPort !== null && (!Number.isInteger(draft.sshPort) || draft.sshPort < 1 || draft.sshPort > 65535)) {
569
+ throw new Error("Enter a name, SSH hostname (or alias), and a port between 1 and 65535");
570
+ }
571
+ if (current.some(
572
+ (item) => item.hostId !== previous?.hostId && item.displayName.trim() === displayName
573
+ )) {
574
+ throw new Error("A connection with this name already exists");
575
+ }
576
+ if (previous?.source === "discovered" && (hostname3 !== previous.sshHost || draft.sshPort !== previous.sshPort || draft.identity !== previous.identity)) {
577
+ throw new Error("Edit SSH-config connection details in native Codex settings");
578
+ }
579
+ next.push(
580
+ previous?.source === "discovered" ? { ...saved(previous), displayName } : {
581
+ hostId: previous?.hostId ?? `remote-ssh-codex-managed:${ownerWindow.crypto.randomUUID()}`,
582
+ displayName,
583
+ source: "codex-managed",
584
+ alias: null,
585
+ hostname: hostname3,
586
+ sshPort: draft.sshPort,
587
+ identity: draft.identity?.trim() || null,
588
+ ...previous?.connectionAnalyticsId ? { connectionAnalyticsId: previous.connectionAnalyticsId } : {}
589
+ }
590
+ );
591
+ }
592
+ await request("save-codex-managed-remote-ssh-connections", { remoteConnections: next }, signal);
593
+ }
594
+ return {
595
+ list,
596
+ save: (draft, previous, signal) => mutate(previous, draft, signal),
597
+ remove: (previous, signal) => mutate(previous, null, signal),
598
+ async connect(hostId2, enabled, signal) {
599
+ await request("set-remote-connection-auto-connect", { hostId: hostId2, autoConnect: enabled }, signal);
600
+ },
601
+ async state(hostId2, signal) {
602
+ const result = await request("app-server-connection-state", { hostId: hostId2 }, signal);
603
+ if (!record(result) || typeof result.state !== "string")
604
+ throw new Error("Invalid Codex connection state");
605
+ return {
606
+ state: result.state,
607
+ error: typeof result.error === "string" ? result.error : record(result.error) && typeof result.error.message === "string" ? result.error.message : null
608
+ };
609
+ }
610
+ };
611
+ }
612
+
613
+ // src/remote-connections-control.ts
614
+ function remoteUpdateTarget(local, remote) {
615
+ if (!remote.updateSupported || !remote.remote || !remote.installedVersion || !local?.runningVersion)
616
+ return null;
617
+ if (["installing", "restarting", "failed"].includes(remote.update.phase)) return null;
618
+ const stable = /^(\d+)\.(\d+)\.(\d+)$/u;
619
+ if (!stable.test(local.runningVersion) || !stable.test(remote.installedVersion)) return null;
620
+ const left = local.runningVersion.split(".").map(Number);
621
+ const right = remote.installedVersion.split(".").map(Number);
622
+ const index = left.findIndex((part, index2) => part !== right[index2]);
623
+ if (index >= 0 && (left[index] ?? 0) > (right[index] ?? 0)) return local.runningVersion;
624
+ if (index < 0 && remote.restartRequired) return remote.installedVersion;
625
+ return null;
626
+ }
627
+ function createRemoteConnectionsControl(ownerWindow, getClient) {
628
+ async function bounded(operation) {
629
+ let timer;
630
+ try {
631
+ return await Promise.race([
632
+ operation,
633
+ new Promise((_, reject) => {
634
+ timer = ownerWindow.setTimeout(
635
+ () => reject(new Error("Remote service did not respond; reconnect and retry")),
636
+ 8e3
637
+ );
638
+ })
639
+ ]);
640
+ } finally {
641
+ ownerWindow.clearTimeout(timer);
642
+ }
643
+ }
644
+ const control = {
645
+ ssh: createCodexSshClient(ownerWindow),
646
+ async setup(connection, action, version2, uninstallPackage) {
647
+ const client = getClient("local");
648
+ if (!client?.setupSsh)
649
+ throw new Error("SSH installation is unavailable; update local codexhost and restart");
650
+ return client.setupSsh({
651
+ hostname: connection.sshAlias ?? connection.sshHost,
652
+ port: connection.sshPort,
653
+ identity: connection.identity,
654
+ action,
655
+ version: version2 ?? null,
656
+ ...action === "uninstall" ? { uninstallPackage: uninstallPackage ?? false } : {}
657
+ });
658
+ },
659
+ async runtime(hostId2) {
660
+ const client = getClient(hostId2);
661
+ if (!client?.runtimeStatus)
662
+ throw new Error(
663
+ "Version management is unavailable; update codexhost on this host and reconnect"
664
+ );
665
+ return bounded(client.runtimeStatus());
666
+ },
667
+ async update(hostId2, version2) {
668
+ if (hostId2 === "local") throw new Error("Choose a remote SSH connection");
669
+ const client = getClient(hostId2);
670
+ if (!client?.updateRemote)
671
+ throw new Error("Remote update is unavailable; update this remote once and reconnect");
672
+ return bounded(client.updateRemote(version2));
673
+ }
674
+ };
675
+ return control;
676
+ }
677
+
456
678
  // ../../node_modules/zod/v4/classic/external.js
457
679
  var external_exports = {};
458
680
  __export(external_exports, {
@@ -647,7 +869,7 @@
647
869
  promise: () => promise,
648
870
  property: () => _property,
649
871
  readonly: () => readonly,
650
- record: () => record,
872
+ record: () => record2,
651
873
  refine: () => refine,
652
874
  regex: () => _regex,
653
875
  regexes: () => regexes_exports,
@@ -12985,7 +13207,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12985
13207
  preprocess: () => preprocess,
12986
13208
  promise: () => promise,
12987
13209
  readonly: () => readonly,
12988
- record: () => record,
13210
+ record: () => record2,
12989
13211
  refine: () => refine,
12990
13212
  set: () => set,
12991
13213
  strictObject: () => strictObject,
@@ -13954,7 +14176,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13954
14176
  inst.keyType = def.keyType;
13955
14177
  inst.valueType = def.valueType;
13956
14178
  });
13957
- function record(keyType, valueType, params) {
14179
+ function record2(keyType, valueType, params) {
13958
14180
  if (!valueType || !valueType._zod) {
13959
14181
  return new ZodRecord({
13960
14182
  type: "record",
@@ -14421,7 +14643,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14421
14643
  }, ...args);
14422
14644
  function json(params) {
14423
14645
  const jsonSchema = lazy(() => {
14424
- return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
14646
+ return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record2(string2(), jsonSchema)]);
14425
14647
  });
14426
14648
  return jsonSchema;
14427
14649
  }
@@ -15050,6 +15272,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15050
15272
  var hostItemIdSchema = opaqueIdSchema.brand();
15051
15273
  var hostInteractionIdSchema = opaqueIdSchema.brand();
15052
15274
 
15275
+ // ../shared-contracts/dist/thread-prewarm.js
15276
+ var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15277
+ var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15278
+
15053
15279
  // ../shared-contracts/dist/harness-plugins.js
15054
15280
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15055
15281
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -15118,6 +15344,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15118
15344
  url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
15119
15345
  });
15120
15346
  var CONSOLE_HOST_METHODS = Object.freeze([
15347
+ "codexhost/console/remote-connections",
15348
+ "codexhost/runtime/status",
15349
+ "codexhost/remote/ssh-setup",
15121
15350
  "codexhost/harness/plugins/list",
15122
15351
  "codexhost/harness/display-settings/get",
15123
15352
  "codexhost/harness/display-settings/set",
@@ -15573,8 +15802,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15573
15802
  message: "Cross-cwd Fork requires exact history Fork support"
15574
15803
  });
15575
15804
  var harnessPermissionModeScopeSchema = external_exports.enum(["live", "atCreate"]);
15576
- function permissionModeFixedAtCreate(configuration2) {
15577
- return configuration2.permissionModeScope === "atCreate";
15805
+ function permissionModeFixedAtCreate(configuration) {
15806
+ return configuration.permissionModeScope === "atCreate";
15578
15807
  }
15579
15808
  var harnessSessionCapabilitiesSchema = external_exports.object({
15580
15809
  configuration: external_exports.object({
@@ -16127,9 +16356,110 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16127
16356
  return `${HARNESS_COMMAND_MENTION_PATH_PREFIX}${encodeURIComponent(name).replace(/[()]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)}`;
16128
16357
  }
16129
16358
 
16359
+ // ../shared-contracts/dist/remote-runtime.js
16360
+ var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
16361
+ var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
16362
+ var remoteUpdatePhaseSchema = external_exports.enum([
16363
+ "idle",
16364
+ "installing",
16365
+ "restarting",
16366
+ "succeeded",
16367
+ "failed"
16368
+ ]);
16369
+ var runtimeStatusSchema = external_exports.object({
16370
+ runningVersion: external_exports.string().nullable(),
16371
+ installedVersion: external_exports.string().nullable(),
16372
+ restartRequired: external_exports.boolean(),
16373
+ remote: external_exports.boolean(),
16374
+ updateSupported: external_exports.boolean(),
16375
+ update: external_exports.object({
16376
+ phase: remoteUpdatePhaseSchema,
16377
+ targetVersion: external_exports.string().nullable(),
16378
+ error: external_exports.string().nullable()
16379
+ })
16380
+ });
16381
+ var remoteUpdateParamsSchema = external_exports.object({
16382
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
16383
+ }).strict();
16384
+ var REMOTE_SSH_SETUP_METHOD = "codexhost/remote/ssh-setup";
16385
+ var remoteSshSetupParamsSchema = external_exports.object({
16386
+ hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
16387
+ port: external_exports.number().int().min(1).max(65535).nullable(),
16388
+ identity: external_exports.string().max(4096).nullable(),
16389
+ action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
16390
+ uninstallPackage: external_exports.boolean().optional(),
16391
+ version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
16392
+ }).strict();
16393
+ var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
16394
+
16395
+ // ../shared-contracts/dist/remote-connections.js
16396
+ var hostId = external_exports.string().min(1).max(1024);
16397
+ var codexSshConnectionSchema = external_exports.object({
16398
+ hostId,
16399
+ displayName: external_exports.string().min(1).max(1024),
16400
+ source: external_exports.enum(["codex-managed", "discovered"]),
16401
+ sshAlias: external_exports.string().max(1024).nullable(),
16402
+ sshHost: external_exports.string().min(1).max(1024),
16403
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
16404
+ identity: external_exports.string().max(4096).nullable(),
16405
+ autoConnect: external_exports.boolean(),
16406
+ connectionAnalyticsId: external_exports.string().max(1024).optional()
16407
+ });
16408
+ var codexSshDraftSchema = external_exports.strictObject({
16409
+ displayName: external_exports.string().min(1).max(1024),
16410
+ hostname: external_exports.string().min(1).max(1024),
16411
+ sshPort: external_exports.number().int().min(1).max(65535).nullable(),
16412
+ identity: external_exports.string().max(4096).nullable()
16413
+ });
16414
+ var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
16415
+ external_exports.strictObject({ action: external_exports.literal("list") }),
16416
+ external_exports.strictObject({
16417
+ action: external_exports.literal("save"),
16418
+ draft: codexSshDraftSchema,
16419
+ previous: codexSshConnectionSchema.nullable()
16420
+ }),
16421
+ external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
16422
+ external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
16423
+ external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
16424
+ external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
16425
+ external_exports.strictObject({
16426
+ action: external_exports.literal("update"),
16427
+ hostId: hostId.refine((id) => id !== "local"),
16428
+ version: remoteUpdateParamsSchema.shape.version
16429
+ })
16430
+ ]);
16431
+ var remoteConnectionsReplySchema = external_exports.union([
16432
+ external_exports.strictObject({ result: jsonValueSchema }),
16433
+ external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
16434
+ ]);
16435
+
16130
16436
  // ../shared-contracts/dist/index.js
16131
16437
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
16132
16438
 
16439
+ // src/remote-connections-request.ts
16440
+ async function handleRemoteConnectionsRequest(control, input) {
16441
+ const request = remoteConnectionsRequestSchema.parse(input);
16442
+ switch (request.action) {
16443
+ case "list":
16444
+ return control.ssh.list();
16445
+ case "save":
16446
+ await control.ssh.save(request.draft, request.previous);
16447
+ return null;
16448
+ case "remove":
16449
+ await control.ssh.remove(request.previous);
16450
+ return null;
16451
+ case "connect":
16452
+ await control.ssh.connect(request.hostId, request.enabled);
16453
+ return null;
16454
+ case "state":
16455
+ return control.ssh.state(request.hostId);
16456
+ case "runtime":
16457
+ return control.runtime(request.hostId);
16458
+ case "update":
16459
+ return control.update(request.hostId, request.version);
16460
+ }
16461
+ }
16462
+
16133
16463
  // src/agent-group-preference.ts
16134
16464
  function partitionAgentsByInstallStatus(entries, isInstalled) {
16135
16465
  const installed = [];
@@ -16300,6 +16630,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16300
16630
  return sharedStore;
16301
16631
  }
16302
16632
 
16633
+ // src/assets/zcode-agent.svg
16634
+ var zcode_agent_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">%0A <path fill="%232D2D2D" stroke="%23FFFFFF" stroke-width="0.6317" stroke-miterlimit="10" d="M24.51,28.51H5.49c-2.21,0-4-1.79-4-4V5.49c0-2.21,1.79-4,4-4h19.03c2.21,0,4,1.79,4,4v19.03C28.51,26.72,26.72,28.51,24.51,28.51z"/>%0A <g fill="%23FFFFFF">%0A <path d="M15.47,7.1l-1.3,1.85c-0.2,0.29-0.54,0.47-0.9,0.47h-7.1V7.09C6.16,7.1,15.47,7.1,15.47,7.1z"/>%0A <polygon points="24.3,7.1 13.14,22.91 5.7,22.91 16.86,7.1"/>%0A <path d="M14.53,22.91l1.31-1.86c0.2-0.29,0.54-0.47,0.9-0.47h7.09v2.33H14.53z"/>%0A </g>%0A</svg>%0A';
16635
+
16303
16636
  // src/assets/kimi-agent.svg
16304
16637
  var kimi_agent_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">%0A <rect width="40" height="40" rx="10" fill="%23000000"/>%0A <path d="M31.6957 7.11414C32.8305 7.11414 33.7505 8.0341 33.7505 9.16893V9.16893C33.7505 10.3038 32.8305 11.2237 31.6957 11.2237L29.8826 11.2237C29.7491 11.2237 29.6409 11.1155 29.6409 10.982L29.6409 9.16893C29.6409 8.0341 30.5609 7.11414 31.6957 7.11414Z" fill="%231783FF"/>%0A <path d="M20.1757 19.0798L27.9302 11.3864C28.0761 11.2413 27.9939 10.9498 27.8056 10.9498H23.633C23.5877 10.9498 23.5438 10.9683 23.5084 11.0038L15.1533 19.2911C15.023 19.4192 14.8304 19.305 14.8304 19.0998V11.1951C14.8304 11.0593 14.7411 10.9498 14.6321 10.9498H11.7569C11.6478 10.9498 11.5586 11.0593 11.5586 11.1951V28.2387C11.5586 28.3745 11.6478 28.484 11.7569 28.484H14.6321C14.7411 28.484 14.8304 28.3745 14.8304 28.2387V24.7661C14.8304 24.6921 14.8573 24.6211 14.904 24.5748L17.4945 22.0047C17.5568 21.943 17.6432 21.9337 17.7126 21.98L24.6414 27.0786C25.7759 27.8423 27.0436 28.3112 28.331 28.4501C28.4458 28.4624 28.5449 28.3483 28.5449 28.2048V24.9343C28.5449 24.8093 28.4698 24.7075 28.3693 24.6921C27.6115 24.5733 26.8722 24.2802 26.2037 23.8297L20.2054 19.487C20.0808 19.4037 20.0652 19.1893 20.1757 19.0798Z" fill="%23FFFFFF"/>%0A</svg>%0A';
16305
16638
 
@@ -16354,7 +16687,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16354
16687
  "cursor-cli": "Cursor CLI (Experimental)",
16355
16688
  qoder: "Qoder",
16356
16689
  "qoder-cn": "Qoder CN",
16357
- "kimi-code": "Kimi Code"
16690
+ "kimi-code": "Kimi Code",
16691
+ zcode: "ZCode"
16358
16692
  };
16359
16693
  var PI_PATHS = [
16360
16694
  {
@@ -16429,9 +16763,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16429
16763
  image.style.flex = "none";
16430
16764
  return image;
16431
16765
  }
16432
- if (agent === "antigravity" || agent === "kiro-cli" || agent === "codebuddy" || agent === "workbuddy" || agent === "cursor-cli" || agent === "kimi-code") {
16766
+ if (agent === "antigravity" || agent === "kiro-cli" || agent === "codebuddy" || agent === "workbuddy" || agent === "cursor-cli" || agent === "kimi-code" || agent === "zcode") {
16433
16767
  const image = ownerDocument.createElement("img");
16434
- image.src = agent === "kimi-code" ? kimi_agent_default : agent === "codebuddy" ? codebuddy_agent_default : agent === "workbuddy" ? workbuddy_agent_default : agent === "cursor-cli" ? cursor_agent_default : agent === "kiro-cli" ? kiro_agent_default : antigravity_agent_default;
16768
+ image.src = agent === "zcode" ? zcode_agent_default : agent === "kimi-code" ? kimi_agent_default : agent === "codebuddy" ? codebuddy_agent_default : agent === "workbuddy" ? workbuddy_agent_default : agent === "cursor-cli" ? cursor_agent_default : agent === "kiro-cli" ? kiro_agent_default : antigravity_agent_default;
16435
16769
  image.alt = "";
16436
16770
  image.draggable = false;
16437
16771
  image.style.width = `${size}px`;
@@ -17082,8 +17416,202 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17082
17416
  return icon2;
17083
17417
  }
17084
17418
 
17419
+ // src/settings/harness-installation-guides.ts
17420
+ var shells = (posix, windows) => [
17421
+ { terminal: "macOS / Linux \xB7 Terminal (sh/bash)", command: posix },
17422
+ { terminal: "Windows \xB7 PowerShell", command: windows }
17423
+ ];
17424
+ var npm = (name) => [
17425
+ {
17426
+ terminal: "macOS / Linux / Windows \xB7 Terminal / PowerShell",
17427
+ command: `npm install -g ${name}`
17428
+ }
17429
+ ];
17430
+ var start = (command) => [
17431
+ `After installation, run ${command} to complete login or setup.`,
17432
+ `\u5B89\u88C5\u540E\u8FD0\u884C ${command}\uFF0C\u5B8C\u6210\u767B\u5F55\u6216\u914D\u7F6E\u3002`
17433
+ ];
17434
+ var node = ["Requires Node.js (including npm).", "\u9700\u5148\u5B89\u88C5 Node.js\uFF08\u5305\u542B npm\uFF09\u3002"];
17435
+ var guides = {
17436
+ zcode: {
17437
+ // codexhost runs the Agent CLI bundled with the installed ZCode Desktop.
17438
+ url: "https://github.com/BytePioneer-AI/codex-host/blob/main/docs/harnesses/zcode/zcode-harness-integration.md#%E5%AE%89%E8%A3%85",
17439
+ commands: [],
17440
+ before: [
17441
+ "Install ZCode Desktop and sign in with a Start Plan account. If ZCode is not in the default location (/Applications/ZCode.app on macOS, %LOCALAPPDATA%\\Programs\\ZCode on Windows, /opt/ZCode on Linux), set its path in the connection settings.",
17442
+ "\u8BF7\u5B89\u88C5 ZCode Desktop \u5E76\u767B\u5F55 Start Plan \u8D26\u53F7\u3002ZCode \u4E0D\u5728\u9ED8\u8BA4\u5B89\u88C5\u4F4D\u7F6E\uFF08macOS \u4E3A /Applications/ZCode.app\uFF0CWindows \u4E3A %LOCALAPPDATA%\\Programs\\ZCode\uFF0CLinux \u4E3A /opt/ZCode\uFF09\u65F6\uFF0C\u53EF\u5728\u8FDE\u63A5\u8BBE\u7F6E\u4E2D\u586B\u5199\u5176\u8DEF\u5F84\u3002"
17443
+ ],
17444
+ downloads: [{ label: "ZCode", url: "https://zcode.z.ai/" }],
17445
+ after: [
17446
+ "Check again after signing in. The ZCode Desktop window does not need to stay open.",
17447
+ "\u767B\u5F55\u540E\u91CD\u65B0\u68C0\u6D4B\uFF1B\u4F7F\u7528\u65F6\u4E0D\u9700\u8981\u4FDD\u6301 ZCode \u7A97\u53E3\u6253\u5F00\u3002"
17448
+ ]
17449
+ },
17450
+ pi: {
17451
+ url: "https://pi.dev/",
17452
+ commands: shells(
17453
+ "curl -fsSL https://pi.dev/install.sh | sh",
17454
+ "irm https://pi.dev/install.ps1 | iex"
17455
+ ),
17456
+ after: start("pi")
17457
+ },
17458
+ "claude-code": {
17459
+ url: "https://code.claude.com/docs/en/quickstart",
17460
+ commands: shells(
17461
+ "curl -fsSL https://claude.ai/install.sh | bash",
17462
+ "irm https://claude.ai/install.ps1 | iex"
17463
+ ),
17464
+ after: start("claude")
17465
+ },
17466
+ "deepseek-harness": {
17467
+ url: "https://github.com/deepseek-ai/deepseek-harness#run",
17468
+ commands: npm("@deepseek-ai/dsh@latest"),
17469
+ before: [
17470
+ "Requires Node.js. Installs npm's latest version; connection still requires native protocol validation.",
17471
+ "\u9700\u5148\u5B89\u88C5 Node.js\u3002\u5B89\u88C5 npm \u6700\u65B0\u7248\u672C\uFF1B\u8FDE\u63A5\u4ECD\u9700\u901A\u8FC7\u539F\u751F\u534F\u8BAE\u6821\u9A8C\u3002"
17472
+ ],
17473
+ after: [
17474
+ "Check again, then open Web UI to configure your provider. Stop any manually started dsh web first.",
17475
+ "\u91CD\u65B0\u68C0\u6D4B\u540E\uFF0C\u6253\u5F00 Web UI \u914D\u7F6E Provider\u3002\u82E5\u5DF2\u624B\u52A8\u542F\u52A8 dsh web\uFF0C\u8BF7\u5148\u505C\u6B62\u3002"
17476
+ ]
17477
+ },
17478
+ opencode: {
17479
+ url: "https://opencode.ai/docs/#install",
17480
+ commands: npm("opencode-ai"),
17481
+ before: node,
17482
+ after: start("opencode")
17483
+ },
17484
+ grok: {
17485
+ url: "https://www.npmjs.com/package/@xai-official/grok",
17486
+ commands: npm("@xai-official/grok"),
17487
+ before: [
17488
+ "Requires Node.js 20 or later (including npm).",
17489
+ "\u9700\u8981 Node.js 20 \u6216\u66F4\u9AD8\u7248\u672C\uFF08\u5305\u542B npm\uFF09\u3002"
17490
+ ],
17491
+ after: start("grok")
17492
+ },
17493
+ omp: {
17494
+ url: "https://github.com/can1357/oh-my-pi#install",
17495
+ commands: shells(
17496
+ "curl -fsSL https://omp.sh/install | sh",
17497
+ "irm https://omp.sh/install.ps1 | iex"
17498
+ ),
17499
+ after: start("omp")
17500
+ },
17501
+ antigravity: {
17502
+ url: "https://antigravity.google/download#antigravity-cli",
17503
+ commands: shells(
17504
+ "curl -fsSL https://antigravity.google/cli/install.sh | bash",
17505
+ "irm https://antigravity.google/cli/install.ps1 | iex"
17506
+ ),
17507
+ after: start("agy")
17508
+ },
17509
+ "kiro-cli": {
17510
+ url: "https://kiro.dev/docs/cli/",
17511
+ commands: shells(
17512
+ "curl -fsSL https://cli.kiro.dev/install | bash",
17513
+ "irm 'https://cli.kiro.dev/install.ps1' | iex"
17514
+ ),
17515
+ after: start("kiro-cli")
17516
+ },
17517
+ codebuddy: {
17518
+ url: "https://www.codebuddy.ai/docs/zh/cli/overview",
17519
+ commands: npm("@tencent-ai/codebuddy-code"),
17520
+ before: [
17521
+ "Requires Node.js 18 or later (including npm).",
17522
+ "\u9700\u8981 Node.js 18 \u6216\u66F4\u9AD8\u7248\u672C\uFF08\u5305\u542B npm\uFF09\u3002"
17523
+ ],
17524
+ after: start("codebuddy")
17525
+ },
17526
+ workbuddy: {
17527
+ url: "https://www.workbuddy.ai/docs/workbuddy/Quickstart",
17528
+ commands: [],
17529
+ before: [
17530
+ "Download and install the WorkBuddy desktop app.",
17531
+ "\u8BF7\u4E0B\u8F7D\u5E76\u5B89\u88C5 WorkBuddy \u684C\u9762\u5E94\u7528\u3002"
17532
+ ],
17533
+ downloads: [
17534
+ {
17535
+ label: "WorkBuddy",
17536
+ url: "https://www.workbuddy.ai/"
17537
+ }
17538
+ ],
17539
+ after: [
17540
+ "The bundled CLI may require separate login. Restart codexhost after changing the installation path.",
17541
+ "\u5185\u7F6E CLI \u53EF\u80FD\u9700\u8981\u5355\u72EC\u767B\u5F55\u3002\u4FEE\u6539\u5B89\u88C5\u8DEF\u5F84\u540E\u9700\u91CD\u542F codexhost\u3002"
17542
+ ]
17543
+ },
17544
+ "cursor-cli": {
17545
+ url: "https://cursor.com/docs/cli/installation",
17546
+ commands: shells(
17547
+ "curl https://cursor.com/install -fsS | bash",
17548
+ "irm 'https://cursor.com/install?win32=true' | iex"
17549
+ ),
17550
+ after: start("agent")
17551
+ },
17552
+ hermes: {
17553
+ url: "https://hermes-agent.nousresearch.com/docs/getting-started/installation",
17554
+ commands: shells(
17555
+ "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
17556
+ "iex (irm https://hermes-agent.nousresearch.com/install.ps1)"
17557
+ ),
17558
+ before: [
17559
+ "On macOS/Linux, install Git first. Linux also needs curl and xz-utils.",
17560
+ "macOS / Linux \u8BF7\u5148\u5B89\u88C5 Git\uFF1BLinux \u8FD8\u9700\u8981 curl \u548C xz-utils\u3002"
17561
+ ],
17562
+ after: start("hermes")
17563
+ },
17564
+ muse: {
17565
+ url: "https://developer.meta.com/ai/products/muse-code/",
17566
+ commands: shells(
17567
+ "curl -fsSL https://dev.meta.ai/install.sh | bash",
17568
+ "curl -fsSL https://dev.meta.ai/install.sh | bash"
17569
+ ),
17570
+ after: start("muse")
17571
+ },
17572
+ qoder: {
17573
+ url: "https://docs.qoder.com/cli/installation",
17574
+ commands: shells(
17575
+ "curl -fsSL https://qoder.com/install | bash",
17576
+ "irm https://qoder.com/install.ps1 | iex"
17577
+ ),
17578
+ after: start("qodercli")
17579
+ },
17580
+ "qoder-cn": {
17581
+ url: "https://docs.qoder.cn/cli/installation",
17582
+ commands: shells(
17583
+ "curl -fsSL https://static.qoder.com.cn/qoder-cli-cn/install.sh | bash",
17584
+ "irm https://static.qoder.com.cn/qoder-cli-cn/install.ps1 | iex"
17585
+ ),
17586
+ after: start("qoderclicn")
17587
+ },
17588
+ "kimi-code": {
17589
+ url: "https://moonshotai.github.io/kimi-code/en/guides/getting-started.html",
17590
+ commands: shells(
17591
+ "curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash",
17592
+ "irm https://code.kimi.com/kimi-code/install.ps1 | iex"
17593
+ ),
17594
+ before: ["On Windows, install Git for Windows first.", "Windows \u8BF7\u5148\u5B89\u88C5 Git for Windows\u3002"],
17595
+ after: start("kimi")
17596
+ }
17597
+ };
17598
+ function harnessHasInstallCommands(agent) {
17599
+ return guides[agent].commands.length > 0;
17600
+ }
17601
+ function harnessInstallationGuide(agent, locale) {
17602
+ const guide = guides[agent];
17603
+ const index = locale === "zh-CN" ? 1 : 0;
17604
+ return { ...guide, before: guide.before?.[index], after: guide.after[index] };
17605
+ }
17606
+
17085
17607
  // src/settings/harness-install.ts
17086
17608
  var HARNESS_INSTALL_SPECS = Object.freeze({
17609
+ zcode: {
17610
+ url: "https://zcode.z.ai/",
17611
+ binary: "zcode",
17612
+ posix: "Install ZCode Desktop and sign in with a Start Plan account.",
17613
+ windows: "Install ZCode Desktop and sign in with a Start Plan account."
17614
+ },
17087
17615
  pi: {
17088
17616
  url: "https://pi.dev/",
17089
17617
  binary: "pi",
@@ -17204,179 +17732,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17204
17732
  });
17205
17733
  }
17206
17734
 
17207
- // src/settings/harness-installation-guides.ts
17208
- var shells = (posix, windows) => [
17209
- { terminal: "macOS / Linux \xB7 Terminal (sh/bash)", command: posix },
17210
- { terminal: "Windows \xB7 PowerShell", command: windows }
17211
- ];
17212
- var npm = (name) => [
17213
- {
17214
- terminal: "macOS / Linux / Windows \xB7 Terminal / PowerShell",
17215
- command: `npm install -g ${name}`
17216
- }
17217
- ];
17218
- var start = (command) => [
17219
- `After installation, run ${command} to complete login or setup.`,
17220
- `\u5B89\u88C5\u540E\u8FD0\u884C ${command}\uFF0C\u5B8C\u6210\u767B\u5F55\u6216\u914D\u7F6E\u3002`
17221
- ];
17222
- var node = ["Requires Node.js (including npm).", "\u9700\u5148\u5B89\u88C5 Node.js\uFF08\u5305\u542B npm\uFF09\u3002"];
17223
- var guides = {
17224
- pi: {
17225
- url: "https://pi.dev/",
17226
- commands: shells(
17227
- "curl -fsSL https://pi.dev/install.sh | sh",
17228
- "irm https://pi.dev/install.ps1 | iex"
17229
- ),
17230
- after: start("pi")
17231
- },
17232
- "claude-code": {
17233
- url: "https://code.claude.com/docs/en/quickstart",
17234
- commands: shells(
17235
- "curl -fsSL https://claude.ai/install.sh | bash",
17236
- "irm https://claude.ai/install.ps1 | iex"
17237
- ),
17238
- after: start("claude")
17239
- },
17240
- "deepseek-harness": {
17241
- url: "https://github.com/deepseek-ai/deepseek-harness#run",
17242
- commands: npm("@deepseek-ai/dsh@latest"),
17243
- before: [
17244
- "Requires Node.js. Installs npm's latest version; connection still requires native protocol validation.",
17245
- "\u9700\u5148\u5B89\u88C5 Node.js\u3002\u5B89\u88C5 npm \u6700\u65B0\u7248\u672C\uFF1B\u8FDE\u63A5\u4ECD\u9700\u901A\u8FC7\u539F\u751F\u534F\u8BAE\u6821\u9A8C\u3002"
17246
- ],
17247
- after: [
17248
- "Check again, then open Web UI to configure your provider. Stop any manually started dsh web first.",
17249
- "\u91CD\u65B0\u68C0\u6D4B\u540E\uFF0C\u6253\u5F00 Web UI \u914D\u7F6E Provider\u3002\u82E5\u5DF2\u624B\u52A8\u542F\u52A8 dsh web\uFF0C\u8BF7\u5148\u505C\u6B62\u3002"
17250
- ]
17251
- },
17252
- opencode: {
17253
- url: "https://opencode.ai/docs/#install",
17254
- commands: npm("opencode-ai"),
17255
- before: node,
17256
- after: start("opencode")
17257
- },
17258
- grok: {
17259
- url: "https://www.npmjs.com/package/@xai-official/grok",
17260
- commands: npm("@xai-official/grok"),
17261
- before: [
17262
- "Requires Node.js 20 or later (including npm).",
17263
- "\u9700\u8981 Node.js 20 \u6216\u66F4\u9AD8\u7248\u672C\uFF08\u5305\u542B npm\uFF09\u3002"
17264
- ],
17265
- after: start("grok")
17266
- },
17267
- omp: {
17268
- url: "https://github.com/can1357/oh-my-pi#install",
17269
- commands: shells(
17270
- "curl -fsSL https://omp.sh/install | sh",
17271
- "irm https://omp.sh/install.ps1 | iex"
17272
- ),
17273
- after: start("omp")
17274
- },
17275
- antigravity: {
17276
- url: "https://antigravity.google/download#antigravity-cli",
17277
- commands: shells(
17278
- "curl -fsSL https://antigravity.google/cli/install.sh | bash",
17279
- "irm https://antigravity.google/cli/install.ps1 | iex"
17280
- ),
17281
- after: start("agy")
17282
- },
17283
- "kiro-cli": {
17284
- url: "https://kiro.dev/docs/cli/",
17285
- commands: shells(
17286
- "curl -fsSL https://cli.kiro.dev/install | bash",
17287
- "irm 'https://cli.kiro.dev/install.ps1' | iex"
17288
- ),
17289
- after: start("kiro-cli")
17290
- },
17291
- codebuddy: {
17292
- url: "https://www.codebuddy.ai/docs/zh/cli/overview",
17293
- commands: npm("@tencent-ai/codebuddy-code"),
17294
- before: [
17295
- "Requires Node.js 18 or later (including npm).",
17296
- "\u9700\u8981 Node.js 18 \u6216\u66F4\u9AD8\u7248\u672C\uFF08\u5305\u542B npm\uFF09\u3002"
17297
- ],
17298
- after: start("codebuddy")
17299
- },
17300
- workbuddy: {
17301
- url: "https://www.workbuddy.ai/docs/workbuddy/Quickstart",
17302
- commands: [],
17303
- before: [
17304
- "Download and install the WorkBuddy desktop app.",
17305
- "\u8BF7\u4E0B\u8F7D\u5E76\u5B89\u88C5 WorkBuddy \u684C\u9762\u5E94\u7528\u3002"
17306
- ],
17307
- downloads: [
17308
- {
17309
- label: "WorkBuddy",
17310
- url: "https://www.workbuddy.ai/"
17311
- }
17312
- ],
17313
- after: [
17314
- "The bundled CLI may require separate login. Restart codexhost after changing the installation path.",
17315
- "\u5185\u7F6E CLI \u53EF\u80FD\u9700\u8981\u5355\u72EC\u767B\u5F55\u3002\u4FEE\u6539\u5B89\u88C5\u8DEF\u5F84\u540E\u9700\u91CD\u542F codexhost\u3002"
17316
- ]
17317
- },
17318
- "cursor-cli": {
17319
- url: "https://cursor.com/docs/cli/installation",
17320
- commands: shells(
17321
- "curl https://cursor.com/install -fsS | bash",
17322
- "irm 'https://cursor.com/install?win32=true' | iex"
17323
- ),
17324
- after: start("agent")
17325
- },
17326
- hermes: {
17327
- url: "https://hermes-agent.nousresearch.com/docs/getting-started/installation",
17328
- commands: shells(
17329
- "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
17330
- "iex (irm https://hermes-agent.nousresearch.com/install.ps1)"
17331
- ),
17332
- before: [
17333
- "On macOS/Linux, install Git first. Linux also needs curl and xz-utils.",
17334
- "macOS / Linux \u8BF7\u5148\u5B89\u88C5 Git\uFF1BLinux \u8FD8\u9700\u8981 curl \u548C xz-utils\u3002"
17335
- ],
17336
- after: start("hermes")
17337
- },
17338
- muse: {
17339
- url: "https://developer.meta.com/ai/products/muse-code/",
17340
- commands: shells(
17341
- "curl -fsSL https://dev.meta.ai/install.sh | bash",
17342
- "curl -fsSL https://dev.meta.ai/install.sh | bash"
17343
- ),
17344
- after: start("muse")
17345
- },
17346
- qoder: {
17347
- url: "https://docs.qoder.com/cli/installation",
17348
- commands: shells(
17349
- "curl -fsSL https://qoder.com/install | bash",
17350
- "irm https://qoder.com/install.ps1 | iex"
17351
- ),
17352
- after: start("qodercli")
17353
- },
17354
- "qoder-cn": {
17355
- url: "https://docs.qoder.cn/cli/installation",
17356
- commands: shells(
17357
- "curl -fsSL https://static.qoder.com.cn/qoder-cli-cn/install.sh | bash",
17358
- "irm https://static.qoder.com.cn/qoder-cli-cn/install.ps1 | iex"
17359
- ),
17360
- after: start("qoderclicn")
17361
- },
17362
- "kimi-code": {
17363
- url: "https://moonshotai.github.io/kimi-code/en/guides/getting-started.html",
17364
- commands: shells(
17365
- "curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash",
17366
- "irm https://code.kimi.com/kimi-code/install.ps1 | iex"
17367
- ),
17368
- before: ["On Windows, install Git for Windows first.", "Windows \u8BF7\u5148\u5B89\u88C5 Git for Windows\u3002"],
17369
- after: start("kimi")
17370
- }
17371
- };
17372
- function harnessInstallationGuide(agent, locale) {
17373
- const guide = guides[agent];
17374
- const index = locale === "zh-CN" ? 1 : 0;
17375
- return { ...guide, before: guide.before?.[index], after: guide.after[index] };
17376
- }
17377
-
17378
17735
  // src/settings/harness-installation-panel.ts
17379
- function createHarnessInstallationPanel(document2, agent, hostId, messages, copy, installation, refresh) {
17736
+ function createHarnessInstallationPanel(document2, agent, hostId2, messages, copy, installation, refresh) {
17380
17737
  const zh = messages.locale === "zh-CN";
17381
17738
  const guide = harnessInstallationGuide(agent, messages.locale);
17382
17739
  const panel = document2.createElement("div");
@@ -17386,7 +17743,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17386
17743
  p.textContent = text;
17387
17744
  panel.append(p);
17388
17745
  };
17389
- if (hostId !== "local") {
17746
+ if (hostId2 !== "local") {
17390
17747
  paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
17391
17748
  }
17392
17749
  if (guide.before) paragraph(guide.before);
@@ -17531,11 +17888,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17531
17888
  input.type = "text";
17532
17889
  input.autocomplete = "off";
17533
17890
  input.spellcheck = false;
17534
- input.placeholder = messages.launchPathPlaceholder;
17891
+ input.placeholder = agent === "zcode" ? messages.launchPathZcodePlaceholder : messages.launchPathPlaceholder;
17535
17892
  input.setAttribute("aria-label", messages.launchPathLabel);
17536
17893
  label.append(input);
17537
17894
  const help = document2.createElement("p");
17538
- help.textContent = messages.launchPathWorkbuddyHelp;
17895
+ help.textContent = agent === "zcode" ? messages.launchPathZcodeHelp : messages.launchPathWorkbuddyHelp;
17539
17896
  const actions = document2.createElement("div");
17540
17897
  actions.className = "settings-harness-launch__actions";
17541
17898
  const save = document2.createElement("button");
@@ -17765,6 +18122,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17765
18122
  "codebuddy-npm-required": "Use CodeBuddy's native updater or original package manager. Latest-version checks here require an identified npm installation.",
17766
18123
  "deepseek-original-installer": "Update with the original installer. Python, desktop, and project-local installations are not upgraded through global npm.",
17767
18124
  "kiro-native-updater": "Use Kiro CLI's original installer or native updater to check for and install updates.",
18125
+ "zcode-desktop-updater": "The CLI ships inside ZCode Desktop. Update ZCode Desktop itself to update it.",
17768
18126
  "qoder-check-unavailable": "This Qoder China release does not expose a non-installing update check. Use its original installer.",
17769
18127
  "hermes-update-plan-unavailable": "This Hermes release does not expose a safe update plan. Use the original installer.",
17770
18128
  "hermes-externally-managed": "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager.",
@@ -17781,6 +18139,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17781
18139
  "codebuddy-npm-required": "\u8BF7\u4F7F\u7528 CodeBuddy \u539F\u751F\u66F4\u65B0\u5668\u6216\u539F\u5305\u7BA1\u7406\u5668\u66F4\u65B0\u3002\u6B64\u5904\u4EC5\u80FD\u67E5\u8BE2\u5DF2\u8BC6\u522B\u7684 npm \u5B89\u88C5\u7684\u6700\u65B0\u7248\u672C\u3002",
17782
18140
  "deepseek-original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u65B9\u5F0F\u66F4\u65B0\u3002Python\u3001\u684C\u9762\u5E94\u7528\u53CA\u9879\u76EE\u5185\u5B89\u88C5\u4E0D\u4F1A\u901A\u8FC7\u5168\u5C40 npm \u66F4\u65B0\u3002",
17783
18141
  "kiro-native-updater": "\u8BF7\u4F7F\u7528 Kiro CLI \u539F\u5B89\u88C5\u7A0B\u5E8F\u6216\u539F\u751F\u66F4\u65B0\u5668\u68C0\u67E5\u5E76\u5B89\u88C5\u66F4\u65B0\u3002",
18142
+ "zcode-desktop-updater": "CLI \u968F ZCode Desktop \u4E00\u8D77\u53D1\u5E03\uFF0C\u8BF7\u76F4\u63A5\u66F4\u65B0 ZCode Desktop\u3002",
17784
18143
  "qoder-check-unavailable": "\u6B64 Qoder \u4E2D\u56FD\u7248\u5C1A\u4E0D\u652F\u6301\u53EA\u68C0\u67E5\u3001\u4E0D\u5B89\u88C5\u7684\u66F4\u65B0\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u65B9\u5F0F\u66F4\u65B0\u3002",
17785
18144
  "hermes-update-plan-unavailable": "\u6B64 Hermes \u7248\u672C\u4E0D\u63D0\u4F9B\u5B89\u5168\u7684\u66F4\u65B0\u8BA1\u5212\uFF0C\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u65B9\u5F0F\u66F4\u65B0\u3002",
17786
18145
  "hermes-externally-managed": "\u6B64 Hermes \u5B89\u88C5\u7531\u5916\u90E8\u5DE5\u5177\u7BA1\u7406\uFF0C\u8BF7\u901A\u8FC7\u5176\u684C\u9762\u5E94\u7528\u3001\u5BB9\u5668\u6216\u539F\u5305\u7BA1\u7406\u5668\u66F4\u65B0\u3002",
@@ -17884,11 +18243,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17884
18243
  if (availability === "notInstalled") return "setup";
17885
18244
  return "failed";
17886
18245
  }
17887
- function diagnosticText(hostId, item) {
18246
+ function diagnosticText(hostId2, item) {
17888
18247
  const error51 = item.error;
17889
18248
  return [
17890
18249
  "BOFT CLI connection diagnostics",
17891
- `host: ${hostId}`,
18250
+ `host: ${hostId2}`,
17892
18251
  `agent: ${item.name}`,
17893
18252
  `status: ${item.availability}`,
17894
18253
  ...error51 ? [
@@ -17923,17 +18282,17 @@ ${error51.stderrTail}`] : []
17923
18282
  () => showCopyButtonFeedback(button, icon2, messages.connectionCopyFailed, restoreLabel)
17924
18283
  );
17925
18284
  }
17926
- function connectionHostName(hostId, messages) {
17927
- if (hostId === "local") return messages.connectionLocalHost;
17928
- const separator = hostId.lastIndexOf(":");
17929
- const encodedName = separator >= 0 ? hostId.slice(separator + 1) : hostId;
18285
+ function connectionHostName(hostId2, messages) {
18286
+ if (hostId2 === "local") return messages.connectionLocalHost;
18287
+ const separator = hostId2.lastIndexOf(":");
18288
+ const encodedName = separator >= 0 ? hostId2.slice(separator + 1) : hostId2;
17930
18289
  try {
17931
18290
  return decodeURIComponent(encodedName);
17932
18291
  } catch {
17933
18292
  return encodedName;
17934
18293
  }
17935
18294
  }
17936
- function createHostSegmentedControl(document2, hosts, selectedHostId, messages, onSelect) {
18295
+ function createHostSegmentedControl(document2, hosts, selectedHostId, messages, onSelect, hostNames) {
17937
18296
  const root = document2.createElement("div");
17938
18297
  root.className = "settings-segmented";
17939
18298
  root.setAttribute("role", "tablist");
@@ -17948,7 +18307,7 @@ ${error51.stderrTail}`] : []
17948
18307
  button.setAttribute("role", "tab");
17949
18308
  button.setAttribute("aria-selected", String(selected));
17950
18309
  button.tabIndex = selected ? 0 : -1;
17951
- const hostName = connectionHostName(host.hostId, messages);
18310
+ const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
17952
18311
  button.textContent = hostName;
17953
18312
  button.title = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
17954
18313
  button.addEventListener("click", () => {
@@ -17978,7 +18337,7 @@ ${error51.stderrTail}`] : []
17978
18337
  }
17979
18338
  return container;
17980
18339
  }
17981
- function createInlineErrorDetail(document2, item, hostId, messages) {
18340
+ function createInlineErrorDetail(document2, item, hostId2, messages) {
17982
18341
  const body = document2.createElement("div");
17983
18342
  body.className = "settings-connection-inline-detail";
17984
18343
  body.dataset.connectionDetail = item.key;
@@ -18111,7 +18470,7 @@ ${error51.stderrTail}`] : []
18111
18470
  copy.type = "button";
18112
18471
  copy.className = "settings-command-button settings-command-button--secondary";
18113
18472
  setActionButtonLabel(copy, "copy", messages.connectionCopyDetails);
18114
- const report = diagnosticText(hostId, item);
18473
+ const report = diagnosticText(hostId2, item);
18115
18474
  copy.addEventListener("click", () => {
18116
18475
  copyTextToClipboard(document2, copy, report, messages, messages.connectionCopyDetails);
18117
18476
  });
@@ -18134,7 +18493,7 @@ ${error51.stderrTail}`] : []
18134
18493
  body.append(summary, logHeader, log, actions, issueNote);
18135
18494
  return body;
18136
18495
  }
18137
- function createConnectionBlock(document2, item, hostId, messages, expanded, toggleExpand, group = null, launchControls = null, versionCapable = false, detailNodes = [], longContext = null) {
18496
+ function createConnectionBlock(document2, item, hostId2, messages, expanded, toggleExpand, group = null, launchControls = null, versionCapable = false, detailNodes = [], longContext = null) {
18138
18497
  const block = document2.createElement("div");
18139
18498
  block.className = "settings-connection-block";
18140
18499
  block.dataset.connectionItem = item.key;
@@ -18230,7 +18589,7 @@ ${error51.stderrTail}`] : []
18230
18589
  row.append(identity, status, action);
18231
18590
  block.append(row);
18232
18591
  if (expanded && canExpand) {
18233
- const detail = createInlineErrorDetail(document2, item, hostId, messages);
18592
+ const detail = createInlineErrorDetail(document2, item, hostId2, messages);
18234
18593
  if (launchControls) detail.append(launchControls);
18235
18594
  for (const node2 of detailNodes) detail.append(node2);
18236
18595
  block.append(detail);
@@ -18285,7 +18644,7 @@ ${error51.stderrTail}`] : []
18285
18644
  button.addEventListener("click", onReset);
18286
18645
  return button;
18287
18646
  }
18288
- function createConnectionsSettingsPage(messages, getDiagnostics, groupPreference = getSharedAgentGroupPreferenceStore()) {
18647
+ function createConnectionsSettingsPage(messages, getDiagnostics, groupPreference = getSharedAgentGroupPreferenceStore(), getRemoteConnections = () => null) {
18289
18648
  return Object.freeze({
18290
18649
  id: "connections",
18291
18650
  label: messages.pageLabels.connections,
@@ -18314,6 +18673,7 @@ ${error51.stderrTail}`] : []
18314
18673
  syncMessage.className = "settings-page-description";
18315
18674
  syncMessage.setAttribute("role", "status");
18316
18675
  context.content.append(header, syncMessage, content);
18676
+ const hostNames = /* @__PURE__ */ new Map();
18317
18677
  let pending = false;
18318
18678
  let selectedHostId = null;
18319
18679
  let expandedItemKey = null;
@@ -18321,23 +18681,24 @@ ${error51.stderrTail}`] : []
18321
18681
  let launchControls = null;
18322
18682
  const versionPanels = /* @__PURE__ */ new Map();
18323
18683
  const longContextControls = /* @__PURE__ */ new Map();
18324
- const launchControlsFor = (hostId, item) => {
18684
+ const launchControlsFor = (hostId2, item) => {
18325
18685
  const getLaunchSettings = diagnostics?.getLaunchSettings;
18326
18686
  const setLaunchSettings = diagnostics?.setLaunchSettings;
18327
- if (hostId !== "local" || item.agentSnapshot?.agent !== "workbuddy" || !getLaunchSettings || !setLaunchSettings) {
18687
+ if (hostId2 !== "local" || item.agentSnapshot?.agent !== "workbuddy" && item.agentSnapshot?.agent !== "zcode" || !getLaunchSettings || !setLaunchSettings) {
18328
18688
  return null;
18329
18689
  }
18330
- if (launchControls?.hostId === hostId && launchControls.itemKey === item.key) {
18690
+ if (launchControls?.hostId === hostId2 && launchControls.itemKey === item.key) {
18331
18691
  return launchControls.element;
18332
18692
  }
18333
- const element = createHarnessLaunchControls(document2, messages, "workbuddy", {
18334
- get: () => getLaunchSettings(hostId, "workbuddy"),
18335
- set: (path) => setLaunchSettings(hostId, "workbuddy", path)
18693
+ const agent = item.agentSnapshot.agent;
18694
+ const element = createHarnessLaunchControls(document2, messages, agent, {
18695
+ get: () => getLaunchSettings(hostId2, agent),
18696
+ set: (path) => setLaunchSettings(hostId2, agent, path)
18336
18697
  });
18337
- launchControls = { hostId, itemKey: item.key, element };
18698
+ launchControls = { hostId: hostId2, itemKey: item.key, element };
18338
18699
  return element;
18339
18700
  };
18340
- const longContextControlFor = (hostId, item) => {
18701
+ const longContextControlFor = (hostId2, item) => {
18341
18702
  const agent = item.agentSnapshot?.agent;
18342
18703
  const availability = item.agentSnapshot?.availability;
18343
18704
  const getLongContext = diagnostics?.getLongContext;
@@ -18345,12 +18706,12 @@ ${error51.stderrTail}`] : []
18345
18706
  if (agent !== "claude-code" || availability === "notInstalled" || availability === "checking" || !getLongContext || !setLongContext) {
18346
18707
  return null;
18347
18708
  }
18348
- const key = JSON.stringify([hostId, agent]);
18709
+ const key = JSON.stringify([hostId2, agent]);
18349
18710
  const cached2 = longContextControls.get(key);
18350
18711
  if (cached2) return cached2;
18351
18712
  const element = createClaudeLongContextControl(document2, messages, {
18352
- get: () => getLongContext(hostId, agent),
18353
- set: (enabled) => setLongContext(hostId, agent, enabled)
18713
+ get: () => getLongContext(hostId2, agent),
18714
+ set: (enabled) => setLongContext(hostId2, agent, enabled)
18354
18715
  });
18355
18716
  longContextControls.set(key, element);
18356
18717
  return element;
@@ -18425,10 +18786,11 @@ ${error51.stderrTail}`] : []
18425
18786
  snapshot.hosts,
18426
18787
  selectedHost.hostId,
18427
18788
  messages,
18428
- (hostId) => {
18429
- selectedHostId = hostId;
18789
+ (hostId2) => {
18790
+ selectedHostId = hostId2;
18430
18791
  render(latestSnapshot);
18431
- }
18792
+ },
18793
+ hostNames
18432
18794
  );
18433
18795
  const list = document2.createElement("section");
18434
18796
  list.className = "settings-connection-list";
@@ -18470,7 +18832,7 @@ ${error51.stderrTail}`] : []
18470
18832
  const agent = item.agentSnapshot?.agent;
18471
18833
  if (expanded && agent && item.availability === "notInstalled") {
18472
18834
  const installState = installs?.get(selectedHost.hostId, agent);
18473
- const canInstall = selectedHost.hostId === "local" && agent !== "workbuddy" && diagnostics?.installation !== void 0;
18835
+ const canInstall = selectedHost.hostId === "local" && harnessHasInstallCommands(agent) && diagnostics?.installation !== void 0;
18474
18836
  const installStatus = installState?.status === "installing" || installState?.status === "checking" ? installState.status : "idle";
18475
18837
  nodes.push(
18476
18838
  createHarnessInstallationPanel(
@@ -18509,9 +18871,9 @@ ${error51.stderrTail}`] : []
18509
18871
  const key = JSON.stringify([selectedHost.hostId, agent]);
18510
18872
  let panel = versionPanels.get(key);
18511
18873
  if (!panel) {
18512
- const hostId = selectedHost.hostId;
18874
+ const hostId2 = selectedHost.hostId;
18513
18875
  panel = createHarnessVersionPanel(document2, messages, context.signal, agent, {
18514
- run: (action) => installation(hostId, agent, action)
18876
+ run: (action) => installation(hostId2, agent, action)
18515
18877
  });
18516
18878
  versionPanels.set(key, panel);
18517
18879
  }
@@ -18754,6 +19116,17 @@ ${error51.stderrTail}`] : []
18754
19116
  content.append(hostSwitch, list);
18755
19117
  };
18756
19118
  render(diagnostics?.snapshot() ?? null);
19119
+ void getRemoteConnections()?.ssh.list(context.signal).then(
19120
+ (connections) => {
19121
+ if (context.signal.aborted) return;
19122
+ for (const connection of connections) {
19123
+ hostNames.set(connection.hostId, connection.displayName.trim());
19124
+ }
19125
+ render(diagnostics?.snapshot() ?? null);
19126
+ },
19127
+ () => {
19128
+ }
19129
+ );
18757
19130
  const unsubscribeGroup = groupPreference.subscribe(
18758
19131
  () => render(diagnostics?.snapshot() ?? latestSnapshot)
18759
19132
  );
@@ -19013,6 +19386,8 @@ ${error51.stderrTail}`] : []
19013
19386
  launchPathLabel: "Installed application path",
19014
19387
  launchPathPlaceholder: "Installation folder, e.g. D:\\program\\WorkBuddy",
19015
19388
  launchPathWorkbuddyHelp: "This integration requires the WorkBuddy app. If it is not detected automatically, enter its installation folder. codexhost locates the required files inside it. Restart codexhost after saving to apply.",
19389
+ launchPathZcodePlaceholder: "Application path, e.g. /Applications/ZCode.app or D:\\program\\ZCode",
19390
+ launchPathZcodeHelp: "This integration requires the ZCode Desktop app. If it is not detected automatically, enter its application path (the .app bundle on macOS, the installation folder on Windows and Linux). codexhost locates the required files inside it. Restart codexhost after saving to apply.",
19016
19391
  launchPathSave: "Save path",
19017
19392
  launchPathReset: "Clear override",
19018
19393
  launchPathRestart: "Saved. Restart codexhost to apply; running sessions are unchanged.",
@@ -19137,6 +19512,7 @@ ${error51.stderrTail}`] : []
19137
19512
  connections: "Agents",
19138
19513
  plugins: "Plugins",
19139
19514
  appearance: "Appearance",
19515
+ "remote-connections": "Remote connections",
19140
19516
  accounts: "Accounts",
19141
19517
  "session-import": "Sessions",
19142
19518
  updates: "Updates",
@@ -19315,6 +19691,8 @@ ${error51.stderrTail}`] : []
19315
19691
  launchPathLabel: "\u5E94\u7528\u5B89\u88C5\u8DEF\u5F84",
19316
19692
  launchPathPlaceholder: "\u586B\u5199\u5B89\u88C5\u76EE\u5F55\uFF0C\u4F8B\u5982 D:\\program\\WorkBuddy",
19317
19693
  launchPathWorkbuddyHelp: "\u6B64\u63A5\u5165\u4F9D\u8D56 WorkBuddy \u5E94\u7528\u3002\u82E5\u672A\u81EA\u52A8\u8BC6\u522B\uFF0C\u8BF7\u586B\u5199\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\uFF0Ccodexhost \u4F1A\u81EA\u52A8\u5B9A\u4F4D\u6240\u9700\u6587\u4EF6\u3002\u4FDD\u5B58\u540E\u91CD\u542F codexhost \u751F\u6548\u3002",
19694
+ launchPathZcodePlaceholder: "\u586B\u5199\u5E94\u7528\u8DEF\u5F84\uFF0C\u4F8B\u5982 /Applications/ZCode.app \u6216 D:\\program\\ZCode",
19695
+ launchPathZcodeHelp: "\u6B64\u63A5\u5165\u4F9D\u8D56 ZCode Desktop \u5E94\u7528\u3002\u82E5\u672A\u81EA\u52A8\u8BC6\u522B\uFF0C\u8BF7\u586B\u5199\u5E94\u7528\u8DEF\u5F84\uFF08macOS \u4E3A .app\uFF0CWindows \u548C Linux \u4E3A\u5B89\u88C5\u76EE\u5F55\uFF09\uFF0Ccodexhost \u4F1A\u81EA\u52A8\u5B9A\u4F4D\u6240\u9700\u6587\u4EF6\u3002\u4FDD\u5B58\u540E\u91CD\u542F codexhost \u751F\u6548\u3002",
19318
19696
  launchPathSave: "\u4FDD\u5B58\u8DEF\u5F84",
19319
19697
  launchPathReset: "\u6E05\u9664\u81EA\u5B9A\u4E49\u8DEF\u5F84",
19320
19698
  launchPathRestart: "\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F codexhost \u540E\u751F\u6548\uFF1B\u5F53\u524D\u8FD0\u884C\u4E2D\u7684\u4F1A\u8BDD\u4E0D\u53D7\u5F71\u54CD\u3002",
@@ -19439,6 +19817,7 @@ ${error51.stderrTail}`] : []
19439
19817
  connections: "Agents",
19440
19818
  plugins: "\u63D2\u4EF6",
19441
19819
  appearance: "\u5916\u89C2",
19820
+ "remote-connections": "\u8FDC\u7A0B\u8FDE\u63A5",
19442
19821
  accounts: "\u8D26\u53F7",
19443
19822
  "session-import": "\u4F1A\u8BDD",
19444
19823
  updates: "\u66F4\u65B0",
@@ -22969,7 +23348,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
22969
23348
  const thinkingReady = availableThinkingOptions.length === 0 || availableThinkingOptions.some(({ id }) => id === modelView.selectedThinkingOptionId);
22970
23349
  const modelReady = selectedModel !== void 0 && selectedCatalogModel !== void 0;
22971
23350
  const modelBlocked = state.agent !== "codex" && (modelView.status === "selecting" || !modelReady || !thinkingReady);
22972
- const permissionModeBlocked = state.agent !== "codex" && (!isPermissionModeControlReady(permissionModeView) || permissionModeView.status !== "unsupported" && !control.nativePermissionModeControlVerified);
23351
+ const permissionModeBlocked = state.agent !== "codex" && !isPermissionModeControlReady(permissionModeView);
22973
23352
  const submissionBlocked = switching || ownershipError || modelBlocked || permissionModeBlocked;
22974
23353
  if (submissionBlocked && control.sendDisabledBeforeSwitch === null) {
22975
23354
  control.sendDisabledBeforeSwitch = control.sendButton.disabled;
@@ -23951,6 +24330,24 @@ Codex Fast mode prioritizes requests and may increase usage.`
23951
24330
  selectThreadModel,
23952
24331
  selectThreadThinking,
23953
24332
  selectThreadPermissionMode,
24333
+ async setupSsh(input) {
24334
+ return remoteSshSetupResultSchema.parse(
24335
+ await manager.sendRequest(REMOTE_SSH_SETUP_METHOD, remoteSshSetupParamsSchema.parse(input))
24336
+ );
24337
+ },
24338
+ async runtimeStatus() {
24339
+ try {
24340
+ return runtimeStatusSchema.parse(await source.sendRequest(RUNTIME_STATUS_METHOD, {}));
24341
+ } catch (error51) {
24342
+ if (!isUnsupportedMethod(error51, RUNTIME_STATUS_METHOD)) throw error51;
24343
+ throw new RendererMethodUnavailableError(RUNTIME_STATUS_METHOD, error51);
24344
+ }
24345
+ },
24346
+ async updateRemote(version2) {
24347
+ return runtimeStatusSchema.parse(
24348
+ await manager.sendRequest(REMOTE_UPDATE_METHOD, { version: version2 })
24349
+ );
24350
+ },
23954
24351
  async checkUpdate() {
23955
24352
  const result = await manager.sendRequest(
23956
24353
  UPDATE_CHECK_METHOD,
@@ -24331,9 +24728,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
24331
24728
  }
24332
24729
 
24333
24730
  // src/renderer-thread-reference-capability.ts
24334
- var record2 = (value) => typeof value === "object" && value !== null;
24731
+ var record3 = (value) => typeof value === "object" && value !== null;
24335
24732
  function restoreThreadReferenceCapability(client, manager, isCurrent) {
24336
- if (!record2(manager) || !record2(manager.storage)) return client;
24733
+ if (!record3(manager) || !record3(manager.storage)) return client;
24337
24734
  const storage = manager.storage;
24338
24735
  const read = storage.readValue;
24339
24736
  const write = storage.writeValue;
@@ -24371,7 +24768,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24371
24768
  function isRecord7(value) {
24372
24769
  return value !== null && typeof value === "object" && !Array.isArray(value);
24373
24770
  }
24374
- function installRendererManualCompaction(target, hostId, messages) {
24771
+ function installRendererManualCompaction(target, hostId2, messages) {
24375
24772
  if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord7(target) || typeof target.registerPendingManualContextCompaction !== "function" || typeof target.getConversation !== "function") {
24376
24773
  return null;
24377
24774
  }
@@ -24381,7 +24778,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24381
24778
  const listener = (event) => {
24382
24779
  if (event.source != null && event.source !== messages) return;
24383
24780
  const message = event.data;
24384
- if (!isRecord7(message) || message.type !== "mcp-notification" || message.hostId !== hostId || message.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
24781
+ if (!isRecord7(message) || message.type !== "mcp-notification" || message.hostId !== hostId2 || message.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
24385
24782
  return;
24386
24783
  }
24387
24784
  const params = threadManualCompactionStartedSchema.safeParse(message.params);
@@ -24405,9 +24802,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
24405
24802
  function createRendererHostClients(readRouting, messages = null) {
24406
24803
  let disposed = false;
24407
24804
  const entries = /* @__PURE__ */ new Map();
24408
- const retire = (hostId) => {
24409
- const entry = entries.get(hostId);
24410
- entries.delete(hostId);
24805
+ const retire = (hostId2) => {
24806
+ const entry = entries.get(hostId2);
24807
+ entries.delete(hostId2);
24411
24808
  for (const cleanup of entry?.cleanups ?? []) {
24412
24809
  try {
24413
24810
  cleanup();
@@ -24457,16 +24854,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
24457
24854
  };
24458
24855
  return {
24459
24856
  forRoute,
24460
- forHost(hostId) {
24857
+ forHost(hostId2) {
24461
24858
  if (disposed) return null;
24462
- const route = readRouting()?.forHost(hostId) ?? null;
24463
- if (!route) retire(hostId);
24859
+ const route = readRouting()?.forHost(hostId2) ?? null;
24860
+ if (!route) retire(hostId2);
24464
24861
  return forRoute(route);
24465
24862
  },
24466
24863
  dispose() {
24467
24864
  if (disposed) return;
24468
24865
  disposed = true;
24469
- for (const hostId of entries.keys()) retire(hostId);
24866
+ for (const hostId2 of entries.keys()) retire(hostId2);
24470
24867
  }
24471
24868
  };
24472
24869
  }
@@ -24577,10 +24974,10 @@ Codex Fast mode prioritizes requests and may increase usage.`
24577
24974
  }
24578
24975
  function sidebarThreadAttributes(element) {
24579
24976
  const taskKey = element.getAttribute(SIDEBAR_THREAD_ID_ATTRIBUTE);
24580
- const hostId = element.getAttribute(SIDEBAR_THREAD_HOST_ID_ATTRIBUTE);
24977
+ const hostId2 = element.getAttribute(SIDEBAR_THREAD_HOST_ID_ATTRIBUTE);
24581
24978
  const rowMarker = element.getAttribute(SIDEBAR_THREAD_ROW_ATTRIBUTE);
24582
- if (taskKey === null || hostId === null || rowMarker === null) return null;
24583
- return { taskKey, hostId, rowMarker };
24979
+ if (taskKey === null || hostId2 === null || rowMarker === null) return null;
24980
+ return { taskKey, hostId: hostId2, rowMarker };
24584
24981
  }
24585
24982
  function draftIdFromSidebarRowElement(element) {
24586
24983
  const attributes = sidebarThreadAttributes(element);
@@ -24592,7 +24989,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24592
24989
  function threadIdFromSidebarRowElement(element) {
24593
24990
  const attributes = sidebarThreadAttributes(element);
24594
24991
  if (!attributes) return null;
24595
- const { taskKey, hostId, rowMarker } = attributes;
24992
+ const { taskKey, hostId: hostId2, rowMarker } = attributes;
24596
24993
  const fiberNames = Object.getOwnPropertyNames(element).filter(
24597
24994
  (name) => name.startsWith("__reactFiber$")
24598
24995
  );
@@ -24607,7 +25004,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24607
25004
  if (isRecord8(props) && isRecord8(props.dataAttributes)) {
24608
25005
  const dataAttributes = props.dataAttributes;
24609
25006
  const threadId = hostThreadIdSchema.safeParse(props.conversationId);
24610
- if (threadId.success && dataAttributes[SIDEBAR_THREAD_ROW_ATTRIBUTE] === rowMarker && dataAttributes[SIDEBAR_THREAD_ID_ATTRIBUTE] === taskKey && dataAttributes[SIDEBAR_THREAD_HOST_ID_ATTRIBUTE] === hostId) {
25007
+ if (threadId.success && dataAttributes[SIDEBAR_THREAD_ROW_ATTRIBUTE] === rowMarker && dataAttributes[SIDEBAR_THREAD_ID_ATTRIBUTE] === taskKey && dataAttributes[SIDEBAR_THREAD_HOST_ID_ATTRIBUTE] === hostId2) {
24611
25008
  candidates.add(threadId.data);
24612
25009
  }
24613
25010
  }
@@ -24816,7 +25213,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24816
25213
  const ownershipRetryTimers = /* @__PURE__ */ new Map();
24817
25214
  let disposed = false;
24818
25215
  let scanScheduled = false;
24819
- const ownershipKey = (hostId, threadId) => JSON.stringify([hostId, threadId]);
25216
+ const ownershipKey = (hostId2, threadId) => JSON.stringify([hostId2, threadId]);
24820
25217
  const scheduleScan = () => {
24821
25218
  if (disposed || scanScheduled) return;
24822
25219
  scanScheduled = true;
@@ -24830,8 +25227,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
24830
25227
  failed.delete(key);
24831
25228
  provisionalCodex.delete(key);
24832
25229
  };
24833
- const scheduleOwnershipRetry = (hostId, threadId) => {
24834
- const key = ownershipKey(hostId, threadId);
25230
+ const scheduleOwnershipRetry = (hostId2, threadId) => {
25231
+ const key = ownershipKey(hostId2, threadId);
24835
25232
  if (disposed || !failed.has(key) && !provisionalCodex.has(key) || pending.has(key) || ownershipRetryTimers.has(key)) {
24836
25233
  return;
24837
25234
  }
@@ -24848,19 +25245,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
24848
25245
  }, delay);
24849
25246
  ownershipRetryTimers.set(key, timer);
24850
25247
  };
24851
- const requestOwnership = (hostId, threadIds, client) => {
24852
- for (const threadId of threadIds) pending.add(ownershipKey(hostId, threadId));
25248
+ const requestOwnership = (hostId2, threadIds, client) => {
25249
+ for (const threadId of threadIds) pending.add(ownershipKey(hostId2, threadId));
24853
25250
  let succeeded = false;
24854
25251
  let retryable = true;
24855
25252
  void Promise.resolve().then(() => client.listThreadOwnership({ threadIds })).then(({ threads }) => {
24856
25253
  if (disposed) return;
24857
25254
  for (const ownership of threads) {
24858
- const key = ownershipKey(hostId, ownership.threadId);
25255
+ const key = ownershipKey(hostId2, ownership.threadId);
24859
25256
  ownershipByThread.set(key, rendererAgentForThreadOwnership(ownership));
24860
25257
  failed.delete(key);
24861
25258
  if (ownership.owner === "codex") {
24862
25259
  provisionalCodex.add(key);
24863
- scheduleOwnershipRetry(hostId, ownership.threadId);
25260
+ scheduleOwnershipRetry(hostId2, ownership.threadId);
24864
25261
  } else {
24865
25262
  clearOwnershipRetry(key);
24866
25263
  }
@@ -24869,11 +25266,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
24869
25266
  }).catch((error51) => {
24870
25267
  if (disposed) return;
24871
25268
  retryable = !(error51 instanceof RendererMethodUnavailableError);
24872
- for (const threadId of threadIds) failed.add(ownershipKey(hostId, threadId));
25269
+ for (const threadId of threadIds) failed.add(ownershipKey(hostId2, threadId));
24873
25270
  }).finally(() => {
24874
- for (const threadId of threadIds) pending.delete(ownershipKey(hostId, threadId));
25271
+ for (const threadId of threadIds) pending.delete(ownershipKey(hostId2, threadId));
24875
25272
  if (retryable) {
24876
- for (const threadId of threadIds) scheduleOwnershipRetry(hostId, threadId);
25273
+ for (const threadId of threadIds) scheduleOwnershipRetry(hostId2, threadId);
24877
25274
  }
24878
25275
  if (succeeded) scheduleScan();
24879
25276
  });
@@ -24887,20 +25284,20 @@ Codex Fast mode prioritizes requests and may increase usage.`
24887
25284
  row.clear();
24888
25285
  continue;
24889
25286
  }
24890
- const hostId = row.hostId();
24891
- if (!hostId) {
25287
+ const hostId2 = row.hostId();
25288
+ if (!hostId2) {
24892
25289
  row.clear();
24893
25290
  continue;
24894
25291
  }
24895
25292
  const threadId = hostThreadIdSchema.safeParse(row.threadId());
24896
25293
  const localAgent = options.getLocalAgent?.({
24897
- hostId,
25294
+ hostId: hostId2,
24898
25295
  threadId: threadId.success ? threadId.data : null,
24899
25296
  draftId: row.draftId()
24900
25297
  });
24901
25298
  if (localAgent !== null && localAgent !== void 0) {
24902
25299
  if (threadId.success) {
24903
- const key2 = ownershipKey(hostId, threadId.data);
25300
+ const key2 = ownershipKey(hostId2, threadId.data);
24904
25301
  ownershipByThread.set(key2, localAgent === "codex" ? null : localAgent);
24905
25302
  clearOwnershipRetry(key2);
24906
25303
  }
@@ -24912,7 +25309,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24912
25309
  row.clear();
24913
25310
  continue;
24914
25311
  }
24915
- const key = ownershipKey(hostId, threadId.data);
25312
+ const key = ownershipKey(hostId2, threadId.data);
24916
25313
  if (ownershipByThread.has(key)) {
24917
25314
  const agent = ownershipByThread.get(key);
24918
25315
  if (agent) row.render(agent);
@@ -24921,28 +25318,28 @@ Codex Fast mode prioritizes requests and may increase usage.`
24921
25318
  }
24922
25319
  row.clear();
24923
25320
  if (!pending.has(key) && !failed.has(key)) {
24924
- let unresolved = unresolvedByHost.get(hostId);
25321
+ let unresolved = unresolvedByHost.get(hostId2);
24925
25322
  if (!unresolved) {
24926
25323
  unresolved = /* @__PURE__ */ new Set();
24927
- unresolvedByHost.set(hostId, unresolved);
25324
+ unresolvedByHost.set(hostId2, unresolved);
24928
25325
  }
24929
25326
  unresolved.add(threadId.data);
24930
25327
  }
24931
25328
  }
24932
- for (const [hostId, unresolved] of unresolvedByHost) {
24933
- const client = options.getClient(hostId);
25329
+ for (const [hostId2, unresolved] of unresolvedByHost) {
25330
+ const client = options.getClient(hostId2);
24934
25331
  if (!client) {
24935
25332
  for (const threadId of unresolved) {
24936
- const key = ownershipKey(hostId, threadId);
25333
+ const key = ownershipKey(hostId2, threadId);
24937
25334
  failed.add(key);
24938
- scheduleOwnershipRetry(hostId, threadId);
25335
+ scheduleOwnershipRetry(hostId2, threadId);
24939
25336
  }
24940
25337
  continue;
24941
25338
  }
24942
25339
  const threadIds = [...unresolved];
24943
25340
  for (let index = 0; index < threadIds.length; index += THREAD_OWNERSHIP_LIST_MAX_LENGTH) {
24944
25341
  requestOwnership(
24945
- hostId,
25342
+ hostId2,
24946
25343
  threadIds.slice(index, index + THREAD_OWNERSHIP_LIST_MAX_LENGTH),
24947
25344
  client
24948
25345
  );
@@ -25616,7 +26013,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
25616
26013
  const localClient = disposed ? null : route?.hostId === "local" ? client : clients.forHost("local");
25617
26014
  idleReleaseSync.connect(localClient);
25618
26015
  const connected = !disposed && (client !== null || localClient !== null || (window.__codexhostHostRoutingV1?.knownHostIds?.() ?? []).some(
25619
- (hostId) => window.__codexhostHostRoutingV1?.forHost(hostId) != null
26016
+ (hostId2) => window.__codexhostHostRoutingV1?.forHost(hostId2) != null
25620
26017
  ));
25621
26018
  updateStatus(
25622
26019
  connected ? "ready" : "installing",
@@ -25644,7 +26041,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
25644
26041
  return disposed ? null : route?.hostId ?? window.__codexhostHostRoutingV1?.hostIdForComposer() ?? null;
25645
26042
  },
25646
26043
  knownHostIds: () => disposed ? [] : window.__codexhostHostRoutingV1?.knownHostIds?.() ?? [],
25647
- clientForHost: (hostId) => disposed ? null : clients.forHost(hostId),
26044
+ clientForHost: (hostId2) => disposed ? null : clients.forHost(hostId2),
25648
26045
  listHarnessPlugins: async () => {
25649
26046
  const client = settingsModelClient();
25650
26047
  if (!client.listHarnessPlugins) throw new Error("Harness plugin directory is unavailable");
@@ -26505,8 +26902,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
26505
26902
  KNOWN_RENDERER_AGENTS.filter(
26506
26903
  (agent) => agent !== "codex"
26507
26904
  ).flatMap((agent) => {
26508
- const configuration2 = parseExternalConfiguration(externalByAgent[agent]);
26509
- return configuration2 ? [[agent, configuration2]] : [];
26905
+ const configuration = parseExternalConfiguration(externalByAgent[agent]);
26906
+ return configuration ? [[agent, configuration]] : [];
26510
26907
  })
26511
26908
  );
26512
26909
  return {
@@ -26803,6 +27200,1174 @@ Codex Fast mode prioritizes requests and may increase usage.`
26803
27200
  });
26804
27201
  }
26805
27202
 
27203
+ // src/settings/remote-failure-messages.ts
27204
+ var REMOTE_FAILURE_CHINESE = Object.freeze({
27205
+ "Remote connection management is unavailable. Restart Codex through codexhost": "\u8FDC\u7A0B\u8FDE\u63A5\u7BA1\u7406\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u901A\u8FC7 codexhost \u91CD\u65B0\u542F\u52A8 Codex",
27206
+ "Remote connection request timed out. Refresh before retrying": "\u8FDC\u7A0B\u8FDE\u63A5\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u5237\u65B0\u540E\u518D\u8BD5",
27207
+ "Invalid remote connection request": "\u8FDC\u7A0B\u8FDE\u63A5\u8BF7\u6C42\u65E0\u6548",
27208
+ // SSH helper: installing, updating and repairing over SSH.
27209
+ "Invalid SSH address or port": "SSH \u5730\u5740\u6216\u7AEF\u53E3\u65E0\u6548",
27210
+ "Install requires a published stable version": "\u53EA\u80FD\u5B89\u88C5\u5DF2\u53D1\u5E03\u7684\u6B63\u5F0F\u7248\u672C",
27211
+ "SSH operation timed out; check the remote computer before retrying": "SSH \u64CD\u4F5C\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u540E\u91CD\u8BD5",
27212
+ "Remote service is already installed. Connect and use its update button": "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u7ECF\u5B89\u88C5\uFF0C\u8BF7\u8FDE\u63A5\u540E\u4F7F\u7528\u66F4\u65B0\u6309\u94AE",
27213
+ "Remote service is not installed. Use Install and connect instead": "\u8FDC\u7A0B\u670D\u52A1\u5C1A\u672A\u5B89\u88C5\uFF0C\u8BF7\u4F7F\u7528\u300C\u5B89\u88C5\u5E76\u8FDE\u63A5\u300D",
27214
+ "This release is not published on npm, or the remote computer cannot reach the registry": "\u8BE5\u7248\u672C\u5C1A\u672A\u53D1\u5E03\u5230 npm\uFF0C\u6216\u8FDC\u7A0B\u7535\u8111\u65E0\u6CD5\u8BBF\u95EE npm \u4ED3\u5E93",
27215
+ "codexhost was installed but is not on the remote PATH. Update this remote manually": "codexhost \u5DF2\u5B89\u88C5\uFF0C\u4F46\u4E0D\u5728\u8FDC\u7A0B\u7535\u8111\u7684 PATH \u4E2D\uFF0C\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u66F4\u65B0",
27216
+ "Only Mac and Linux remote computers are supported": "\u53EA\u652F\u6301 Mac \u548C Linux \u8FDC\u7A0B\u7535\u8111",
27217
+ "Node.js was not detected over SSH. Install it on the remote computer or add it to the login shell PATH, then retry": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 Node.js\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 Node.js \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5",
27218
+ "npm was not detected over SSH. Install it on the remote computer or add it to the login shell PATH, then retry": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 npm\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 npm \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5",
27219
+ "Codex CLI was not detected over SSH. Install the command-line tool on the remote computer or add it to the login shell PATH, then retry. Codex Desktop is not required": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 Codex CLI\uFF08\u547D\u4EE4\u884C\u5DE5\u5177\uFF09\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 Codex CLI \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5\u3002\u65E0\u9700\u5B89\u88C5 Codex \u684C\u9762\u7AEF",
27220
+ "codexhost was not detected over SSH. Install it on the remote computer or add it to the login shell PATH, then retry": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 codexhost\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 codexhost \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5",
27221
+ "The active codexhost does not match the global npm installation. Uninstall only the remote service, or remove the package manually on the remote computer": "\u5F53\u524D codexhost \u4E0E npm \u5168\u5C40\u5B89\u88C5\u4F4D\u7F6E\u4E0D\u5339\u914D\u3002\u8BF7\u9009\u62E9\u4EC5\u5378\u8F7D\u8FDC\u7A0B\u670D\u52A1\uFF0C\u6216\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u5378\u8F7D\u8F6F\u4EF6\u5305",
27222
+ "The remote service was uninstalled, but removing the codexhost package failed. Check npm permissions on the remote computer and retry": "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5378\u8F7D\uFF0C\u4F46 codexhost \u8F6F\u4EF6\u5305\u5378\u8F7D\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u4E0A\u7684 npm \u6743\u9650\u540E\u91CD\u8BD5",
27223
+ "Remote Node.js is unsupported. Select Node.js 22.19 or later in the 22.x series, or Node.js 24.x": "\u8FDC\u7A0B Node.js \u7248\u672C\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u9009\u62E9 Node.js 22.19 \u53CA\u4EE5\u4E0A\u7684 22.x \u7248\u672C\uFF0C\u6216 Node.js 24.x",
27224
+ "npm installation failed. Check network access and global installation permissions": "npm \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u548C\u5168\u5C40\u5B89\u88C5\u6743\u9650",
27225
+ "Remote service configuration failed. Check Codex CLI and the remote desktop login": "\u8FDC\u7A0B\u670D\u52A1\u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 Codex CLI \u4EE5\u53CA\u8FDC\u7A0B\u7535\u8111\u7684\u684C\u9762\u767B\u5F55\u72B6\u6001",
27226
+ "Remote service could not stop. Check the remote service before retrying": "\u8FDC\u7A0B\u670D\u52A1\u65E0\u6CD5\u505C\u6B62\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u670D\u52A1\u540E\u91CD\u8BD5",
27227
+ "Remote connection configuration could not be removed. Check file permissions": "\u65E0\u6CD5\u79FB\u9664\u8FDC\u7A0B\u8FDE\u63A5\u914D\u7F6E\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u6743\u9650",
27228
+ "Another remote installation is in progress. Wait and check again": "\u53E6\u4E00\u9879\u8FDC\u7A0B\u5B89\u88C5\u6B63\u5728\u8FDB\u884C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u65B0\u68C0\u6D4B",
27229
+ "Remote service was installed but could not start. Check the remote service and retry connecting": "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5B89\u88C5\u4F46\u65E0\u6CD5\u542F\u52A8\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u670D\u52A1\u540E\u91CD\u65B0\u8FDE\u63A5",
27230
+ "SSH failed. Check the address, key authentication and trusted host key": "SSH \u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u5730\u5740\u3001\u5BC6\u94A5\u8BA4\u8BC1\u4EE5\u53CA\u4E3B\u673A\u5BC6\u94A5\u662F\u5426\u5DF2\u4FE1\u4EFB",
27231
+ "Unexpected SSH inspection response": "SSH \u68C0\u6D4B\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u7ED3\u679C",
27232
+ "SSH installation failed; check the remote computer and retry": "SSH \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u540E\u91CD\u8BD5",
27233
+ "SSH installation helper is unavailable. Update local BOFT and restart.": "SSH \u5B89\u88C5\u7EC4\u4EF6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u66F4\u65B0\u672C\u673A BOFT \u540E\u91CD\u542F",
27234
+ "SSH installation must run from the local computer": "SSH \u5B89\u88C5\u53EA\u80FD\u4ECE\u672C\u673A\u53D1\u8D77",
27235
+ "An SSH operation is already running for this connection": "\u8FD9\u4E2A\u8FDE\u63A5\u5DF2\u6709 SSH \u64CD\u4F5C\u6B63\u5728\u8FDB\u884C",
27236
+ // Remote service: updating or restarting itself.
27237
+ "Another codexhost update is active; finish it before retrying": "\u53E6\u4E00\u9879 codexhost \u66F4\u65B0\u6B63\u5728\u8FDB\u884C\uFF0C\u8BF7\u7B49\u5B83\u5B8C\u6210\u540E\u91CD\u8BD5",
27238
+ "The remote installation changed before the update acquired its lock; refresh and retry": "\u66F4\u65B0\u5F00\u59CB\u524D\u8FDC\u7A0B\u5B89\u88C5\u53D1\u751F\u4E86\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",
27239
+ "Could not identify the global npm installation": "\u65E0\u6CD5\u8BC6\u522B\u8FDC\u7A0B\u7535\u8111\u7684\u5168\u5C40 npm \u5B89\u88C5",
27240
+ "npm uses a different global installation; update this remote manually": "\u8FDC\u7A0B\u7535\u8111\u7684 npm \u4F7F\u7528\u4E86\u53E6\u4E00\u5904\u5168\u5C40\u5B89\u88C5\uFF0C\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u66F4\u65B0",
27241
+ "The requested release is unavailable or npm cannot reach the registry": "\u76EE\u6807\u7248\u672C\u4E0D\u5B58\u5728\uFF0C\u6216\u8FDC\u7A0B\u7535\u8111\u65E0\u6CD5\u8BBF\u95EE npm \u4ED3\u5E93",
27242
+ "npm installation failed; check remote network access and write permissions": "npm \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u7684\u7F51\u7EDC\u548C\u5199\u5165\u6743\u9650",
27243
+ "Installed remote version does not match the requested version": "\u8FDC\u7A0B\u5B89\u88C5\u7684\u7248\u672C\u4E0E\u8BF7\u6C42\u7684\u7248\u672C\u4E0D\u4E00\u81F4",
27244
+ "Remote stop failed": "\u66F4\u65B0\u5DF2\u5B89\u88C5\uFF0C\u4F46\u505C\u6B62\u65E7\u670D\u52A1\u5931\u8D25",
27245
+ "Remote install failed": "\u66F4\u65B0\u5DF2\u5B89\u88C5\uFF0C\u4F46\u91CD\u65B0\u914D\u7F6E\u8FDC\u7A0B\u670D\u52A1\u5931\u8D25",
27246
+ "Remote start failed": "\u66F4\u65B0\u5DF2\u5B89\u88C5\uFF0C\u4F46\u542F\u52A8\u8FDC\u7A0B\u670D\u52A1\u5931\u8D25",
27247
+ "The previous remote update was interrupted; retry the update": "\u4E0A\u4E00\u6B21\u8FDC\u7A0B\u66F4\u65B0\u88AB\u4E2D\u65AD\uFF0C\u8BF7\u91CD\u8BD5",
27248
+ "Remote updater did not start": "\u8FDC\u7A0B\u66F4\u65B0\u7A0B\u5E8F\u672A\u80FD\u542F\u52A8",
27249
+ "Remote updater could not be started": "\u65E0\u6CD5\u542F\u52A8\u8FDC\u7A0B\u66F4\u65B0\u7A0B\u5E8F",
27250
+ "Remote updater is unavailable": "\u8FDC\u7A0B\u66F4\u65B0\u7A0B\u5E8F\u4E0D\u53EF\u7528",
27251
+ "Another remote update is already pending": "\u5DF2\u6709\u53E6\u4E00\u9879\u8FDC\u7A0B\u66F4\u65B0\u5728\u7B49\u5F85\u6267\u884C",
27252
+ "Remote update requires an npm installation with the current updater": "\u8FDC\u7A0B\u66F4\u65B0\u9700\u8981\u901A\u8FC7 npm \u5B89\u88C5\u5E76\u5E26\u6709\u5F53\u524D\u7248\u672C\u7684\u66F4\u65B0\u7A0B\u5E8F",
27253
+ "Remote downgrades are not automatic; update this computer first": "\u4E0D\u4F1A\u81EA\u52A8\u964D\u4F4E\u8FDC\u7A0B\u7248\u672C\uFF0C\u8BF7\u5148\u66F4\u65B0\u672C\u673A",
27254
+ "The remote installation changed; refresh versions before retrying": "\u8FDC\u7A0B\u5B89\u88C5\u53D1\u751F\u4E86\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u7248\u672C\u540E\u91CD\u8BD5",
27255
+ "Remote service is updating; reconnect shortly": "\u8FDC\u7A0B\u670D\u52A1\u6B63\u5728\u66F4\u65B0\uFF0C\u8BF7\u7A0D\u540E\u91CD\u65B0\u8FDE\u63A5",
27256
+ "Runtime version management is unavailable in this build": "\u5F53\u524D\u6784\u5EFA\u4E0D\u652F\u6301\u7248\u672C\u7BA1\u7406",
27257
+ // This window's bridge to the remote service.
27258
+ "Remote service did not respond; reconnect and retry": "\u8FDC\u7A0B\u670D\u52A1\u6CA1\u6709\u54CD\u5E94\uFF0C\u8BF7\u91CD\u65B0\u8FDE\u63A5\u540E\u91CD\u8BD5",
27259
+ "SSH installation is unavailable; update local codexhost and restart": "SSH \u5B89\u88C5\u4E0D\u53EF\u7528\uFF0C\u8BF7\u66F4\u65B0\u672C\u673A codexhost \u540E\u91CD\u542F",
27260
+ "Version management is unavailable; update codexhost on this host and reconnect": "\u7248\u672C\u7BA1\u7406\u4E0D\u53EF\u7528\uFF0C\u8BF7\u66F4\u65B0\u8FD9\u53F0\u7535\u8111\u4E0A\u7684 codexhost \u540E\u91CD\u65B0\u8FDE\u63A5",
27261
+ "Remote update is unavailable; update this remote once and reconnect": "\u8FDC\u7A0B\u66F4\u65B0\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5148\u624B\u52A8\u66F4\u65B0\u4E00\u6B21\u8FD9\u53F0\u8FDC\u7A0B\u7535\u8111\u518D\u91CD\u65B0\u8FDE\u63A5",
27262
+ // Codex SSH bridge: reading and saving connections.
27263
+ "Codex SSH settings are unavailable in this window": "\u6B64\u7A97\u53E3\u65E0\u6CD5\u4F7F\u7528 Codex SSH \u8BBE\u7F6E",
27264
+ "Codex SSH request failed; check the native Connections settings": "Codex SSH \u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u539F\u751F\u7684\u8FDE\u63A5\u8BBE\u7F6E",
27265
+ "Invalid Codex SSH response": "Codex SSH \u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u7ED3\u679C",
27266
+ "Codex SSH request timed out; refresh before retrying": "Codex SSH \u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",
27267
+ "Invalid Codex SSH connection list": "Codex \u8FD4\u56DE\u7684 SSH \u8FDE\u63A5\u5217\u8868\u65E0\u6CD5\u8BC6\u522B",
27268
+ "This Codex version uses an unsupported SSH configuration; open native settings": "\u5F53\u524D Codex \u7248\u672C\u7684 SSH \u914D\u7F6E\u683C\u5F0F\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u5728\u539F\u751F\u8BBE\u7F6E\u4E2D\u7BA1\u7406",
27269
+ "This connection changed in Codex. Refresh and edit it again.": "\u8FD9\u4E2A\u8FDE\u63A5\u5DF2\u5728 Codex \u4E2D\u88AB\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u7F16\u8F91",
27270
+ "Enter a name, SSH hostname (or alias), and a port between 1 and 65535": "\u8BF7\u586B\u5199\u540D\u79F0\u3001SSH \u4E3B\u673A\u540D\uFF08\u6216\u522B\u540D\uFF09\uFF0C\u7AEF\u53E3\u9700\u5728 1 \u5230 65535 \u4E4B\u95F4",
27271
+ "A connection with this name already exists": "\u5DF2\u5B58\u5728\u540C\u540D\u7684\u8FDE\u63A5",
27272
+ "Edit SSH-config connection details in native Codex settings": "\u6765\u81EA SSH \u914D\u7F6E\u7684\u8FDE\u63A5\uFF0C\u8BF7\u5728 Codex \u539F\u751F\u8BBE\u7F6E\u4E2D\u4FEE\u6539\u8BE6\u7EC6\u4FE1\u606F",
27273
+ "Invalid Codex connection state": "Codex \u8FD4\u56DE\u7684\u8FDE\u63A5\u72B6\u6001\u65E0\u6CD5\u8BC6\u522B"
27274
+ });
27275
+ function localizeRemoteFailure(message, t) {
27276
+ const text = message.replace(/^Error:\s*/u, "");
27277
+ const detail = text.indexOf(": ");
27278
+ const chinese = REMOTE_FAILURE_CHINESE[text] ?? (detail > 0 ? REMOTE_FAILURE_CHINESE[text.slice(0, detail)] : void 0);
27279
+ return chinese ? t(chinese, text) : text;
27280
+ }
27281
+
27282
+ // src/settings/remote-connections-card.ts
27283
+ var STABLE_VERSION = /^\d+\.\d+\.\d+$/u;
27284
+ function remoteErrorMessage(error51) {
27285
+ return error51 instanceof Error && error51.message ? error51.message : String(error51);
27286
+ }
27287
+ function remoteVersionIssue(error51) {
27288
+ const outdated = typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === -32601;
27289
+ return { outdated, message: remoteErrorMessage(error51) };
27290
+ }
27291
+ function remoteElement(document2, tag, className = "", text = "") {
27292
+ const result = document2.createElement(tag);
27293
+ if (className) result.className = className;
27294
+ if (text) result.textContent = text;
27295
+ return result;
27296
+ }
27297
+ function remoteInstallVersion(local) {
27298
+ const version2 = local?.runningVersion;
27299
+ return version2 && STABLE_VERSION.test(version2) ? version2 : null;
27300
+ }
27301
+ function remoteMaintenanceTarget(local, remote) {
27302
+ if (!remote.updateSupported) return null;
27303
+ return newerLocalVersion(local, remote) ?? (remote.restartRequired ? remote.installedVersion : null);
27304
+ }
27305
+ function newerLocalVersion(local, remote) {
27306
+ return remoteUpdateTarget(local, { ...remote, update: { ...remote.update, phase: "idle" } });
27307
+ }
27308
+ function remoteBusy(remote) {
27309
+ return !!remote && ["installing", "restarting"].includes(remote.update.phase);
27310
+ }
27311
+ function remoteTroubled(row) {
27312
+ if (row.remote) return row.remote.update.phase === "failed";
27313
+ if (row.state === "connecting") return false;
27314
+ return !(row.state === "disconnected" && !row.connection.autoConnect);
27315
+ }
27316
+ function connectionState(row, t) {
27317
+ switch (row.state) {
27318
+ case null:
27319
+ return ["progress", t("\u68C0\u6D4B\u4E2D\u2026", "Checking\u2026")];
27320
+ case "connected":
27321
+ return ["success", t("\u5DF2\u8FDE\u63A5", "Connected")];
27322
+ case "connecting":
27323
+ return ["progress", t("\u8FDE\u63A5\u4E2D\u2026", "Connecting\u2026")];
27324
+ case "disconnected":
27325
+ return ["neutral", t("\u672A\u8FDE\u63A5", "Disconnected")];
27326
+ case "error":
27327
+ return ["danger", t("\u8FDE\u63A5\u5931\u8D25", "Connection failed")];
27328
+ default:
27329
+ return ["neutral", t("\u72B6\u6001\u672A\u77E5", "Unknown state")];
27330
+ }
27331
+ }
27332
+ function serviceSummary(row, local, t) {
27333
+ const { remote } = row;
27334
+ const hints = [];
27335
+ if (!remote) {
27336
+ if (row.probing) return { title: t("\u6B63\u5728\u68C0\u6D4B\u8FDC\u7A0B\u670D\u52A1\u2026", "Checking remote service\u2026"), hints };
27337
+ if (row.installation === "not-installed") {
27338
+ const version2 = remoteInstallVersion(local);
27339
+ hints.push(
27340
+ version2 ? [
27341
+ "neutral",
27342
+ t(
27343
+ `\u5C06\u5B89\u88C5\u4E0E\u672C\u673A\u76F8\u540C\u7684\u7248\u672C ${version2}`,
27344
+ `Installs version ${version2}, matching this computer`
27345
+ )
27346
+ ] : [
27347
+ "warning",
27348
+ t(
27349
+ "\u672C\u673A\u7248\u672C\u4E0D\u53EF\u7528\u4E8E\u5B89\u88C5\uFF0C\u8BF7\u4F7F\u7528\u6B63\u5F0F\u53D1\u5E03\u7248\u672C\u3002",
27350
+ "Install from a published local release."
27351
+ )
27352
+ ]
27353
+ );
27354
+ return { title: t("\u9700\u8981\u5B89\u88C5\u8FDC\u7A0B\u670D\u52A1", "Remote service needs installation"), hints };
27355
+ }
27356
+ if (row.remoteIssue?.outdated) {
27357
+ const version2 = remoteInstallVersion(local);
27358
+ hints.push(
27359
+ version2 ? [
27360
+ "neutral",
27361
+ t(
27362
+ `\u66F4\u65B0\u5230\u672C\u673A\u7248\u672C ${version2} \u540E\u53EF\u5728\u8FD9\u91CC\u67E5\u770B\u548C\u7BA1\u7406\u7248\u672C\u3002`,
27363
+ `Update to this computer's version ${version2} to manage versions here.`
27364
+ )
27365
+ ] : [
27366
+ "warning",
27367
+ t(
27368
+ "\u672C\u673A\u4E0D\u662F\u6B63\u5F0F\u53D1\u5E03\u7248\u672C\uFF0C\u65E0\u6CD5\u4ECE\u8FD9\u91CC\u66F4\u65B0\uFF1B\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u66F4\u65B0 codexhost\u3002",
27369
+ "This computer is not running a published release, so it cannot update the remote. Update codexhost on the remote computer manually."
27370
+ )
27371
+ ]
27372
+ );
27373
+ return { title: t("\u8FDC\u7A0B\u670D\u52A1\u9700\u8981\u66F4\u65B0", "Remote service needs an update"), hints };
27374
+ }
27375
+ hints.push([
27376
+ "neutral",
27377
+ row.state === "connecting" || row.state === "disconnected" && !row.connection.autoConnect ? t("\u8FDE\u63A5\u540E\u663E\u793A\u8FDC\u7A0B\u670D\u52A1\u7248\u672C\u3002", "Connect to see the remote service version.") : t(
27378
+ "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u8FDC\u7A0B\u7248\u672C\uFF0C\u53EF\u5237\u65B0\u6216\u91CD\u65B0\u8FDE\u63A5\u540E\u518D\u8BD5\u3002",
27379
+ "Remote version information is temporarily unavailable. Refresh or reconnect to retry."
27380
+ )
27381
+ ]);
27382
+ if (row.remoteIssue)
27383
+ hints.push([
27384
+ "danger",
27385
+ `${t("\u539F\u56E0", "Reason")}: ${localizeRemoteFailure(row.remoteIssue.message, t)}`
27386
+ ]);
27387
+ return { title: t("\u8FDC\u7A0B\u670D\u52A1", "Remote service"), hints };
27388
+ }
27389
+ const busy = remoteBusy(remote);
27390
+ const installed = (busy ? remote.runningVersion : remote.installedVersion) ?? remote.runningVersion ?? "\u2014";
27391
+ const title = !busy && remote.runningVersion && remote.runningVersion !== remote.installedVersion ? t(
27392
+ `\u8FDC\u7A0B\u670D\u52A1 ${installed} \xB7 \u8FD0\u884C\u4E2D ${remote.runningVersion}`,
27393
+ `Remote service ${installed} \xB7 running ${remote.runningVersion}`
27394
+ ) : t(`\u8FDC\u7A0B\u670D\u52A1 ${installed}`, `Remote service ${installed}`);
27395
+ const phases = {
27396
+ idle: null,
27397
+ installing: ["progress", t("\u6B63\u5728\u66F4\u65B0\u8FDC\u7A0B\u670D\u52A1\u2026", "Updating remote service\u2026")],
27398
+ restarting: ["progress", t("\u6B63\u5728\u91CD\u542F\uFF0C\u8BF7\u7A0D\u5019\u91CD\u8FDE\u2026", "Restarting; reconnecting shortly\u2026")],
27399
+ // The record outlives the update; the version line already shows the result.
27400
+ succeeded: null,
27401
+ failed: ["danger", t("\u66F4\u65B0\u5931\u8D25\uFF0C\u53EF\u4EE5\u91CD\u8BD5", "Update failed; you can retry")]
27402
+ };
27403
+ const phase = phases[remote.update.phase];
27404
+ if (phase) hints.push(phase);
27405
+ if (remote.update.error) hints.push(["danger", localizeRemoteFailure(remote.update.error, t)]);
27406
+ if (remote.restartRequired && !busy)
27407
+ hints.push([
27408
+ "warning",
27409
+ t("\u9700\u8981\u91CD\u542F\u4EE5\u4F7F\u7528\u5DF2\u5B89\u88C5\u7684\u7248\u672C", "Restart needed to use the installed version")
27410
+ ]);
27411
+ const newer = newerLocalVersion(local, remote);
27412
+ const localVersion = local?.runningVersion;
27413
+ if (remoteBusy(remote)) {
27414
+ } else if (newer && remote.installedVersion !== localVersion)
27415
+ hints.push([
27416
+ "warning",
27417
+ t(`\u6709\u66F4\u65B0\u53EF\u7528 \xB7 \u672C\u673A\u4E3A ${newer}`, `Update available \xB7 this computer runs ${newer}`)
27418
+ ]);
27419
+ else if (localVersion && remote.installedVersion === localVersion && !remote.restartRequired)
27420
+ hints.push(["success", t("\u4E0E\u672C\u673A\u7248\u672C\u4E00\u81F4", "Matches this computer")]);
27421
+ if (localVersion && remote.installedVersion && localVersion !== remote.installedVersion && !newer)
27422
+ hints.push([
27423
+ "warning",
27424
+ t(
27425
+ "\u7248\u672C\u4E0D\u540C\uFF0C\u8BF7\u5148\u68C0\u67E5\u672C\u673A\u66F4\u65B0\uFF1B\u4E0D\u4F1A\u81EA\u52A8\u964D\u4F4E\u8FDC\u7A0B\u7248\u672C\u3002",
27426
+ "Versions differ. Check for a local update; the remote version will not be downgraded."
27427
+ )
27428
+ ]);
27429
+ return { title, hints };
27430
+ }
27431
+ function renderRemoteCard(document2, row, local, t, onAction) {
27432
+ const { connection, remote } = row;
27433
+ const locked = row.pending !== null;
27434
+ const command = (action, label, primary = false) => {
27435
+ const button = remoteElement(
27436
+ document2,
27437
+ "button",
27438
+ primary ? "settings-command-button" : "settings-command-button settings-command-button--secondary",
27439
+ label
27440
+ );
27441
+ button.type = "button";
27442
+ button.dataset.action = action;
27443
+ button.disabled = locked;
27444
+ button.addEventListener("click", () => onAction(action));
27445
+ return button;
27446
+ };
27447
+ const card = remoteElement(document2, "section", "settings-remote-card");
27448
+ card.dataset.hostId = connection.hostId;
27449
+ card.setAttribute("aria-label", connection.displayName);
27450
+ card.setAttribute("aria-busy", String(locked));
27451
+ const head = remoteElement(document2, "div", "settings-remote-card__head");
27452
+ const identity = remoteElement(document2, "div", "settings-remote-card__identity");
27453
+ const titleLine = remoteElement(document2, "div", "settings-remote-card__title");
27454
+ const [tone, stateLabel] = connectionState(row, t);
27455
+ const state = remoteElement(document2, "span", "settings-remote-card__state", stateLabel);
27456
+ state.dataset.tone = tone;
27457
+ titleLine.append(remoteElement(document2, "h3", "", connection.displayName), state);
27458
+ const address = `${connection.sshAlias ?? connection.sshHost}${connection.sshPort ? `:${connection.sshPort}` : ""}`;
27459
+ const addressLine = remoteElement(document2, "div", "settings-remote-card__address", address);
27460
+ addressLine.title = address;
27461
+ if (connection.source === "discovered")
27462
+ addressLine.append(
27463
+ remoteElement(document2, "span", "settings-status-badge", t("SSH \u914D\u7F6E", "SSH config"))
27464
+ );
27465
+ identity.append(titleLine, addressLine);
27466
+ const headActions = remoteElement(document2, "div", "settings-remote-card__actions");
27467
+ if (row.installation !== "not-installed" && !row.probing) {
27468
+ if (row.state === "error" && connection.autoConnect)
27469
+ headActions.append(command("reconnect", t("\u91CD\u65B0\u8FDE\u63A5", "Reconnect")));
27470
+ headActions.append(
27471
+ command("toggle", connection.autoConnect ? t("\u65AD\u5F00", "Disconnect") : t("\u8FDE\u63A5", "Connect"))
27472
+ );
27473
+ }
27474
+ headActions.append(command("edit", t("\u7F16\u8F91", "Edit")));
27475
+ const remove = remoteElement(
27476
+ document2,
27477
+ "button",
27478
+ "settings-icon-button settings-remote-card__remove"
27479
+ );
27480
+ remove.type = "button";
27481
+ remove.dataset.action = "remove";
27482
+ remove.disabled = locked;
27483
+ remove.title = t("\u79FB\u9664", "Remove");
27484
+ remove.setAttribute("aria-label", t("\u79FB\u9664", "Remove"));
27485
+ remove.append(createRendererSettingsIcon("trash", 15));
27486
+ remove.addEventListener("click", () => onAction("remove"));
27487
+ headActions.append(remove);
27488
+ head.append(identity, headActions);
27489
+ card.append(head);
27490
+ if (row.stateError) {
27491
+ const detail = remoteElement(
27492
+ document2,
27493
+ "p",
27494
+ "settings-remote-card__detail",
27495
+ localizeRemoteFailure(row.stateError, t)
27496
+ );
27497
+ detail.dataset.tone = "danger";
27498
+ card.append(detail);
27499
+ }
27500
+ const service = remoteElement(document2, "div", "settings-remote-card__service");
27501
+ const copy = remoteElement(document2, "div", "settings-remote-card__service-copy");
27502
+ const hint = (hintTone, text, live = false) => {
27503
+ const line = remoteElement(document2, "p", "settings-remote-card__hint");
27504
+ line.dataset.tone = hintTone;
27505
+ if (hintTone === "progress")
27506
+ line.append(remoteElement(document2, "span", "settings-remote-spinner"));
27507
+ line.append(text);
27508
+ if (live) line.setAttribute("role", hintTone === "danger" ? "alert" : "status");
27509
+ return line;
27510
+ };
27511
+ const summary = serviceSummary(row, local, t);
27512
+ copy.append(remoteElement(document2, "div", "settings-remote-card__service-title", summary.title));
27513
+ if (row.pending) copy.append(hint("progress", row.pending, true));
27514
+ else {
27515
+ for (const [hintTone, text] of summary.hints) copy.append(hint(hintTone, text));
27516
+ if (row.notice)
27517
+ copy.append(hint(row.notice.tone, localizeRemoteFailure(row.notice.text, t), true));
27518
+ }
27519
+ const serviceActions = remoteElement(document2, "div", "settings-remote-card__actions");
27520
+ if (!row.probing) {
27521
+ if (row.installation === "installed" && !remoteBusy(remote)) {
27522
+ serviceActions.append(command("uninstall", t("\u5378\u8F7D\u8FDC\u7A0B\u670D\u52A1", "Uninstall remote service")));
27523
+ }
27524
+ const outdated = !remote && !!row.remoteIssue?.outdated && row.installation !== "not-installed";
27525
+ if (outdated) {
27526
+ const upgrade = command("upgrade", t("\u66F4\u65B0\u8FDC\u7A0B\u670D\u52A1", "Update remote service"), true);
27527
+ upgrade.disabled ||= !remoteInstallVersion(local);
27528
+ serviceActions.append(upgrade);
27529
+ } else if (remoteTroubled(row)) {
27530
+ if (row.installation !== "not-installed") {
27531
+ const repair = command("repair", t("\u4FEE\u590D\u8FDC\u7A0B\u670D\u52A1", "Repair remote service"));
27532
+ repair.title = t(
27533
+ "\u505C\u6B62\u5E76\u91CD\u65B0\u914D\u7F6E\u8FDC\u7A0B\u670D\u52A1\uFF0C\u4E0D\u4F1A\u66F4\u65B0\u7248\u672C\u3002",
27534
+ "Stops and reconfigures the remote service. It does not change the version."
27535
+ );
27536
+ serviceActions.append(repair);
27537
+ }
27538
+ if (!remote) serviceActions.append(command("recheck", t("\u91CD\u65B0\u68C0\u6D4B", "Check again")));
27539
+ }
27540
+ const target = remote ? remoteMaintenanceTarget(local, remote) : null;
27541
+ if (row.installation === "not-installed") {
27542
+ const install2 = command("install", t("\u5B89\u88C5\u5E76\u8FDE\u63A5", "Install and connect"), true);
27543
+ install2.disabled ||= !remoteInstallVersion(local);
27544
+ serviceActions.append(install2);
27545
+ } else if (remote && target && !remoteBusy(remote)) {
27546
+ const update = command(
27547
+ "update",
27548
+ target === remote.installedVersion ? t("\u91CD\u542F\u5E76\u8FDE\u63A5", "Restart and connect") : t("\u66F4\u65B0\u5230\u672C\u673A\u7248\u672C", "Match local version"),
27549
+ true
27550
+ );
27551
+ serviceActions.append(update);
27552
+ }
27553
+ }
27554
+ service.append(copy, serviceActions);
27555
+ card.append(service);
27556
+ return card;
27557
+ }
27558
+
27559
+ // src/settings/preference-ui.ts
27560
+ var nextPreferenceId = 0;
27561
+ function preferenceId(prefix) {
27562
+ nextPreferenceId += 1;
27563
+ return `codexhost-${prefix}-${nextPreferenceId}`;
27564
+ }
27565
+ function createPreferenceGroup(document2, title) {
27566
+ const group = document2.createElement("section");
27567
+ group.className = "mt-7 first-of-type:mt-0";
27568
+ const header = document2.createElement("div");
27569
+ header.className = "mb-2 flex min-h-6 items-center gap-2 px-1";
27570
+ const heading = document2.createElement("h3");
27571
+ heading.id = preferenceId("preference-group");
27572
+ heading.className = "m-0 text-[13px] leading-5 font-semibold text-settings-text";
27573
+ heading.textContent = title;
27574
+ header.append(heading);
27575
+ const card = document2.createElement("div");
27576
+ card.className = "rounded-[10px] border border-settings-border bg-settings-panel";
27577
+ group.setAttribute("aria-labelledby", heading.id);
27578
+ group.append(header, card);
27579
+ return { group, header, card };
27580
+ }
27581
+ function createPreferenceItem(document2, input) {
27582
+ const item = document2.createElement("div");
27583
+ item.className = "flex min-h-[60px] items-center justify-between gap-6 border-t border-settings-divider px-4 py-3 first:border-t-0";
27584
+ const copy = document2.createElement("div");
27585
+ copy.className = "flex min-w-0 flex-col gap-0.5";
27586
+ const heading = document2.createElement("div");
27587
+ heading.className = "flex items-center gap-1.5";
27588
+ const title = document2.createElement("label");
27589
+ title.htmlFor = input.controlId;
27590
+ title.className = "cursor-pointer text-[13px] leading-5 font-medium text-settings-text";
27591
+ title.textContent = input.title;
27592
+ heading.append(title);
27593
+ if (input.help) heading.append(createHelpTooltip(document2, input.help.label, input.help.lines));
27594
+ const description = document2.createElement("div");
27595
+ description.id = preferenceId("preference-description");
27596
+ description.className = "text-xs leading-[18px] text-settings-muted data-[invalid=true]:text-settings-danger";
27597
+ description.textContent = input.description;
27598
+ copy.append(heading, description);
27599
+ item.append(copy);
27600
+ return { item, description };
27601
+ }
27602
+ function createHelpTooltip(document2, label, lines) {
27603
+ const wrapper = document2.createElement("span");
27604
+ wrapper.className = "group relative inline-flex";
27605
+ const button = document2.createElement("button");
27606
+ button.type = "button";
27607
+ button.className = "inline-flex size-4 cursor-help items-center justify-center rounded-full border-0 bg-transparent p-0 text-settings-subtle transition-colors hover:text-settings-text focus-visible:text-settings-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-settings-focus";
27608
+ button.setAttribute("aria-label", label);
27609
+ button.append(createRendererSettingsIcon("help", 14));
27610
+ const tooltip = document2.createElement("div");
27611
+ tooltip.id = preferenceId("preference-tooltip");
27612
+ tooltip.setAttribute("role", "tooltip");
27613
+ tooltip.className = "pointer-events-none invisible absolute top-full left-0 z-20 mt-2 w-80 rounded-lg border border-settings-border bg-settings-panel px-3 py-2.5 text-xs leading-[18px] font-normal text-settings-text opacity-0 shadow-[0_10px_30px_rgb(0_0_0/0.22)] transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100";
27614
+ const list = document2.createElement("ul");
27615
+ list.className = "m-0 grid list-disc gap-1 pl-4 marker:text-settings-subtle";
27616
+ for (const line of lines) {
27617
+ const item = document2.createElement("li");
27618
+ item.textContent = line;
27619
+ list.append(item);
27620
+ }
27621
+ tooltip.append(list);
27622
+ button.setAttribute("aria-describedby", tooltip.id);
27623
+ button.addEventListener("keydown", (event) => {
27624
+ if (event.key === "Escape") button.blur();
27625
+ });
27626
+ wrapper.append(button, tooltip);
27627
+ return wrapper;
27628
+ }
27629
+ function createPreferenceSwitch(document2, id, describedBy) {
27630
+ const input = document2.createElement("input");
27631
+ input.type = "checkbox";
27632
+ input.id = id;
27633
+ input.setAttribute("role", "switch");
27634
+ input.setAttribute("aria-describedby", describedBy);
27635
+ input.className = "relative m-0 h-5 w-9 shrink-0 cursor-pointer appearance-none rounded-full bg-settings-surface-hover ring-1 ring-settings-border transition-colors ring-inset before:absolute before:top-0.5 before:left-0.5 before:size-4 before:rounded-full before:bg-white before:shadow-[0_1px_2px_rgb(0_0_0/0.3)] before:transition-transform checked:bg-settings-focus checked:ring-transparent checked:before:translate-x-4 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-settings-focus";
27636
+ return input;
27637
+ }
27638
+ function createNumberField(document2, input) {
27639
+ const field = document2.createElement("div");
27640
+ field.className = "flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-settings-border bg-settings-surface px-2.5 transition-colors focus-within:border-settings-focus data-[invalid=true]:border-settings-danger";
27641
+ const control = document2.createElement("input");
27642
+ control.type = "number";
27643
+ control.id = input.id;
27644
+ control.min = String(input.min);
27645
+ control.max = String(input.max);
27646
+ control.step = "1";
27647
+ control.setAttribute("aria-describedby", input.describedBy);
27648
+ control.className = "w-14 border-0 bg-transparent p-0 text-right text-[13px] leading-5 text-settings-text tabular-nums outline-none";
27649
+ const unit = document2.createElement("span");
27650
+ unit.className = "text-xs text-settings-muted";
27651
+ unit.setAttribute("aria-hidden", "true");
27652
+ unit.textContent = input.unit;
27653
+ field.append(control, unit);
27654
+ return { field, control };
27655
+ }
27656
+
27657
+ // src/settings/remote-connections-dialogs.ts
27658
+ function createRemoteDialog({ container, signal, t }, title) {
27659
+ if (signal.aborted || container.querySelector("dialog")) return null;
27660
+ const document2 = container.ownerDocument;
27661
+ const modal = remoteElement(
27662
+ document2,
27663
+ "dialog",
27664
+ "settings-account-dialog settings-credential-dialog settings-remote-dialog"
27665
+ );
27666
+ const form = remoteElement(document2, "form");
27667
+ const heading = remoteElement(document2, "h2", "", title);
27668
+ heading.id = preferenceId("remote-dialog-title");
27669
+ modal.setAttribute("aria-labelledby", heading.id);
27670
+ const body = remoteElement(document2, "div", "settings-credential-dialog__body");
27671
+ const error51 = remoteElement(document2, "p", "settings-credential-dialog__error");
27672
+ error51.setAttribute("role", "alert");
27673
+ const actions = remoteElement(document2, "div", "settings-credential-dialog__actions");
27674
+ const cancel = remoteElement(
27675
+ document2,
27676
+ "button",
27677
+ "settings-command-button settings-command-button--secondary",
27678
+ t("\u53D6\u6D88", "Cancel")
27679
+ );
27680
+ cancel.type = "button";
27681
+ const confirm = remoteElement(document2, "button", "settings-command-button");
27682
+ confirm.type = "submit";
27683
+ actions.append(cancel, confirm);
27684
+ form.append(heading, body, error51, actions);
27685
+ modal.append(form);
27686
+ let busy = false;
27687
+ let labels = { idle: "", busy: "" };
27688
+ const setBusy = (next) => {
27689
+ busy = next;
27690
+ cancel.disabled = confirm.disabled = next;
27691
+ confirm.textContent = next ? labels.busy : labels.idle;
27692
+ modal.setAttribute("aria-busy", String(next));
27693
+ };
27694
+ const dispose = () => modal.remove();
27695
+ cancel.addEventListener("click", () => modal.close());
27696
+ modal.addEventListener("cancel", (event) => {
27697
+ if (busy) event.preventDefault();
27698
+ });
27699
+ modal.addEventListener("close", () => {
27700
+ signal.removeEventListener("abort", dispose);
27701
+ dispose();
27702
+ });
27703
+ signal.addEventListener("abort", dispose, { once: true });
27704
+ return {
27705
+ form,
27706
+ body,
27707
+ submit(operation) {
27708
+ if (busy) return;
27709
+ error51.textContent = "";
27710
+ setBusy(true);
27711
+ operation().then(
27712
+ () => modal.close(),
27713
+ (failure) => {
27714
+ if (signal.aborted) return;
27715
+ setBusy(false);
27716
+ error51.textContent = localizeRemoteFailure(remoteErrorMessage(failure), t);
27717
+ }
27718
+ );
27719
+ },
27720
+ show(confirmLabel, busyLabel, danger = false) {
27721
+ labels = { idle: confirmLabel, busy: busyLabel };
27722
+ confirm.textContent = confirmLabel;
27723
+ if (danger)
27724
+ confirm.className = "settings-command-button settings-command-button--secondary settings-command-button--danger";
27725
+ container.append(modal);
27726
+ modal.showModal();
27727
+ }
27728
+ };
27729
+ }
27730
+ function openRemoteConnectionEditor(options) {
27731
+ const { t, previous } = options;
27732
+ const dialog = createRemoteDialog(
27733
+ options,
27734
+ previous ? t("\u7F16\u8F91\u8FDE\u63A5", "Edit connection") : t("\u6DFB\u52A0 SSH \u8FDE\u63A5", "Add SSH connection")
27735
+ );
27736
+ if (!dialog) return;
27737
+ const document2 = options.container.ownerDocument;
27738
+ const field = (label, value, placeholder = "", hint = "") => {
27739
+ const wrapper = remoteElement(document2, "div", "settings-credential-dialog__field");
27740
+ const input = remoteElement(document2, "input");
27741
+ input.id = preferenceId("remote-field");
27742
+ input.value = value;
27743
+ input.placeholder = placeholder;
27744
+ input.autocomplete = "off";
27745
+ input.spellcheck = false;
27746
+ const caption = remoteElement(document2, "label", "", label);
27747
+ caption.htmlFor = input.id;
27748
+ wrapper.append(caption, input);
27749
+ if (hint) {
27750
+ const description = remoteElement(document2, "small", "", hint);
27751
+ description.id = `${input.id}-hint`;
27752
+ input.setAttribute("aria-describedby", description.id);
27753
+ wrapper.append(description);
27754
+ }
27755
+ dialog.body.append(wrapper);
27756
+ return input;
27757
+ };
27758
+ const name = field(t("\u540D\u79F0", "Name"), previous?.displayName ?? "");
27759
+ name.required = true;
27760
+ const addressHint = t(
27761
+ "user@hostname\uFF0C\u6216 ~/.ssh/config \u4E2D\u7684\u4E3B\u673A\u522B\u540D",
27762
+ "user@hostname, or a host alias from ~/.ssh/config"
27763
+ );
27764
+ const hostname3 = field(
27765
+ t("SSH \u5730\u5740", "SSH address"),
27766
+ previous?.sshHost ?? "",
27767
+ "user@hostname",
27768
+ addressHint
27769
+ );
27770
+ hostname3.required = true;
27771
+ hostname3.pattern = "[^\\s\\-]\\S*";
27772
+ hostname3.title = addressHint;
27773
+ const port = field(
27774
+ t("\u7AEF\u53E3\uFF08\u53EF\u9009\uFF09", "Port (optional)"),
27775
+ previous?.sshPort?.toString() ?? "",
27776
+ "22"
27777
+ );
27778
+ port.type = "number";
27779
+ port.min = "1";
27780
+ port.max = "65535";
27781
+ port.step = "1";
27782
+ const identity = field(
27783
+ t("\u79C1\u94A5\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09", "Identity file (optional)"),
27784
+ previous?.identity ?? "",
27785
+ "~/.ssh/id_ed25519"
27786
+ );
27787
+ if (previous?.source === "discovered") {
27788
+ hostname3.disabled = port.disabled = identity.disabled = true;
27789
+ dialog.body.append(
27790
+ remoteElement(
27791
+ document2,
27792
+ "p",
27793
+ "",
27794
+ t(
27795
+ "\u6B64\u8FDE\u63A5\u6765\u81EA SSH \u914D\u7F6E\uFF0C\u8FD9\u91CC\u53EA\u80FD\u4FEE\u6539\u540D\u79F0\uFF1B\u5176\u4F59\u914D\u7F6E\u8BF7\u5728\u539F\u751F\u8BBE\u7F6E\u4E2D\u7F16\u8F91\u3002",
27796
+ "This connection comes from SSH config, so only its name can change here. Edit other details in native settings."
27797
+ )
27798
+ )
27799
+ );
27800
+ }
27801
+ dialog.form.addEventListener("submit", (event) => {
27802
+ event.preventDefault();
27803
+ dialog.submit(
27804
+ () => options.save({
27805
+ displayName: name.value,
27806
+ hostname: hostname3.value,
27807
+ sshPort: port.value ? Number(port.value) : null,
27808
+ identity: identity.value.trim() || null
27809
+ })
27810
+ );
27811
+ });
27812
+ dialog.show(t("\u4FDD\u5B58", "Save"), t("\u4FDD\u5B58\u4E2D\u2026", "Saving\u2026"));
27813
+ name.focus();
27814
+ name.select();
27815
+ }
27816
+ function openRemoteConnectionRemoval(options) {
27817
+ const { t, connection } = options;
27818
+ const dialog = createRemoteDialog(
27819
+ options,
27820
+ t(`\u79FB\u9664\u201C${connection.displayName}\u201D\uFF1F`, `Remove "${connection.displayName}"?`)
27821
+ );
27822
+ if (!dialog) return;
27823
+ dialog.body.append(
27824
+ remoteElement(
27825
+ options.container.ownerDocument,
27826
+ "p",
27827
+ "",
27828
+ t(
27829
+ "\u79FB\u9664\u8FDE\u63A5\u4E0D\u4F1A\u5220\u9664\u8FDC\u7A0B\u6587\u4EF6\u6216\u4F1A\u8BDD\u3002",
27830
+ "Removing a connection does not delete remote files or chats."
27831
+ )
27832
+ )
27833
+ );
27834
+ dialog.form.addEventListener("submit", (event) => {
27835
+ event.preventDefault();
27836
+ dialog.submit(options.remove);
27837
+ });
27838
+ dialog.show(t("\u79FB\u9664", "Remove"), t("\u79FB\u9664\u4E2D\u2026", "Removing\u2026"), true);
27839
+ }
27840
+ function openRemoteServiceUninstall(options) {
27841
+ const { t, connection } = options;
27842
+ const dialog = createRemoteDialog(
27843
+ options,
27844
+ t(
27845
+ `\u5378\u8F7D\u201C${connection.displayName}\u201D\u7684\u8FDC\u7A0B\u670D\u52A1\uFF1F`,
27846
+ `Uninstall remote service on "${connection.displayName}"?`
27847
+ )
27848
+ );
27849
+ if (!dialog) return;
27850
+ const document2 = options.container.ownerDocument;
27851
+ dialog.body.append(
27852
+ remoteElement(
27853
+ document2,
27854
+ "p",
27855
+ "",
27856
+ t(
27857
+ "\u5378\u8F7D\u4F1A\u4E2D\u65AD codexhost \u542F\u52A8\u7684\u4F1A\u8BDD\u3002\u5982\u9700\u5728\u8BE5\u7535\u8111\u7EE7\u7EED\u4F7F\u7528\uFF0C\u8BF7\u624B\u52A8\u901A\u8FC7 codexhost \u91CD\u65B0\u542F\u52A8\u3002",
27858
+ "Uninstalling interrupts sessions started through codexhost. To keep using it on that computer, manually relaunch through codexhost."
27859
+ )
27860
+ )
27861
+ );
27862
+ const label = remoteElement(document2, "label", "settings-remote-dialog__package-option");
27863
+ const removePackage = remoteElement(document2, "input");
27864
+ removePackage.type = "checkbox";
27865
+ label.append(
27866
+ removePackage,
27867
+ t("\u540C\u65F6\u5378\u8F7D codexhost \u8F6F\u4EF6\u5305", "Also uninstall the codexhost package")
27868
+ );
27869
+ dialog.body.append(
27870
+ label,
27871
+ remoteElement(
27872
+ document2,
27873
+ "p",
27874
+ "",
27875
+ t(
27876
+ "\u52FE\u9009\u540E\uFF0C\u518D\u6B21\u4F7F\u7528\u524D\u9700\u91CD\u65B0\u5B89\u88C5 codexhost\u3002",
27877
+ "If selected, reinstall codexhost before using it again."
27878
+ )
27879
+ )
27880
+ );
27881
+ dialog.form.addEventListener("submit", (event) => {
27882
+ event.preventDefault();
27883
+ const selected = removePackage.checked;
27884
+ dialog.submit(async () => {
27885
+ removePackage.disabled = true;
27886
+ try {
27887
+ await options.uninstall(selected);
27888
+ } finally {
27889
+ removePackage.disabled = false;
27890
+ }
27891
+ });
27892
+ });
27893
+ dialog.show(t("\u5378\u8F7D", "Uninstall"), t("\u5378\u8F7D\u4E2D\u2026", "Uninstalling\u2026"), true);
27894
+ }
27895
+
27896
+ // src/settings/remote-connections-page.ts
27897
+ var POLL_INTERVAL_MS = 5e3;
27898
+ var SUCCESS_NOTICE_MS = 6e3;
27899
+ var INSPECT_RETRY_MS = 6e4;
27900
+ var RESTART_GRACE_MS = 9e4;
27901
+ var CONNECT_REQUEST_WAIT_MS = 3e3;
27902
+ function createRemoteConnectionsPage(messages, getControl) {
27903
+ const zh = messages.locale === "zh-CN";
27904
+ const t = (cn, en) => zh ? cn : en;
27905
+ return Object.freeze({
27906
+ id: "remote-connections",
27907
+ label: messages.pageLabels["remote-connections"],
27908
+ icon: "gateway",
27909
+ mount({ content, signal }) {
27910
+ const document2 = content.ownerDocument;
27911
+ const el = (tag, className = "", text = "") => remoteElement(document2, tag, className, text);
27912
+ const emptyPanel = (title, detail) => {
27913
+ const panel = el("div", "settings-remote__empty");
27914
+ const copy = el("div");
27915
+ copy.append(el("strong", "", title), el("span", "", detail));
27916
+ panel.append(copy);
27917
+ return panel;
27918
+ };
27919
+ const root = el("div", "settings-remote");
27920
+ const header = el("div", "settings-remote__header");
27921
+ const headerCopy = el("div");
27922
+ const localVersion = el("p", "settings-remote__meta");
27923
+ headerCopy.append(
27924
+ el("h1", "settings-section-label", messages.pageLabels["remote-connections"]),
27925
+ el(
27926
+ "p",
27927
+ "settings-page-description",
27928
+ t(
27929
+ "\u901A\u8FC7 SSH \u8FDE\u63A5\u4F60\u7684 Mac \u6216 Linux \u7535\u8111\u3002\u8FDE\u63A5\u914D\u7F6E\u4E0E Codex \u5171\u7528\u3002",
27930
+ "Connect to a Mac or Linux computer over SSH. Connection settings are shared with Codex."
27931
+ )
27932
+ ),
27933
+ localVersion
27934
+ );
27935
+ header.append(headerCopy);
27936
+ root.append(header);
27937
+ content.append(root);
27938
+ const availableControl = getControl();
27939
+ if (!availableControl) {
27940
+ root.append(
27941
+ emptyPanel(
27942
+ t("\u6B64\u7A97\u53E3\u65E0\u6CD5\u7BA1\u7406 SSH \u8FDE\u63A5", "SSH connections are unavailable in this window"),
27943
+ t("\u8BF7\u5728 Codex \u684C\u9762\u7A0B\u5E8F\u4E2D\u7BA1\u7406 SSH \u8FDE\u63A5\u3002", "Manage SSH connections in Codex Desktop.")
27944
+ )
27945
+ );
27946
+ return;
27947
+ }
27948
+ const control = availableControl;
27949
+ const toolbar = el("div", "settings-remote__toolbar");
27950
+ const refreshButton = el("button", "settings-icon-button settings-remote__refresh");
27951
+ refreshButton.type = "button";
27952
+ refreshButton.title = t("\u5237\u65B0", "Refresh");
27953
+ refreshButton.setAttribute("aria-label", t("\u5237\u65B0", "Refresh"));
27954
+ refreshButton.append(createRendererSettingsIcon("refresh", 16));
27955
+ const addButton = el("button", "settings-command-button");
27956
+ addButton.type = "button";
27957
+ addButton.append(createRendererSettingsIcon("add", 14), t("\u6DFB\u52A0\u8FDE\u63A5", "Add connection"));
27958
+ toolbar.append(refreshButton, addButton);
27959
+ header.append(toolbar);
27960
+ const banner = el("div", "settings-remote__banner");
27961
+ banner.setAttribute("role", "alert");
27962
+ banner.hidden = true;
27963
+ const bannerText = el("span");
27964
+ const retry = el(
27965
+ "button",
27966
+ "settings-command-button settings-command-button--secondary",
27967
+ t("\u91CD\u8BD5", "Retry")
27968
+ );
27969
+ retry.type = "button";
27970
+ banner.append(bannerText, retry);
27971
+ const placeholder = el("div", "settings-remote__placeholder");
27972
+ const list = el("div", "settings-remote__list");
27973
+ root.append(banner, placeholder, list);
27974
+ let local = null;
27975
+ let localLoaded = false;
27976
+ let loaded = false;
27977
+ let loadError = null;
27978
+ let order = [];
27979
+ let polling = false;
27980
+ const rows = /* @__PURE__ */ new Map();
27981
+ const cards = /* @__PURE__ */ new Map();
27982
+ const installations = /* @__PURE__ */ new Map();
27983
+ const probeTokens = /* @__PURE__ */ new Map();
27984
+ const inspectFailures = /* @__PURE__ */ new Map();
27985
+ const restarting = /* @__PURE__ */ new Map();
27986
+ const focusedElement = () => {
27987
+ const active = root.getRootNode().activeElement;
27988
+ return active instanceof HTMLElement ? active : null;
27989
+ };
27990
+ function renderPlaceholder() {
27991
+ if (!loaded) {
27992
+ const loading = el("p", "settings-remote__loading");
27993
+ loading.append(
27994
+ el("span", "settings-remote-spinner"),
27995
+ t("\u6B63\u5728\u8BFB\u53D6\u8FDE\u63A5\u2026", "Loading connections\u2026")
27996
+ );
27997
+ placeholder.replaceChildren(...loadError ? [] : [loading]);
27998
+ } else if (!order.length) {
27999
+ const empty = emptyPanel(
28000
+ t("\u8FD8\u6CA1\u6709 SSH \u8FDE\u63A5", "No SSH connections yet"),
28001
+ t(
28002
+ "\u6DFB\u52A0\u4E00\u53F0 Mac \u6216 Linux \u7535\u8111\uFF0C\u5728\u4E0A\u9762\u8FD0\u884C\u4F1A\u8BDD\u3002",
28003
+ "Add a Mac or Linux computer to run conversations on it."
28004
+ )
28005
+ );
28006
+ const add = el(
28007
+ "button",
28008
+ "settings-command-button settings-command-button--secondary",
28009
+ t("\u6DFB\u52A0\u8FDE\u63A5", "Add connection")
28010
+ );
28011
+ add.type = "button";
28012
+ add.addEventListener("click", () => edit(null));
28013
+ empty.append(add);
28014
+ placeholder.replaceChildren(empty);
28015
+ } else placeholder.replaceChildren();
28016
+ }
28017
+ function render() {
28018
+ if (signal.aborted) return;
28019
+ localVersion.textContent = localLoaded ? `${t("\u672C\u673A codexhost", "Local codexhost")} ${local?.runningVersion ?? t("\u7248\u672C\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6", "version is temporarily unavailable")}` : "";
28020
+ banner.hidden = !loadError;
28021
+ bannerText.textContent = loadError ? `${t("\u8BFB\u53D6\u8FDE\u63A5\u5931\u8D25", "Could not load connections")}: ${localizeRemoteFailure(loadError, t)}` : "";
28022
+ renderPlaceholder();
28023
+ for (const [hostId2, card] of cards) {
28024
+ if (rows.has(hostId2)) continue;
28025
+ card.element.remove();
28026
+ cards.delete(hostId2);
28027
+ }
28028
+ const active = focusedElement();
28029
+ order.forEach((hostId2, index) => {
28030
+ const row = rows.get(hostId2);
28031
+ if (!row) return;
28032
+ const signature = JSON.stringify([row, local]);
28033
+ let card = cards.get(hostId2);
28034
+ if (card?.signature !== signature) {
28035
+ const element = renderRemoteCard(
28036
+ document2,
28037
+ row,
28038
+ local,
28039
+ t,
28040
+ (action) => handle(row, action)
28041
+ );
28042
+ const focusedAction = active && card?.element.contains(active) ? active.dataset.action : void 0;
28043
+ if (card) card.element.replaceWith(element);
28044
+ card = { element, signature };
28045
+ cards.set(hostId2, card);
28046
+ if (focusedAction) focusAction(element, focusedAction);
28047
+ }
28048
+ if (list.children[index] !== card.element)
28049
+ list.insertBefore(card.element, list.children[index] ?? null);
28050
+ });
28051
+ }
28052
+ function focusAction(card, action) {
28053
+ const target = card.querySelector(`[data-action="${action}"]:not(:disabled)`) ?? card.querySelector("button:not(:disabled)");
28054
+ target?.focus();
28055
+ }
28056
+ async function probe(row) {
28057
+ const { hostId: hostId2 } = row.connection;
28058
+ const token = (probeTokens.get(hostId2) ?? 0) + 1;
28059
+ probeTokens.set(hostId2, token);
28060
+ const state = await control.ssh.state(hostId2, signal).catch((error51) => ({ state: "unknown", error: remoteErrorMessage(error51) }));
28061
+ let remote = null;
28062
+ let remoteIssue = null;
28063
+ if (state.state === "connected")
28064
+ remote = await control.runtime(hostId2).catch((error51) => {
28065
+ remoteIssue = remoteVersionIssue(error51);
28066
+ return null;
28067
+ });
28068
+ if (signal.aborted || rows.get(hostId2) !== row || probeTokens.get(hostId2) !== token) return;
28069
+ let expectedGap = false;
28070
+ if (remote && remoteBusy(remote)) restarting.set(hostId2, Date.now() + RESTART_GRACE_MS);
28071
+ else if (remote || (restarting.get(hostId2) ?? 0) <= Date.now()) restarting.delete(hostId2);
28072
+ else if (row.remote) {
28073
+ expectedGap = true;
28074
+ remote = { ...row.remote, update: { ...row.remote.update, phase: "restarting" } };
28075
+ remoteIssue = null;
28076
+ }
28077
+ if (remote) installations.set(hostId2, "installed");
28078
+ else if (!installations.has(hostId2) && Date.now() - (inspectFailures.get(hostId2) ?? -INSPECT_RETRY_MS) >= INSPECT_RETRY_MS) {
28079
+ const inspected = await control.setup(row.connection, "inspect").catch(() => null);
28080
+ if (signal.aborted || rows.get(hostId2) !== row || probeTokens.get(hostId2) !== token)
28081
+ return;
28082
+ if (inspected) installations.set(hostId2, inspected.state);
28083
+ else inspectFailures.set(hostId2, Date.now());
28084
+ }
28085
+ if (signal.aborted || rows.get(hostId2) !== row || probeTokens.get(hostId2) !== token) return;
28086
+ row.probing = false;
28087
+ row.state = expectedGap ? "connecting" : state.state;
28088
+ row.stateError = expectedGap ? null : state.error;
28089
+ row.remote = remote;
28090
+ row.remoteIssue = remoteIssue;
28091
+ row.installation = installations.get(hostId2) ?? "unknown";
28092
+ render();
28093
+ }
28094
+ async function refresh(actingHostId, wait = "acting") {
28095
+ if (signal.aborted) return;
28096
+ const localTask = control.runtime("local").catch(() => null).then((status) => {
28097
+ if (signal.aborted) return;
28098
+ local = status;
28099
+ localLoaded = true;
28100
+ render();
28101
+ });
28102
+ let connections;
28103
+ try {
28104
+ connections = await control.ssh.list(signal);
28105
+ } catch (error51) {
28106
+ if (signal.aborted) return;
28107
+ loadError = remoteErrorMessage(error51);
28108
+ render();
28109
+ return;
28110
+ }
28111
+ if (signal.aborted) return;
28112
+ loadError = null;
28113
+ loaded = true;
28114
+ order = connections.map((connection) => connection.hostId);
28115
+ for (const connection of connections) {
28116
+ const row = rows.get(connection.hostId);
28117
+ if (row) row.connection = connection;
28118
+ else
28119
+ rows.set(connection.hostId, {
28120
+ connection,
28121
+ probing: true,
28122
+ state: null,
28123
+ stateError: null,
28124
+ remote: null,
28125
+ remoteIssue: null,
28126
+ installation: null,
28127
+ pending: null,
28128
+ notice: null
28129
+ });
28130
+ }
28131
+ for (const hostId2 of [...rows.keys()]) {
28132
+ if (order.includes(hostId2)) continue;
28133
+ rows.delete(hostId2);
28134
+ installations.delete(hostId2);
28135
+ probeTokens.delete(hostId2);
28136
+ inspectFailures.delete(hostId2);
28137
+ restarting.delete(hostId2);
28138
+ }
28139
+ render();
28140
+ const probes = [...rows.values()].filter((row) => !row.pending || row.connection.hostId === actingHostId).map((row) => ({ hostId: row.connection.hostId, done: probe(row) }));
28141
+ const awaited = wait === "all" ? probes : probes.filter((p) => p.hostId === actingHostId);
28142
+ await Promise.all([localTask, ...awaited.map((p) => p.done)]);
28143
+ }
28144
+ async function act(row, action, label, operation, rethrow = false) {
28145
+ const { hostId: hostId2 } = row.connection;
28146
+ probeTokens.set(hostId2, (probeTokens.get(hostId2) ?? 0) + 1);
28147
+ row.pending = label;
28148
+ row.notice = null;
28149
+ render();
28150
+ try {
28151
+ const done = await operation();
28152
+ await refresh(hostId2);
28153
+ if (typeof done === "string") {
28154
+ const notice = { tone: "success", text: done };
28155
+ row.notice = notice;
28156
+ setTimeout(() => {
28157
+ if (row.notice !== notice) return;
28158
+ row.notice = null;
28159
+ render();
28160
+ }, SUCCESS_NOTICE_MS);
28161
+ }
28162
+ } catch (error51) {
28163
+ row.notice = { tone: "danger", text: remoteErrorMessage(error51) };
28164
+ installations.delete(hostId2);
28165
+ inspectFailures.delete(hostId2);
28166
+ void refresh(hostId2);
28167
+ if (rethrow) throw error51;
28168
+ } finally {
28169
+ row.pending = null;
28170
+ if (!signal.aborted) {
28171
+ render();
28172
+ const card = cards.get(hostId2)?.element;
28173
+ if (card && !focusedElement()) focusAction(card, action);
28174
+ }
28175
+ }
28176
+ }
28177
+ function edit(previous) {
28178
+ openRemoteConnectionEditor({
28179
+ container: root,
28180
+ signal,
28181
+ t,
28182
+ previous,
28183
+ async save(draft) {
28184
+ await control.ssh.save(draft, previous, signal);
28185
+ if (previous) {
28186
+ installations.delete(previous.hostId);
28187
+ inspectFailures.delete(previous.hostId);
28188
+ restarting.delete(previous.hostId);
28189
+ }
28190
+ await refresh();
28191
+ }
28192
+ });
28193
+ }
28194
+ function handle(row, action) {
28195
+ if (row.pending) return;
28196
+ const { connection } = row;
28197
+ const { hostId: hostId2 } = connection;
28198
+ const setConnected = async (enabled) => {
28199
+ const request = control.ssh.connect(hostId2, enabled, signal);
28200
+ request.catch(() => void 0);
28201
+ await Promise.race([
28202
+ request,
28203
+ new Promise((resolve) => setTimeout(resolve, CONNECT_REQUEST_WAIT_MS))
28204
+ ]);
28205
+ };
28206
+ const reconnect = async () => {
28207
+ installations.delete(hostId2);
28208
+ inspectFailures.delete(hostId2);
28209
+ await setConnected(true);
28210
+ };
28211
+ switch (action) {
28212
+ case "edit":
28213
+ edit(connection);
28214
+ break;
28215
+ case "remove":
28216
+ openRemoteConnectionRemoval({
28217
+ container: root,
28218
+ signal,
28219
+ t,
28220
+ connection,
28221
+ async remove() {
28222
+ await control.ssh.remove(connection, signal);
28223
+ await refresh();
28224
+ }
28225
+ });
28226
+ break;
28227
+ case "toggle":
28228
+ void act(
28229
+ row,
28230
+ action,
28231
+ connection.autoConnect ? t("\u6B63\u5728\u65AD\u5F00\u2026", "Disconnecting\u2026") : t("\u6B63\u5728\u8FDE\u63A5\u2026", "Connecting\u2026"),
28232
+ () => setConnected(!connection.autoConnect)
28233
+ );
28234
+ break;
28235
+ case "reconnect":
28236
+ void act(row, action, t("\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u2026", "Reconnecting\u2026"), async () => {
28237
+ await setConnected(false);
28238
+ await setConnected(true);
28239
+ });
28240
+ break;
28241
+ case "recheck":
28242
+ void act(row, action, t("\u6B63\u5728\u91CD\u65B0\u68C0\u6D4B\u2026", "Checking again\u2026"), async () => {
28243
+ installations.delete(hostId2);
28244
+ inspectFailures.delete(hostId2);
28245
+ });
28246
+ break;
28247
+ case "install": {
28248
+ const version2 = remoteInstallVersion(local);
28249
+ if (!version2) break;
28250
+ void act(
28251
+ row,
28252
+ action,
28253
+ t("\u6B63\u5728\u5B89\u88C5\u8FDC\u7A0B\u670D\u52A1\uFF0C\u8BF7\u7A0D\u5019\u2026", "Installing remote service, please wait\u2026"),
28254
+ async () => {
28255
+ await control.setup(connection, "install", version2);
28256
+ await reconnect();
28257
+ return t("\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5B89\u88C5\uFF0C\u6B63\u5728\u8FDE\u63A5", "Remote service installed; connecting");
28258
+ }
28259
+ );
28260
+ break;
28261
+ }
28262
+ case "upgrade": {
28263
+ const version2 = remoteInstallVersion(local);
28264
+ if (!version2) break;
28265
+ void act(
28266
+ row,
28267
+ action,
28268
+ t("\u6B63\u5728\u66F4\u65B0\u8FDC\u7A0B\u670D\u52A1\uFF0C\u8BF7\u7A0D\u5019\u2026", "Updating remote service, please wait\u2026"),
28269
+ async () => {
28270
+ await control.setup(connection, "update", version2);
28271
+ await reconnect();
28272
+ return t("\u8FDC\u7A0B\u670D\u52A1\u5DF2\u66F4\u65B0\uFF0C\u6B63\u5728\u8FDE\u63A5", "Remote service updated; connecting");
28273
+ }
28274
+ );
28275
+ break;
28276
+ }
28277
+ case "repair":
28278
+ void act(
28279
+ row,
28280
+ action,
28281
+ t("\u6B63\u5728\u91CD\u65B0\u914D\u7F6E\u8FDC\u7A0B\u670D\u52A1\u2026", "Reconfiguring remote service\u2026"),
28282
+ async () => {
28283
+ await control.setup(connection, "repair");
28284
+ await reconnect();
28285
+ return t("\u8FDC\u7A0B\u670D\u52A1\u5DF2\u4FEE\u590D\uFF0C\u6B63\u5728\u8FDE\u63A5", "Remote service repaired; connecting");
28286
+ }
28287
+ );
28288
+ break;
28289
+ case "uninstall":
28290
+ if (row.installation !== "installed" || remoteBusy(row.remote)) break;
28291
+ openRemoteServiceUninstall({
28292
+ container: root,
28293
+ signal,
28294
+ t,
28295
+ connection,
28296
+ async uninstall(removePackage) {
28297
+ if (row.pending || remoteBusy(row.remote))
28298
+ throw new Error(
28299
+ t(
28300
+ "\u8FDC\u7A0B\u670D\u52A1\u6B63\u5728\u6267\u884C\u5176\u4ED6\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",
28301
+ "Another remote operation is active; retry shortly"
28302
+ )
28303
+ );
28304
+ await act(
28305
+ row,
28306
+ action,
28307
+ t("\u6B63\u5728\u5378\u8F7D\u8FDC\u7A0B\u670D\u52A1\u2026", "Uninstalling remote service\u2026"),
28308
+ async () => {
28309
+ await control.ssh.connect(hostId2, false, signal);
28310
+ await control.setup(connection, "uninstall", void 0, removePackage);
28311
+ installations.set(hostId2, "not-installed");
28312
+ inspectFailures.delete(hostId2);
28313
+ restarting.delete(hostId2);
28314
+ row.remote = null;
28315
+ row.remoteIssue = null;
28316
+ row.stateError = null;
28317
+ return removePackage ? t(
28318
+ "\u8FDC\u7A0B\u670D\u52A1\u548C codexhost \u8F6F\u4EF6\u5305\u5DF2\u5378\u8F7D",
28319
+ "Remote service and codexhost package uninstalled"
28320
+ ) : t(
28321
+ "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5378\u8F7D\uFF0Ccodexhost \u8F6F\u4EF6\u5305\u5DF2\u4FDD\u7559",
28322
+ "Remote service uninstalled; codexhost package kept"
28323
+ );
28324
+ },
28325
+ true
28326
+ );
28327
+ }
28328
+ });
28329
+ break;
28330
+ case "update": {
28331
+ const target = row.remote ? remoteMaintenanceTarget(local, row.remote) : null;
28332
+ if (!target) break;
28333
+ const restart = target === row.remote?.installedVersion;
28334
+ void act(
28335
+ row,
28336
+ action,
28337
+ restart ? t("\u6B63\u5728\u91CD\u542F\u8FDC\u7A0B\u670D\u52A1\u2026", "Restarting remote service\u2026") : t("\u6B63\u5728\u63D0\u4EA4\u66F4\u65B0\u2026", "Starting update\u2026"),
28338
+ async () => {
28339
+ await control.update(hostId2, target);
28340
+ await setConnected(true);
28341
+ }
28342
+ );
28343
+ break;
28344
+ }
28345
+ }
28346
+ }
28347
+ const reload = () => {
28348
+ if (refreshButton.getAttribute("aria-busy") === "true") return;
28349
+ refreshButton.setAttribute("aria-busy", "true");
28350
+ installations.clear();
28351
+ inspectFailures.clear();
28352
+ void refresh(void 0, "all").finally(() => refreshButton.removeAttribute("aria-busy"));
28353
+ };
28354
+ refreshButton.addEventListener("click", reload);
28355
+ retry.addEventListener("click", reload);
28356
+ addButton.addEventListener("click", () => edit(null));
28357
+ render();
28358
+ void refresh();
28359
+ const timer = setInterval(() => {
28360
+ if (polling) return;
28361
+ polling = true;
28362
+ void refresh(void 0, "all").finally(() => {
28363
+ polling = false;
28364
+ });
28365
+ }, POLL_INTERVAL_MS);
28366
+ return () => clearInterval(timer);
28367
+ }
28368
+ });
28369
+ }
28370
+
26806
28371
  // src/settings/core.ts
26807
28372
  var SETTINGS_PAGE_ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
26808
28373
  var MAX_SETTINGS_PAGE_ID_LENGTH = 48;
@@ -26906,6 +28471,74 @@ Codex Fast mode prioritizes requests and may increase usage.`
26906
28471
  }
26907
28472
  };
26908
28473
 
28474
+ // src/settings/horizontal-scroll-hint.ts
28475
+ function createHorizontalScrollHint(document2, scroller, className) {
28476
+ const element = document2.createElement("div");
28477
+ element.className = className;
28478
+ element.setAttribute("aria-hidden", "true");
28479
+ const thumb = document2.createElement("span");
28480
+ element.append(thumb);
28481
+ const limit = () => Math.max(0, scroller.scrollWidth - scroller.clientWidth);
28482
+ const scrollTo = (left) => {
28483
+ scroller.scrollLeft = Math.min(limit(), Math.max(0, left));
28484
+ update();
28485
+ };
28486
+ const update = () => {
28487
+ const { clientWidth, scrollLeft, scrollWidth } = scroller;
28488
+ const overflowing = scrollWidth > clientWidth + 1;
28489
+ element.dataset.overflowing = String(overflowing);
28490
+ if (!overflowing) return;
28491
+ thumb.style.width = `${clientWidth / scrollWidth * 100}%`;
28492
+ thumb.style.left = `${scrollLeft / scrollWidth * 100}%`;
28493
+ };
28494
+ scroller.addEventListener("scroll", update, { passive: true });
28495
+ scroller.addEventListener(
28496
+ "wheel",
28497
+ (event) => {
28498
+ if (event.deltaX !== 0 || event.deltaY === 0 || event.ctrlKey) return;
28499
+ const next = Math.min(limit(), Math.max(0, scroller.scrollLeft + event.deltaY));
28500
+ if (Math.abs(next - scroller.scrollLeft) < 1) return;
28501
+ event.preventDefault();
28502
+ scrollTo(next);
28503
+ },
28504
+ { passive: false }
28505
+ );
28506
+ let drag = null;
28507
+ element.addEventListener("pointerdown", (event) => {
28508
+ if (event.button !== 0 || limit() <= 1) return;
28509
+ const track = element.getBoundingClientRect();
28510
+ if (track.width <= 0) return;
28511
+ if (event.target !== thumb) {
28512
+ const pointed = (event.clientX - track.left) / track.width * scroller.scrollWidth;
28513
+ scrollTo(pointed - scroller.clientWidth / 2);
28514
+ }
28515
+ drag = {
28516
+ pointerId: event.pointerId,
28517
+ startX: event.clientX,
28518
+ startLeft: scroller.scrollLeft,
28519
+ // One pixel along the line is this many pixels of row content.
28520
+ scale: scroller.scrollWidth / track.width
28521
+ };
28522
+ element.dataset.dragging = "true";
28523
+ element.setPointerCapture(event.pointerId);
28524
+ event.preventDefault();
28525
+ });
28526
+ element.addEventListener("pointermove", (event) => {
28527
+ if (drag?.pointerId !== event.pointerId) return;
28528
+ scrollTo(drag.startLeft + (event.clientX - drag.startX) * drag.scale);
28529
+ });
28530
+ const release = (event) => {
28531
+ if (drag?.pointerId !== event.pointerId) return;
28532
+ drag = null;
28533
+ delete element.dataset.dragging;
28534
+ };
28535
+ element.addEventListener("pointerup", release);
28536
+ element.addEventListener("pointercancel", release);
28537
+ const ResizeObserverClass = document2.defaultView?.ResizeObserver;
28538
+ if (ResizeObserverClass) new ResizeObserverClass(update).observe(scroller);
28539
+ return { element, update };
28540
+ }
28541
+
26909
28542
  // src/settings/session-import-list-controls.ts
26910
28543
  function createSessionImportListControls(document2, messages, onChange) {
26911
28544
  let query = "";
@@ -27041,7 +28674,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27041
28674
  text.textContent = message;
27042
28675
  return text;
27043
28676
  }
27044
- function createSessionImportSettingsPage(messages, getClient, openImportedThread) {
28677
+ function createSessionImportSettingsPage(messages, getClient, openImportedThread, getDiagnostics = () => null) {
27045
28678
  return Object.freeze({
27046
28679
  id: "session-import",
27047
28680
  label: messages.pageLabels["session-import"],
@@ -27080,10 +28713,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
27080
28713
  harnessOptions.dataset.sessionImportHarness = "selector";
27081
28714
  harnessOptions.setAttribute("role", "group");
27082
28715
  harnessOptions.setAttribute("aria-label", messages.sessionImportHarness);
28716
+ const harnessScroller = document2.createElement("div");
28717
+ harnessScroller.className = "settings-session-import-harness__scroller";
28718
+ const harnessHint = createHorizontalScrollHint(
28719
+ document2,
28720
+ harnessOptions,
28721
+ "settings-session-import-harness__indicator"
28722
+ );
28723
+ harnessScroller.append(harnessOptions, harnessHint.element);
27083
28724
  let selectedHarness = null;
27084
28725
  let sources = [];
27085
28726
  const sourceButtons = [];
27086
28727
  const renderHarnessOptions = () => {
28728
+ const scrolled = harnessOptions.scrollLeft;
27087
28729
  harnessOptions.replaceChildren();
27088
28730
  sourceButtons.length = 0;
27089
28731
  for (const source of sources) {
@@ -27104,8 +28746,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
27104
28746
  sourceButtons.push(option);
27105
28747
  harnessOptions.append(option);
27106
28748
  }
28749
+ harnessOptions.scrollLeft = scrolled;
28750
+ harnessOptions.querySelector('[aria-pressed="true"]')?.scrollIntoView?.({ block: "nearest", inline: "nearest" });
28751
+ harnessHint.update();
27107
28752
  };
27108
- harness.append(harnessOptions);
28753
+ harness.append(harnessScroller);
27109
28754
  const importStatus = document2.createElement("div");
27110
28755
  importStatus.setAttribute("role", "status");
27111
28756
  const content = document2.createElement("section");
@@ -27169,7 +28814,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
27169
28814
  status.focus();
27170
28815
  }
27171
28816
  };
27172
- const renderOpenRecovery = (candidate, threadId, hostId) => {
28817
+ const renderOpenRecovery = (candidate, threadId, hostId2) => {
27173
28818
  if (!openImportedThread) return;
27174
28819
  actions = [];
27175
28820
  refresh.disabled = false;
@@ -27236,12 +28881,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
27236
28881
  retry.addEventListener("click", () => {
27237
28882
  if (retry.disabled) return;
27238
28883
  setRetrying(true);
27239
- void context.runLatest((signal) => openImportedThread(threadId, signal, hostId), {
28884
+ void context.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
27240
28885
  success() {
27241
28886
  setRetrying(false);
27242
28887
  },
27243
28888
  failure() {
27244
- renderOpenRecovery(candidate, threadId, hostId);
28889
+ renderOpenRecovery(candidate, threadId, hostId2);
27245
28890
  }
27246
28891
  });
27247
28892
  });
@@ -27389,10 +29034,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
27389
29034
  const pageParams = listControls.params();
27390
29035
  void context.runLatest(
27391
29036
  async (signal) => {
27392
- const result = await client.listSessionImportSources();
27393
- const selected = result.harnesses.find(({ harnessId }) => harnessId === requestedHarness)?.harnessId ?? result.harnesses[0]?.harnessId ?? null;
29037
+ const missing = new Set(
29038
+ getDiagnostics()?.snapshot().hosts.find(({ hostId: hostId2 }) => hostId2 === "local")?.agents.filter(({ availability }) => availability === "notInstalled").map(({ agent }) => agent)
29039
+ );
29040
+ const harnesses = (await client.listSessionImportSources()).harnesses.filter(
29041
+ ({ harnessId }) => !missing.has(harnessId)
29042
+ );
29043
+ const selected = harnesses.find(({ harnessId }) => harnessId === requestedHarness)?.harnessId ?? harnesses[0]?.harnessId ?? null;
27394
29044
  if (signal.aborted) throw new Error("Session import selection changed");
27395
- sources = result.harnesses;
29045
+ sources = harnesses;
27396
29046
  selectedHarness = selected;
27397
29047
  if (selected !== requestedHarness) {
27398
29048
  listControls.reset();
@@ -27677,104 +29327,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
27677
29327
  };
27678
29328
  }
27679
29329
 
27680
- // src/settings/preference-ui.ts
27681
- var nextPreferenceId = 0;
27682
- function preferenceId(prefix) {
27683
- nextPreferenceId += 1;
27684
- return `codexhost-${prefix}-${nextPreferenceId}`;
27685
- }
27686
- function createPreferenceGroup(document2, title) {
27687
- const group = document2.createElement("section");
27688
- group.className = "mt-7 first-of-type:mt-0";
27689
- const header = document2.createElement("div");
27690
- header.className = "mb-2 flex min-h-6 items-center gap-2 px-1";
27691
- const heading = document2.createElement("h3");
27692
- heading.id = preferenceId("preference-group");
27693
- heading.className = "m-0 text-[13px] leading-5 font-semibold text-settings-text";
27694
- heading.textContent = title;
27695
- header.append(heading);
27696
- const card = document2.createElement("div");
27697
- card.className = "rounded-[10px] border border-settings-border bg-settings-panel";
27698
- group.setAttribute("aria-labelledby", heading.id);
27699
- group.append(header, card);
27700
- return { group, header, card };
27701
- }
27702
- function createPreferenceItem(document2, input) {
27703
- const item = document2.createElement("div");
27704
- item.className = "flex min-h-[60px] items-center justify-between gap-6 border-t border-settings-divider px-4 py-3 first:border-t-0";
27705
- const copy = document2.createElement("div");
27706
- copy.className = "flex min-w-0 flex-col gap-0.5";
27707
- const heading = document2.createElement("div");
27708
- heading.className = "flex items-center gap-1.5";
27709
- const title = document2.createElement("label");
27710
- title.htmlFor = input.controlId;
27711
- title.className = "cursor-pointer text-[13px] leading-5 font-medium text-settings-text";
27712
- title.textContent = input.title;
27713
- heading.append(title);
27714
- if (input.help) heading.append(createHelpTooltip(document2, input.help.label, input.help.lines));
27715
- const description = document2.createElement("div");
27716
- description.id = preferenceId("preference-description");
27717
- description.className = "text-xs leading-[18px] text-settings-muted data-[invalid=true]:text-settings-danger";
27718
- description.textContent = input.description;
27719
- copy.append(heading, description);
27720
- item.append(copy);
27721
- return { item, description };
27722
- }
27723
- function createHelpTooltip(document2, label, lines) {
27724
- const wrapper = document2.createElement("span");
27725
- wrapper.className = "group relative inline-flex";
27726
- const button = document2.createElement("button");
27727
- button.type = "button";
27728
- button.className = "inline-flex size-4 cursor-help items-center justify-center rounded-full border-0 bg-transparent p-0 text-settings-subtle transition-colors hover:text-settings-text focus-visible:text-settings-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-settings-focus";
27729
- button.setAttribute("aria-label", label);
27730
- button.append(createRendererSettingsIcon("help", 14));
27731
- const tooltip = document2.createElement("div");
27732
- tooltip.id = preferenceId("preference-tooltip");
27733
- tooltip.setAttribute("role", "tooltip");
27734
- tooltip.className = "pointer-events-none invisible absolute top-full left-0 z-20 mt-2 w-80 rounded-lg border border-settings-border bg-settings-panel px-3 py-2.5 text-xs leading-[18px] font-normal text-settings-text opacity-0 shadow-[0_10px_30px_rgb(0_0_0/0.22)] transition-opacity duration-150 group-hover:visible group-hover:opacity-100 group-focus-within:visible group-focus-within:opacity-100";
27735
- const list = document2.createElement("ul");
27736
- list.className = "m-0 grid list-disc gap-1 pl-4 marker:text-settings-subtle";
27737
- for (const line of lines) {
27738
- const item = document2.createElement("li");
27739
- item.textContent = line;
27740
- list.append(item);
27741
- }
27742
- tooltip.append(list);
27743
- button.setAttribute("aria-describedby", tooltip.id);
27744
- button.addEventListener("keydown", (event) => {
27745
- if (event.key === "Escape") button.blur();
27746
- });
27747
- wrapper.append(button, tooltip);
27748
- return wrapper;
27749
- }
27750
- function createPreferenceSwitch(document2, id, describedBy) {
27751
- const input = document2.createElement("input");
27752
- input.type = "checkbox";
27753
- input.id = id;
27754
- input.setAttribute("role", "switch");
27755
- input.setAttribute("aria-describedby", describedBy);
27756
- input.className = "relative m-0 h-5 w-9 shrink-0 cursor-pointer appearance-none rounded-full bg-settings-surface-hover ring-1 ring-settings-border transition-colors ring-inset before:absolute before:top-0.5 before:left-0.5 before:size-4 before:rounded-full before:bg-white before:shadow-[0_1px_2px_rgb(0_0_0/0.3)] before:transition-transform checked:bg-settings-focus checked:ring-transparent checked:before:translate-x-4 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-settings-focus";
27757
- return input;
27758
- }
27759
- function createNumberField(document2, input) {
27760
- const field = document2.createElement("div");
27761
- field.className = "flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-settings-border bg-settings-surface px-2.5 transition-colors focus-within:border-settings-focus data-[invalid=true]:border-settings-danger";
27762
- const control = document2.createElement("input");
27763
- control.type = "number";
27764
- control.id = input.id;
27765
- control.min = String(input.min);
27766
- control.max = String(input.max);
27767
- control.step = "1";
27768
- control.setAttribute("aria-describedby", input.describedBy);
27769
- control.className = "w-14 border-0 bg-transparent p-0 text-right text-[13px] leading-5 text-settings-text tabular-nums outline-none";
27770
- const unit = document2.createElement("span");
27771
- unit.className = "text-xs text-settings-muted";
27772
- unit.setAttribute("aria-hidden", "true");
27773
- unit.textContent = input.unit;
27774
- field.append(control, unit);
27775
- return { field, control };
27776
- }
27777
-
27778
29330
  // src/settings/idle-release-controls.ts
27779
29331
  function mountIdleReleaseControls(context, messages, getLoadedSessionsClient) {
27780
29332
  const { content } = context;
@@ -28139,7 +29691,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28139
29691
  }
28140
29692
  function defaultImportName(source, existing) {
28141
29693
  const base = source.provider === "openai-codex" ? "codex" : "grok";
28142
- const used = new Set(existing.map((record3) => record3.name));
29694
+ const used = new Set(existing.map((record4) => record4.name));
28143
29695
  const valid = (name) => credentialImportNameSchema.safeParse(name).success;
28144
29696
  if (!used.has(base)) return base;
28145
29697
  const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
@@ -28159,7 +29711,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28159
29711
  let othersExpanded = false;
28160
29712
  const targetButtons = /* @__PURE__ */ new Map();
28161
29713
  const importedRecords = () => snapshot.targets.find((target) => target.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
28162
- const sourceOf = (record3) => snapshot.sources.find((source) => source.id === record3.source.id);
29714
+ const sourceOf = (record4) => snapshot.sources.find((source) => source.id === record4.source.id);
28163
29715
  const section = document2.createElement("section");
28164
29716
  section.className = "settings-pi-accounts";
28165
29717
  section.hidden = true;
@@ -28208,33 +29760,33 @@ Codex Fast mode prioritizes requests and may increase usage.`
28208
29760
  mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2));
28209
29761
  return mark;
28210
29762
  };
28211
- const renderRow = (record3) => {
29763
+ const renderRow = (record4) => {
28212
29764
  const row = document2.createElement("div");
28213
29765
  row.className = "settings-pi-accounts__row";
28214
29766
  row.tabIndex = -1;
28215
- row.dataset.importName = record3.name;
28216
- row.setAttribute("aria-label", record3.source.label);
28217
- const agent = KNOWN_RENDERER_AGENTS.find((candidate) => candidate === record3.source.harnessId);
29767
+ row.dataset.importName = record4.name;
29768
+ row.setAttribute("aria-label", record4.source.label);
29769
+ const agent = KNOWN_RENDERER_AGENTS.find((candidate) => candidate === record4.source.harnessId);
28218
29770
  const mark = createMark(agent);
28219
29771
  const identity = document2.createElement("div");
28220
29772
  identity.className = "settings-pi-accounts__identity";
28221
29773
  const label = document2.createElement("strong");
28222
29774
  label.className = "settings-account-email";
28223
- label.textContent = record3.source.label;
28224
- label.title = record3.source.label;
29775
+ label.textContent = record4.source.label;
29776
+ label.title = record4.source.label;
28225
29777
  label.translate = false;
28226
29778
  const meta3 = document2.createElement("div");
28227
29779
  meta3.className = "settings-account-metadata";
28228
- const source = sourceOf(record3);
29780
+ const source = sourceOf(record4);
28229
29781
  const parts = [
28230
29782
  metaPart(
28231
- agent && RENDERER_AGENT_LABELS[agent] || record3.source.harnessId,
29783
+ agent && RENDERER_AGENT_LABELS[agent] || record4.source.harnessId,
28232
29784
  "settings-pi-accounts__agent"
28233
29785
  ),
28234
- metaPart(`${record3.name}/\u2026`, void 0, true),
29786
+ metaPart(`${record4.name}/\u2026`, void 0, true),
28235
29787
  metaPart(messages.copied)
28236
29788
  ];
28237
- const time3 = formatImportedAt(record3.importedAt);
29789
+ const time3 = formatImportedAt(record4.importedAt);
28238
29790
  if (time3) parts.push(metaPart(time3));
28239
29791
  parts.forEach((part, index) => {
28240
29792
  if (index > 0) {
@@ -28251,23 +29803,23 @@ Codex Fast mode prioritizes requests and may increase usage.`
28251
29803
  reimport.type = "button";
28252
29804
  reimport.className = "settings-account-action";
28253
29805
  reimport.textContent = messages.rowReimport;
28254
- reimport.setAttribute("aria-label", `${messages.reimport}: ${record3.source.label}`);
29806
+ reimport.setAttribute("aria-label", `${messages.reimport}: ${record4.source.label}`);
28255
29807
  reimport.disabled = busy || !source;
28256
29808
  reimport.title = messages.reimport;
28257
29809
  reimport.addEventListener("click", () => {
28258
- if (source) openDialog("reimport", { source, record: record3 }, `row:${record3.name}`);
29810
+ if (source) openDialog("reimport", { source, record: record4 }, `row:${record4.name}`);
28259
29811
  });
28260
29812
  const remove = document2.createElement("button");
28261
29813
  remove.type = "button";
28262
29814
  remove.className = "settings-account-action settings-pi-accounts__remove";
28263
29815
  remove.textContent = messages.rowRemove;
28264
- remove.setAttribute("aria-label", `${messages.remove}: ${record3.source.label}`);
29816
+ remove.setAttribute("aria-label", `${messages.remove}: ${record4.source.label}`);
28265
29817
  remove.disabled = busy;
28266
- remove.addEventListener("click", () => openDialog("remove", { record: record3 }, `row:${record3.name}`));
29818
+ remove.addEventListener("click", () => openDialog("remove", { record: record4 }, `row:${record4.name}`));
28267
29819
  if (source) actions.append(reimport);
28268
29820
  actions.append(remove);
28269
29821
  row.append(mark, identity, actions);
28270
- rows.set(record3.name, row);
29822
+ rows.set(record4.name, row);
28271
29823
  return row;
28272
29824
  };
28273
29825
  const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
@@ -28414,7 +29966,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28414
29966
  const name = request.action === "list" ? void 0 : request.name;
28415
29967
  state = {
28416
29968
  source: state.source,
28417
- record: importedRecords().find((record3) => record3.name === name) ?? state.record
29969
+ record: importedRecords().find((record4) => record4.name === name) ?? state.record
28418
29970
  };
28419
29971
  show(next);
28420
29972
  } else {
@@ -28427,20 +29979,20 @@ Codex Fast mode prioritizes requests and may increase usage.`
28427
29979
  nameInput = void 0;
28428
29980
  body.replaceChildren();
28429
29981
  controls.replaceChildren();
28430
- const { source, record: record3 } = state;
29982
+ const { source, record: record4 } = state;
28431
29983
  const close = () => modal.close();
28432
29984
  if (mode === "add" || mode === "reimport") {
28433
29985
  title.textContent = mode === "add" ? messages.add : messages.reimport;
28434
29986
  modal.setAttribute("aria-label", title.textContent);
28435
- const active = source ?? record3?.source;
29987
+ const active = source ?? record4?.source;
28436
29988
  if (active) body.append(line(messages.source, active.label));
28437
29989
  const input = document2.createElement("input");
28438
29990
  input.type = "text";
28439
29991
  input.maxLength = 48;
28440
29992
  input.autocomplete = "off";
28441
29993
  input.spellcheck = false;
28442
- input.value = record3?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
28443
- input.readOnly = Boolean(record3);
29994
+ input.value = record4?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
29995
+ input.readOnly = Boolean(record4);
28444
29996
  nameInput = input;
28445
29997
  const label = document2.createElement("label");
28446
29998
  label.className = "settings-credential-dialog__field";
@@ -28469,7 +30021,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28469
30021
  {
28470
30022
  action: mode === "reimport" ? "reimport" : "import",
28471
30023
  sourceId: source.id,
28472
- name: record3?.name ?? input.value,
30024
+ name: record4?.name ?? input.value,
28473
30025
  confirmed: true
28474
30026
  },
28475
30027
  "done"
@@ -28479,16 +30031,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
28479
30031
  )
28480
30032
  );
28481
30033
  (mode === "add" ? input : controls.children[0]).focus();
28482
- } else if (mode === "remove" && record3) {
30034
+ } else if (mode === "remove" && record4) {
28483
30035
  title.textContent = messages.remove;
28484
30036
  modal.setAttribute("aria-label", title.textContent);
28485
- body.append(note(messages.removeWarning.replace("{name}", record3.name)));
30037
+ body.append(note(messages.removeWarning.replace("{name}", record4.name)));
28486
30038
  const cancel = command(messages.cancel, close);
28487
30039
  controls.append(
28488
30040
  cancel,
28489
30041
  command(
28490
30042
  messages.remove,
28491
- () => submit({ action: "remove", name: record3.name, confirmed: true }, null),
30043
+ () => submit({ action: "remove", name: record4.name, confirmed: true }, null),
28492
30044
  "danger"
28493
30045
  )
28494
30046
  );
@@ -28496,7 +30048,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
28496
30048
  } else {
28497
30049
  title.textContent = messages.doneTitle;
28498
30050
  modal.setAttribute("aria-label", title.textContent);
28499
- const name = record3?.name;
30051
+ const name = record4?.name;
28500
30052
  if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
28501
30053
  body.append(note(messages.done));
28502
30054
  const done = command(messages.close, close, "primary");
@@ -28537,25 +30089,25 @@ Codex Fast mode prioritizes requests and may increase usage.`
28537
30089
  (candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
28538
30090
  );
28539
30091
  if (!source || !target) return null;
28540
- const record3 = target.imports.find((candidate) => candidate.source.id === source.id);
30092
+ const record4 = target.imports.find((candidate) => candidate.source.id === source.id);
28541
30093
  const key = `${harnessId}:${accountLabel}:import`;
28542
30094
  const button = document2.createElement("button");
28543
30095
  button.type = "button";
28544
30096
  button.className = "settings-icon-button settings-account-harness-target";
28545
30097
  button.dataset.accountFocus = key;
28546
30098
  button.disabled = busy;
28547
- if (record3) button.dataset.state = "imported";
28548
- const hint = record3 ? messages.importedHint.replace("{name}", record3.name) : messages.add;
30099
+ if (record4) button.dataset.state = "imported";
30100
+ const hint = record4 ? messages.importedHint.replace("{name}", record4.name) : messages.add;
28549
30101
  button.title = hint;
28550
30102
  button.setAttribute("aria-label", hint);
28551
30103
  button.setAttribute("aria-haspopup", "dialog");
28552
30104
  button.append(createRendererAgentIcon("pi", 16, document2));
28553
30105
  button.addEventListener("click", () => {
28554
- if (!record3) {
30106
+ if (!record4) {
28555
30107
  openDialog("add", { source }, key);
28556
30108
  return;
28557
30109
  }
28558
- const row = rows.get(record3.name);
30110
+ const row = rows.get(record4.name);
28559
30111
  row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
28560
30112
  row?.focus();
28561
30113
  });
@@ -29738,7 +31290,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
29738
31290
  var RENDERER_SETTINGS_NAV_SECTIONS = [
29739
31291
  {
29740
31292
  id: "connection",
29741
- pageIds: ["connections", "accounts", "session-import"]
31293
+ pageIds: ["connections", "remote-connections", "accounts", "session-import"]
29742
31294
  },
29743
31295
  {
29744
31296
  id: "general",
@@ -30310,11 +31862,17 @@ Codex Fast mode prioritizes requests and may increase usage.`
30310
31862
  }
30311
31863
  });
30312
31864
  }
30313
- function createDefaultRendererSettingsPages(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread = () => Promise.reject(new Error("Imported Thread navigation is unavailable")), getLoadedSessionsClient = () => null) {
31865
+ function createDefaultRendererSettingsPages(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread = () => Promise.reject(new Error("Imported Thread navigation is unavailable")), getLoadedSessionsClient = () => null, getRemoteConnections = () => null) {
30314
31866
  return Object.freeze([
30315
- createConnectionsSettingsPage(messages, getDiagnostics),
31867
+ createConnectionsSettingsPage(messages, getDiagnostics, void 0, getRemoteConnections),
31868
+ createRemoteConnectionsPage(messages, getRemoteConnections),
30316
31869
  createAccountsSettingsPage(messages, getAccountClient),
30317
- createSessionImportSettingsPage(messages, getSessionImportClient, openImportedThread),
31870
+ createSessionImportSettingsPage(
31871
+ messages,
31872
+ getSessionImportClient,
31873
+ openImportedThread,
31874
+ getDiagnostics
31875
+ ),
30318
31876
  createAppearanceSettingsPage(messages, getLoadedSessionsClient),
30319
31877
  createPluginsSettingsPage(messages, getDiagnostics),
30320
31878
  updatesPage(messages, getUpdateClient),
@@ -30748,17 +32306,91 @@ Codex Fast mode prioritizes requests and may increase usage.`
30748
32306
 
30749
32307
  .settings-session-import-harness {
30750
32308
  display: flex;
32309
+ /* The label lines up with the options whether or not the scroll indicator is shown. */
32310
+ align-items: flex-start;
30751
32311
  min-width: 0;
32312
+ gap: 12px;
30752
32313
  margin: 0 0 16px;
32314
+ color: var(--settings-muted);
32315
+ font-size: 13px;
32316
+ }
32317
+
32318
+ .settings-session-import-harness > span {
32319
+ flex: none;
32320
+ line-height: 32px;
32321
+ }
32322
+
32323
+ .settings-session-import-harness__scroller {
32324
+ min-width: 0;
32325
+ flex: 1;
30753
32326
  }
30754
32327
 
30755
32328
  .settings-session-import-harness__options {
30756
32329
  display: flex;
30757
- flex-wrap: wrap;
32330
+ flex-wrap: nowrap;
30758
32331
  align-items: center;
30759
- width: fit-content;
30760
- max-width: 100%;
30761
- gap: 8px;
32332
+ gap: 6px;
32333
+ overflow-x: auto;
32334
+ overflow-y: hidden;
32335
+ /* Replaced by the hairline below: a native overlay scrollbar covers the options. */
32336
+ scrollbar-width: none;
32337
+ }
32338
+
32339
+ .settings-session-import-harness__options::-webkit-scrollbar {
32340
+ display: none;
32341
+ }
32342
+
32343
+ /*
32344
+ * Always occupies 6px so the page does not shift; drawn only while the options overflow. The box
32345
+ * is taller than the 2px line it draws so the line can be grabbed with a mouse.
32346
+ */
32347
+ .settings-session-import-harness__indicator {
32348
+ position: relative;
32349
+ height: 12px;
32350
+ margin-bottom: -6px;
32351
+ cursor: grab;
32352
+ touch-action: none;
32353
+ visibility: hidden;
32354
+ }
32355
+
32356
+ .settings-session-import-harness__indicator[data-overflowing="true"] {
32357
+ visibility: visible;
32358
+ }
32359
+
32360
+ .settings-session-import-harness__indicator[data-dragging="true"] {
32361
+ cursor: grabbing;
32362
+ }
32363
+
32364
+ .settings-session-import-harness__indicator::before,
32365
+ .settings-session-import-harness__indicator > span {
32366
+ position: absolute;
32367
+ top: 4px;
32368
+ height: 2px;
32369
+ border-radius: 1px;
32370
+ }
32371
+
32372
+ .settings-session-import-harness__indicator::before {
32373
+ right: 0;
32374
+ left: 0;
32375
+ background: var(--settings-divider);
32376
+ content: "";
32377
+ }
32378
+
32379
+ .settings-session-import-harness__indicator > span {
32380
+ /* Quieter than text: a hint that there is more, not a control competing with the options. */
32381
+ background: light-dark(rgb(13 13 13 / 24%), rgb(255 255 255 / 26%));
32382
+ }
32383
+
32384
+ /* The thumb takes the press across the whole grab area, not only on its 2px line. */
32385
+ .settings-session-import-harness__indicator > span::before {
32386
+ position: absolute;
32387
+ inset: -4px 0 -6px;
32388
+ content: "";
32389
+ }
32390
+
32391
+ .settings-session-import-harness__indicator:hover > span,
32392
+ .settings-session-import-harness__indicator[data-dragging="true"] > span {
32393
+ background: light-dark(rgb(13 13 13 / 42%), rgb(255 255 255 / 46%));
30762
32394
  }
30763
32395
 
30764
32396
  .settings-session-import-harness__option {
@@ -32857,6 +34489,353 @@ Codex Fast mode prioritizes requests and may increase usage.`
32857
34489
  transition-duration: 0s !important;
32858
34490
  }
32859
34491
  }
34492
+
34493
+ .settings-remote {
34494
+ display: grid;
34495
+ gap: 14px;
34496
+ min-width: 0;
34497
+ }
34498
+
34499
+ .settings-remote__header {
34500
+ display: flex;
34501
+ align-items: flex-start;
34502
+ justify-content: space-between;
34503
+ gap: 18px;
34504
+ margin-bottom: 4px;
34505
+ }
34506
+
34507
+ .settings-remote__header .settings-section-label {
34508
+ padding-bottom: 0;
34509
+ }
34510
+
34511
+ .settings-remote__header .settings-page-description {
34512
+ margin: 5px 0 0;
34513
+ }
34514
+
34515
+ .settings-remote__meta {
34516
+ margin: 2px 0 0;
34517
+ color: var(--settings-subtle);
34518
+ font-size: 12px;
34519
+ line-height: 18px;
34520
+ font-variant-numeric: tabular-nums;
34521
+ }
34522
+
34523
+ .settings-remote__meta:empty {
34524
+ display: none;
34525
+ }
34526
+
34527
+ .settings-remote__toolbar,
34528
+ .settings-remote-card__actions {
34529
+ display: flex;
34530
+ align-items: center;
34531
+ flex: none;
34532
+ gap: 6px;
34533
+ }
34534
+
34535
+ .settings-remote__toolbar {
34536
+ gap: 8px;
34537
+ }
34538
+
34539
+ .settings-remote__banner {
34540
+ display: flex;
34541
+ align-items: center;
34542
+ justify-content: space-between;
34543
+ gap: 12px;
34544
+ padding: 8px 8px 8px 12px;
34545
+ color: var(--settings-danger);
34546
+ font-size: 12px;
34547
+ line-height: 18px;
34548
+ overflow-wrap: anywhere;
34549
+ background: var(--settings-danger-bg);
34550
+ border: 1px solid var(--settings-danger-border);
34551
+ border-radius: 10px;
34552
+ }
34553
+
34554
+ .settings-remote__loading {
34555
+ display: flex;
34556
+ align-items: center;
34557
+ gap: 8px;
34558
+ margin: 0;
34559
+ padding: 16px 2px;
34560
+ color: var(--settings-muted);
34561
+ font-size: 12px;
34562
+ }
34563
+
34564
+ .settings-remote__empty {
34565
+ display: flex;
34566
+ align-items: center;
34567
+ justify-content: space-between;
34568
+ gap: 16px;
34569
+ padding: 16px;
34570
+ background: var(--settings-panel);
34571
+ border: 1px dashed var(--settings-border);
34572
+ border-radius: 10px;
34573
+ }
34574
+
34575
+ .settings-remote__empty > div {
34576
+ display: grid;
34577
+ min-width: 0;
34578
+ gap: 2px;
34579
+ }
34580
+
34581
+ .settings-remote__empty strong {
34582
+ color: var(--settings-text);
34583
+ font-size: 13px;
34584
+ font-weight: 500;
34585
+ line-height: 19px;
34586
+ }
34587
+
34588
+ .settings-remote__empty span {
34589
+ color: var(--settings-muted);
34590
+ font-size: 12px;
34591
+ line-height: 18px;
34592
+ }
34593
+
34594
+ .settings-remote__list {
34595
+ display: grid;
34596
+ gap: 12px;
34597
+ }
34598
+
34599
+ .settings-remote__placeholder:empty,
34600
+ .settings-remote__list:empty {
34601
+ display: none;
34602
+ }
34603
+
34604
+ .settings-remote-card {
34605
+ min-width: 0;
34606
+ overflow: hidden;
34607
+ background: var(--settings-panel);
34608
+ border: 1px solid var(--settings-border);
34609
+ border-radius: 10px;
34610
+ }
34611
+
34612
+ .settings-remote-card__head {
34613
+ display: flex;
34614
+ align-items: center;
34615
+ gap: 12px;
34616
+ padding: 12px 10px 12px 14px;
34617
+ }
34618
+
34619
+ .settings-remote-card__identity {
34620
+ display: grid;
34621
+ flex: 1;
34622
+ min-width: 0;
34623
+ gap: 2px;
34624
+ }
34625
+
34626
+ .settings-remote-card__title {
34627
+ display: flex;
34628
+ align-items: center;
34629
+ min-width: 0;
34630
+ gap: 10px;
34631
+ }
34632
+
34633
+ .settings-remote-card h3 {
34634
+ min-width: 0;
34635
+ margin: 0;
34636
+ overflow: hidden;
34637
+ color: var(--settings-text);
34638
+ font-size: 13px;
34639
+ font-weight: 600;
34640
+ line-height: 20px;
34641
+ text-overflow: ellipsis;
34642
+ white-space: nowrap;
34643
+ }
34644
+
34645
+ .settings-remote-card__state {
34646
+ display: inline-flex;
34647
+ align-items: center;
34648
+ flex: none;
34649
+ gap: 6px;
34650
+ color: var(--settings-muted);
34651
+ font-size: 12px;
34652
+ line-height: 18px;
34653
+ }
34654
+
34655
+ .settings-remote-card__state::before {
34656
+ width: 7px;
34657
+ height: 7px;
34658
+ content: "";
34659
+ background: var(--settings-subtle);
34660
+ border-radius: 50%;
34661
+ }
34662
+
34663
+ .settings-remote-card__state[data-tone="success"]::before {
34664
+ background: var(--settings-success);
34665
+ }
34666
+
34667
+ .settings-remote-card__state[data-tone="danger"]::before {
34668
+ background: var(--settings-danger);
34669
+ }
34670
+
34671
+ .settings-remote-card__state[data-tone="progress"]::before {
34672
+ animation: settings-remote-pulse 1.2s ease-in-out infinite;
34673
+ }
34674
+
34675
+ .settings-remote-card__address {
34676
+ display: flex;
34677
+ align-items: center;
34678
+ min-width: 0;
34679
+ gap: 8px;
34680
+ overflow: hidden;
34681
+ color: var(--settings-muted);
34682
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
34683
+ font-size: 12px;
34684
+ line-height: 18px;
34685
+ text-overflow: ellipsis;
34686
+ white-space: nowrap;
34687
+ }
34688
+
34689
+ .settings-remote-card__address .settings-status-badge {
34690
+ padding: 0 6px;
34691
+ font-family: system-ui, sans-serif;
34692
+ }
34693
+
34694
+ .settings-remote-card__actions {
34695
+ flex-wrap: wrap;
34696
+ justify-content: flex-end;
34697
+ }
34698
+
34699
+ .settings-remote-card__remove:hover:not(:disabled) {
34700
+ color: var(--settings-danger);
34701
+ background: var(--settings-danger-bg);
34702
+ }
34703
+
34704
+ .settings-remote .settings-icon-button:disabled {
34705
+ cursor: not-allowed;
34706
+ opacity: 0.55;
34707
+ }
34708
+
34709
+ .settings-remote-card__detail {
34710
+ margin: -4px 14px 12px;
34711
+ font-size: 12px;
34712
+ line-height: 18px;
34713
+ overflow-wrap: anywhere;
34714
+ }
34715
+
34716
+ .settings-remote-card__service {
34717
+ display: flex;
34718
+ align-items: center;
34719
+ justify-content: space-between;
34720
+ gap: 12px;
34721
+ padding: 10px 10px 10px 14px;
34722
+ background: var(--settings-surface);
34723
+ border-top: 1px solid var(--settings-divider);
34724
+ }
34725
+
34726
+ .settings-remote-card__service-copy {
34727
+ display: grid;
34728
+ min-width: 0;
34729
+ gap: 2px;
34730
+ font-size: 12px;
34731
+ line-height: 18px;
34732
+ }
34733
+
34734
+ .settings-remote-card__service-title {
34735
+ color: var(--settings-text);
34736
+ font-weight: 500;
34737
+ font-variant-numeric: tabular-nums;
34738
+ }
34739
+
34740
+ .settings-remote-card__hint {
34741
+ display: flex;
34742
+ align-items: center;
34743
+ gap: 6px;
34744
+ margin: 0;
34745
+ color: var(--settings-muted);
34746
+ overflow-wrap: anywhere;
34747
+ }
34748
+
34749
+ .settings-remote [data-tone="success"] {
34750
+ color: var(--settings-success);
34751
+ }
34752
+
34753
+ .settings-remote [data-tone="warning"] {
34754
+ color: var(--settings-warning);
34755
+ }
34756
+
34757
+ .settings-remote [data-tone="danger"] {
34758
+ color: var(--settings-danger);
34759
+ }
34760
+
34761
+ .settings-remote-spinner {
34762
+ width: 12px;
34763
+ height: 12px;
34764
+ flex: none;
34765
+ border: 1.5px solid var(--settings-border);
34766
+ border-top-color: var(--settings-muted);
34767
+ border-radius: 50%;
34768
+ animation: settings-remote-spin 0.8s linear infinite;
34769
+ }
34770
+
34771
+ .settings-remote__refresh[aria-busy="true"] svg {
34772
+ animation: settings-remote-spin 0.8s linear infinite;
34773
+ }
34774
+
34775
+ .settings-remote-dialog .settings-credential-dialog__field small {
34776
+ color: var(--settings-subtle);
34777
+ font-size: 11px;
34778
+ line-height: 16px;
34779
+ }
34780
+
34781
+ .settings-remote-dialog input:disabled {
34782
+ color: var(--settings-muted);
34783
+ cursor: not-allowed;
34784
+ }
34785
+
34786
+ .settings-remote-dialog input:focus-visible {
34787
+ border-color: var(--settings-focus);
34788
+ outline-offset: -1px;
34789
+ }
34790
+
34791
+ .settings-remote-dialog__package-option {
34792
+ display: flex;
34793
+ align-items: center;
34794
+ gap: 8px;
34795
+ cursor: pointer;
34796
+ }
34797
+
34798
+ .settings-remote-dialog .settings-remote-dialog__package-option input {
34799
+ flex: none;
34800
+ width: 16px;
34801
+ height: 16px;
34802
+ min-height: 16px;
34803
+ margin: 0;
34804
+ padding: 0;
34805
+ accent-color: var(--settings-focus);
34806
+ }
34807
+
34808
+ @keyframes settings-remote-spin {
34809
+ to {
34810
+ transform: rotate(360deg);
34811
+ }
34812
+ }
34813
+
34814
+ @keyframes settings-remote-pulse {
34815
+ 50% {
34816
+ opacity: 0.3;
34817
+ }
34818
+ }
34819
+
34820
+ @container (max-width: 620px) {
34821
+ .settings-remote-card__head,
34822
+ .settings-remote-card__service {
34823
+ align-items: stretch;
34824
+ flex-direction: column;
34825
+ }
34826
+
34827
+ .settings-remote-card__actions {
34828
+ justify-content: flex-start;
34829
+ }
34830
+ }
34831
+
34832
+ @media (prefers-reduced-motion: reduce) {
34833
+ .settings-remote-spinner,
34834
+ .settings-remote__refresh svg,
34835
+ .settings-remote-card__state::before {
34836
+ animation: none !important;
34837
+ }
34838
+ }
32860
34839
  `;
32861
34840
 
32862
34841
  // src/settings/accounts.css
@@ -34386,14 +36365,15 @@ ${accounts_default}`;
34386
36365
  options.getConnectionDiagnostics ?? (() => null),
34387
36366
  options.getAccountClient ?? (() => null),
34388
36367
  options.getSessionImportClient ?? (() => null),
34389
- async (threadId, signal, hostId) => {
36368
+ async (threadId, signal, hostId2) => {
34390
36369
  if (!options.openImportedThread) {
34391
36370
  throw new Error("Imported Thread navigation is unavailable");
34392
36371
  }
34393
- await options.openImportedThread(threadId, signal, hostId);
36372
+ await options.openImportedThread(threadId, signal, hostId2);
34394
36373
  if (!disposed && !signal.aborted) shell?.close();
34395
36374
  },
34396
- options.getLoadedSessionsClient ?? (() => null)
36375
+ options.getLoadedSessionsClient ?? (() => null),
36376
+ options.getRemoteConnections ?? (() => null)
34397
36377
  );
34398
36378
  const nextShell = installRendererSettingsShell(definitions, messages, ownerWindow.document, {
34399
36379
  onOpenChange(open) {
@@ -35118,7 +37098,8 @@ ${accounts_default}`;
35118
37098
  "cursor-cli": harnessIdSchema.parse("cursor-cli"),
35119
37099
  qoder: harnessIdSchema.parse("qoder"),
35120
37100
  "qoder-cn": harnessIdSchema.parse("qoder-cn"),
35121
- "kimi-code": harnessIdSchema.parse("kimi-code")
37101
+ "kimi-code": harnessIdSchema.parse("kimi-code"),
37102
+ zcode: harnessIdSchema.parse("zcode")
35122
37103
  };
35123
37104
  var externalAgents = [
35124
37105
  "pi",
@@ -35136,7 +37117,8 @@ ${accounts_default}`;
35136
37117
  "cursor-cli",
35137
37118
  "qoder",
35138
37119
  "qoder-cn",
35139
- "kimi-code"
37120
+ "kimi-code",
37121
+ "zcode"
35140
37122
  ];
35141
37123
  function isRetryableHarnessAvailability(availability, error51) {
35142
37124
  return availability !== void 0 && availability !== "ready" && availability !== "notInstalled" && error51?.retryable === true;
@@ -35160,9 +37142,9 @@ ${accounts_default}`;
35160
37142
  var rendererUsageRefreshDelays = [250, 500, 1e3, 2e3, 4e3, 8e3];
35161
37143
  function refreshConnectionHosts(hostIds, refreshHost, pendingHost) {
35162
37144
  return Promise.all(
35163
- [...hostIds].map(async (hostId) => {
35164
- if (pendingHost) await pendingHost(hostId)?.catch(() => void 0);
35165
- await refreshHost(hostId);
37145
+ [...hostIds].map(async (hostId2) => {
37146
+ if (pendingHost) await pendingHost(hostId2)?.catch(() => void 0);
37147
+ await refreshHost(hostId2);
35166
37148
  })
35167
37149
  ).then(() => void 0);
35168
37150
  }
@@ -35400,9 +37382,9 @@ ${accounts_default}`;
35400
37382
  if (!isLateConversationTarget(mountedTarget, currentTarget)) return "none";
35401
37383
  return mountedTarget?.[0] === "default" && (sourcePhase === "locked" || submissionPending) ? "transfer" : "inspect";
35402
37384
  }
35403
- function scopedComposerTarget(target, hostId) {
35404
- if (target?.[0] !== "conversation" || !hostId) return target;
35405
- return ["conversation", target[1], hostId];
37385
+ function scopedComposerTarget(target, hostId2) {
37386
+ if (target?.[0] !== "conversation" || !hostId2) return target;
37387
+ return ["conversation", target[1], hostId2];
35406
37388
  }
35407
37389
  function isComposerModelWriteAllowed(target) {
35408
37390
  return target?.[0] === "default";
@@ -35477,7 +37459,7 @@ ${accounts_default}`;
35477
37459
  if (!modelControl) return null;
35478
37460
  return modelControl.currentHostId ? modelControl.currentHostId(composer) : "local";
35479
37461
  };
35480
- const controllerTarget = (target, hostId) => scopedComposerTarget(target, hostId);
37462
+ const controllerTarget = (target, hostId2) => scopedComposerTarget(target, hostId2);
35481
37463
  const usageSubscriptions = /* @__PURE__ */ new Map();
35482
37464
  const usageNotificationDispose = () => {
35483
37465
  for (const subscription of usageSubscriptions.values()) subscription.dispose();
@@ -35496,11 +37478,11 @@ ${accounts_default}`;
35496
37478
  return null;
35497
37479
  };
35498
37480
  const sidebarAgentIcons = installRendererSidebarAgentIcons({
35499
- getClient: (hostId) => modelClientForHost(hostId),
37481
+ getClient: (hostId2) => modelClientForHost(hostId2),
35500
37482
  getLocalAgent: localAgentForSidebarThread
35501
37483
  });
35502
37484
  const stopSidebarExternalPinning = installRendererSidebarExternalPinning({
35503
- getClient: (hostId) => modelClientForHost(hostId),
37485
+ getClient: (hostId2) => modelClientForHost(hostId2),
35504
37486
  reportError: (error51) => {
35505
37487
  console.error(
35506
37488
  "codexhost External Thread pin update failed",
@@ -35509,26 +37491,28 @@ ${accounts_default}`;
35509
37491
  }
35510
37492
  });
35511
37493
  let connectionDiagnostics = null;
37494
+ const remoteConnections = createRemoteConnectionsControl(window, modelClientForHost);
35512
37495
  const settingsLifecycle = installRendererSettingsLifecycle(window, {
37496
+ getRemoteConnections: () => remoteConnections,
35513
37497
  getUpdateClient: () => modelControl,
35514
37498
  getAccountClient: () => modelControl,
35515
37499
  getConnectionDiagnostics: () => connectionDiagnostics,
35516
37500
  getLoadedSessionsClient: () => modelClientForHost("local"),
35517
37501
  getSessionImportClient: () => {
35518
- const hostId = activeModelHostId() ?? "local";
35519
- const client = modelClientForHost(hostId);
37502
+ const hostId2 = activeModelHostId() ?? "local";
37503
+ const client = modelClientForHost(hostId2);
35520
37504
  const sources = client?.listSessionImportSources;
35521
37505
  const list = client?.listHarnessSessions;
35522
37506
  const importSession = client?.importHarnessSession;
35523
37507
  if (!sources || !list || !importSession) return null;
35524
37508
  return {
35525
- hostId,
37509
+ hostId: hostId2,
35526
37510
  listSessionImportSources: () => sources(),
35527
37511
  listHarnessSessions: (input) => list(input),
35528
37512
  importHarnessSession: (input) => importSession(input)
35529
37513
  };
35530
37514
  },
35531
- openImportedThread: (threadId, signal, hostId) => openRendererThread(threadId, { hostId: hostId ?? "local", signal }),
37515
+ openImportedThread: (threadId, signal, hostId2) => openRendererThread(threadId, { hostId: hostId2 ?? "local", signal }),
35532
37516
  onLocaleChange() {
35533
37517
  for (const mounted of mountedByComposer.values()) renderMounted(mounted);
35534
37518
  }
@@ -35560,7 +37544,8 @@ ${accounts_default}`;
35560
37544
  "cursor-cli": void 0,
35561
37545
  qoder: void 0,
35562
37546
  "qoder-cn": void 0,
35563
- "kimi-code": void 0
37547
+ "kimi-code": void 0,
37548
+ zcode: void 0
35564
37549
  },
35565
37550
  webUi: Object.fromEntries(
35566
37551
  externalAgents.map((agent) => [agent, false])
@@ -35571,27 +37556,27 @@ ${accounts_default}`;
35571
37556
  retryAttempt: 0
35572
37557
  });
35573
37558
  const harnessAvailabilityByHost = /* @__PURE__ */ new Map();
35574
- const hostHarnessAvailabilityState = (hostId) => {
35575
- let state = harnessAvailabilityByHost.get(hostId);
37559
+ const hostHarnessAvailabilityState = (hostId2) => {
37560
+ let state = harnessAvailabilityByHost.get(hostId2);
35576
37561
  if (!state) {
35577
37562
  state = createHostHarnessAvailabilityState();
35578
- harnessAvailabilityByHost.set(hostId, state);
37563
+ harnessAvailabilityByHost.set(hostId2, state);
35579
37564
  }
35580
37565
  return state;
35581
37566
  };
35582
- const codexAccountsForHost = (hostId) => {
35583
- if (!hostId) return null;
35584
- const client = modelClientForHost(hostId);
37567
+ const codexAccountsForHost = (hostId2) => {
37568
+ if (!hostId2) return null;
37569
+ const client = modelClientForHost(hostId2);
35585
37570
  if (!client) return null;
35586
- const state = hostHarnessAvailabilityState(hostId);
37571
+ const state = hostHarnessAvailabilityState(hostId2);
35587
37572
  if (state.codexAccounts?.client !== client) {
35588
37573
  state.codexAccounts?.dispose();
35589
37574
  state.codexAccounts = new RendererCodexAccountState(client, () => {
35590
37575
  queueMicrotask(() => {
35591
- if (disposed || hostHarnessAvailabilityState(hostId).codexAccounts?.client !== client)
37576
+ if (disposed || hostHarnessAvailabilityState(hostId2).codexAccounts?.client !== client)
35592
37577
  return;
35593
37578
  for (const mounted of mountedByComposer.values()) {
35594
- if (mounted.hostId !== hostId) continue;
37579
+ if (mounted.hostId !== hostId2) continue;
35595
37580
  renderMounted(mounted);
35596
37581
  void refreshDraftCodexUsage(mounted);
35597
37582
  }
@@ -35678,8 +37663,8 @@ ${accounts_default}`;
35678
37663
  {
35679
37664
  const published = Reflect.get(window, "__codexhostDraftWorkspacesV1");
35680
37665
  if (typeof published === "object" && published !== null) {
35681
- for (const [hostId, cwd] of Object.entries(published)) {
35682
- if (typeof cwd === "string" && cwd.length > 0) draftWorkspaces.set(hostId, cwd);
37666
+ for (const [hostId2, cwd] of Object.entries(published)) {
37667
+ if (typeof cwd === "string" && cwd.length > 0) draftWorkspaces.set(hostId2, cwd);
35683
37668
  }
35684
37669
  }
35685
37670
  }
@@ -35687,17 +37672,17 @@ ${accounts_default}`;
35687
37672
  const generation = ++mounted.commandRequestGeneration;
35688
37673
  const agent = controller.get(mounted.composer).agent;
35689
37674
  const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
35690
- const hostId = threadId ? mounted.hostId : activeModelHostId(mounted.composer);
37675
+ const hostId2 = threadId ? mounted.hostId : activeModelHostId(mounted.composer);
35691
37676
  const requestControl = modelControl;
35692
- const client = modelClientForHostFrom(requestControl, hostId);
37677
+ const client = modelClientForHostFrom(requestControl, hostId2);
35693
37678
  if (!keepCurrent || agent === "codex") mounted.control.harnessCommands.setCommands([]);
35694
37679
  if (agent === "codex" || !client) return;
35695
37680
  try {
35696
37681
  const catalog = threadId ? await client.inspectThreadCommands({ threadId }) : await client.inspectHarnessCommands({
35697
37682
  harnessId: externalHarnessIds[agent],
35698
- ...hostId && draftWorkspaces.has(hostId) ? { cwd: draftWorkspaces.get(hostId) } : {}
37683
+ ...hostId2 && draftWorkspaces.has(hostId2) ? { cwd: draftWorkspaces.get(hostId2) } : {}
35699
37684
  });
35700
- if (disposed || mountedByComposer.get(mounted.composer) !== mounted || mounted.commandRequestGeneration !== generation || requestControl !== modelControl || (threadIdFromComposerModelTarget(mounted.modelTarget) ? mounted.hostId : activeModelHostId(mounted.composer)) !== hostId || controller.get(mounted.composer).agent !== agent)
37685
+ if (disposed || mountedByComposer.get(mounted.composer) !== mounted || mounted.commandRequestGeneration !== generation || requestControl !== modelControl || (threadIdFromComposerModelTarget(mounted.modelTarget) ? mounted.hostId : activeModelHostId(mounted.composer)) !== hostId2 || controller.get(mounted.composer).agent !== agent)
35701
37686
  return;
35702
37687
  mounted.control.harnessCommands.setCommands(
35703
37688
  catalog.commands,
@@ -35737,9 +37722,9 @@ ${accounts_default}`;
35737
37722
  }
35738
37723
  console.error("codexhost Harness command could not claim the current Composer editor");
35739
37724
  };
35740
- const applyThreadUsageUpdate = (hostId, update) => {
37725
+ const applyThreadUsageUpdate = (hostId2, update) => {
35741
37726
  for (const mounted of mountedByComposer.values()) {
35742
- if (mounted.hostId !== hostId || threadIdFromComposerModelTarget(mounted.modelTarget) !== update.threadId)
37727
+ if (mounted.hostId !== hostId2 || threadIdFromComposerModelTarget(mounted.modelTarget) !== update.threadId)
35743
37728
  continue;
35744
37729
  mounted.usageRequestGeneration += 1;
35745
37730
  mounted.usage = update.usage;
@@ -35755,7 +37740,7 @@ ${accounts_default}`;
35755
37740
  const accounts = composerCodexAccounts(mounted.composer);
35756
37741
  const client = accounts?.client;
35757
37742
  const accountId = accounts?.readyAccountId;
35758
- const hostId = mounted.hostId;
37743
+ const hostId2 = mounted.hostId;
35759
37744
  const generation = ++mounted.usageRequestGeneration;
35760
37745
  mounted.usage = null;
35761
37746
  mounted.accountCredits = null;
@@ -35763,7 +37748,7 @@ ${accounts_default}`;
35763
37748
  if (!accountId || !client?.inspectCodexAccountUsage) return;
35764
37749
  try {
35765
37750
  const result = await client.inspectCodexAccountUsage({ accountId });
35766
- if (disposed || mounted.hostId !== hostId || composerCodexAccounts(mounted.composer) !== accounts || !mounted.composer.isConnected || mountedByComposer.get(mounted.composer) !== mounted || mounted.usageRequestGeneration !== generation || controller.get(mounted.composer).agent !== "codex" || controller.get(mounted.composer).phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget) || accounts.readyAccountId !== accountId || result.accountId !== accountId)
37751
+ if (disposed || mounted.hostId !== hostId2 || composerCodexAccounts(mounted.composer) !== accounts || !mounted.composer.isConnected || mountedByComposer.get(mounted.composer) !== mounted || mounted.usageRequestGeneration !== generation || controller.get(mounted.composer).agent !== "codex" || controller.get(mounted.composer).phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget) || accounts.readyAccountId !== accountId || result.accountId !== accountId)
35767
37752
  return;
35768
37753
  mounted.usage = result.usage;
35769
37754
  mounted.accountCredits = composerAccountCredits(result.accountCredits);
@@ -35784,7 +37769,7 @@ ${accounts_default}`;
35784
37769
  renderMounted(mounted);
35785
37770
  return;
35786
37771
  }
35787
- const hostId = mounted.hostId;
37772
+ const hostId2 = mounted.hostId;
35788
37773
  const client = composerClient(mounted);
35789
37774
  if (!client) return;
35790
37775
  const generation = ++mounted.usageRequestGeneration;
@@ -35793,7 +37778,7 @@ ${accounts_default}`;
35793
37778
  threadId,
35794
37779
  ...refresh ? { refresh } : {}
35795
37780
  });
35796
- if (disposed || mountedByComposer.get(mounted.composer) !== mounted || !mounted.composer.isConnected || mounted.usageRequestGeneration !== generation || mounted.hostId !== hostId || composerClient(mounted) !== client || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId || result.threadId !== threadId) {
37781
+ if (disposed || mountedByComposer.get(mounted.composer) !== mounted || !mounted.composer.isConnected || mounted.usageRequestGeneration !== generation || mounted.hostId !== hostId2 || composerClient(mounted) !== client || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId || result.threadId !== threadId) {
35797
37782
  return;
35798
37783
  }
35799
37784
  mounted.usage = result.usage;
@@ -36599,29 +38584,29 @@ ${accounts_default}`;
36599
38584
  const loadCodexAccounts = async () => {
36600
38585
  const hostIds = new Set([...mountedByComposer.values()].map((mounted) => mounted.hostId));
36601
38586
  await Promise.all(
36602
- [...hostIds].map(async (hostId) => {
36603
- const accounts = codexAccountsForHost(hostId);
38587
+ [...hostIds].map(async (hostId2) => {
38588
+ const accounts = codexAccountsForHost(hostId2);
36604
38589
  if (!accounts) return;
36605
38590
  await accounts.refresh();
36606
- if (disposed || codexAccountsForHost(hostId) !== accounts) return;
38591
+ if (disposed || codexAccountsForHost(hostId2) !== accounts) return;
36607
38592
  for (const mounted of mountedByComposer.values()) {
36608
- if (mounted.hostId !== hostId) continue;
38593
+ if (mounted.hostId !== hostId2) continue;
36609
38594
  renderMounted(mounted);
36610
38595
  void refreshDraftCodexUsage(mounted);
36611
38596
  }
36612
38597
  })
36613
38598
  );
36614
38599
  };
36615
- function resetHarnessAvailabilityRetry(hostId) {
36616
- const state = hostHarnessAvailabilityState(hostId);
38600
+ function resetHarnessAvailabilityRetry(hostId2) {
38601
+ const state = hostHarnessAvailabilityState(hostId2);
36617
38602
  if (state.retryTimer !== null) {
36618
38603
  window.clearTimeout(state.retryTimer);
36619
38604
  state.retryTimer = null;
36620
38605
  }
36621
38606
  state.retryAttempt = 0;
36622
38607
  }
36623
- function scheduleHarnessAvailabilityRetry(hostId) {
36624
- const state = hostHarnessAvailabilityState(hostId);
38608
+ function scheduleHarnessAvailabilityRetry(hostId2) {
38609
+ const state = hostHarnessAvailabilityState(hostId2);
36625
38610
  if (disposed || state.retryTimer !== null || state.retryAttempt >= availabilityRetryDelays.length) {
36626
38611
  return;
36627
38612
  }
@@ -36629,50 +38614,50 @@ ${accounts_default}`;
36629
38614
  state.retryAttempt += 1;
36630
38615
  state.retryTimer = window.setTimeout(() => {
36631
38616
  state.retryTimer = null;
36632
- void refreshHarnessAvailabilityForHost(hostId, true, true);
38617
+ void refreshHarnessAvailabilityForHost(hostId2, true, true);
36633
38618
  }, delay);
36634
38619
  }
36635
- function modelClientForHostFrom(control, hostId) {
36636
- if (!control || !hostId) return null;
36637
- if (control.clientForHost) return control.clientForHost(hostId);
36638
- if (!control.currentHostId) return hostId === "local" ? control : null;
36639
- return control.currentHostId() === hostId ? control : null;
38620
+ function modelClientForHostFrom(control, hostId2) {
38621
+ if (!control || !hostId2) return null;
38622
+ if (control.clientForHost) return control.clientForHost(hostId2);
38623
+ if (!control.currentHostId) return hostId2 === "local" ? control : null;
38624
+ return control.currentHostId() === hostId2 ? control : null;
36640
38625
  }
36641
- function modelClientForHost(hostId) {
36642
- return modelClientForHostFrom(modelControl, hostId);
38626
+ function modelClientForHost(hostId2) {
38627
+ return modelClientForHostFrom(modelControl, hostId2);
36643
38628
  }
36644
- function refreshHarnessAvailabilityForHost(hostId, refresh = false, retry = false, force = false) {
36645
- const state = hostHarnessAvailabilityState(hostId);
36646
- if (!retry) resetHarnessAvailabilityRetry(hostId);
36647
- const client = modelClientForHost(hostId);
38629
+ function refreshHarnessAvailabilityForHost(hostId2, refresh = false, retry = false, force = false) {
38630
+ const state = hostHarnessAvailabilityState(hostId2);
38631
+ if (!retry) resetHarnessAvailabilityRetry(hostId2);
38632
+ const client = modelClientForHost(hostId2);
36648
38633
  if (!client) {
36649
38634
  if (state.request) {
36650
38635
  state.requestGeneration += 1;
36651
38636
  state.request = null;
36652
38637
  }
36653
- if (force || [...mountedByComposer.values()].some((mounted) => mounted.hostId === hostId)) {
38638
+ if (force || [...mountedByComposer.values()].some((mounted) => mounted.hostId === hostId2)) {
36654
38639
  for (const agent of externalAgents) {
36655
38640
  state.availability[agent] = "error";
36656
38641
  state.errors[agent] = {
36657
38642
  code: "unavailable",
36658
- message: `Renderer connection is unavailable for Host ${hostId}`,
38643
+ message: `Renderer connection is unavailable for Host ${hostId2}`,
36659
38644
  retryable: true,
36660
38645
  stage: "request"
36661
38646
  };
36662
38647
  state.webUi[agent] = false;
36663
38648
  }
36664
38649
  publishConnectionStatus();
36665
- if (hostId === activeAvailabilityHostId) {
38650
+ if (hostId2 === activeAvailabilityHostId) {
36666
38651
  for (const mounted of mountedByComposer.values()) renderMounted(mounted);
36667
38652
  }
36668
38653
  }
36669
- scheduleHarnessAvailabilityRetry(hostId);
38654
+ scheduleHarnessAvailabilityRetry(hostId2);
36670
38655
  return Promise.resolve();
36671
38656
  }
36672
38657
  if (state.request?.client === client) return state.request.promise;
36673
38658
  const agentsToInspect = force ? externalAgents : passiveHarnessAvailabilityAgents(state.availability, state.errors);
36674
38659
  if (agentsToInspect.length === 0) {
36675
- resetHarnessAvailabilityRetry(hostId);
38660
+ resetHarnessAvailabilityRetry(hostId2);
36676
38661
  return Promise.resolve();
36677
38662
  }
36678
38663
  const nextAvailability = { ...state.availability };
@@ -36680,7 +38665,7 @@ ${accounts_default}`;
36680
38665
  nextAvailability[agent] = harnessAvailabilityDuringInspect(nextAvailability[agent]);
36681
38666
  }
36682
38667
  state.availability = nextAvailability;
36683
- if (hostId === activeAvailabilityHostId) {
38668
+ if (hostId2 === activeAvailabilityHostId) {
36684
38669
  publishConnectionStatus();
36685
38670
  for (const mounted of mountedByComposer.values()) renderMounted(mounted);
36686
38671
  }
@@ -36697,7 +38682,7 @@ ${accounts_default}`;
36697
38682
  { priority: "background" }
36698
38683
  );
36699
38684
  status = inspection.status === "ready" ? "ready" : inspection.status;
36700
- webUiAvailable = hostId === "local" && inspection.status === "ready" && inspection.webUi?.open === true;
38685
+ webUiAvailable = hostId2 === "local" && inspection.status === "ready" && inspection.webUi?.open === true;
36701
38686
  if (inspection.status !== "ready") {
36702
38687
  const error51 = inspection.error;
36703
38688
  nextError = {
@@ -36725,17 +38710,17 @@ ${accounts_default}`;
36725
38710
  state.availability = { ...state.availability, [agent]: status };
36726
38711
  state.webUi = { ...state.webUi, [agent]: webUiAvailable };
36727
38712
  for (const mounted of mountedByComposer.values()) {
36728
- if (mounted.hostId !== hostId) continue;
38713
+ if (mounted.hostId !== hostId2) continue;
36729
38714
  const composerState = controller.get(mounted.composer);
36730
38715
  if (composerAdapterState(mounted) === "ready" && composerState.phase === "draft" && composerState.agent === agent && status !== "ready") {
36731
38716
  await switchComposerAgent(mounted, "codex");
36732
38717
  }
36733
38718
  }
36734
38719
  for (const mounted of mountedByComposer.values()) {
36735
- if (mounted.hostId !== hostId) continue;
38720
+ if (mounted.hostId !== hostId2) continue;
36736
38721
  const composerState = controller.get(mounted.composer);
36737
38722
  const pendingCatalog = catalogRequests.get(mounted);
36738
- const loadingCurrentCatalog = pendingCatalog?.client === client && pendingCatalog.hostId === hostId && pendingCatalog.agent === agent && isCurrentModelRequest(mounted, pendingCatalog.generation);
38723
+ const loadingCurrentCatalog = pendingCatalog?.client === client && pendingCatalog.hostId === hostId2 && pendingCatalog.agent === agent && isCurrentModelRequest(mounted, pendingCatalog.generation);
36739
38724
  if (composerState.agent === agent && (status !== "ready" || !loadingCurrentCatalog || refresh && force) && shouldReloadExternalCatalogAfterAvailabilityRefresh(
36740
38725
  previousStatus,
36741
38726
  status,
@@ -36751,9 +38736,9 @@ ${accounts_default}`;
36751
38736
  );
36752
38737
  if (generation !== state.requestGeneration || disposed) return;
36753
38738
  if (retryableHarnessAvailabilityAgents(state.availability, state.errors).length === 0) {
36754
- resetHarnessAvailabilityRetry(hostId);
38739
+ resetHarnessAvailabilityRetry(hostId2);
36755
38740
  } else {
36756
- scheduleHarnessAvailabilityRetry(hostId);
38741
+ scheduleHarnessAvailabilityRetry(hostId2);
36757
38742
  }
36758
38743
  })();
36759
38744
  const request = { client, promise: promise2 };
@@ -36770,12 +38755,12 @@ ${accounts_default}`;
36770
38755
  }
36771
38756
  const reloadMountedOwnershipForHost = () => {
36772
38757
  for (const mounted of mountedByComposer.values()) {
36773
- const hostId = activeModelHostId(mounted.composer);
36774
- if (!hostId || mounted.hostId === hostId) continue;
38758
+ const hostId2 = activeModelHostId(mounted.composer);
38759
+ if (!hostId2 || mounted.hostId === hostId2) continue;
36775
38760
  if (!threadIdFromComposerModelTarget(mounted.modelTarget)) {
36776
38761
  controller.clearPendingSubmission(mounted.composer);
36777
38762
  controller.beginModelRequest(mounted.composer);
36778
- mounted.hostId = hostId;
38763
+ mounted.hostId = hostId2;
36779
38764
  mounted.modelView = { status: "idle" };
36780
38765
  mounted.permissionModeView = { status: "idle" };
36781
38766
  mounted.usage = null;
@@ -36788,13 +38773,13 @@ ${accounts_default}`;
36788
38773
  void loadExternalCatalog(mounted);
36789
38774
  continue;
36790
38775
  }
36791
- const target = controllerTarget(mounted.modelTarget, hostId);
38776
+ const target = controllerTarget(mounted.modelTarget, hostId2);
36792
38777
  if (controller.rebindConversation(mounted.composer, target) === null) {
36793
38778
  mounted.ownershipStatus = "error";
36794
38779
  renderMounted(mounted);
36795
38780
  continue;
36796
38781
  }
36797
- mounted.hostId = hostId;
38782
+ mounted.hostId = hostId2;
36798
38783
  mounted.composerId = controller.get(mounted.composer).composerId;
36799
38784
  mounted.modelView = { status: "idle" };
36800
38785
  mounted.permissionModeView = { status: "idle" };
@@ -36815,8 +38800,8 @@ ${accounts_default}`;
36815
38800
  sidebarAgentIcons.refresh();
36816
38801
  };
36817
38802
  function reconcileHarnessAvailabilityHost() {
36818
- for (const hostId2 of modelControl?.knownHostIds?.() ?? []) {
36819
- hostHarnessAvailabilityState(hostId2);
38803
+ for (const hostId3 of modelControl?.knownHostIds?.() ?? []) {
38804
+ hostHarnessAvailabilityState(hostId3);
36820
38805
  }
36821
38806
  reloadMountedOwnershipForHost();
36822
38807
  for (const target of new Set([...mountedByComposer.values()].map((m) => m.hostId))) {
@@ -36837,14 +38822,14 @@ ${accounts_default}`;
36837
38822
  } catch {
36838
38823
  }
36839
38824
  }
36840
- const hostId = activeModelHostId();
36841
- if (!hostId || hostId === activeAvailabilityHostId && [...mountedByComposer.values()].every((mounted) => mounted.hostId !== null))
38825
+ const hostId2 = activeModelHostId();
38826
+ if (!hostId2 || hostId2 === activeAvailabilityHostId && [...mountedByComposer.values()].every((mounted) => mounted.hostId !== null))
36842
38827
  return;
36843
- activeAvailabilityHostId = hostId;
36844
- hostHarnessAvailabilityState(hostId);
38828
+ activeAvailabilityHostId = hostId2;
38829
+ hostHarnessAvailabilityState(hostId2);
36845
38830
  publishConnectionStatus();
36846
38831
  for (const mounted of mountedByComposer.values()) renderMounted(mounted);
36847
- void refreshHarnessAvailabilityForHost(hostId);
38832
+ void refreshHarnessAvailabilityForHost(hostId2);
36848
38833
  }
36849
38834
  const refreshHarnessAvailability = async (refresh = false) => {
36850
38835
  reconcileHarnessAvailabilityHost();
@@ -36853,22 +38838,22 @@ ${accounts_default}`;
36853
38838
  if (mounted.hostId) hostIds.add(mounted.hostId);
36854
38839
  }
36855
38840
  await Promise.all(
36856
- [...hostIds].map((hostId) => refreshHarnessAvailabilityForHost(hostId, refresh))
38841
+ [...hostIds].map((hostId2) => refreshHarnessAvailabilityForHost(hostId2, refresh))
36857
38842
  );
36858
38843
  };
36859
38844
  connectionDiagnostics = {
36860
38845
  snapshot() {
36861
38846
  const hostIds = [
36862
38847
  "local",
36863
- ...[...harnessAvailabilityByHost.keys()].filter((hostId) => hostId !== "local").sort()
38848
+ ...[...harnessAvailabilityByHost.keys()].filter((hostId2) => hostId2 !== "local").sort()
36864
38849
  ];
36865
38850
  return {
36866
38851
  adapter: { ...adapterStatus },
36867
- hosts: hostIds.map((hostId) => {
36868
- const state = hostHarnessAvailabilityState(hostId);
38852
+ hosts: hostIds.map((hostId2) => {
38853
+ const state = hostHarnessAvailabilityState(hostId2);
36869
38854
  return {
36870
- hostId,
36871
- active: hostId === activeAvailabilityHostId,
38855
+ hostId: hostId2,
38856
+ active: hostId2 === activeAvailabilityHostId,
36872
38857
  agents: externalAgents.map((agent) => ({
36873
38858
  agent,
36874
38859
  availability: state.availability[agent] ?? "checking",
@@ -36879,10 +38864,10 @@ ${accounts_default}`;
36879
38864
  })
36880
38865
  };
36881
38866
  },
36882
- refresh(hostId) {
36883
- if (hostId !== void 0) {
38867
+ refresh(hostId2) {
38868
+ if (hostId2 !== void 0) {
36884
38869
  return refreshConnectionHosts(
36885
- [hostId],
38870
+ [hostId2],
36886
38871
  (target) => refreshHarnessAvailabilityForHost(target, true, false, true),
36887
38872
  (target) => hostHarnessAvailabilityState(target).request?.promise
36888
38873
  );
@@ -36893,35 +38878,35 @@ ${accounts_default}`;
36893
38878
  (target) => refreshHarnessAvailabilityForHost(target, true, false, true)
36894
38879
  );
36895
38880
  },
36896
- async installation(hostId, agent, action) {
36897
- const client = modelClientForHost(hostId);
38881
+ async installation(hostId2, agent, action) {
38882
+ const client = modelClientForHost(hostId2);
36898
38883
  if (!client?.installation)
36899
38884
  throw new Error("Harness version management is unavailable on this Host");
36900
38885
  return client.installation({ harnessId: externalHarnessIds[agent], action });
36901
38886
  },
36902
- async getLaunchSettings(hostId, agent) {
36903
- const client = hostId === "local" ? modelClientForHost(hostId) : null;
38887
+ async getLaunchSettings(hostId2, agent) {
38888
+ const client = hostId2 === "local" ? modelClientForHost(hostId2) : null;
36904
38889
  if (!client?.getHarnessLaunchSettings) throw new Error("Launch settings are unavailable");
36905
38890
  return client.getHarnessLaunchSettings({ harnessId: externalHarnessIds[agent] });
36906
38891
  },
36907
- async setLaunchSettings(hostId, agent, path) {
36908
- const client = hostId === "local" ? modelClientForHost(hostId) : null;
38892
+ async setLaunchSettings(hostId2, agent, path) {
38893
+ const client = hostId2 === "local" ? modelClientForHost(hostId2) : null;
36909
38894
  if (!client?.setHarnessLaunchSettings) throw new Error("Launch settings are unavailable");
36910
38895
  return client.setHarnessLaunchSettings({ harnessId: externalHarnessIds[agent], path });
36911
38896
  },
36912
- async getLongContext(hostId, agent) {
36913
- const client = modelClientForHost(hostId);
38897
+ async getLongContext(hostId2, agent) {
38898
+ const client = modelClientForHost(hostId2);
36914
38899
  if (!client?.getHarnessLongContext) throw new Error("1M context is unavailable");
36915
38900
  return client.getHarnessLongContext({ harnessId: externalHarnessIds[agent] });
36916
38901
  },
36917
- async setLongContext(hostId, agent, enabled) {
36918
- const client = modelClientForHost(hostId);
38902
+ async setLongContext(hostId2, agent, enabled) {
38903
+ const client = modelClientForHost(hostId2);
36919
38904
  if (!client?.setHarnessLongContext) throw new Error("1M context is unavailable");
36920
38905
  return client.setHarnessLongContext({ harnessId: externalHarnessIds[agent], enabled });
36921
38906
  },
36922
- async openWebUi(hostId, agent) {
36923
- const state = hostHarnessAvailabilityState(hostId);
36924
- const client = hostId === "local" ? modelClientForHost(hostId) : null;
38907
+ async openWebUi(hostId2, agent) {
38908
+ const state = hostHarnessAvailabilityState(hostId2);
38909
+ const client = hostId2 === "local" ? modelClientForHost(hostId2) : null;
36925
38910
  if (state.availability[agent] !== "ready" || state.webUi[agent] !== true || !client?.openHarnessWebUi) {
36926
38911
  throw new Error("Harness Web UI is unavailable");
36927
38912
  }
@@ -36930,7 +38915,7 @@ ${accounts_default}`;
36930
38915
  } catch (error51) {
36931
38916
  state.webUi = { ...state.webUi, [agent]: false };
36932
38917
  publishConnectionStatus();
36933
- void refreshHarnessAvailabilityForHost(hostId, true, false, true).catch(() => void 0);
38918
+ void refreshHarnessAvailabilityForHost(hostId2, true, false, true).catch(() => void 0);
36934
38919
  throw error51;
36935
38920
  }
36936
38921
  },
@@ -36947,12 +38932,12 @@ ${accounts_default}`;
36947
38932
  const sendButton = sendButtonWithin(composer) ?? allButtons.at(-1) ?? null;
36948
38933
  if (!sendButton) return;
36949
38934
  const modelTarget = findComposerModelTarget(composer);
36950
- const hostId = activeModelHostId(composer);
38935
+ const hostId2 = activeModelHostId(composer);
36951
38936
  const editor = composer.querySelector(EDITOR_SELECTOR);
36952
38937
  if (!editor) return;
36953
38938
  const state = controller.mount(
36954
38939
  composer,
36955
- controllerTarget(modelTarget, hostId),
38940
+ controllerTarget(modelTarget, hostId2),
36956
38941
  modelTarget?.[0] === "default" ? readNewThreadAgentPreference(enabledAgentSet) : void 0
36957
38942
  );
36958
38943
  const inherited = pendingReplacements.get(composer)?.source;
@@ -37001,7 +38986,7 @@ ${accounts_default}`;
37001
38986
  threadConfiguration: inherited?.threadConfiguration,
37002
38987
  usage: inherited?.usage ?? null,
37003
38988
  accountCredits: composerAccountCredits(inherited?.accountCredits),
37004
- hostId: inherited?.hostId ?? hostId,
38989
+ hostId: inherited?.hostId ?? hostId2,
37005
38990
  usageRequestGeneration: 0,
37006
38991
  commandRequestGeneration: 0
37007
38992
  };
@@ -37227,8 +39212,8 @@ ${accounts_default}`;
37227
39212
  });
37228
39213
  const onHostRouteChange = () => {
37229
39214
  for (const mounted of mountedByComposer.values()) {
37230
- const hostId = activeModelHostId(mounted.composer);
37231
- if (hostId && mounted.hostId === hostId && !threadIdFromComposerModelTarget(mounted.modelTarget) && controller.get(mounted.composer).agent !== "codex" && !controller.isSwitching(mounted.composer) && isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
39215
+ const hostId2 = activeModelHostId(mounted.composer);
39216
+ if (hostId2 && mounted.hostId === hostId2 && !threadIdFromComposerModelTarget(mounted.modelTarget) && controller.get(mounted.composer).agent !== "codex" && !controller.isSwitching(mounted.composer) && isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
37232
39217
  applyComposerAgent(mounted.composer);
37233
39218
  }
37234
39219
  }
@@ -37291,11 +39276,11 @@ ${accounts_default}`;
37291
39276
  const onDraftWorkspace = (event) => {
37292
39277
  const detail = event.detail;
37293
39278
  if (typeof detail !== "object" || detail === null) return;
37294
- const { hostId, cwd } = detail;
37295
- if (typeof hostId !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
37296
- draftWorkspaces.set(hostId, cwd);
39279
+ const { hostId: hostId2, cwd } = detail;
39280
+ if (typeof hostId2 !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
39281
+ draftWorkspaces.set(hostId2, cwd);
37297
39282
  for (const mounted of mountedByComposer.values()) {
37298
- if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId && controller.get(mounted.composer).agent !== "codex") {
39283
+ if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId2 && controller.get(mounted.composer).agent !== "codex") {
37299
39284
  void refreshCommands(mounted, { keepCurrent: true });
37300
39285
  }
37301
39286
  }
@@ -37351,6 +39336,11 @@ ${accounts_default}`;
37351
39336
  (mounted) => mounted.composer.isConnected && mounted.control.root.isConnected
37352
39337
  );
37353
39338
  const api = {
39339
+ remoteConnections: (request) => handleRemoteConnectionsRequest(remoteConnections, request),
39340
+ currentThreadId() {
39341
+ const mounted = connectedComposers();
39342
+ return mounted.length === 1 && mounted[0] ? threadIdFromComposerModelTarget(mounted[0].modelTarget) ?? null : null;
39343
+ },
37354
39344
  status() {
37355
39345
  const selections = connectedComposers().map((mounted) => ({
37356
39346
  composerId: mounted.composerId,
@@ -37484,9 +39474,9 @@ ${accounts_default}`;
37484
39474
  }
37485
39475
 
37486
39476
  // src/install-renderer-binding.ts
37487
- function installRendererBinding(enabledAgents = DEFAULT_RENDERER_AGENTS, defaultAgent = "codex") {
39477
+ function installRendererBinding(enabledAgents = DEFAULT_RENDERER_AGENTS) {
37488
39478
  window.__codexhostRendererBindingProbeV1?.dispose();
37489
- const binding = installRendererBindingProbe({ enabledAgents, defaultAgent });
39479
+ const binding = installRendererBindingProbe({ enabledAgents });
37490
39480
  try {
37491
39481
  const adapter = installCurrentRendererAdapter();
37492
39482
  binding.setAdapter(adapter.status, adapter.dispose, adapter.applyAgent, adapter.modelControl);
@@ -37506,10 +39496,8 @@ ${accounts_default}`;
37506
39496
  }
37507
39497
 
37508
39498
  // src/production-entry.ts
37509
- var configuration = window.__codexhostProductionConfigV1;
37510
- delete window.__codexhostProductionConfigV1;
37511
39499
  var install = () => {
37512
- installRendererBinding(DEFAULT_RENDERER_AGENTS, configuration?.defaultAgent ?? "codex");
39500
+ installRendererBinding(DEFAULT_RENDERER_AGENTS);
37513
39501
  };
37514
39502
  if (document.documentElement && document.body) {
37515
39503
  install();