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

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.
@@ -15785,7 +15785,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15785
15785
  latestVersion: external_exports.string().min(1).max(128),
15786
15786
  updateAvailable: external_exports.boolean(),
15787
15787
  canUpdate: external_exports.boolean(),
15788
- message: external_exports.string().max(2048).optional()
15788
+ // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15789
+ message: external_exports.string().max(2048).optional(),
15790
+ messageCode: external_exports.string().min(1).max(128).optional(),
15791
+ latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
15789
15792
  }).strict();
15790
15793
 
15791
15794
  // ../shared-contracts/dist/codex-accounts.js
@@ -16081,7 +16084,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16081
16084
  }
16082
16085
  });
16083
16086
  var updateEmptyParamsSchema = external_exports.strictObject({});
16084
- var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/LiberSeek\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
16087
+ var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
16085
16088
  var updateCheckResultSchema = external_exports.strictObject({
16086
16089
  currentVersion: updateSemanticVersionSchema,
16087
16090
  installation: updateInstallationSchema.nullable(),
@@ -17373,7 +17376,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17373
17376
  }
17374
17377
 
17375
17378
  // src/settings/harness-installation-panel.ts
17376
- function createHarnessInstallationPanel(document2, agent, hostId, messages, copy, refresh) {
17379
+ function createHarnessInstallationPanel(document2, agent, hostId, messages, copy, installation, refresh) {
17377
17380
  const zh = messages.locale === "zh-CN";
17378
17381
  const guide = harnessInstallationGuide(agent, messages.locale);
17379
17382
  const panel = document2.createElement("div");
@@ -17387,6 +17390,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17387
17390
  paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
17388
17391
  }
17389
17392
  if (guide.before) paragraph(guide.before);
17393
+ const install2 = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
17394
+ if (install2 && installation) {
17395
+ install2.type = "button";
17396
+ install2.className = "settings-command-button";
17397
+ install2.dataset.connectionAction = "install";
17398
+ install2.disabled = installation.status !== "idle";
17399
+ install2.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
17400
+ install2.addEventListener("click", () => {
17401
+ if (install2.disabled) return;
17402
+ install2.disabled = true;
17403
+ install2.textContent = messages.connectionStatusInstalling;
17404
+ installation.run();
17405
+ });
17406
+ if (guide.commands.length > 1) panel.append(install2);
17407
+ }
17390
17408
  for (const { terminal, command } of guide.commands) {
17391
17409
  const block = document2.createElement("div");
17392
17410
  block.className = "settings-harness-installation-command";
@@ -17404,7 +17422,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17404
17422
  button.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
17405
17423
  button.append(createRendererSettingsIcon("copy", 16), copyLabel);
17406
17424
  button.addEventListener("click", () => copy(button, command, copyLabel));
17407
- block.append(label, pre, button);
17425
+ const actions = document2.createElement("div");
17426
+ actions.className = "settings-harness-installation-actions";
17427
+ if (install2 && guide.commands.length === 1) actions.append(install2);
17428
+ actions.append(button);
17429
+ block.append(label, pre, actions);
17408
17430
  panel.append(block);
17409
17431
  }
17410
17432
  const link = (url2, label) => {
@@ -17423,17 +17445,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17423
17445
  );
17424
17446
  }
17425
17447
  paragraph(guide.after);
17426
- const check2 = document2.createElement("button");
17427
- check2.type = "button";
17428
- check2.className = "settings-command-button";
17429
- check2.dataset.connectionAction = "check-install";
17430
- check2.textContent = zh ? "\u91CD\u65B0\u68C0\u6D4B" : "Check again";
17431
- check2.addEventListener("click", () => {
17432
- check2.disabled = true;
17433
- check2.textContent = messages.connectionRefreshing;
17434
- refresh();
17435
- });
17436
- panel.append(check2);
17448
+ if (refresh) {
17449
+ const check2 = document2.createElement("button");
17450
+ check2.type = "button";
17451
+ check2.className = "settings-command-button";
17452
+ check2.dataset.connectionAction = "check-install";
17453
+ check2.textContent = zh ? "\u91CD\u65B0\u68C0\u6D4B" : "Check again";
17454
+ check2.addEventListener("click", () => {
17455
+ check2.disabled = true;
17456
+ check2.textContent = messages.connectionRefreshing;
17457
+ refresh();
17458
+ });
17459
+ panel.append(check2);
17460
+ }
17437
17461
  link(guide.url, zh ? "\u67E5\u770B\u5B98\u65B9\u5B89\u88C5\u8BF4\u660E" : "View official installation instructions");
17438
17462
  return panel;
17439
17463
  }
@@ -17731,6 +17755,52 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17731
17755
  return control;
17732
17756
  }
17733
17757
 
17758
+ // src/settings/harness-version-messages.ts
17759
+ var harnessVersionEnglish = Object.freeze({
17760
+ unknown: "Unknown",
17761
+ trackingBranch: "Tracking branch (new commits)",
17762
+ notes: Object.freeze({
17763
+ "original-installer": "Use the original installer, package manager, or launcher to update this installation.",
17764
+ "claude-policy-restricted": "Claude updates are restricted by the installation's settings or policy.",
17765
+ "codebuddy-npm-required": "Use CodeBuddy's native updater or original package manager. Latest-version checks here require an identified npm installation.",
17766
+ "deepseek-original-installer": "Update with the original installer. Python, desktop, and project-local installations are not upgraded through global npm.",
17767
+ "kiro-native-updater": "Use Kiro CLI's original installer or native updater to check for and install updates.",
17768
+ "qoder-check-unavailable": "This Qoder China release does not expose a non-installing update check. Use its original installer.",
17769
+ "hermes-update-plan-unavailable": "This Hermes release does not expose a safe update plan. Use the original installer.",
17770
+ "hermes-externally-managed": "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager.",
17771
+ "hermes-update-channel": "Uses Hermes's configured update channel. Gateway restarts are deferred; existing processes keep their running code.",
17772
+ "hermes-manual-update": "Use the native updater manually. Safe non-interactive updates require a clean source checkout, commit identity, and Gateway restart deferral."
17773
+ })
17774
+ });
17775
+ var harnessVersionChinese = Object.freeze({
17776
+ unknown: "\u672A\u77E5",
17777
+ trackingBranch: "\u8DDF\u8E2A\u5206\u652F\uFF08\u6709\u65B0\u63D0\u4EA4\uFF09",
17778
+ notes: Object.freeze({
17779
+ "original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u7A0B\u5E8F\u3001\u5305\u7BA1\u7406\u5668\u6216\u542F\u52A8\u5668\u66F4\u65B0\u6B64\u5B89\u88C5\u3002",
17780
+ "claude-policy-restricted": "\u6B64 Claude \u5B89\u88C5\u7684\u8BBE\u7F6E\u6216\u7B56\u7565\u9650\u5236\u4E86\u66F4\u65B0\u3002",
17781
+ "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
+ "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
+ "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",
17784
+ "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
+ "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
+ "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",
17787
+ "hermes-update-channel": "\u4F7F\u7528 Hermes \u914D\u7F6E\u7684\u66F4\u65B0\u6E20\u9053\uFF0C\u6682\u4E0D\u91CD\u542F Gateway\uFF1B\u73B0\u6709\u8FDB\u7A0B\u7EE7\u7EED\u8FD0\u884C\u539F\u6709\u4EE3\u7801\u3002",
17788
+ "hermes-manual-update": "\u8BF7\u624B\u52A8\u4F7F\u7528\u539F\u751F\u66F4\u65B0\u5668\u3002\u5B89\u5168\u7684\u975E\u4EA4\u4E92\u66F4\u65B0\u8981\u6C42\u6E90\u7801\u76EE\u5F55\u65E0\u672A\u63D0\u4EA4\u4FEE\u6539\u3001\u53EF\u8BC6\u522B\u5F53\u524D\u63D0\u4EA4\uFF0C\u5E76\u652F\u6301\u63A8\u8FDF Gateway \u91CD\u542F\u3002"
17789
+ })
17790
+ });
17791
+ function harnessVersionLabel(state, messages) {
17792
+ if (!state) return "\u2014";
17793
+ if (state.latestVersionKind === "unknown" || state.latestVersion === "Unknown")
17794
+ return messages.unknown;
17795
+ if (state.latestVersionKind === "tracking-branch" || state.latestVersion === "Tracking branch (new commits)")
17796
+ return messages.trackingBranch;
17797
+ return state.latestVersion;
17798
+ }
17799
+ function harnessVersionNote(state, messages) {
17800
+ const code = state?.messageCode;
17801
+ return code && Object.hasOwn(messages.notes, code) ? messages.notes[code] : void 0;
17802
+ }
17803
+
17734
17804
  // src/settings/harness-version-panel.ts
17735
17805
  function createHarnessVersionPanel(document2, messages, signal, agent, client) {
17736
17806
  const panel = document2.createElement("section");
@@ -17761,10 +17831,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17761
17831
  let unsupported = false;
17762
17832
  const render = () => {
17763
17833
  current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
17764
- latest.textContent = `${messages.harnessVersionLatest}: ${state?.latestVersion ?? "\u2014"}`;
17834
+ latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
17765
17835
  update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
17766
17836
  update.textContent = state?.canUpdate && state.latestVersion !== "Unknown" && !state.updateAvailable ? messages.harnessVersionUpToDate : messages.harnessVersionUpdate;
17767
- note.textContent = state?.message ? `${state.message} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
17837
+ const detail = harnessVersionNote(state, messages.harnessVersion);
17838
+ note.textContent = detail ? `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
17768
17839
  };
17769
17840
  const run = async (action) => {
17770
17841
  if (busy || unsupported || signal.aborted) return;
@@ -17832,16 +17903,6 @@ ${error51.stderrTail}`] : []
17832
17903
  ] : []
17833
17904
  ].join("\n");
17834
17905
  }
17835
- function detailLine(document2, label, value) {
17836
- const line = document2.createElement("div");
17837
- line.className = "settings-connection-detail-line";
17838
- const name = document2.createElement("span");
17839
- name.textContent = label;
17840
- const content = document2.createElement("code");
17841
- content.textContent = value;
17842
- line.append(name, content);
17843
- return line;
17844
- }
17845
17906
  function setActionButtonLabel(button, icon2, label) {
17846
17907
  button.replaceChildren(createRendererSettingsIcon(icon2, 16), label);
17847
17908
  }
@@ -18033,30 +18094,15 @@ ${error51.stderrTail}`] : []
18033
18094
  }
18034
18095
  return body;
18035
18096
  }
18097
+ const needsLogin = item.error.code === "authenticationRequired";
18098
+ const needsConfiguration = item.error.code === "configurationRequired";
18036
18099
  const summary = document2.createElement("div");
18037
18100
  summary.className = "settings-connection-error-summary";
18038
18101
  const title = document2.createElement("strong");
18039
- title.textContent = messages.connectionErrorTitle;
18102
+ title.textContent = needsLogin ? messages.connectionLoginRequired : needsConfiguration ? messages.connectionConfigurationRequired : messages.connectionErrorTitle;
18040
18103
  const description = document2.createElement("p");
18041
- description.textContent = item.error.message;
18104
+ description.textContent = needsLogin ? messages.connectionLoginDescription : needsConfiguration ? messages.connectionConfigurationDescription : item.error.message;
18042
18105
  summary.append(title, description);
18043
- const metadata = document2.createElement("div");
18044
- metadata.className = "settings-connection-error-metadata";
18045
- metadata.append(
18046
- detailLine(document2, messages.connectionErrorCode, item.error.code),
18047
- detailLine(document2, messages.connectionRetryable, String(item.error.retryable))
18048
- );
18049
- if (item.error.stage) {
18050
- metadata.append(detailLine(document2, messages.connectionFailureStage, item.error.stage));
18051
- }
18052
- if (item.error.durationMs !== void 0) {
18053
- metadata.append(
18054
- detailLine(document2, messages.connectionDuration, `${item.error.durationMs} ms`)
18055
- );
18056
- }
18057
- if (item.error.diagnostic) {
18058
- metadata.append(detailLine(document2, messages.connectionDiagnostic, item.error.diagnostic));
18059
- }
18060
18106
  const logHeader = document2.createElement("div");
18061
18107
  logHeader.className = "settings-connection-error-log-header";
18062
18108
  const logTitle = document2.createElement("strong");
@@ -18072,7 +18118,7 @@ ${error51.stderrTail}`] : []
18072
18118
  logHeader.append(logTitle, copy);
18073
18119
  const log = document2.createElement("pre");
18074
18120
  log.className = "settings-connection-stderr";
18075
- log.textContent = item.error.stderrTail ?? item.error.diagnostic ?? report;
18121
+ log.textContent = report;
18076
18122
  const actions = document2.createElement("div");
18077
18123
  actions.className = "settings-connection-error-actions";
18078
18124
  const issue2 = document2.createElement("a");
@@ -18085,7 +18131,7 @@ ${error51.stderrTail}`] : []
18085
18131
  const issueNote = document2.createElement("p");
18086
18132
  issueNote.className = "settings-connection-issue-note";
18087
18133
  issueNote.textContent = messages.connectionIssueDescription;
18088
- body.append(summary, metadata, logHeader, log, actions, issueNote);
18134
+ body.append(summary, logHeader, log, actions, issueNote);
18089
18135
  return body;
18090
18136
  }
18091
18137
  function createConnectionBlock(document2, item, hostId, messages, expanded, toggleExpand, group = null, launchControls = null, versionCapable = false, detailNodes = [], longContext = null) {
@@ -18116,7 +18162,7 @@ ${error51.stderrTail}`] : []
18116
18162
  status.className = "settings-connection-row__status";
18117
18163
  status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
18118
18164
  status.setAttribute("role", "cell");
18119
- status.textContent = connectionStatusLabel(item.availability, messages, item.error !== null);
18165
+ status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
18120
18166
  const action = document2.createElement("div");
18121
18167
  action.className = "settings-connection-row__action";
18122
18168
  action.setAttribute("role", "cell");
@@ -18423,6 +18469,9 @@ ${error51.stderrTail}`] : []
18423
18469
  const nodes = [];
18424
18470
  const agent = item.agentSnapshot?.agent;
18425
18471
  if (expanded && agent && item.availability === "notInstalled") {
18472
+ const installState = installs?.get(selectedHost.hostId, agent);
18473
+ const canInstall = selectedHost.hostId === "local" && agent !== "workbuddy" && diagnostics?.installation !== void 0;
18474
+ const installStatus = installState?.status === "installing" || installState?.status === "checking" ? installState.status : "idle";
18426
18475
  nodes.push(
18427
18476
  createHarnessInstallationPanel(
18428
18477
  document2,
@@ -18430,35 +18479,26 @@ ${error51.stderrTail}`] : []
18430
18479
  selectedHost.hostId,
18431
18480
  messages,
18432
18481
  (button, command, label) => copyTextToClipboard(document2, button, command, messages, label),
18482
+ canInstall ? {
18483
+ run: () => {
18484
+ void installs?.install(selectedHost.hostId, agent);
18485
+ },
18486
+ status: installStatus
18487
+ } : void 0,
18433
18488
  runRefresh
18434
18489
  )
18435
18490
  );
18436
- const installState = installs?.get(selectedHost.hostId, agent);
18437
- const canInstall = selectedHost.hostId === "local" && agent !== "workbuddy" && diagnostics?.installation !== void 0;
18438
- if (canInstall) {
18439
- const busy = installState?.status === "installing" || installState?.status === "checking";
18440
- if (installState?.error) {
18441
- const error51 = document2.createElement("p");
18442
- error51.className = "settings-connection-install-error";
18443
- error51.setAttribute("role", "alert");
18444
- error51.textContent = installState.error;
18445
- nodes.push(error51);
18446
- }
18447
- if (busy) {
18448
- const note = document2.createElement("p");
18449
- note.textContent = messages.connectionInstallRunning;
18450
- nodes.push(note);
18451
- }
18452
- const installNow = document2.createElement("button");
18453
- installNow.type = "button";
18454
- installNow.className = "settings-command-button";
18455
- installNow.dataset.connectionAction = "run-install";
18456
- installNow.disabled = busy;
18457
- installNow.textContent = busy ? messages.connectionInstallRunning : messages.connectionInstall;
18458
- installNow.addEventListener("click", () => {
18459
- void installs?.install(selectedHost.hostId, agent);
18460
- });
18461
- nodes.push(installNow);
18491
+ if (canInstall && installState?.error) {
18492
+ const error51 = document2.createElement("p");
18493
+ error51.className = "settings-connection-install-error";
18494
+ error51.setAttribute("role", "alert");
18495
+ error51.textContent = installState.error;
18496
+ nodes.push(error51);
18497
+ }
18498
+ if (canInstall && installStatus !== "idle") {
18499
+ const note = document2.createElement("p");
18500
+ note.textContent = messages.connectionInstallRunning;
18501
+ nodes.push(note);
18462
18502
  }
18463
18503
  }
18464
18504
  const installation = diagnostics?.installation?.bind(diagnostics);
@@ -18950,15 +18990,14 @@ ${error51.stderrTail}`] : []
18950
18990
  connectionCopyDetails: "Copy diagnostics",
18951
18991
  connectionCopied: "Copied",
18952
18992
  connectionCopyFailed: "Copy failed",
18953
- connectionErrorCode: "Error code",
18954
18993
  connectionErrorMessage: "Error message",
18955
- connectionRetryable: "Retryable",
18956
- connectionFailureStage: "Failure stage",
18957
- connectionDuration: "Duration",
18958
- connectionDiagnostic: "Diagnostic",
18959
18994
  connectionNoRuntime: "The renderer request bridge is not available yet.",
18960
18995
  connectionStatusReady: "Ready",
18961
18996
  connectionStatusConnected: "Connected",
18997
+ connectionLoginRequired: "Login required",
18998
+ connectionConfigurationRequired: "Setup required",
18999
+ connectionConfigurationDescription: "Configure a Provider and its required credentials in this Harness on the selected Host, then check the connection again.",
19000
+ connectionLoginDescription: "Complete login or authentication setup in this Harness on the selected Host, then check the connection again.",
18962
19001
  connectionStatusChecking: "Checking",
18963
19002
  connectionStatusNotInstalled: "Not installed",
18964
19003
  connectionStatusUnavailable: "Unavailable",
@@ -18997,6 +19036,7 @@ ${error51.stderrTail}`] : []
18997
19036
  connectionCopyPrompt: "Copy prompt",
18998
19037
  connectionInstallPrompt: "Please install {name} (CLI command: {binary}) on this machine.\n\nUse the official install method and run:\n{command}\n\nOfficial installation page: {url}\n\nAfter installation, verify that `{binary}` is available in the terminal and report the result.",
18999
19038
  connectionInstallRunning: "Installing on the selected Host. You can leave this page; login or setup may still be required afterward.",
19039
+ harnessVersion: harnessVersionEnglish,
19000
19040
  harnessVersionTitle: "Harness CLI version",
19001
19041
  harnessVersionCurrent: "Current version",
19002
19042
  harnessVersionLatest: "Latest version",
@@ -19252,15 +19292,14 @@ ${error51.stderrTail}`] : []
19252
19292
  connectionCopyDetails: "\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",
19253
19293
  connectionCopied: "\u5DF2\u590D\u5236",
19254
19294
  connectionCopyFailed: "\u590D\u5236\u5931\u8D25",
19255
- connectionErrorCode: "\u9519\u8BEF\u7801",
19256
19295
  connectionErrorMessage: "\u9519\u8BEF\u4FE1\u606F",
19257
- connectionRetryable: "\u53EF\u91CD\u8BD5",
19258
- connectionFailureStage: "\u5931\u8D25\u9636\u6BB5",
19259
- connectionDuration: "\u68C0\u67E5\u8017\u65F6",
19260
- connectionDiagnostic: "\u8BCA\u65AD\u4FE1\u606F",
19261
19296
  connectionNoRuntime: "Renderer \u8BF7\u6C42\u6865\u5C1A\u672A\u53EF\u7528\u3002",
19262
19297
  connectionStatusReady: "\u6B63\u5E38",
19263
19298
  connectionStatusConnected: "\u5DF2\u8FDE\u63A5",
19299
+ connectionLoginRequired: "\u9700\u8981\u767B\u5F55",
19300
+ connectionConfigurationRequired: "\u9700\u8981\u914D\u7F6E",
19301
+ connectionConfigurationDescription: "\u8BF7\u5728\u6240\u9009 Host \u4E0A\u914D\u7F6E\u8BE5 Harness \u7684 Provider \u53CA\u6240\u9700\u8BA4\u8BC1\u4FE1\u606F\uFF0C\u7136\u540E\u91CD\u65B0\u68C0\u6D4B\u8FDE\u63A5\u3002",
19302
+ connectionLoginDescription: "\u8BF7\u5728\u6240\u9009 Host \u4E0A\u5B8C\u6210\u8BE5 Harness \u7684\u767B\u5F55\u6216\u8BA4\u8BC1\u914D\u7F6E\uFF0C\u7136\u540E\u91CD\u65B0\u68C0\u6D4B\u8FDE\u63A5\u3002",
19264
19303
  connectionStatusChecking: "\u68C0\u67E5\u4E2D",
19265
19304
  connectionStatusNotInstalled: "\u672A\u5B89\u88C5",
19266
19305
  connectionStatusUnavailable: "\u4E0D\u53EF\u7528",
@@ -19299,6 +19338,7 @@ ${error51.stderrTail}`] : []
19299
19338
  connectionCopyPrompt: "\u590D\u5236 Prompt",
19300
19339
  connectionInstallPrompt: "\u8BF7\u5E2E\u6211\u5728\u672C\u673A\u5B89\u88C5 {name}\uFF08CLI \u547D\u4EE4\uFF1A{binary}\uFF09\u3002\n\n\u8BF7\u6309\u5B98\u65B9\u5B89\u88C5\u65B9\u5F0F\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF0C\u5E76\u5904\u7406 PATH\u3001\u6743\u9650\u548C\u4F9D\u8D56\u95EE\u9898\uFF1A\n{command}\n\n\u5B98\u65B9\u5B89\u88C5\u9875\u9762\uFF1A{url}\n\n\u5B89\u88C5\u5B8C\u6210\u540E\u8BF7\u9A8C\u8BC1 `{binary}` \u53EF\u4EE5\u5728\u7EC8\u7AEF\u4E2D\u8FD0\u884C\uFF0C\u5E76\u544A\u8BC9\u6211\u7ED3\u679C\u3002",
19301
19340
  connectionInstallRunning: "\u6B63\u5728\u6240\u9009 Host \u4E0A\u5B89\u88C5\uFF0C\u79BB\u5F00\u9875\u9762\u4E0D\u4F1A\u4E2D\u65AD\u3002\u5B89\u88C5\u540E\u53EF\u80FD\u4ECD\u9700\u767B\u5F55\u6216\u914D\u7F6E\u3002",
19341
+ harnessVersion: harnessVersionChinese,
19302
19342
  harnessVersionTitle: "Harness CLI \u7248\u672C",
19303
19343
  harnessVersionCurrent: "\u5F53\u524D\u7248\u672C",
19304
19344
  harnessVersionLatest: "\u6700\u65B0\u7248\u672C",
@@ -25573,13 +25613,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
25573
25613
  const route = disposed ? null : window.__codexhostHostRoutingV1?.forComposer() ?? null;
25574
25614
  const client = clients.forRoute(route);
25575
25615
  usageSubscription.connect(client);
25576
- idleReleaseSync.connect(
25577
- disposed ? null : route?.hostId === "local" ? client : clients.forHost("local")
25578
- );
25616
+ const localClient = disposed ? null : route?.hostId === "local" ? client : clients.forHost("local");
25617
+ idleReleaseSync.connect(localClient);
25618
+ const connected = !disposed && (client !== null || localClient !== null || (window.__codexhostHostRoutingV1?.knownHostIds?.() ?? []).some(
25619
+ (hostId) => window.__codexhostHostRoutingV1?.forHost(hostId) != null
25620
+ ));
25579
25621
  updateStatus(
25580
- route ? "ready" : "installing",
25581
- route ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
25582
- route ? "request-bridge" : null
25622
+ connected ? "ready" : "installing",
25623
+ connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
25624
+ connected ? "request-bridge" : null
25583
25625
  );
25584
25626
  return route;
25585
25627
  };
@@ -25594,10 +25636,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
25594
25636
  return client;
25595
25637
  };
25596
25638
  const modelControl = Object.freeze({
25597
- currentHostId: () => {
25639
+ currentHostId: (composer) => {
25640
+ if (composer) {
25641
+ return disposed ? null : window.__codexhostHostRoutingV1?.hostIdForComposer(composer) ?? null;
25642
+ }
25598
25643
  const route = currentRequestRoute();
25599
25644
  return disposed ? null : route?.hostId ?? window.__codexhostHostRoutingV1?.hostIdForComposer() ?? null;
25600
25645
  },
25646
+ knownHostIds: () => disposed ? [] : window.__codexhostHostRoutingV1?.knownHostIds?.() ?? [],
25601
25647
  clientForHost: (hostId) => disposed ? null : clients.forHost(hostId),
25602
25648
  listHarnessPlugins: async () => {
25603
25649
  const client = settingsModelClient();
@@ -30033,6 +30079,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
30033
30079
  messages.updateDownloadFromReleases,
30034
30080
  createRendererSettingsIcon("external-link", 14)
30035
30081
  );
30082
+ releaseLink.addEventListener("click", (event) => {
30083
+ const open = getClient()?.openExternalUrl;
30084
+ if (!open) return;
30085
+ event.preventDefault();
30086
+ const url2 = releaseLink.href;
30087
+ void open(url2).catch((error51) => {
30088
+ console.error("codexhost external URL open failed", error51);
30089
+ document2.defaultView?.open(url2, "_blank", "noopener,noreferrer");
30090
+ });
30091
+ });
30036
30092
  actions.append(releaseLink);
30037
30093
  controls.append(manualTitle, manualNpm, manualWindowsInstaller, actions);
30038
30094
  const notes = document2.createElement("div");
@@ -31386,6 +31442,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
31386
31442
  border-radius: 10px;
31387
31443
  }
31388
31444
 
31445
+ .settings-harness-installation-actions {
31446
+ display: flex;
31447
+ flex-wrap: wrap;
31448
+ gap: 8px;
31449
+ }
31450
+
31389
31451
  .settings-harness-installation-command pre {
31390
31452
  white-space: pre-wrap;
31391
31453
  overflow-wrap: anywhere;
@@ -31808,33 +31870,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
31808
31870
  border-radius: 10px;
31809
31871
  }
31810
31872
 
31811
- .settings-connection-error-metadata {
31812
- display: grid;
31813
- gap: 7px;
31814
- padding: 12px;
31815
- background: var(--settings-inset);
31816
- border: 1px solid var(--settings-border);
31817
- border-radius: 9px;
31818
- }
31819
-
31820
- .settings-connection-detail-line {
31821
- display: grid;
31822
- grid-template-columns: 92px minmax(0, 1fr);
31823
- gap: 10px;
31824
- min-width: 0;
31825
- color: var(--settings-muted);
31826
- font-size: 10px;
31827
- line-height: 16px;
31828
- }
31829
-
31830
- .settings-connection-detail-line code {
31831
- min-width: 0;
31832
- overflow-wrap: anywhere;
31833
- color: var(--settings-text);
31834
- font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
31835
- white-space: pre-wrap;
31836
- }
31837
-
31838
31873
  .settings-connection-error-log-header {
31839
31874
  display: flex;
31840
31875
  align-items: center;
@@ -34904,7 +34939,7 @@ ${accounts_default}`;
34904
34939
  openedFor = { node: trigger.node, start: trigger.start };
34905
34940
  options.onOpen?.(trigger.editor);
34906
34941
  }
34907
- const allTargets = options.readTargets();
34942
+ const allTargets = options.readTargets(trigger.editor);
34908
34943
  syncChipStyle(ownerDocument, allTargets, iconCache);
34909
34944
  const targets = filterDelegationTargets(allTargets, trigger.query);
34910
34945
  const source = options.readCommands(trigger.editor);
@@ -35438,19 +35473,23 @@ ${accounts_default}`;
35438
35473
  let adapterDispose = null;
35439
35474
  let applyAdapterAgent = null;
35440
35475
  let modelControl = null;
35441
- const activeModelHostId = () => {
35476
+ const activeModelHostId = (composer) => {
35442
35477
  if (!modelControl) return null;
35443
- return modelControl.currentHostId ? modelControl.currentHostId() : "local";
35478
+ return modelControl.currentHostId ? modelControl.currentHostId(composer) : "local";
35444
35479
  };
35445
35480
  const controllerTarget = (target, hostId) => scopedComposerTarget(target, hostId);
35446
- let usageNotificationDispose = null;
35481
+ const usageSubscriptions = /* @__PURE__ */ new Map();
35482
+ const usageNotificationDispose = () => {
35483
+ for (const subscription of usageSubscriptions.values()) subscription.dispose();
35484
+ usageSubscriptions.clear();
35485
+ };
35447
35486
  const localAgentForSidebarThread = (input) => {
35448
35487
  for (const mounted of mountedByComposer.values()) {
35449
35488
  const target = mounted.modelTarget;
35450
35489
  const matchesDraft = target?.[0] === "default" && input.draftId !== null && target[1] === input.draftId;
35451
35490
  const matchesConversation = target?.[0] === "conversation" && input.threadId !== null && target[1] === input.threadId && mounted.ownershipStatus === "ready";
35452
35491
  if (!matchesDraft && !matchesConversation) continue;
35453
- const mountedHostId = modelControl?.currentHostId?.() ?? "local";
35492
+ const mountedHostId = activeModelHostId(mounted.composer);
35454
35493
  if (input.hostId !== mountedHostId) return null;
35455
35494
  return controller.get(mounted.composer).agent;
35456
35495
  }
@@ -35602,6 +35641,9 @@ ${accounts_default}`;
35602
35641
  const title = status === "unsupported" ? rendererHarnessMessages(settingsLifecycle.locale).codexUsageGateUnavailable : "";
35603
35642
  if (mounted.control.root.title !== title) mounted.control.root.title = title;
35604
35643
  };
35644
+ const composerClient = (mounted) => mounted.hostId ? modelClientForHost(mounted.hostId) : null;
35645
+ const composerAvailability = (mounted) => mounted.hostId ? hostHarnessAvailabilityState(mounted.hostId).availability : {};
35646
+ const composerAdapterState = (mounted) => composerClient(mounted) ? "ready" : "installing";
35605
35647
  const renderMounted = (mounted) => {
35606
35648
  const accounts = composerCodexAccounts(mounted.composer);
35607
35649
  const currentCodexAccount = accounts?.accounts.find(
@@ -35610,9 +35652,9 @@ ${accounts_default}`;
35610
35652
  const externalSubmissionReady = renderComposerAgentControl(
35611
35653
  mounted.control,
35612
35654
  controller.get(mounted.composer),
35613
- adapterStatus.state,
35655
+ composerAdapterState(mounted),
35614
35656
  controller.isSwitching(mounted.composer) || mounted.ownershipStatus === "loading",
35615
- activeHarnessAvailabilityState().availability,
35657
+ composerAvailability(mounted),
35616
35658
  mounted.modelView,
35617
35659
  mounted.permissionModeView,
35618
35660
  mounted.usage,
@@ -35645,7 +35687,7 @@ ${accounts_default}`;
35645
35687
  const generation = ++mounted.commandRequestGeneration;
35646
35688
  const agent = controller.get(mounted.composer).agent;
35647
35689
  const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
35648
- const hostId = threadId ? mounted.hostId : activeModelHostId();
35690
+ const hostId = threadId ? mounted.hostId : activeModelHostId(mounted.composer);
35649
35691
  const requestControl = modelControl;
35650
35692
  const client = modelClientForHostFrom(requestControl, hostId);
35651
35693
  if (!keepCurrent || agent === "codex") mounted.control.harnessCommands.setCommands([]);
@@ -35655,7 +35697,7 @@ ${accounts_default}`;
35655
35697
  harnessId: externalHarnessIds[agent],
35656
35698
  ...hostId && draftWorkspaces.has(hostId) ? { cwd: draftWorkspaces.get(hostId) } : {}
35657
35699
  });
35658
- if (disposed || mountedByComposer.get(mounted.composer) !== mounted || mounted.commandRequestGeneration !== generation || requestControl !== modelControl || (threadIdFromComposerModelTarget(mounted.modelTarget) ? mounted.hostId : activeModelHostId()) !== hostId || controller.get(mounted.composer).agent !== agent)
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)
35659
35701
  return;
35660
35702
  mounted.control.harnessCommands.setCommands(
35661
35703
  catalog.commands,
@@ -35669,9 +35711,11 @@ ${accounts_default}`;
35669
35711
  const executeCommand = async (mounted, command) => {
35670
35712
  const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
35671
35713
  if (!threadId || !modelControl || controller.get(mounted.composer).agent === "codex") return;
35714
+ const client = composerClient(mounted);
35715
+ if (!client) return;
35672
35716
  mounted.control.harnessCommands.setExecuting(command.id);
35673
35717
  try {
35674
- await modelControl.executeThreadCommand({ threadId, commandId: command.id });
35718
+ await client.executeThreadCommand({ threadId, commandId: command.id });
35675
35719
  } catch (error51) {
35676
35720
  console.error(
35677
35721
  "codexhost Harness command failed",
@@ -35693,9 +35737,10 @@ ${accounts_default}`;
35693
35737
  }
35694
35738
  console.error("codexhost Harness command could not claim the current Composer editor");
35695
35739
  };
35696
- const applyThreadUsageUpdate = (update) => {
35740
+ const applyThreadUsageUpdate = (hostId, update) => {
35697
35741
  for (const mounted of mountedByComposer.values()) {
35698
- if (threadIdFromComposerModelTarget(mounted.modelTarget) !== update.threadId) continue;
35742
+ if (mounted.hostId !== hostId || threadIdFromComposerModelTarget(mounted.modelTarget) !== update.threadId)
35743
+ continue;
35699
35744
  mounted.usageRequestGeneration += 1;
35700
35745
  mounted.usage = update.usage;
35701
35746
  mounted.accountCredits = composerAccountCredits(update.accountCredits);
@@ -35739,13 +35784,16 @@ ${accounts_default}`;
35739
35784
  renderMounted(mounted);
35740
35785
  return;
35741
35786
  }
35787
+ const hostId = mounted.hostId;
35788
+ const client = composerClient(mounted);
35789
+ if (!client) return;
35742
35790
  const generation = ++mounted.usageRequestGeneration;
35743
35791
  try {
35744
- const result = await modelControl.inspectThreadUsage({
35792
+ const result = await client.inspectThreadUsage({
35745
35793
  threadId,
35746
35794
  ...refresh ? { refresh } : {}
35747
35795
  });
35748
- if (disposed || mountedByComposer.get(mounted.composer) !== mounted || !mounted.composer.isConnected || mounted.usageRequestGeneration !== generation || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId || result.threadId !== threadId) {
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) {
35749
35797
  return;
35750
35798
  }
35751
35799
  mounted.usage = result.usage;
@@ -35814,7 +35862,7 @@ ${accounts_default}`;
35814
35862
  return;
35815
35863
  }
35816
35864
  const requestModelControl = modelControl;
35817
- const requestHostId = activeModelHostId();
35865
+ const requestHostId = activeModelHostId(mounted.composer);
35818
35866
  const client = modelClientForHostFrom(requestModelControl, requestHostId);
35819
35867
  const generation = controller.beginOwnershipRequest(mounted.composer);
35820
35868
  const usageGeneration = mounted.usageRequestGeneration;
@@ -35824,7 +35872,7 @@ ${accounts_default}`;
35824
35872
  if (!client || !requestHostId) throw new Error("Thread ownership control is unavailable");
35825
35873
  mounted.hostId = requestHostId;
35826
35874
  const inspection = await client.inspectThread({ threadId });
35827
- if (!isCurrentOwnershipRequest(mounted, generation) || mountedByComposer.get(mounted.composer) !== mounted || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId || mounted.hostId !== requestHostId || modelControl !== requestModelControl || activeModelHostId() !== requestHostId) {
35875
+ if (!isCurrentOwnershipRequest(mounted, generation) || mountedByComposer.get(mounted.composer) !== mounted || threadIdFromComposerModelTarget(mounted.modelTarget) !== threadId || mounted.hostId !== requestHostId || modelControl !== requestModelControl || activeModelHostId(mounted.composer) !== requestHostId) {
35828
35876
  return;
35829
35877
  }
35830
35878
  const { agent, model, thinkingOptionId, permissionModeId } = restoredThreadOwnership(inspection);
@@ -35890,7 +35938,7 @@ ${accounts_default}`;
35890
35938
  );
35891
35939
  if (resolution === "none") return false;
35892
35940
  const previousTarget = mounted.modelTarget;
35893
- const nextHostId = activeModelHostId() ?? mounted.hostId;
35941
+ const nextHostId = activeModelHostId(mounted.composer);
35894
35942
  const nextControllerTarget = controllerTarget(currentTarget, nextHostId);
35895
35943
  mounted.modelTarget = currentTarget;
35896
35944
  mounted.hostId = nextHostId;
@@ -35929,7 +35977,7 @@ ${accounts_default}`;
35929
35977
  const agent = state.agent;
35930
35978
  const requestModelControl = modelControl;
35931
35979
  const isDraft = !threadIdFromComposerModelTarget(mounted.modelTarget);
35932
- const requestHostId = isDraft ? activeModelHostId() : mounted.hostId;
35980
+ const requestHostId = isDraft ? activeModelHostId(mounted.composer) : mounted.hostId;
35933
35981
  if (!requestHostId) {
35934
35982
  mounted.modelView = {
35935
35983
  status: "waitingForAdapter",
@@ -35943,7 +35991,7 @@ ${accounts_default}`;
35943
35991
  const availability = hostHarnessAvailabilityState(requestHostId).availability[agent];
35944
35992
  if (availability !== "ready" && availability !== "checking") {
35945
35993
  mounted.modelView = {
35946
- status: adapterStatus.state === "ready" ? "error" : "waitingForAdapter",
35994
+ status: composerAdapterState(mounted) === "ready" ? "error" : "waitingForAdapter",
35947
35995
  thinkingSelectionSupported: false,
35948
35996
  ...availability ? { error: `${agent} runtime is ${availability}` } : {}
35949
35997
  };
@@ -35952,12 +36000,12 @@ ${accounts_default}`;
35952
36000
  return;
35953
36001
  }
35954
36002
  mounted.modelView = {
35955
- status: adapterStatus.state === "ready" ? "loading" : "waitingForAdapter",
36003
+ status: composerAdapterState(mounted) === "ready" ? "loading" : "waitingForAdapter",
35956
36004
  thinkingSelectionSupported: false
35957
36005
  };
35958
36006
  mounted.permissionModeView = { status: "idle" };
35959
36007
  renderMounted(mounted);
35960
- if (adapterStatus.state !== "ready") return;
36008
+ if (!composerClient(mounted)) return;
35961
36009
  const generation = controller.beginModelRequest(mounted.composer);
35962
36010
  let catalogRequest;
35963
36011
  try {
@@ -35973,7 +36021,7 @@ ${accounts_default}`;
35973
36021
  const inspection = await client.inspectHarness({
35974
36022
  harnessId: externalHarnessIds[agent]
35975
36023
  });
35976
- if (!isCurrentModelRequest(mounted, generation) || controller.get(mounted.composer).agent !== agent || mounted.hostId !== requestHostId || modelControl !== requestModelControl || modelClientForHostFrom(requestModelControl, requestHostId) !== client || activeModelHostId() !== requestHostId) {
36024
+ if (!isCurrentModelRequest(mounted, generation) || controller.get(mounted.composer).agent !== agent || mounted.hostId !== requestHostId || modelControl !== requestModelControl || modelClientForHostFrom(requestModelControl, requestHostId) !== client || activeModelHostId(mounted.composer) !== requestHostId) {
35977
36025
  return;
35978
36026
  }
35979
36027
  if (inspection.status !== "ready") throw new Error(inspection.error.message);
@@ -36202,7 +36250,10 @@ ${accounts_default}`;
36202
36250
  if (!threadId) {
36203
36251
  throw new Error("External Thread identity is unavailable for Model selection");
36204
36252
  }
36205
- const state = await modelControl.selectThreadModel({ threadId, model: selected });
36253
+ const client = composerClient(mounted);
36254
+ if (!client) throw new Error("Thread Host is unavailable");
36255
+ const state = await client.selectThreadModel({ threadId, model: selected });
36256
+ if (composerClient(mounted) !== client) return;
36206
36257
  if (!isCurrentModelRequest(mounted, generation) || controller.get(mounted.composer).agent !== agent) {
36207
36258
  return;
36208
36259
  }
@@ -36326,10 +36377,13 @@ ${accounts_default}`;
36326
36377
  if (!threadId) {
36327
36378
  throw new Error("External Thread identity is unavailable for Permission Mode selection");
36328
36379
  }
36329
- const state = await modelControl.selectThreadPermissionMode({
36380
+ const client = composerClient(mounted);
36381
+ if (!client) throw new Error("Thread Host is unavailable");
36382
+ const state = await client.selectThreadPermissionMode({
36330
36383
  threadId,
36331
36384
  permissionModeId: selectedPermissionModeId
36332
36385
  });
36386
+ if (composerClient(mounted) !== client) return;
36333
36387
  if (!isCurrentModelRequest(mounted, generation) || controller.get(mounted.composer).agent !== agent) {
36334
36388
  return;
36335
36389
  }
@@ -36440,10 +36494,13 @@ ${accounts_default}`;
36440
36494
  if (!threadId || !modelControl) {
36441
36495
  throw new Error("External Thread identity is unavailable for Thinking selection");
36442
36496
  }
36443
- const state = await modelControl.selectThreadThinking({
36497
+ const client = composerClient(mounted);
36498
+ if (!client) throw new Error("Thread Host is unavailable");
36499
+ const state = await client.selectThreadThinking({
36444
36500
  threadId,
36445
36501
  thinkingOptionId: selectedThinkingOptionId
36446
36502
  });
36503
+ if (composerClient(mounted) !== client) return;
36447
36504
  if (!isCurrentModelRequest(mounted, generation) || controller.get(mounted.composer).agent !== agent) {
36448
36505
  return;
36449
36506
  }
@@ -36503,7 +36560,7 @@ ${accounts_default}`;
36503
36560
  }
36504
36561
  };
36505
36562
  const switchComposerAgent = async (mounted, agent) => {
36506
- if (agent !== "codex" && activeHarnessAvailabilityState().availability[agent] !== "ready") {
36563
+ if (agent !== "codex" && composerAvailability(mounted)[agent] !== "ready") {
36507
36564
  return false;
36508
36565
  }
36509
36566
  controller.clearPendingSubmission(mounted.composer);
@@ -36540,16 +36597,20 @@ ${accounts_default}`;
36540
36597
  }
36541
36598
  };
36542
36599
  const loadCodexAccounts = async () => {
36543
- const hostId = activeModelHostId();
36544
- const accounts = codexAccountsForHost(hostId);
36545
- if (!accounts) return;
36546
- await accounts.refresh();
36547
- if (disposed || codexAccountsForHost(hostId) !== accounts) return;
36548
- for (const mounted of mountedByComposer.values()) {
36549
- if (mounted.hostId !== hostId) continue;
36550
- renderMounted(mounted);
36551
- void refreshDraftCodexUsage(mounted);
36552
- }
36600
+ const hostIds = new Set([...mountedByComposer.values()].map((mounted) => mounted.hostId));
36601
+ await Promise.all(
36602
+ [...hostIds].map(async (hostId) => {
36603
+ const accounts = codexAccountsForHost(hostId);
36604
+ if (!accounts) return;
36605
+ await accounts.refresh();
36606
+ if (disposed || codexAccountsForHost(hostId) !== accounts) return;
36607
+ for (const mounted of mountedByComposer.values()) {
36608
+ if (mounted.hostId !== hostId) continue;
36609
+ renderMounted(mounted);
36610
+ void refreshDraftCodexUsage(mounted);
36611
+ }
36612
+ })
36613
+ );
36553
36614
  };
36554
36615
  function resetHarnessAvailabilityRetry(hostId) {
36555
36616
  const state = hostHarnessAvailabilityState(hostId);
@@ -36589,7 +36650,7 @@ ${accounts_default}`;
36589
36650
  state.requestGeneration += 1;
36590
36651
  state.request = null;
36591
36652
  }
36592
- if (force || activeModelHostId() === hostId) {
36653
+ if (force || [...mountedByComposer.values()].some((mounted) => mounted.hostId === hostId)) {
36593
36654
  for (const agent of externalAgents) {
36594
36655
  state.availability[agent] = "error";
36595
36656
  state.errors[agent] = {
@@ -36663,17 +36724,15 @@ ${accounts_default}`;
36663
36724
  state.errors[agent] = nextError;
36664
36725
  state.availability = { ...state.availability, [agent]: status };
36665
36726
  state.webUi = { ...state.webUi, [agent]: webUiAvailable };
36666
- if (hostId !== activeAvailabilityHostId) {
36667
- publishConnectionStatus();
36668
- return;
36669
- }
36670
36727
  for (const mounted of mountedByComposer.values()) {
36728
+ if (mounted.hostId !== hostId) continue;
36671
36729
  const composerState = controller.get(mounted.composer);
36672
- if (adapterStatus.state === "ready" && composerState.phase === "draft" && composerState.agent === agent && status !== "ready") {
36730
+ if (composerAdapterState(mounted) === "ready" && composerState.phase === "draft" && composerState.agent === agent && status !== "ready") {
36673
36731
  await switchComposerAgent(mounted, "codex");
36674
36732
  }
36675
36733
  }
36676
36734
  for (const mounted of mountedByComposer.values()) {
36735
+ if (mounted.hostId !== hostId) continue;
36677
36736
  const composerState = controller.get(mounted.composer);
36678
36737
  const pendingCatalog = catalogRequests.get(mounted);
36679
36738
  const loadingCurrentCatalog = pendingCatalog?.client === client && pendingCatalog.hostId === hostId && pendingCatalog.agent === agent && isCurrentModelRequest(mounted, pendingCatalog.generation);
@@ -36709,9 +36768,10 @@ ${accounts_default}`;
36709
36768
  );
36710
36769
  return promise2;
36711
36770
  }
36712
- const reloadMountedOwnershipForHost = (hostId) => {
36771
+ const reloadMountedOwnershipForHost = () => {
36713
36772
  for (const mounted of mountedByComposer.values()) {
36714
- if (mounted.hostId === hostId) continue;
36773
+ const hostId = activeModelHostId(mounted.composer);
36774
+ if (!hostId || mounted.hostId === hostId) continue;
36715
36775
  if (!threadIdFromComposerModelTarget(mounted.modelTarget)) {
36716
36776
  controller.clearPendingSubmission(mounted.composer);
36717
36777
  controller.beginModelRequest(mounted.composer);
@@ -36755,19 +36815,46 @@ ${accounts_default}`;
36755
36815
  sidebarAgentIcons.refresh();
36756
36816
  };
36757
36817
  function reconcileHarnessAvailabilityHost() {
36818
+ for (const hostId2 of modelControl?.knownHostIds?.() ?? []) {
36819
+ hostHarnessAvailabilityState(hostId2);
36820
+ }
36821
+ reloadMountedOwnershipForHost();
36822
+ for (const target of new Set([...mountedByComposer.values()].map((m) => m.hostId))) {
36823
+ if (!target) continue;
36824
+ const client = modelClientForHost(target);
36825
+ const previous = usageSubscriptions.get(target);
36826
+ if (previous?.client === client) continue;
36827
+ previous?.dispose();
36828
+ usageSubscriptions.delete(target);
36829
+ if (!client?.subscribeThreadUsage) continue;
36830
+ try {
36831
+ const dispose = client.subscribeThreadUsage((update) => {
36832
+ if (usageSubscriptions.get(target)?.client !== client) return;
36833
+ if (modelClientForHost(target) !== client) return;
36834
+ applyThreadUsageUpdate(target, update);
36835
+ });
36836
+ usageSubscriptions.set(target, { client, dispose });
36837
+ } catch {
36838
+ }
36839
+ }
36758
36840
  const hostId = activeModelHostId();
36759
36841
  if (!hostId || hostId === activeAvailabilityHostId && [...mountedByComposer.values()].every((mounted) => mounted.hostId !== null))
36760
36842
  return;
36761
36843
  activeAvailabilityHostId = hostId;
36762
36844
  hostHarnessAvailabilityState(hostId);
36763
- reloadMountedOwnershipForHost(hostId);
36764
36845
  publishConnectionStatus();
36765
36846
  for (const mounted of mountedByComposer.values()) renderMounted(mounted);
36766
36847
  void refreshHarnessAvailabilityForHost(hostId);
36767
36848
  }
36768
- const refreshHarnessAvailability = (refresh = false) => {
36849
+ const refreshHarnessAvailability = async (refresh = false) => {
36769
36850
  reconcileHarnessAvailabilityHost();
36770
- return refreshHarnessAvailabilityForHost(activeAvailabilityHostId, refresh);
36851
+ const hostIds = /* @__PURE__ */ new Set([activeAvailabilityHostId]);
36852
+ for (const mounted of mountedByComposer.values()) {
36853
+ if (mounted.hostId) hostIds.add(mounted.hostId);
36854
+ }
36855
+ await Promise.all(
36856
+ [...hostIds].map((hostId) => refreshHarnessAvailabilityForHost(hostId, refresh))
36857
+ );
36771
36858
  };
36772
36859
  connectionDiagnostics = {
36773
36860
  snapshot() {
@@ -36860,7 +36947,7 @@ ${accounts_default}`;
36860
36947
  const sendButton = sendButtonWithin(composer) ?? allButtons.at(-1) ?? null;
36861
36948
  if (!sendButton) return;
36862
36949
  const modelTarget = findComposerModelTarget(composer);
36863
- const hostId = activeModelHostId();
36950
+ const hostId = activeModelHostId(composer);
36864
36951
  const editor = composer.querySelector(EDITOR_SELECTOR);
36865
36952
  if (!editor) return;
36866
36953
  const state = controller.mount(
@@ -36943,7 +37030,7 @@ ${accounts_default}`;
36943
37030
  for (const [target, replacement] of pendingReplacements) {
36944
37031
  const sourceState = controller.get(replacement.source.composer);
36945
37032
  const replacementTarget = findComposerModelTarget(target);
36946
- const replacementHostId = activeModelHostId() ?? replacement.source.hostId;
37033
+ const replacementHostId = activeModelHostId(target);
36947
37034
  if (!shouldTransferComposerState(
36948
37035
  replacement.sourceModelTarget,
36949
37036
  replacementTarget,
@@ -36986,8 +37073,8 @@ ${accounts_default}`;
36986
37073
  void refreshHarnessAvailabilityForHost("local");
36987
37074
  }
36988
37075
  reconcileHarnessAvailabilityHost();
36989
- if (externalAgents.some(
36990
- (agent) => activeHarnessAvailabilityState().availability[agent] === "checking"
37076
+ if ([...mountedByComposer.values()].some(
37077
+ (mounted) => externalAgents.some((agent) => composerAvailability(mounted)[agent] === "checking")
36991
37078
  )) {
36992
37079
  void refreshHarnessAvailability();
36993
37080
  }
@@ -37139,8 +37226,8 @@ ${accounts_default}`;
37139
37226
  scheduleScan(relevant.some(mutationMayChangeComposerTarget));
37140
37227
  });
37141
37228
  const onHostRouteChange = () => {
37142
- const hostId = activeModelHostId();
37143
37229
  for (const mounted of mountedByComposer.values()) {
37230
+ const hostId = activeModelHostId(mounted.composer);
37144
37231
  if (hostId && mounted.hostId === hostId && !threadIdFromComposerModelTarget(mounted.modelTarget) && controller.get(mounted.composer).agent !== "codex" && !controller.isSwitching(mounted.composer) && isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
37145
37232
  applyComposerAgent(mounted.composer);
37146
37233
  }
@@ -37163,14 +37250,14 @@ ${accounts_default}`;
37163
37250
  sidebarAgentIcons.refresh();
37164
37251
  void refreshHarnessAvailabilityForHost("local");
37165
37252
  void refreshHarnessAvailability();
37166
- for (const mounted of mountedByComposer.values()) {
37167
- if (mounted.modelView.status === "waitingForAdapter" && mounted.composer.isConnected) {
37168
- applyComposerAgent(mounted.composer);
37169
- void loadExternalCatalog(mounted);
37170
- }
37253
+ }
37254
+ for (const mounted of mountedByComposer.values()) {
37255
+ if (mounted.modelView.status === "waitingForAdapter" && mounted.composer.isConnected && composerClient(mounted)) {
37256
+ applyComposerAgent(mounted.composer);
37257
+ void loadExternalCatalog(mounted);
37171
37258
  }
37259
+ renderMounted(mounted);
37172
37260
  }
37173
- for (const mounted of mountedByComposer.values()) renderMounted(mounted);
37174
37261
  };
37175
37262
  mutationObserver.observe(document.documentElement, {
37176
37263
  attributes: true,
@@ -37187,7 +37274,7 @@ ${accounts_default}`;
37187
37274
  reconcileHarnessAvailabilityHost();
37188
37275
  void loadCodexAccounts();
37189
37276
  for (const mounted of mountedByComposer.values()) {
37190
- if (mounted.hostId === activeModelHostId() && mounted.ownershipStatus === "error") {
37277
+ if (mounted.hostId === activeModelHostId(mounted.composer) && mounted.ownershipStatus === "error") {
37191
37278
  void loadThreadOwnership(mounted);
37192
37279
  }
37193
37280
  }
@@ -37195,8 +37282,9 @@ ${accounts_default}`;
37195
37282
  if (externalAgents.some((agent) => local.availability[agent] !== "ready")) {
37196
37283
  void refreshHarnessAvailabilityForHost("local", true);
37197
37284
  }
37198
- const active = activeHarnessAvailabilityState();
37199
- if (externalAgents.some((agent) => active.availability[agent] !== "ready")) {
37285
+ if ([...mountedByComposer.values()].some(
37286
+ (mounted) => externalAgents.some((agent) => composerAvailability(mounted)[agent] !== "ready")
37287
+ )) {
37200
37288
  void refreshHarnessAvailability(true);
37201
37289
  }
37202
37290
  };
@@ -37207,7 +37295,7 @@ ${accounts_default}`;
37207
37295
  if (typeof hostId !== "string" || typeof cwd !== "string" || cwd.length === 0) return;
37208
37296
  draftWorkspaces.set(hostId, cwd);
37209
37297
  for (const mounted of mountedByComposer.values()) {
37210
- if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId() === hostId && controller.get(mounted.composer).agent !== "codex") {
37298
+ if (!threadIdFromComposerModelTarget(mounted.modelTarget) && activeModelHostId(mounted.composer) === hostId && controller.get(mounted.composer).agent !== "codex") {
37211
37299
  void refreshCommands(mounted, { keepCurrent: true });
37212
37300
  }
37213
37301
  }
@@ -37224,8 +37312,10 @@ ${accounts_default}`;
37224
37312
  void refreshCommands(mounted, { keepCurrent: true });
37225
37313
  }
37226
37314
  },
37227
- readTargets: () => {
37228
- const availability = activeHarnessAvailabilityState().availability;
37315
+ readTargets: (editor) => {
37316
+ const composer = composerForElement(editor);
37317
+ const mounted = composer ? mountedByComposer.get(composer) : void 0;
37318
+ const availability = mounted ? composerAvailability(mounted) : {};
37229
37319
  return enabledAgents.filter((agent) => agent === "codex" || availability[agent] === "ready").map((agent) => ({ agent, label: RENDERER_AGENT_LABELS[agent] }));
37230
37320
  },
37231
37321
  isComposerEditor: (editor) => {
@@ -37294,17 +37384,11 @@ ${accounts_default}`;
37294
37384
  };
37295
37385
  },
37296
37386
  setAdapter(status, dispose, applyAgent, nextModelControl) {
37297
- usageNotificationDispose?.();
37298
- usageNotificationDispose = null;
37387
+ usageNotificationDispose();
37299
37388
  adapterDispose?.();
37300
37389
  adapterDispose = dispose ?? null;
37301
37390
  applyAdapterAgent = applyAgent ?? null;
37302
37391
  modelControl = nextModelControl ?? null;
37303
- try {
37304
- usageNotificationDispose = modelControl?.subscribeThreadUsage?.(applyThreadUsageUpdate) ?? null;
37305
- } catch {
37306
- usageNotificationDispose = null;
37307
- }
37308
37392
  adapterStatus = status;
37309
37393
  publishConnectionStatus();
37310
37394
  const installedModelControl = modelControl;
@@ -37333,7 +37417,7 @@ ${accounts_default}`;
37333
37417
  if (mounted) {
37334
37418
  const state = controller.get(mounted.composer);
37335
37419
  if (!threadIdFromComposerModelTarget(mounted.modelTarget)) {
37336
- mounted.hostId = activeModelHostId();
37420
+ mounted.hostId = activeModelHostId(mounted.composer);
37337
37421
  }
37338
37422
  if (threadIdFromComposerModelTarget(mounted.modelTarget) && mounted.ownershipStatus !== "ready") {
37339
37423
  void loadThreadOwnership(mounted);
@@ -37354,8 +37438,7 @@ ${accounts_default}`;
37354
37438
  disposed = true;
37355
37439
  disposeApprovalStyle();
37356
37440
  subagentRowMeta.dispose();
37357
- usageNotificationDispose?.();
37358
- usageNotificationDispose = null;
37441
+ usageNotificationDispose();
37359
37442
  adapterDispose?.();
37360
37443
  adapterDispose = null;
37361
37444
  applyAdapterAgent = null;