@codexhost/cli-darwin-x64 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +83 -5
  4. package/app/console-web.js +1172 -687
  5. package/app/desktop-controller.mjs +314 -15
  6. package/app/host-runtime.mjs +13158 -2853
  7. package/app/plugins/antigravity/plugin.mjs +8861 -3944
  8. package/app/plugins/claude-code/plugin.mjs +164 -14
  9. package/app/plugins/codebuddy/plugin.mjs +193 -25
  10. package/app/plugins/codex-usage/plugin.mjs +85 -5
  11. package/app/plugins/copilot/plugin.mjs +85 -5
  12. package/app/plugins/cursor-cli/plugin.mjs +160 -15
  13. package/app/plugins/deepseek-harness/manifest.json +2 -2
  14. package/app/plugins/deepseek-harness/plugin.mjs +112 -10
  15. package/app/plugins/devin/plugin.mjs +84 -5
  16. package/app/plugins/grok/plugin.mjs +418 -272
  17. package/app/plugins/hermes/plugin.mjs +163 -17
  18. package/app/plugins/kimi-code/plugin.mjs +85 -5
  19. package/app/plugins/kiro-cli/plugin.mjs +313 -21
  20. package/app/plugins/omp/plugin.mjs +1018 -819
  21. package/app/plugins/opencode/plugin.mjs +85 -5
  22. package/app/plugins/pi/plugin.mjs +828 -663
  23. package/app/plugins/qoder/plugin.mjs +109 -10
  24. package/app/plugins/qoder-cn/plugin.mjs +109 -10
  25. package/app/plugins/qwen-code/plugin.mjs +194 -97
  26. package/app/plugins/workbuddy/plugin.mjs +197 -28
  27. package/app/plugins/zcode/plugin.mjs +158 -8
  28. package/app/renderer-extension.js +2065 -1004
  29. package/app/web/assets/index-D6-hvggd.css +1 -0
  30. package/app/web/assets/index-D85gPBbQ.js +201 -0
  31. package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
  32. package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
  33. package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
  34. package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
  35. package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
  36. package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
  37. package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
  38. package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
  39. package/app/web/codexhost-settings.js +1178 -689
  40. package/app/web/index.html +4 -3
  41. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
  42. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  43. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  44. package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +134 -8
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  51. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  52. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  53. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  54. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  55. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  56. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  57. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  58. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  59. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  60. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  61. package/app/web-modules/server.mjs +2468 -1575
  62. package/bin/codexhost +0 -0
  63. package/libexec/codexhost-shim +0 -0
  64. package/libexec/codexhost-updater +0 -0
  65. package/package.json +1 -1
  66. package/app/web/assets/index-C0aXz2jD.js +0 -199
  67. package/app/web/assets/index-C3lniEH1.css +0 -1
@@ -14765,13 +14765,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14765
14765
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14766
14766
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
14767
14767
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
14768
+ var usageOutputTimingSchema = external_exports.object({
14769
+ version: external_exports.literal(3).optional(),
14770
+ requestId: external_exports.string().min(1),
14771
+ turnId: external_exports.string().min(1).max(1024),
14772
+ outputTokens: nonNegativeSafeIntegerSchema,
14773
+ startedAtMs: nonNegativeSafeIntegerSchema,
14774
+ completedAtMs: nonNegativeSafeIntegerSchema
14775
+ }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
14768
14776
  var usageMeasurementSchema = external_exports.object({
14777
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
14769
14778
  value: finiteNonNegativeNumberSchema,
14770
14779
  turnId: external_exports.string().min(1).max(1024),
14771
14780
  at: nonNegativeSafeIntegerSchema
14772
14781
  }).strict();
14773
14782
  var usageMeasurementsSchema = external_exports.object({
14774
- outputTokensPerSecond: usageMeasurementSchema.optional(),
14783
+ // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
14784
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
14785
+ // Retain independent TTFT facts when dropping incompatible speed measurements.
14786
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
14775
14787
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
14776
14788
  }).strict();
14777
14789
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -14791,6 +14803,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14791
14803
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
14792
14804
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
14793
14805
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
14806
+ sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
14794
14807
  apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
14795
14808
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
14796
14809
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15203,11 +15216,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15203
15216
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15204
15217
  }).strict();
15205
15218
 
15219
+ // ../shared-contracts/dist/thread-archive-confirm.js
15220
+ var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15221
+ var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15222
+
15206
15223
  // ../shared-contracts/dist/client-channel.js
15207
15224
  var CLIENT_CHANNEL_VERSION = 1;
15208
15225
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
15209
15226
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15210
15227
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15228
+ var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
15229
+ var clientThreadTreeSchema = external_exports.object({
15230
+ parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
15231
+ }).strict();
15211
15232
  var clientProjectlessWorkspaceSchema = external_exports.object({
15212
15233
  prompt: external_exports.string().max(16384).optional()
15213
15234
  }).strict();
@@ -15224,6 +15245,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15224
15245
  sequence: external_exports.number().int().nonnegative()
15225
15246
  });
15226
15247
  var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15248
+ external_exports.object({
15249
+ type: external_exports.literal("skills-changed"),
15250
+ cursor: clientChannelCursorSchema,
15251
+ cwd: external_exports.string().optional()
15252
+ }),
15227
15253
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15228
15254
  external_exports.object({
15229
15255
  type: external_exports.literal("preferences-changed"),
@@ -15333,7 +15359,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15333
15359
  /** Current interruptible Host Turn, including command Turns omitted from client history. */
15334
15360
  activeTurnId: external_exports.string().min(1).nullable().optional(),
15335
15361
  /** Most recent explicit command in this Host process; not native conversation history. */
15336
- command: external_exports.object({ name: external_exports.string().min(1), turn: clientTurnSchema }).optional(),
15362
+ command: external_exports.object({
15363
+ name: external_exports.string().min(1),
15364
+ turn: clientTurnSchema,
15365
+ /** First ordinary Turn started after this command; its retained result is not a new event. */
15366
+ subsequentTurnId: external_exports.string().min(1).optional()
15367
+ }).optional(),
15337
15368
  thread: external_exports.object({
15338
15369
  id: external_exports.string().min(1),
15339
15370
  cwd: external_exports.string(),
@@ -15421,6 +15452,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15421
15452
  external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
15422
15453
  ]);
15423
15454
 
15455
+ // ../shared-contracts/dist/skills.js
15456
+ var SKILLS_LIST_METHOD = "codexhost/skills/list";
15457
+ var SKILLS_CHANGED_METHOD = "codexhost/skills/changed";
15458
+ var skillsListParamsSchema = external_exports.object({
15459
+ threadId: hostThreadIdSchema.optional(),
15460
+ cwd: external_exports.string().min(1).optional()
15461
+ }).strict().refine((params) => !(params.threadId && params.cwd), {
15462
+ message: "Specify threadId or cwd, not both"
15463
+ });
15464
+ var librarySkillSchema = external_exports.object({
15465
+ name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
15466
+ description: external_exports.string().optional(),
15467
+ path: external_exports.string().min(1),
15468
+ scope: external_exports.enum(["project", "global"]),
15469
+ source: external_exports.string().min(1)
15470
+ }).strict();
15471
+ var skillsListResultSchema = external_exports.object({
15472
+ revision: external_exports.number().int().nonnegative(),
15473
+ complete: external_exports.boolean(),
15474
+ skills: external_exports.array(librarySkillSchema),
15475
+ warnings: external_exports.array(external_exports.string()).optional()
15476
+ }).strict();
15477
+ var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
15478
+
15424
15479
  // ../shared-contracts/dist/web-access-tokens.js
15425
15480
  var webNetworkAccessUrlSchema = external_exports.object({
15426
15481
  /**
@@ -15519,7 +15574,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15519
15574
  quotaUntil: external_exports.string().optional()
15520
15575
  }).strict().optional()
15521
15576
  }).strict();
15522
- var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
15523
15577
 
15524
15578
  // ../shared-contracts/dist/delegation-read.js
15525
15579
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
@@ -15527,8 +15581,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15527
15581
  var delegationReadParamsSchema = external_exports.strictObject({
15528
15582
  threadId: external_exports.string().min(1).max(1024),
15529
15583
  view: external_exports.enum(["result", "messages"]),
15530
- cursor: external_exports.string().min(1).max(8192).optional(),
15531
- limit: external_exports.number().int().min(1).max(100).optional()
15584
+ from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
15585
+ to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
15532
15586
  });
15533
15587
 
15534
15588
  // ../shared-contracts/dist/credential-imports.js
@@ -16528,6 +16582,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16528
16582
  status: updateStatusSchema.nullable()
16529
16583
  });
16530
16584
 
16585
+ // ../shared-contracts/dist/thread-watch-notice.js
16586
+ var THREAD_WATCH_NOTICE_OUTCOMES = [
16587
+ "completed",
16588
+ "failed",
16589
+ "interrupted",
16590
+ "timedOut",
16591
+ "unreadable",
16592
+ "notFound"
16593
+ ];
16594
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
16595
+
16531
16596
  // ../shared-contracts/dist/remote-runtime.js
16532
16597
  var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
16533
16598
  var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
@@ -16578,6 +16643,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16578
16643
  archived: external_exports.boolean()
16579
16644
  }),
16580
16645
  external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16646
+ external_exports.strictObject({
16647
+ kind: external_exports.literal("configure"),
16648
+ ...thread,
16649
+ epoch: identity,
16650
+ modelId: identity.optional(),
16651
+ thinkingOptionId: identity.optional(),
16652
+ permissionModeId: identity.optional()
16653
+ }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
16581
16654
  external_exports.strictObject({
16582
16655
  kind: external_exports.literal("prompt"),
16583
16656
  ...thread,
@@ -16651,6 +16724,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16651
16724
  external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
16652
16725
  ]);
16653
16726
 
16727
+ // ../shared-contracts/dist/thread-title.js
16728
+ var threadTitleInputSchema = external_exports.strictObject({
16729
+ prompt: external_exports.string().trim().min(1).max(2e3),
16730
+ cwd: external_exports.string().max(4096).nullable()
16731
+ });
16732
+ var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
16733
+
16654
16734
  // ../shared-contracts/dist/web-ui-extensions.js
16655
16735
  var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
16656
16736
  var localizedTextSchema2 = external_exports.union([
@@ -17654,7 +17734,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17654
17734
  await Promise.all(
17655
17735
  plugins.map(async ({ id }) => {
17656
17736
  try {
17657
- const inspection = await client.inspectHarness({ harnessId: id, refresh });
17737
+ const inspection = await client.inspectHarness({
17738
+ harnessId: id,
17739
+ refresh,
17740
+ purpose: "availability"
17741
+ });
17658
17742
  availability.set(id, inspection.status);
17659
17743
  webUi.set(id, inspection.status === "ready" && inspection.webUi?.open === true);
17660
17744
  const error51 = inspection.status === "ready" ? null : inspection.error;
@@ -20447,6 +20531,19 @@ th[aria-sort] .console-usage-sort__mark {
20447
20531
  return externalThreadForkResultSchema.parse(result);
20448
20532
  },
20449
20533
  inspectHarness,
20534
+ async listSkills(params) {
20535
+ return skillsListResultSchema.parse(
20536
+ await manager.sendRequest(SKILLS_LIST_METHOD, skillsListParamsSchema.parse(params))
20537
+ );
20538
+ },
20539
+ subscribeSkillsChanged(listener) {
20540
+ return notificationTarget(source)?.addNotificationCallback?.(SKILLS_CHANGED_METHOD, (value) => {
20541
+ if (!isRecord2(value) || value.method !== SKILLS_CHANGED_METHOD) return;
20542
+ const parsed = skillsChangedParamsSchema.safeParse(value.params);
20543
+ if (parsed.success) listener(parsed.data);
20544
+ }) ?? (() => {
20545
+ });
20546
+ },
20450
20547
  async listHarnessPlugins() {
20451
20548
  return harnessPluginListResultSchema.parse(
20452
20549
  await manager.sendRequest(HARNESS_PLUGIN_LIST_METHOD, {})
@@ -22944,7 +23041,7 @@ th[aria-sort] .console-usage-sort__mark {
22944
23041
  launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
22945
23042
  connectionOfficialWebsite: "Visit official website",
22946
23043
  connectionOpenHarnessWeb: "Open DeepSeek Harness Web",
22947
- connectionDeepSeekTestedVersions: "Supported DSH versions: 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3, 0.2.1-rc.4, 0.2.1-rc.5 and 0.2.2-rc.1. Versions newer than 0.2.2-rc.1 can be tried, but compatibility may be limited; versions older than 0.1.7-rc.1 must be upgraded first.",
23044
+ connectionDeepSeekTestedVersions: "Supported DSH versions: 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1, 0.2.1-rc.2, 0.2.1-rc.3, 0.2.1-rc.4, 0.2.1-rc.5, 0.2.2-rc.1 and 0.2.2-rc.2. Versions newer than 0.2.2-rc.2 can be tried, but compatibility may be limited; versions older than 0.1.7-rc.1 must be upgraded first.",
22948
23045
  connectionInstall: "Install",
22949
23046
  connectionInstallDescription: "This Harness was not detected.",
22950
23047
  connectionInstallRunning: "Installing on the selected Host. You can leave this page; login or setup may still be required afterward.",
@@ -23226,7 +23323,7 @@ th[aria-sort] .console-usage-sort__mark {
23226
23323
  launchPathSaveError: "\u4FDD\u5B58\u5931\u8D25\u3002\u8BF7\u586B\u5199\u6B64 Host \u4E0A\u5B9E\u9645\u5B58\u5728\u7684\u5B89\u88C5\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5E76\u786E\u8BA4\u914D\u7F6E\u76EE\u5F55\u53EF\u5199\u3002",
23227
23324
  connectionOfficialWebsite: "\u8BBF\u95EE\u5B98\u7F51",
23228
23325
  connectionOpenHarnessWeb: "\u6253\u5F00 DeepSeek Harness Web",
23229
- connectionDeepSeekTestedVersions: "\u652F\u6301 DSH \u7248\u672C\uFF1A0.1.7-rc.1\u30010.1.7-rc.2\u30010.2.0-rc.1\u30010.2.0-rc.2\u30010.2.1-rc.1\u30010.2.1-rc.2\u30010.2.1-rc.3\u30010.2.1-rc.4\u30010.2.1-rc.5 \u548C 0.2.2-rc.1\u3002\u9AD8\u4E8E 0.2.2-rc.1 \u7684\u7248\u672C\u53EF\u4EE5\u5C1D\u8BD5\u8FDE\u63A5\uFF0C\u4F46\u9002\u914D\u5EA6\u53EF\u80FD\u6709\u9650\uFF1B\u4F4E\u4E8E 0.1.7-rc.1 \u7684\u7248\u672C\u9700\u8981\u5148\u5347\u7EA7\u3002",
23326
+ connectionDeepSeekTestedVersions: "\u652F\u6301 DSH \u7248\u672C\uFF1A0.1.7-rc.1\u30010.1.7-rc.2\u30010.2.0-rc.1\u30010.2.0-rc.2\u30010.2.1-rc.1\u30010.2.1-rc.2\u30010.2.1-rc.3\u30010.2.1-rc.4\u30010.2.1-rc.5\u30010.2.2-rc.1 \u548C 0.2.2-rc.2\u3002\u9AD8\u4E8E 0.2.2-rc.2 \u7684\u7248\u672C\u53EF\u4EE5\u5C1D\u8BD5\u8FDE\u63A5\uFF0C\u4F46\u9002\u914D\u5EA6\u53EF\u80FD\u6709\u9650\uFF1B\u4F4E\u4E8E 0.1.7-rc.1 \u7684\u7248\u672C\u9700\u8981\u5148\u5347\u7EA7\u3002",
23230
23327
  connectionInstall: "\u5B89\u88C5",
23231
23328
  connectionInstallDescription: "\u5C1A\u672A\u68C0\u6D4B\u5230\u8BE5 Harness\u3002",
23232
23329
  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",
@@ -23398,6 +23495,7 @@ th[aria-sort] .console-usage-sort__mark {
23398
23495
  latestCacheHit: "Latest cache hit (CH)",
23399
23496
  sessionCacheHit: "Average cache hit",
23400
23497
  outputSpeed: "Output speed (TPS)",
23498
+ averageOutputSpeed: "Average output speed (TPS)",
23401
23499
  apiOutputSpeed: "API average speed",
23402
23500
  apiOutputSpeedDescription: "Output tokens / native API time, including first-token wait; not generation TPS.",
23403
23501
  timeToFirstOutput: "Time to first token (TTFT)",
@@ -23423,6 +23521,7 @@ th[aria-sort] .console-usage-sort__mark {
23423
23521
  latestCacheHit: "\u6700\u8FD1\u7F13\u5B58\u547D\u4E2D\uFF08CH\uFF09",
23424
23522
  sessionCacheHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
23425
23523
  outputSpeed: "\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
23524
+ averageOutputSpeed: "\u5E73\u5747\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
23426
23525
  apiOutputSpeed: "API \u5E73\u5747\u901F\u5EA6",
23427
23526
  apiOutputSpeedDescription: "\u8F93\u51FA Token \xF7 \u539F\u751F API \u8017\u65F6\uFF0C\u542B\u9996\u5B57\u7B49\u5F85\uFF1B\u4E0D\u662F\u751F\u6210 TPS\u3002",
23428
23527
  timeToFirstOutput: "\u9996 token\uFF08TTFT\uFF09",
@@ -27162,242 +27261,474 @@ ${detail}` : ""}`
27162
27261
  return fallback;
27163
27262
  }
27164
27263
 
27165
- // src/settings/harness-launch-controls.ts
27166
- function createHarnessLaunchControls(document2, messages, agent, settings) {
27167
- const section = document2.createElement("section");
27168
- section.className = "settings-harness-launch";
27169
- section.dataset.harnessLaunch = agent;
27170
- const label = document2.createElement("label");
27171
- label.textContent = messages.launchPathLabel;
27172
- const input = document2.createElement("input");
27173
- input.type = "text";
27174
- input.autocomplete = "off";
27175
- input.spellcheck = false;
27176
- input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
27177
- input.setAttribute("aria-label", messages.launchPathLabel);
27178
- label.append(input);
27179
- const help = document2.createElement("p");
27180
- help.textContent = messages.locale === "zh-CN" ? "\u586B\u5199\u63D2\u4EF6\u5BF9\u5E94\u5E94\u7528\u7684\u5B89\u88C5\u76EE\u5F55\uFF1B\u6E05\u9664\u540E\u6062\u590D\u81EA\u52A8\u53D1\u73B0\u3002\u4FEE\u6539\u540E\u9700\u91CD\u542F codexhost\u3002" : "Choose the application's installation directory; clear it to restore automatic discovery. Restart codexhost after changing it.";
27181
- const actions = document2.createElement("div");
27182
- actions.className = "settings-harness-launch__actions";
27183
- const save = document2.createElement("button");
27184
- save.type = "button";
27185
- save.className = "settings-command-button";
27186
- save.textContent = messages.launchPathSave;
27187
- const reset = document2.createElement("button");
27188
- reset.type = "button";
27189
- reset.className = "settings-command-button settings-command-button--secondary";
27190
- reset.textContent = messages.launchPathReset;
27191
- const status = document2.createElement("p");
27192
- status.setAttribute("role", "status");
27193
- status.setAttribute("aria-live", "polite");
27194
- actions.append(save, reset);
27195
- section.append(label, help, actions, status);
27196
- let busy = true;
27197
- let loaded = false;
27198
- const controls = () => {
27199
- input.disabled = busy || !loaded;
27200
- save.disabled = busy || !loaded || !input.value.trim();
27201
- reset.disabled = busy || !loaded;
27202
- };
27203
- const show = (value) => {
27204
- input.value = value.path ?? "";
27205
- status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
27206
- };
27207
- const persist = async (value) => {
27208
- if (busy || !loaded) return;
27209
- busy = true;
27210
- controls();
27211
- status.textContent = messages.launchPathSaving;
27212
- try {
27213
- show(await settings.set(value));
27214
- } catch {
27215
- status.textContent = messages.launchPathSaveError;
27216
- } finally {
27217
- busy = false;
27218
- controls();
27219
- }
27220
- };
27221
- input.addEventListener("input", controls);
27222
- save.addEventListener("click", () => {
27223
- if (input.value.trim()) void persist(input.value.trim());
27224
- });
27225
- reset.addEventListener("click", () => {
27226
- void persist(null);
27227
- });
27228
- controls();
27229
- status.textContent = messages.launchPathLoading;
27230
- void settings.get().then((value) => {
27231
- loaded = true;
27232
- show(value);
27233
- }).catch(() => {
27234
- loaded = true;
27235
- status.textContent = messages.launchPathLoadError;
27236
- }).finally(() => {
27237
- busy = false;
27238
- controls();
27239
- });
27240
- return section;
27241
- }
27242
-
27243
- // src/settings/harness-installation-guides.ts
27244
- function harnessHasInstallCommands(plugin) {
27245
- return (plugin?.installation?.commands.length ?? 0) > 0;
27264
+ // src/settings/connection-row.ts
27265
+ function connectionStatusLabel(availability, messages, hasError = false) {
27266
+ if (availability === "updating") return messages.connectionStatusUpdating;
27267
+ if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
27268
+ if (availability === "ready") return messages.connectionStatusReady;
27269
+ if (availability === "checking") return messages.connectionStatusChecking;
27270
+ if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
27271
+ if (availability === "unavailable" || availability === "error") {
27272
+ return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
27273
+ }
27274
+ return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
27246
27275
  }
27247
- function harnessInstallationGuide(plugin, locale) {
27248
- const guide = plugin?.installation;
27249
- const text = (value) => value?.[locale] ?? value?.en;
27250
- return {
27251
- url: plugin?.links?.installation ?? plugin?.links?.documentation ?? plugin?.links?.website,
27252
- commands: guide?.commands ?? [],
27253
- downloads: guide?.downloads ?? [],
27254
- before: text(guide?.before),
27255
- after: text(guide?.after)
27256
- };
27276
+ function connectionStatusTone(availability, hasError = false) {
27277
+ if (availability === "updating") return "checking";
27278
+ if (hasError && availability !== "notInstalled") return "failed";
27279
+ if (availability === "ready") return "ready";
27280
+ if (availability === "checking" || availability === "installing") return "checking";
27281
+ if (availability === "notInstalled") return "setup";
27282
+ return "failed";
27257
27283
  }
27258
-
27259
- // src/settings/harness-installation-panel.ts
27260
- function createHarnessInstallationPanel(document2, plugin, hostId2, messages, copy, installation) {
27261
- const zh = messages.locale === "zh-CN";
27262
- const guide = harnessInstallationGuide(plugin, messages.locale);
27263
- const panel = document2.createElement("div");
27264
- panel.className = "settings-harness-installation";
27265
- const paragraph = (text) => {
27266
- const p = document2.createElement("p");
27267
- p.textContent = text;
27268
- panel.append(p);
27269
- };
27270
- if (hostId2 !== "local") {
27271
- paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
27284
+ function createConnectionIdentityIcon(document2, item, size) {
27285
+ const container = document2.createElement("span");
27286
+ container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
27287
+ container.setAttribute("aria-hidden", "true");
27288
+ if (item.agentSnapshot) {
27289
+ container.append(
27290
+ createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
27291
+ );
27292
+ } else {
27293
+ container.textContent = "CH";
27272
27294
  }
27273
- if (guide.before) paragraph(guide.before);
27274
- const install = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
27275
- if (install && installation) {
27276
- install.type = "button";
27277
- install.className = "settings-command-button";
27278
- install.dataset.connectionAction = "install";
27279
- install.disabled = installation.status !== "idle";
27280
- install.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
27281
- install.addEventListener("click", () => {
27282
- if (install.disabled) return;
27283
- install.disabled = true;
27284
- install.textContent = messages.connectionStatusInstalling;
27285
- installation.run();
27286
- });
27287
- if (guide.commands.length > 1) panel.append(install);
27295
+ return container;
27296
+ }
27297
+ function sameElementChildren(container, next) {
27298
+ if (container.children.length !== next.length) return false;
27299
+ for (let index = 0; index < next.length; index++) {
27300
+ if (container.children[index] !== next[index]) return false;
27288
27301
  }
27289
- for (const { terminal, command } of guide.commands) {
27290
- const block = document2.createElement("div");
27291
- block.className = "settings-harness-installation-command";
27292
- const label = document2.createElement("strong");
27293
- label.textContent = terminal;
27294
- const pre = document2.createElement("pre");
27295
- const code = document2.createElement("code");
27296
- code.textContent = command;
27297
- pre.append(code);
27298
- const button2 = document2.createElement("button");
27299
- button2.type = "button";
27300
- button2.className = "settings-command-button settings-command-button--secondary";
27301
- button2.dataset.connectionAction = "copy-install";
27302
- const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
27303
- button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
27304
- button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
27305
- button2.addEventListener("click", () => copy(button2, command, copyLabel));
27306
- const actions = document2.createElement("div");
27307
- actions.className = "settings-harness-installation-actions";
27308
- if (install && guide.commands.length === 1) actions.append(install);
27309
- actions.append(button2);
27310
- block.append(label, pre, actions);
27311
- panel.append(block);
27302
+ return true;
27303
+ }
27304
+ function reconcileElementChildren(container, next) {
27305
+ if (sameElementChildren(container, next)) return;
27306
+ if (typeof container.insertBefore !== "function") {
27307
+ container.replaceChildren(...next);
27308
+ return;
27312
27309
  }
27313
- for (const download2 of guide.downloads ?? []) {
27314
- const link = document2.createElement("a");
27315
- link.className = "settings-command-button settings-command-button--secondary";
27316
- link.href = download2.url;
27317
- link.target = "_blank";
27318
- link.rel = "noopener noreferrer";
27319
- link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
27320
- link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
27321
- panel.append(link);
27310
+ const nextSet = new Set(next);
27311
+ for (const child of [...container.children]) {
27312
+ if (!nextSet.has(child)) child.remove();
27322
27313
  }
27323
- if (guide.after) paragraph(guide.after);
27324
- if (!plugin?.installation && guide.url) {
27325
- const link = document2.createElement("a");
27326
- link.href = guide.url;
27327
- link.target = "_blank";
27328
- link.rel = "noopener noreferrer";
27329
- link.textContent = zh ? "\u5B89\u88C5\u8BF4\u660E" : "Installation instructions";
27330
- panel.append(link);
27314
+ for (let index = 0; index < next.length; index++) {
27315
+ const desired = next[index];
27316
+ if (!desired) continue;
27317
+ const current = container.children[index] ?? null;
27318
+ if (current !== desired) {
27319
+ container.insertBefore(desired, current);
27320
+ }
27331
27321
  }
27332
- return panel;
27333
- }
27334
-
27335
- // src/settings/harness-install-store.ts
27336
- function errorMessage2(error51) {
27337
- return typeof error51 === "object" && error51 !== null && "message" in error51 && typeof error51.message === "string" ? error51.message.slice(0, 2048) : "Could not install the Harness. Check the official installation guide and retry.";
27338
27322
  }
27339
- function unknownInstallOutcome(message2) {
27340
- return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
27323
+ function identityIconSignature(item) {
27324
+ if (!item.agentSnapshot) return "adapter";
27325
+ const plugin = item.agentSnapshot.plugin;
27326
+ return `${item.agentSnapshot.agent}:${String(plugin?.icon ?? "")}:${String(plugin?.iconStyle ?? "")}`;
27341
27327
  }
27342
- var stores = /* @__PURE__ */ new WeakMap();
27343
- function createStore(diagnostics) {
27344
- const states2 = /* @__PURE__ */ new Map();
27345
- const listeners = /* @__PURE__ */ new Set();
27346
- const key = (host, agent) => JSON.stringify([host, agent]);
27347
- const notify2 = () => listeners.forEach((listener) => listener());
27348
- return {
27349
- get: (host, agent) => states2.get(key(host, agent)),
27350
- clearErrors() {
27351
- for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
27352
- notify2();
27353
- },
27354
- subscribe(listener) {
27355
- listeners.add(listener);
27356
- return () => {
27357
- listeners.delete(listener);
27358
- };
27359
- },
27360
- async install(host, agent) {
27361
- const id = key(host, agent);
27362
- const previous = states2.get(id);
27363
- if (!diagnostics.installation || previous && previous.status !== "error") return;
27364
- states2.set(id, { status: "installing" });
27365
- notify2();
27366
- let failure;
27367
- try {
27368
- await diagnostics.installation(host, agent, "install");
27369
- states2.set(id, { status: "checking" });
27370
- notify2();
27371
- } catch (error51) {
27372
- failure = errorMessage2(error51);
27328
+ function createConnectionRowView(document2, messages, groupable) {
27329
+ const row = document2.createElement("div");
27330
+ row.className = "settings-connection-row";
27331
+ row.setAttribute("role", "row");
27332
+ const identity2 = document2.createElement("div");
27333
+ identity2.className = "settings-connection-row__identity";
27334
+ identity2.setAttribute("role", "cell");
27335
+ let handle = null;
27336
+ if (groupable) {
27337
+ handle = document2.createElement("span");
27338
+ handle.className = "settings-connection-row__handle";
27339
+ handle.setAttribute("aria-hidden", "true");
27340
+ handle.append(createRendererSettingsIcon("grip-vertical", 15));
27341
+ identity2.append(handle);
27342
+ }
27343
+ let iconElement = null;
27344
+ let renderedIconKey = null;
27345
+ const label = document2.createElement("strong");
27346
+ const status = document2.createElement("span");
27347
+ status.className = "settings-connection-row__status";
27348
+ status.setAttribute("role", "cell");
27349
+ const action = document2.createElement("div");
27350
+ action.className = "settings-connection-row__action";
27351
+ action.setAttribute("role", "cell");
27352
+ row.append(identity2, status, action);
27353
+ let currentItem = null;
27354
+ let currentSelect = () => void 0;
27355
+ let currentGroup = null;
27356
+ let installButton = null;
27357
+ let viewErrorButton = null;
27358
+ let versionAvailableBadge = null;
27359
+ let updateButton = null;
27360
+ let groupToggleButton = null;
27361
+ let groupToggleSection = null;
27362
+ row.addEventListener("click", (event) => {
27363
+ const target2 = event.target;
27364
+ if (target2?.closest?.("a")) return;
27365
+ currentSelect();
27366
+ });
27367
+ row.addEventListener("keydown", (event) => {
27368
+ if (event.target?.closest?.("button, a")) return;
27369
+ if (event.key !== "Enter" && event.key !== " ") return;
27370
+ event.preventDefault();
27371
+ currentSelect();
27372
+ });
27373
+ if (groupable) {
27374
+ row.addEventListener("dragstart", (event) => currentGroup?.onDragStart(event));
27375
+ row.addEventListener("dragover", (event) => currentGroup?.onDragOver(event));
27376
+ row.addEventListener("dragleave", (event) => currentGroup?.onDragLeave(event));
27377
+ row.addEventListener("drop", (event) => currentGroup?.onDrop(event));
27378
+ row.addEventListener("dragend", (event) => currentGroup?.onDragEnd(event));
27379
+ }
27380
+ const setSelected = (selected) => {
27381
+ const nextSelected = String(selected);
27382
+ if (row.dataset.connectionSelected !== nextSelected) {
27383
+ row.dataset.connectionSelected = nextSelected;
27384
+ }
27385
+ const nextTabIndex = selected ? 0 : -1;
27386
+ if (row.tabIndex !== nextTabIndex) {
27387
+ row.tabIndex = nextTabIndex;
27388
+ }
27389
+ };
27390
+ return {
27391
+ element: row,
27392
+ setSelected,
27393
+ update(item, selected, select, group) {
27394
+ currentItem = item;
27395
+ currentSelect = select;
27396
+ currentGroup = group;
27397
+ if (row.dataset.connectionItem !== item.key) {
27398
+ row.dataset.connectionItem = item.key;
27399
+ }
27400
+ setSelected(selected);
27401
+ const nextIconKey = identityIconSignature(item);
27402
+ if (renderedIconKey !== nextIconKey || !iconElement) {
27403
+ renderedIconKey = nextIconKey;
27404
+ iconElement = createConnectionIdentityIcon(document2, item, 19);
27405
+ reconcileElementChildren(
27406
+ identity2,
27407
+ handle ? [handle, iconElement, label] : [iconElement, label]
27408
+ );
27373
27409
  }
27374
- try {
27375
- await diagnostics.refresh(host);
27376
- const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
27377
- if (refreshed?.availability === "ready") failure = void 0;
27378
- else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
27379
- failure = void 0;
27410
+ if (handle && group && handle.title !== group.dragHandleTitle) {
27411
+ handle.title = group.dragHandleTitle;
27412
+ }
27413
+ if (label.textContent !== item.name) {
27414
+ label.textContent = item.name;
27415
+ }
27416
+ const tone = connectionStatusTone(item.availability, item.error !== null);
27417
+ if (status.dataset.connectionTone !== tone) {
27418
+ status.dataset.connectionTone = tone;
27419
+ }
27420
+ const statusText = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
27421
+ if (status.textContent !== statusText) {
27422
+ status.textContent = statusText;
27423
+ }
27424
+ const nextActions = [];
27425
+ if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
27426
+ if (!installButton) {
27427
+ const button2 = document2.createElement("button");
27428
+ button2.type = "button";
27429
+ button2.className = "settings-connection-install-link";
27430
+ button2.append(createRendererSettingsIcon("download", 17));
27431
+ button2.addEventListener("click", (event) => {
27432
+ event.stopPropagation();
27433
+ currentSelect();
27434
+ currentItem?.install?.();
27435
+ });
27436
+ installButton = button2;
27437
+ }
27438
+ installButton.disabled = item.availability === "installing" || item.availability === "checking";
27439
+ const installLabel = messages.connectionInstall;
27440
+ const ariaLabel = `${installLabel}: ${item.name}`;
27441
+ if (installButton.getAttribute("aria-label") !== ariaLabel) {
27442
+ installButton.setAttribute("aria-label", ariaLabel);
27443
+ }
27444
+ if (installButton.title !== installLabel) {
27445
+ installButton.title = installLabel;
27446
+ }
27447
+ nextActions.push(installButton);
27448
+ } else if (item.error) {
27449
+ if (!viewErrorButton) {
27450
+ const button2 = document2.createElement("button");
27451
+ button2.type = "button";
27452
+ button2.className = "settings-connection-view-error";
27453
+ button2.textContent = messages.connectionViewError;
27454
+ button2.addEventListener("click", (event) => {
27455
+ event.stopPropagation();
27456
+ currentSelect();
27457
+ });
27458
+ viewErrorButton = button2;
27459
+ }
27460
+ nextActions.push(viewErrorButton);
27461
+ }
27462
+ const version2 = item.version;
27463
+ if (version2?.state?.updateAvailable && !version2.updating) {
27464
+ if (!versionAvailableBadge) {
27465
+ const badge = document2.createElement("span");
27466
+ badge.className = "settings-connection-version-available";
27467
+ badge.textContent = messages.harnessVersionAvailable;
27468
+ versionAvailableBadge = badge;
27469
+ }
27470
+ const badgeTitle = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
27471
+ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
27472
+ if (versionAvailableBadge.title !== badgeTitle) {
27473
+ versionAvailableBadge.title = badgeTitle;
27474
+ }
27475
+ nextActions.push(versionAvailableBadge);
27476
+ }
27477
+ if (version2?.state?.updateAvailable && version2.state.canUpdate) {
27478
+ if (!updateButton) {
27479
+ const button2 = document2.createElement("button");
27480
+ button2.type = "button";
27481
+ button2.className = "settings-connection-install-link";
27482
+ button2.dataset.connectionAction = "update";
27483
+ button2.append(createRendererSettingsIcon("download", 17));
27484
+ button2.addEventListener("click", (event) => {
27485
+ event.stopPropagation();
27486
+ if (button2.disabled) return;
27487
+ void currentItem?.version?.update();
27488
+ currentSelect();
27489
+ });
27490
+ updateButton = button2;
27491
+ }
27492
+ updateButton.disabled = version2.updating;
27493
+ if (updateButton.title !== messages.harnessVersionUpdate) {
27494
+ updateButton.title = messages.harnessVersionUpdate;
27495
+ }
27496
+ const updateAriaLabel = `${messages.harnessVersionUpdate}: ${item.name}`;
27497
+ if (updateButton.getAttribute("aria-label") !== updateAriaLabel) {
27498
+ updateButton.setAttribute("aria-label", updateAriaLabel);
27499
+ }
27500
+ nextActions.push(updateButton);
27501
+ }
27502
+ if (group) {
27503
+ if (!groupToggleButton) {
27504
+ const button2 = document2.createElement("button");
27505
+ button2.type = "button";
27506
+ button2.className = "settings-connection-row__group-toggle";
27507
+ button2.addEventListener("click", (event) => {
27508
+ event.stopPropagation();
27509
+ currentGroup?.toggleSection();
27510
+ });
27511
+ groupToggleButton = button2;
27512
+ }
27513
+ groupToggleButton.disabled = group.disabled;
27514
+ if (groupToggleButton.title !== group.moveLabel) {
27515
+ groupToggleButton.title = group.moveLabel;
27516
+ }
27517
+ if (groupToggleButton.getAttribute("aria-label") !== group.moveLabel) {
27518
+ groupToggleButton.setAttribute("aria-label", group.moveLabel);
27519
+ }
27520
+ if (groupToggleSection !== group.section) {
27521
+ groupToggleSection = group.section;
27522
+ groupToggleButton.replaceChildren(
27523
+ createRendererSettingsIcon(
27524
+ group.section === "main" ? "chevron-down" : "chevron-up",
27525
+ 15
27526
+ )
27527
+ );
27528
+ }
27529
+ nextActions.push(groupToggleButton);
27530
+ }
27531
+ reconcileElementChildren(action, nextActions);
27532
+ if (group) {
27533
+ row.draggable = !group.disabled;
27534
+ if (row.dataset.connectionGroupSection !== group.section) {
27535
+ row.dataset.connectionGroupSection = group.section;
27380
27536
  }
27381
- } catch (error51) {
27382
- failure ??= errorMessage2(error51);
27383
27537
  }
27384
- if (failure) states2.set(id, { status: "error", error: failure });
27385
- else states2.delete(id);
27386
- notify2();
27387
27538
  }
27388
27539
  };
27389
27540
  }
27390
- function harnessInstallStore(diagnostics) {
27391
- let store = stores.get(diagnostics);
27541
+
27542
+ // src/settings/connection-updates.ts
27543
+ var sharedBatchStores = /* @__PURE__ */ new WeakMap();
27544
+ function getBatchStore(diagnostics) {
27545
+ if (!diagnostics) {
27546
+ return { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
27547
+ }
27548
+ let store = sharedBatchStores.get(diagnostics);
27392
27549
  if (!store) {
27393
- store = createStore(diagnostics);
27394
- stores.set(diagnostics, store);
27550
+ store = { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
27551
+ sharedBatchStores.set(diagnostics, store);
27395
27552
  }
27396
27553
  return store;
27397
27554
  }
27555
+ function createConnectionUpdates(document2, messages, signal, onChange, diagnostics = null) {
27556
+ const store = getBatchStore(diagnostics);
27557
+ const notify2 = () => {
27558
+ for (const listener of [...store.listeners]) listener();
27559
+ };
27560
+ if (!signal.aborted) {
27561
+ const listener = () => {
27562
+ if (!signal.aborted) onChange();
27563
+ };
27564
+ store.listeners.add(listener);
27565
+ signal.addEventListener(
27566
+ "abort",
27567
+ () => {
27568
+ store.listeners.delete(listener);
27569
+ },
27570
+ { once: true }
27571
+ );
27572
+ }
27573
+ const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
27574
+ const start = async (hostId2, panels) => {
27575
+ if (signal.aborted || store.batches.get(hostId2)?.running) return;
27576
+ const targets = eligible(panels);
27577
+ if (!targets.length) return;
27578
+ const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
27579
+ store.batches.set(hostId2, batch);
27580
+ notify2();
27581
+ await Promise.all(
27582
+ targets.map(async (panel) => {
27583
+ try {
27584
+ if (await panel.update()) batch.succeeded++;
27585
+ else batch.failed++;
27586
+ } catch {
27587
+ batch.failed++;
27588
+ }
27589
+ notify2();
27590
+ })
27591
+ );
27592
+ batch.running = false;
27593
+ notify2();
27594
+ };
27595
+ return {
27596
+ createControls(hostId2, panels) {
27597
+ let currentHostId = hostId2;
27598
+ let currentPanels = panels;
27599
+ let renderedLabel = null;
27600
+ const button2 = document2.createElement("button");
27601
+ button2.type = "button";
27602
+ button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
27603
+ button2.dataset.connectionAction = "update-all";
27604
+ button2.title = messages.harnessUpdateAllDescription;
27605
+ button2.addEventListener("click", () => {
27606
+ if (!button2.disabled) void start(currentHostId, currentPanels);
27607
+ });
27608
+ const result = document2.createElement("p");
27609
+ result.className = "settings-connection-update-result";
27610
+ result.setAttribute("role", "status");
27611
+ const update = (nextHostId, nextPanels) => {
27612
+ currentHostId = nextHostId;
27613
+ currentPanels = nextPanels;
27614
+ const batch = store.batches.get(nextHostId);
27615
+ const count3 = eligible(nextPanels).length;
27616
+ button2.disabled = signal.aborted || Boolean(batch?.running) || !count3;
27617
+ const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count3 ? `${messages.harnessUpdateAll} (${count3})` : messages.harnessUpdateAll;
27618
+ if (renderedLabel !== label) {
27619
+ renderedLabel = label;
27620
+ button2.replaceChildren(createRendererSettingsIcon("download", 15), label);
27621
+ }
27622
+ const hidden = !batch || batch.running;
27623
+ result.hidden = hidden;
27624
+ const resultText = batch && !batch.running ? messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed)) : "";
27625
+ if (result.textContent !== resultText) {
27626
+ result.textContent = resultText;
27627
+ }
27628
+ };
27629
+ update(hostId2, panels);
27630
+ return { button: button2, result, update };
27631
+ }
27632
+ };
27633
+ }
27398
27634
 
27399
27635
  // src/settings/harness-version-panel.ts
27400
- function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0) {
27636
+ function isUnsupportedInstallationError(error51) {
27637
+ return typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
27638
+ }
27639
+ function createHarnessVersionSession(client, options) {
27640
+ let state;
27641
+ let statusKind = "checking";
27642
+ let checkPromise = null;
27643
+ let updatePromise = null;
27644
+ const listeners = /* @__PURE__ */ new Set();
27645
+ const signal = options?.signal;
27646
+ const notify2 = (pageChange) => {
27647
+ if (signal?.aborted) return;
27648
+ for (const listener of [...listeners]) listener(pageChange);
27649
+ };
27650
+ const check2 = () => {
27651
+ if (signal?.aborted || updatePromise) return Promise.resolve();
27652
+ if (checkPromise) return checkPromise;
27653
+ statusKind = "checking";
27654
+ notify2(false);
27655
+ checkPromise = (async () => {
27656
+ try {
27657
+ const result = await client.run("check");
27658
+ if (signal?.aborted || updatePromise) return;
27659
+ state = result;
27660
+ statusKind = "idle";
27661
+ } catch (error51) {
27662
+ if (signal?.aborted || updatePromise) return;
27663
+ statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
27664
+ if (state) state = { ...state, canUpdate: false };
27665
+ } finally {
27666
+ checkPromise = null;
27667
+ if (!signal?.aborted && !updatePromise) {
27668
+ notify2(true);
27669
+ }
27670
+ }
27671
+ })();
27672
+ return checkPromise;
27673
+ };
27674
+ const update = () => {
27675
+ if (updatePromise) return updatePromise;
27676
+ updatePromise = (async () => {
27677
+ if (signal?.aborted) return false;
27678
+ if (checkPromise) await checkPromise;
27679
+ if (signal?.aborted || statusKind === "unsupported" || !state?.canUpdate || !state.updateAvailable) {
27680
+ return false;
27681
+ }
27682
+ statusKind = "updating";
27683
+ notify2(true);
27684
+ try {
27685
+ const result = await client.run("update");
27686
+ if (signal?.aborted) return false;
27687
+ state = result;
27688
+ statusKind = !result.canUpdate ? "updated" : result.updateAvailable ? "failed" : "updated";
27689
+ return result.canUpdate && !result.updateAvailable;
27690
+ } catch (error51) {
27691
+ if (signal?.aborted) return false;
27692
+ statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
27693
+ if (state) state = { ...state, canUpdate: false };
27694
+ return false;
27695
+ } finally {
27696
+ updatePromise = null;
27697
+ if (!signal?.aborted) {
27698
+ notify2(true);
27699
+ }
27700
+ }
27701
+ })();
27702
+ return updatePromise;
27703
+ };
27704
+ return {
27705
+ get state() {
27706
+ return state;
27707
+ },
27708
+ get statusKind() {
27709
+ return statusKind;
27710
+ },
27711
+ get updating() {
27712
+ return statusKind === "updating";
27713
+ },
27714
+ prepareMount() {
27715
+ if (updatePromise || checkPromise) return false;
27716
+ statusKind = "checking";
27717
+ return true;
27718
+ },
27719
+ check: check2,
27720
+ update,
27721
+ subscribe(listener) {
27722
+ listeners.add(listener);
27723
+ return () => {
27724
+ listeners.delete(listener);
27725
+ };
27726
+ }
27727
+ };
27728
+ }
27729
+ function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0, sharedSession) {
27730
+ const session = sharedSession ?? createHarnessVersionSession(client, { signal });
27731
+ const shouldScheduleCheck = session.prepareMount();
27401
27732
  const panel = document2.createElement("section");
27402
27733
  panel.className = "settings-harness-version";
27403
27734
  panel.dataset.harnessVersion = agent;
@@ -27421,15 +27752,14 @@ ${detail}` : ""}`
27421
27752
  note.textContent = messages.harnessVersionNote;
27422
27753
  actions.append(update);
27423
27754
  panel.append(heading, versions, status, actions, note);
27424
- let state;
27425
- let busy = false;
27426
- let updating = false;
27427
- let unsupported = false;
27428
- let updatePromise = null;
27429
27755
  const render = () => {
27756
+ const state = session.state;
27757
+ const statusKind = session.statusKind;
27758
+ const busy = statusKind === "checking" || statusKind === "updating";
27430
27759
  heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
27431
27760
  current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
27432
27761
  latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
27762
+ status.textContent = statusKind === "checking" ? messages.harnessVersionChecking : statusKind === "updating" ? messages.harnessVersionUpdating : statusKind === "unsupported" ? messages.harnessVersionUnsupported : statusKind === "failed" ? messages.harnessVersionFailed : statusKind === "updated" ? !state?.canUpdate ? messages.harnessVersionManual : messages.harnessVersionUpdated : state && !state.canUpdate ? messages.harnessVersionManual : "";
27433
27763
  update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
27434
27764
  const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
27435
27765
  actions.replaceChildren(update);
@@ -27448,99 +27778,92 @@ ${detail}` : ""}`
27448
27778
  const detail = harnessVersionNote(state, messages.harnessVersion);
27449
27779
  note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
27450
27780
  };
27451
- const run = async (action) => {
27452
- if (busy || unsupported || signal.aborted) return false;
27453
- if (action === "update" && (!state?.canUpdate || !state.updateAvailable)) return false;
27454
- busy = true;
27455
- updating = action === "update";
27456
- onChange();
27457
- status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
27781
+ update.addEventListener("click", () => {
27782
+ if (!signal.aborted) void session.update();
27783
+ });
27784
+ const unsubscribe = session.subscribe((pageChange) => {
27785
+ if (signal.aborted) return;
27458
27786
  render();
27459
- try {
27460
- const result = await client.run(action);
27461
- if (signal.aborted) return false;
27462
- state = result;
27463
- status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
27464
- return result.canUpdate && !result.updateAvailable;
27465
- } catch (error51) {
27466
- if (signal.aborted) return false;
27467
- unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
27468
- status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
27469
- if (state) state = { ...state, canUpdate: false };
27470
- return false;
27471
- } finally {
27472
- busy = false;
27473
- updating = false;
27474
- if (!signal.aborted) {
27475
- render();
27476
- onChange();
27477
- }
27478
- }
27479
- };
27480
- const updateVersion = () => {
27481
- updatePromise ??= run("update").finally(() => {
27482
- updatePromise = null;
27483
- });
27484
- return updatePromise;
27485
- };
27486
- update.addEventListener("click", () => void updateVersion());
27787
+ if (pageChange) onChange();
27788
+ });
27487
27789
  const owner = document2.defaultView;
27488
27790
  let checkFrame = null;
27489
27791
  let checkTimer = null;
27490
27792
  signal.addEventListener(
27491
27793
  "abort",
27492
27794
  () => {
27795
+ unsubscribe();
27493
27796
  if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
27494
27797
  if (checkTimer !== null) owner?.clearTimeout(checkTimer);
27495
27798
  render();
27496
27799
  },
27497
27800
  { once: true }
27498
27801
  );
27499
- status.textContent = messages.harnessVersionChecking;
27500
27802
  render();
27501
- if (!signal.aborted && owner?.requestAnimationFrame) {
27502
- checkFrame = owner.requestAnimationFrame(() => {
27503
- checkFrame = null;
27504
- if (signal.aborted) return;
27505
- checkTimer = owner.setTimeout(() => {
27506
- checkTimer = null;
27507
- void run("check");
27508
- }, 0);
27509
- });
27510
- } else {
27511
- void run("check");
27803
+ if (shouldScheduleCheck && !signal.aborted) {
27804
+ if (owner?.requestAnimationFrame) {
27805
+ checkFrame = owner.requestAnimationFrame(() => {
27806
+ checkFrame = null;
27807
+ if (signal.aborted) return;
27808
+ checkTimer = owner.setTimeout(() => {
27809
+ checkTimer = null;
27810
+ if (!signal.aborted) void session.check();
27811
+ }, 0);
27812
+ });
27813
+ } else {
27814
+ void session.check();
27815
+ }
27512
27816
  }
27513
27817
  return {
27514
27818
  element: panel,
27515
27819
  get state() {
27516
- return state;
27820
+ return session.state;
27517
27821
  },
27518
27822
  get updating() {
27519
- return updating;
27823
+ return session.updating;
27520
27824
  },
27521
- update: updateVersion
27825
+ update: () => signal.aborted ? Promise.resolve(false) : session.update()
27522
27826
  };
27523
27827
  }
27524
27828
 
27525
27829
  // src/settings/connection-versions.ts
27830
+ var sessionStores = /* @__PURE__ */ new WeakMap();
27831
+ function getSessionStore(diagnostics) {
27832
+ let store = sessionStores.get(diagnostics);
27833
+ if (!store) {
27834
+ store = /* @__PURE__ */ new Map();
27835
+ sessionStores.set(diagnostics, store);
27836
+ }
27837
+ return store;
27838
+ }
27526
27839
  function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
27527
27840
  const panels = /* @__PURE__ */ new Map();
27528
27841
  const installation = diagnostics?.installation?.bind(diagnostics);
27842
+ const sessions = diagnostics ? getSessionStore(diagnostics) : null;
27843
+ const sessionKey = (hostId2, agent) => JSON.stringify([hostId2, agent]);
27529
27844
  return {
27845
+ isUpdating(hostId2, agent) {
27846
+ return Boolean(sessions?.get(sessionKey(hostId2, agent))?.updating);
27847
+ },
27530
27848
  get(hostId2, agent) {
27531
27849
  if (!installation || signal.aborted) return void 0;
27532
- const key = JSON.stringify([hostId2, agent]);
27850
+ const key = sessionKey(hostId2, agent);
27533
27851
  let panel = panels.get(key);
27534
27852
  if (!panel) {
27853
+ const run = (action) => installation(hostId2, agent, action);
27854
+ let session = sessions?.get(key);
27855
+ if (!session) {
27856
+ session = createHarnessVersionSession({ run });
27857
+ sessions?.set(key, session);
27858
+ }
27535
27859
  panel = createHarnessVersionPanel(
27536
27860
  document2,
27537
27861
  messages,
27538
27862
  signal,
27539
27863
  agent,
27540
- {
27541
- run: (action) => installation(hostId2, agent, action)
27542
- },
27543
- onChange
27864
+ { run },
27865
+ onChange,
27866
+ session
27544
27867
  );
27545
27868
  panels.set(key, panel);
27546
27869
  }
@@ -27549,79 +27872,242 @@ ${detail}` : ""}`
27549
27872
  };
27550
27873
  }
27551
27874
 
27552
- // src/settings/connection-updates.ts
27553
- function createConnectionUpdates(document2, messages, signal, onChange) {
27554
- const batches = /* @__PURE__ */ new Map();
27555
- const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
27556
- const start = async (hostId2, panels) => {
27557
- if (signal.aborted || batches.get(hostId2)?.running) return;
27558
- const targets = eligible(panels);
27559
- if (!targets.length) return;
27560
- const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
27561
- batches.set(hostId2, batch);
27562
- onChange();
27563
- await Promise.all(
27564
- targets.map(async (panel) => {
27565
- try {
27566
- if (await panel.update()) batch.succeeded++;
27567
- else batch.failed++;
27568
- } catch {
27569
- batch.failed++;
27570
- }
27571
- if (!signal.aborted) onChange();
27572
- })
27573
- );
27574
- batch.running = false;
27575
- if (!signal.aborted) onChange();
27875
+ // src/settings/harness-install-store.ts
27876
+ function errorMessage2(error51) {
27877
+ return typeof error51 === "object" && error51 !== null && "message" in error51 && typeof error51.message === "string" ? error51.message.slice(0, 2048) : "Could not install the Harness. Check the official installation guide and retry.";
27878
+ }
27879
+ function unknownInstallOutcome(message2) {
27880
+ return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
27881
+ }
27882
+ var stores = /* @__PURE__ */ new WeakMap();
27883
+ function createStore(diagnostics) {
27884
+ const states2 = /* @__PURE__ */ new Map();
27885
+ const listeners = /* @__PURE__ */ new Set();
27886
+ const key = (host, agent) => JSON.stringify([host, agent]);
27887
+ const notify2 = () => listeners.forEach((listener) => listener());
27888
+ return {
27889
+ get: (host, agent) => states2.get(key(host, agent)),
27890
+ clearErrors() {
27891
+ for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
27892
+ notify2();
27893
+ },
27894
+ subscribe(listener) {
27895
+ listeners.add(listener);
27896
+ return () => {
27897
+ listeners.delete(listener);
27898
+ };
27899
+ },
27900
+ async install(host, agent) {
27901
+ const id = key(host, agent);
27902
+ const previous = states2.get(id);
27903
+ if (!diagnostics.installation || previous && previous.status !== "error") return;
27904
+ states2.set(id, { status: "installing" });
27905
+ notify2();
27906
+ let failure;
27907
+ try {
27908
+ await diagnostics.installation(host, agent, "install");
27909
+ states2.set(id, { status: "checking" });
27910
+ notify2();
27911
+ } catch (error51) {
27912
+ failure = errorMessage2(error51);
27913
+ }
27914
+ try {
27915
+ await diagnostics.refresh(host);
27916
+ const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
27917
+ if (refreshed?.availability === "ready") failure = void 0;
27918
+ else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
27919
+ failure = void 0;
27920
+ }
27921
+ } catch (error51) {
27922
+ failure ??= errorMessage2(error51);
27923
+ }
27924
+ if (failure) states2.set(id, { status: "error", error: failure });
27925
+ else states2.delete(id);
27926
+ notify2();
27927
+ }
27928
+ };
27929
+ }
27930
+ function harnessInstallStore(diagnostics) {
27931
+ let store = stores.get(diagnostics);
27932
+ if (!store) {
27933
+ store = createStore(diagnostics);
27934
+ stores.set(diagnostics, store);
27935
+ }
27936
+ return store;
27937
+ }
27938
+
27939
+ // src/settings/harness-installation-guides.ts
27940
+ function harnessHasInstallCommands(plugin) {
27941
+ return (plugin?.installation?.commands.length ?? 0) > 0;
27942
+ }
27943
+ function harnessInstallationGuide(plugin, locale) {
27944
+ const guide = plugin?.installation;
27945
+ const text = (value) => value?.[locale] ?? value?.en;
27946
+ return {
27947
+ url: plugin?.links?.installation ?? plugin?.links?.documentation ?? plugin?.links?.website,
27948
+ commands: guide?.commands ?? [],
27949
+ downloads: guide?.downloads ?? [],
27950
+ before: text(guide?.before),
27951
+ after: text(guide?.after)
27952
+ };
27953
+ }
27954
+
27955
+ // src/settings/harness-installation-panel.ts
27956
+ function createHarnessInstallationPanel(document2, plugin, hostId2, messages, copy, installation) {
27957
+ const zh = messages.locale === "zh-CN";
27958
+ const guide = harnessInstallationGuide(plugin, messages.locale);
27959
+ const panel = document2.createElement("div");
27960
+ panel.className = "settings-harness-installation";
27961
+ const paragraph = (text) => {
27962
+ const p = document2.createElement("p");
27963
+ p.textContent = text;
27964
+ panel.append(p);
27965
+ };
27966
+ if (hostId2 !== "local") {
27967
+ paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
27968
+ }
27969
+ if (guide.before) paragraph(guide.before);
27970
+ const install = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
27971
+ if (install && installation) {
27972
+ install.type = "button";
27973
+ install.className = "settings-command-button";
27974
+ install.dataset.connectionAction = "install";
27975
+ install.disabled = installation.status !== "idle";
27976
+ install.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
27977
+ install.addEventListener("click", () => {
27978
+ if (install.disabled) return;
27979
+ install.disabled = true;
27980
+ install.textContent = messages.connectionStatusInstalling;
27981
+ installation.run();
27982
+ });
27983
+ if (guide.commands.length > 1) panel.append(install);
27984
+ }
27985
+ for (const { terminal, command } of guide.commands) {
27986
+ const block = document2.createElement("div");
27987
+ block.className = "settings-harness-installation-command";
27988
+ const label = document2.createElement("strong");
27989
+ label.textContent = terminal;
27990
+ const pre = document2.createElement("pre");
27991
+ const code = document2.createElement("code");
27992
+ code.textContent = command;
27993
+ pre.append(code);
27994
+ const button2 = document2.createElement("button");
27995
+ button2.type = "button";
27996
+ button2.className = "settings-command-button settings-command-button--secondary";
27997
+ button2.dataset.connectionAction = "copy-install";
27998
+ const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
27999
+ button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
28000
+ button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
28001
+ button2.addEventListener("click", () => copy(button2, command, copyLabel));
28002
+ const actions = document2.createElement("div");
28003
+ actions.className = "settings-harness-installation-actions";
28004
+ if (install && guide.commands.length === 1) actions.append(install);
28005
+ actions.append(button2);
28006
+ block.append(label, pre, actions);
28007
+ panel.append(block);
28008
+ }
28009
+ for (const download2 of guide.downloads ?? []) {
28010
+ const link = document2.createElement("a");
28011
+ link.className = "settings-command-button settings-command-button--secondary";
28012
+ link.href = download2.url;
28013
+ link.target = "_blank";
28014
+ link.rel = "noopener noreferrer";
28015
+ link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
28016
+ link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
28017
+ panel.append(link);
28018
+ }
28019
+ if (guide.after) paragraph(guide.after);
28020
+ if (!plugin?.installation && guide.url) {
28021
+ const link = document2.createElement("a");
28022
+ link.href = guide.url;
28023
+ link.target = "_blank";
28024
+ link.rel = "noopener noreferrer";
28025
+ link.textContent = zh ? "\u5B89\u88C5\u8BF4\u660E" : "Installation instructions";
28026
+ panel.append(link);
28027
+ }
28028
+ return panel;
28029
+ }
28030
+
28031
+ // src/settings/harness-launch-controls.ts
28032
+ function createHarnessLaunchControls(document2, messages, agent, settings) {
28033
+ const section = document2.createElement("section");
28034
+ section.className = "settings-harness-launch";
28035
+ section.dataset.harnessLaunch = agent;
28036
+ const label = document2.createElement("label");
28037
+ label.textContent = messages.launchPathLabel;
28038
+ const input = document2.createElement("input");
28039
+ input.type = "text";
28040
+ input.autocomplete = "off";
28041
+ input.spellcheck = false;
28042
+ input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
28043
+ input.setAttribute("aria-label", messages.launchPathLabel);
28044
+ label.append(input);
28045
+ const help = document2.createElement("p");
28046
+ help.textContent = messages.locale === "zh-CN" ? "\u586B\u5199\u63D2\u4EF6\u5BF9\u5E94\u5E94\u7528\u7684\u5B89\u88C5\u76EE\u5F55\uFF1B\u6E05\u9664\u540E\u6062\u590D\u81EA\u52A8\u53D1\u73B0\u3002\u4FEE\u6539\u540E\u9700\u91CD\u542F codexhost\u3002" : "Choose the application's installation directory; clear it to restore automatic discovery. Restart codexhost after changing it.";
28047
+ const actions = document2.createElement("div");
28048
+ actions.className = "settings-harness-launch__actions";
28049
+ const save = document2.createElement("button");
28050
+ save.type = "button";
28051
+ save.className = "settings-command-button";
28052
+ save.textContent = messages.launchPathSave;
28053
+ const reset = document2.createElement("button");
28054
+ reset.type = "button";
28055
+ reset.className = "settings-command-button settings-command-button--secondary";
28056
+ reset.textContent = messages.launchPathReset;
28057
+ const status = document2.createElement("p");
28058
+ status.setAttribute("role", "status");
28059
+ status.setAttribute("aria-live", "polite");
28060
+ actions.append(save, reset);
28061
+ section.append(label, help, actions, status);
28062
+ let busy = true;
28063
+ let loaded = false;
28064
+ const controls = () => {
28065
+ input.disabled = busy || !loaded;
28066
+ save.disabled = busy || !loaded || !input.value.trim();
28067
+ reset.disabled = busy || !loaded;
27576
28068
  };
27577
- return {
27578
- createControls(hostId2, panels) {
27579
- const batch = batches.get(hostId2);
27580
- const count3 = eligible(panels).length;
27581
- const button2 = document2.createElement("button");
27582
- button2.type = "button";
27583
- button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
27584
- button2.dataset.connectionAction = "update-all";
27585
- button2.disabled = signal.aborted || Boolean(batch?.running) || !count3;
27586
- button2.title = messages.harnessUpdateAllDescription;
27587
- const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count3 ? `${messages.harnessUpdateAll} (${count3})` : messages.harnessUpdateAll;
27588
- button2.append(createRendererSettingsIcon("download", 15), label);
27589
- button2.addEventListener("click", () => {
27590
- if (!button2.disabled) void start(hostId2, panels);
27591
- });
27592
- const result = document2.createElement("p");
27593
- result.className = "settings-connection-update-result";
27594
- result.setAttribute("role", "status");
27595
- result.hidden = !batch || batch.running;
27596
- if (batch && !batch.running) {
27597
- result.textContent = messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed));
27598
- }
27599
- return { button: button2, result };
28069
+ const show = (value) => {
28070
+ input.value = value.path ?? "";
28071
+ status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
28072
+ };
28073
+ const persist = async (value) => {
28074
+ if (busy || !loaded) return;
28075
+ busy = true;
28076
+ controls();
28077
+ status.textContent = messages.launchPathSaving;
28078
+ try {
28079
+ show(await settings.set(value));
28080
+ } catch {
28081
+ status.textContent = messages.launchPathSaveError;
28082
+ } finally {
28083
+ busy = false;
28084
+ controls();
27600
28085
  }
27601
28086
  };
28087
+ input.addEventListener("input", controls);
28088
+ save.addEventListener("click", () => {
28089
+ if (input.value.trim()) void persist(input.value.trim());
28090
+ });
28091
+ reset.addEventListener("click", () => {
28092
+ void persist(null);
28093
+ });
28094
+ controls();
28095
+ status.textContent = messages.launchPathLoading;
28096
+ void settings.get().then((value) => {
28097
+ loaded = true;
28098
+ show(value);
28099
+ }).catch(() => {
28100
+ loaded = true;
28101
+ status.textContent = messages.launchPathLoadError;
28102
+ }).finally(() => {
28103
+ busy = false;
28104
+ controls();
28105
+ });
28106
+ return section;
27602
28107
  }
27603
28108
 
27604
28109
  // src/settings/connections-page.ts
27605
28110
  var CODEXHOST_GITHUB_ISSUES_NEW_URL = "https://github.com/BytePioneer-AI/codex-host/issues/new";
27606
- function connectionStatusLabel(availability, messages, hasError = false) {
27607
- if (availability === "updating") return messages.connectionStatusUpdating;
27608
- if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
27609
- if (availability === "ready") return messages.connectionStatusReady;
27610
- if (availability === "checking") return messages.connectionStatusChecking;
27611
- if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
27612
- if (availability === "unavailable" || availability === "error") {
27613
- return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
27614
- }
27615
- return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
27616
- }
27617
- function connectionStatusTone(availability, hasError = false) {
27618
- if (availability === "updating") return "checking";
27619
- if (hasError && availability !== "notInstalled") return "failed";
27620
- if (availability === "ready") return "ready";
27621
- if (availability === "checking" || availability === "installing") return "checking";
27622
- if (availability === "notInstalled") return "setup";
27623
- return "failed";
27624
- }
27625
28111
  function diagnosticText(hostId2, item) {
27626
28112
  const error51 = item.error;
27627
28113
  return [
@@ -27717,148 +28203,21 @@ ${error51.stderrTail}`] : []
27717
28203
  tabs.addEventListener("wheel", onWheel, { passive: false });
27718
28204
  const ownerWindow = document2.defaultView;
27719
28205
  ownerWindow?.addEventListener("resize", updateButtons);
27720
- ownerWindow?.setTimeout(updateButtons, 0);
27721
- updateButtons();
27722
- return () => {
27723
- left.removeEventListener("click", onLeft);
27724
- right.removeEventListener("click", onRight);
27725
- tabs.removeEventListener("scroll", updateButtons);
27726
- tabs.removeEventListener("wheel", onWheel);
27727
- ownerWindow?.removeEventListener("resize", updateButtons);
28206
+ const refreshLayout = () => {
28207
+ ownerWindow?.setTimeout(updateButtons, 0);
28208
+ updateButtons();
28209
+ };
28210
+ refreshLayout();
28211
+ return {
28212
+ update: refreshLayout,
28213
+ dispose() {
28214
+ left.removeEventListener("click", onLeft);
28215
+ right.removeEventListener("click", onRight);
28216
+ tabs.removeEventListener("scroll", updateButtons);
28217
+ tabs.removeEventListener("wheel", onWheel);
28218
+ ownerWindow?.removeEventListener("resize", updateButtons);
28219
+ }
27728
28220
  };
27729
- }
27730
- function createConnectionIdentityIcon(document2, item, size) {
27731
- const container = document2.createElement("span");
27732
- container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
27733
- container.setAttribute("aria-hidden", "true");
27734
- if (item.agentSnapshot) {
27735
- container.append(
27736
- createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
27737
- );
27738
- } else {
27739
- container.textContent = "CH";
27740
- }
27741
- return container;
27742
- }
27743
- function createConnectionRow(document2, item, messages, selected, select, group = null) {
27744
- const row = document2.createElement("div");
27745
- row.className = "settings-connection-row";
27746
- row.dataset.connectionItem = item.key;
27747
- row.dataset.connectionSelected = String(selected);
27748
- row.tabIndex = selected ? 0 : -1;
27749
- row.setAttribute("role", "row");
27750
- const identity2 = document2.createElement("div");
27751
- identity2.className = "settings-connection-row__identity";
27752
- identity2.setAttribute("role", "cell");
27753
- if (group) {
27754
- const handle = document2.createElement("span");
27755
- handle.className = "settings-connection-row__handle";
27756
- handle.setAttribute("aria-hidden", "true");
27757
- handle.title = group.dragHandleTitle;
27758
- handle.append(createRendererSettingsIcon("grip-vertical", 15));
27759
- identity2.append(handle);
27760
- }
27761
- const label = document2.createElement("strong");
27762
- label.textContent = item.name;
27763
- identity2.append(createConnectionIdentityIcon(document2, item, 19), label);
27764
- const status = document2.createElement("span");
27765
- status.className = "settings-connection-row__status";
27766
- status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
27767
- status.setAttribute("role", "cell");
27768
- status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
27769
- const version2 = item.version;
27770
- const action = document2.createElement("div");
27771
- action.className = "settings-connection-row__action";
27772
- action.setAttribute("role", "cell");
27773
- if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
27774
- const install = document2.createElement("button");
27775
- install.type = "button";
27776
- install.className = "settings-connection-install-link";
27777
- install.addEventListener("click", (event) => {
27778
- event.stopPropagation();
27779
- select();
27780
- item.install?.();
27781
- });
27782
- install.disabled = item.availability === "installing" || item.availability === "checking";
27783
- const installLabel = messages.connectionInstall;
27784
- install.setAttribute("aria-label", `${installLabel}: ${item.name}`);
27785
- install.title = installLabel;
27786
- install.append(createRendererSettingsIcon("download", 17));
27787
- action.append(install);
27788
- } else if (item.error) {
27789
- const viewError = document2.createElement("button");
27790
- viewError.type = "button";
27791
- viewError.className = "settings-connection-view-error";
27792
- viewError.textContent = messages.connectionViewError;
27793
- viewError.addEventListener("click", (event) => {
27794
- event.stopPropagation();
27795
- select();
27796
- });
27797
- action.append(viewError);
27798
- }
27799
- if (version2?.state?.updateAvailable && !version2.updating) {
27800
- const available = document2.createElement("span");
27801
- available.className = "settings-connection-version-available";
27802
- available.textContent = messages.harnessVersionAvailable;
27803
- available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
27804
- ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
27805
- action.append(available);
27806
- }
27807
- if (version2?.state?.updateAvailable && version2.state.canUpdate) {
27808
- const update = document2.createElement("button");
27809
- update.type = "button";
27810
- update.className = "settings-connection-install-link";
27811
- update.dataset.connectionAction = "update";
27812
- update.disabled = version2.updating;
27813
- update.title = messages.harnessVersionUpdate;
27814
- update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
27815
- update.append(createRendererSettingsIcon("download", 17));
27816
- update.addEventListener("click", (event) => {
27817
- event.stopPropagation();
27818
- if (update.disabled) return;
27819
- void version2.update();
27820
- select();
27821
- });
27822
- action.append(update);
27823
- }
27824
- if (group) {
27825
- const toggle = document2.createElement("button");
27826
- toggle.type = "button";
27827
- toggle.disabled = group.disabled;
27828
- toggle.className = "settings-connection-row__group-toggle";
27829
- toggle.title = group.moveLabel;
27830
- toggle.setAttribute("aria-label", group.moveLabel);
27831
- toggle.append(
27832
- createRendererSettingsIcon(group.section === "main" ? "chevron-down" : "chevron-up", 15)
27833
- );
27834
- toggle.addEventListener("click", (event) => {
27835
- event.stopPropagation();
27836
- group.toggleSection();
27837
- });
27838
- action.append(toggle);
27839
- }
27840
- row.addEventListener("click", (event) => {
27841
- const target2 = event.target;
27842
- if (target2?.closest?.("a")) return;
27843
- select();
27844
- });
27845
- row.addEventListener("keydown", (event) => {
27846
- if (event.target?.closest?.("button, a")) return;
27847
- if (event.key !== "Enter" && event.key !== " ") return;
27848
- event.preventDefault();
27849
- select();
27850
- });
27851
- if (group) {
27852
- row.draggable = !group.disabled;
27853
- row.dataset.connectionGroupSection = group.section;
27854
- row.addEventListener("dragstart", group.onDragStart);
27855
- row.addEventListener("dragover", group.onDragOver);
27856
- row.addEventListener("dragleave", group.onDragLeave);
27857
- row.addEventListener("drop", group.onDrop);
27858
- row.addEventListener("dragend", group.onDragEnd);
27859
- }
27860
- row.append(identity2, status, action);
27861
- return row;
27862
28221
  }
27863
28222
  function createInspectorHeader(document2, item, messages) {
27864
28223
  const header = document2.createElement("header");
@@ -27888,6 +28247,29 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
27888
28247
  header.append(identity2, status);
27889
28248
  return header;
27890
28249
  }
28250
+ function inspectorRenderSignature(hostId2, item, messages, diagnostics) {
28251
+ const plugin = item.agentSnapshot?.plugin;
28252
+ const notice = plugin?.notice ? plugin.notice[messages.locale] ?? plugin.notice.en : "";
28253
+ const websiteUrl = plugin?.links?.website ?? plugin?.links?.documentation ?? "";
28254
+ const hasLaunchControls = hostId2 === "local" && Boolean(item.agentSnapshot?.agent) && Boolean(plugin?.launchCommand) && Boolean(diagnostics?.getLaunchSettings && diagnostics?.setLaunchSettings);
28255
+ return JSON.stringify([
28256
+ hostId2,
28257
+ item.key,
28258
+ item.name,
28259
+ item.availability,
28260
+ item.agentSnapshot?.availability ?? null,
28261
+ String(plugin?.icon ?? ""),
28262
+ String(plugin?.iconStyle ?? ""),
28263
+ websiteUrl,
28264
+ notice,
28265
+ item.installError ?? "",
28266
+ Boolean(item.install),
28267
+ plugin?.installation ?? null,
28268
+ Boolean(item.openWebUi),
28269
+ hasLaunchControls,
28270
+ item.error ? diagnosticText(hostId2, item) : ""
28271
+ ]);
28272
+ }
27891
28273
  function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
27892
28274
  inspector.replaceChildren(createInspectorHeader(document2, item, messages));
27893
28275
  const body = document2.createElement("div");
@@ -28050,11 +28432,10 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28050
28432
  ];
28051
28433
  }
28052
28434
  var pendingFocusAgent = null;
28053
- function createGroupDivider(document2, messages, count3) {
28435
+ function createGroupDivider(document2) {
28054
28436
  const divider = document2.createElement("div");
28055
28437
  divider.className = "settings-connection-group-divider";
28056
28438
  divider.setAttribute("role", "presentation");
28057
- divider.textContent = `${messages.connectionGroupMoreLabel} (${count3})`;
28058
28439
  return divider;
28059
28440
  }
28060
28441
  function createGroupMoreHint(document2, messages) {
@@ -28107,11 +28488,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28107
28488
  context.content.append(header, syncMessage, content);
28108
28489
  let pending = false;
28109
28490
  let selectedHostId = null;
28491
+ let renderedHostId = null;
28110
28492
  let selectedItemKey = null;
28111
28493
  let launchControls = null;
28494
+ let renderedInspector = null;
28112
28495
  const hostNames = /* @__PURE__ */ new Map();
28496
+ const knownNotInstalled = /* @__PURE__ */ new Map();
28113
28497
  let latestSnapshot = null;
28114
- let disposeHostScroller = () => void 0;
28115
28498
  let disposed = false;
28116
28499
  let renderQueued = false;
28117
28500
  let renderFrame = null;
@@ -28145,7 +28528,99 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28145
28528
  scheduleRender
28146
28529
  );
28147
28530
  const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
28148
- const updates = createConnectionUpdates(document2, messages, context.signal, scheduleRender);
28531
+ const updates = createConnectionUpdates(
28532
+ document2,
28533
+ messages,
28534
+ context.signal,
28535
+ scheduleRender,
28536
+ diagnostics
28537
+ );
28538
+ const panelId = "codexhost-settings-connection-host-panel";
28539
+ const empty = document2.createElement("div");
28540
+ empty.className = "settings-empty";
28541
+ empty.textContent = messages.connectionNoRuntime;
28542
+ const layout = document2.createElement("div");
28543
+ layout.className = "settings-connections-layout";
28544
+ const list = document2.createElement("section");
28545
+ list.className = "settings-connection-list";
28546
+ const hostStrip = document2.createElement("div");
28547
+ hostStrip.className = "settings-connection-host-strip";
28548
+ const scrollLeft = createHostScrollButton(document2, "left", messages);
28549
+ const tabs = document2.createElement("div");
28550
+ tabs.className = "settings-connection-host-tabs";
28551
+ tabs.setAttribute("role", "tablist");
28552
+ tabs.setAttribute("aria-label", messages.connectionHosts);
28553
+ const scrollRight = createHostScrollButton(document2, "right", messages);
28554
+ hostStrip.append(scrollLeft, tabs, scrollRight);
28555
+ const updateControls = updates.createControls("local", []);
28556
+ const hostHeader = document2.createElement("div");
28557
+ hostHeader.className = "settings-connection-host-header";
28558
+ hostHeader.append(hostStrip, updateControls.button);
28559
+ const tableHeader = document2.createElement("div");
28560
+ tableHeader.className = "settings-connection-table-header";
28561
+ tableHeader.setAttribute("role", "row");
28562
+ const componentHeading = document2.createElement("span");
28563
+ componentHeading.textContent = messages.connectionComponent;
28564
+ componentHeading.setAttribute("role", "columnheader");
28565
+ const statusHeading = document2.createElement("span");
28566
+ statusHeading.textContent = messages.connectionStatus;
28567
+ statusHeading.setAttribute("role", "columnheader");
28568
+ const actionHeading = document2.createElement("span");
28569
+ actionHeading.setAttribute("aria-hidden", "true");
28570
+ tableHeader.append(componentHeading, statusHeading, actionHeading);
28571
+ const rows = document2.createElement("div");
28572
+ rows.className = "settings-connection-rows";
28573
+ rows.id = panelId;
28574
+ rows.setAttribute("role", "rowgroup");
28575
+ list.append(hostHeader, updateControls.result, tableHeader, rows);
28576
+ const inspector = document2.createElement("aside");
28577
+ inspector.className = "settings-connection-inspector";
28578
+ inspector.setAttribute("aria-live", "polite");
28579
+ layout.append(list, inspector);
28580
+ const hostScroller = configureHostScroller(
28581
+ document2,
28582
+ hostStrip,
28583
+ tabs,
28584
+ scrollLeft,
28585
+ scrollRight
28586
+ );
28587
+ const hostTabElements = /* @__PURE__ */ new Map();
28588
+ const hostRowViews = /* @__PURE__ */ new Map();
28589
+ const groupDivider = createGroupDivider(document2);
28590
+ const moreHint = createGroupMoreHint(document2, messages);
28591
+ const moreZone = document2.createElement("div");
28592
+ moreZone.className = "settings-connection-group-more";
28593
+ moreZone.setAttribute("role", "presentation");
28594
+ const resetButton = createGroupResetButton(document2, messages, () => {
28595
+ groupPreference.resetToDefault();
28596
+ });
28597
+ let draggingAgent = null;
28598
+ let currentCatalog = [];
28599
+ let currentMainEntries = [];
28600
+ let currentMoreEntries = [];
28601
+ let currentHostRows = /* @__PURE__ */ new Map();
28602
+ const clearDropIndicators = () => {
28603
+ for (const view of currentHostRows.values()) {
28604
+ view.element.dataset.connectionDropIndicator = "";
28605
+ }
28606
+ moreZone.dataset.connectionDragOver = "false";
28607
+ };
28608
+ moreZone.addEventListener("dragover", (event) => {
28609
+ if (!draggingAgent) return;
28610
+ event.preventDefault();
28611
+ moreZone.dataset.connectionDragOver = "true";
28612
+ });
28613
+ moreZone.addEventListener("dragleave", () => {
28614
+ moreZone.dataset.connectionDragOver = "false";
28615
+ });
28616
+ moreZone.addEventListener("drop", (event) => {
28617
+ event.preventDefault();
28618
+ moreZone.dataset.connectionDragOver = "false";
28619
+ if (!draggingAgent) return;
28620
+ groupPreference.moveAgent(draggingAgent, "more", null, currentCatalog);
28621
+ draggingAgent = null;
28622
+ clearDropIndicators();
28623
+ });
28149
28624
  const runRefresh = () => {
28150
28625
  if (pending || !diagnostics) return;
28151
28626
  pending = true;
@@ -28158,6 +28633,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28158
28633
  success() {
28159
28634
  installs?.clearErrors();
28160
28635
  pending = false;
28636
+ renderedInspector = null;
28161
28637
  refresh.disabled = false;
28162
28638
  refresh.replaceChildren(
28163
28639
  createRendererSettingsIcon("diagnose", 16),
@@ -28167,6 +28643,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28167
28643
  },
28168
28644
  failure(error51) {
28169
28645
  pending = false;
28646
+ renderedInspector = null;
28170
28647
  refresh.disabled = false;
28171
28648
  refresh.replaceChildren(
28172
28649
  createRendererSettingsIcon("diagnose", 16),
@@ -28192,97 +28669,111 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28192
28669
  }
28193
28670
  });
28194
28671
  };
28672
+ const syncSelectedInspector = (hostId2, item) => {
28673
+ const currentDiagnostics = getDiagnostics();
28674
+ const signature = inspectorRenderSignature(hostId2, item, messages, currentDiagnostics);
28675
+ const versionElement = item.version?.element ?? null;
28676
+ if (renderedInspector?.signature === signature && renderedInspector.versionElement === versionElement) {
28677
+ return;
28678
+ }
28679
+ const existing = launchControls?.hostId === hostId2 && launchControls.itemKey === item.key ? launchControls.element : null;
28680
+ const element = renderConnectionInspector(
28681
+ document2,
28682
+ inspector,
28683
+ item,
28684
+ hostId2,
28685
+ messages,
28686
+ currentDiagnostics,
28687
+ existing,
28688
+ runRefresh
28689
+ );
28690
+ launchControls = { hostId: hostId2, itemKey: item.key, element };
28691
+ if (versionElement) inspector.append(versionElement);
28692
+ renderedInspector = { signature, versionElement };
28693
+ };
28195
28694
  const render = (snapshot) => {
28196
28695
  const syncStatus = groupPreference.syncStatus();
28197
28696
  const groupDisabled = syncStatus === "loading" || syncStatus === "saving";
28198
28697
  syncMessage.hidden = syncStatus === "ready";
28199
28698
  syncMessage.textContent = syncStatus === "error" ? messages.connectionGroupSyncFailed : syncStatus === "saving" ? messages.connectionGroupSaving : messages.connectionGroupLoading;
28200
28699
  latestSnapshot = snapshot;
28201
- disposeHostScroller();
28202
- disposeHostScroller = () => void 0;
28203
28700
  if (!snapshot) {
28204
- const empty = document2.createElement("div");
28205
- empty.className = "settings-empty";
28206
- empty.textContent = messages.connectionNoRuntime;
28207
- content.replaceChildren(empty);
28701
+ renderedHostId = null;
28702
+ renderedInspector = null;
28703
+ reconcileElementChildren(content, [empty]);
28208
28704
  return;
28209
28705
  }
28210
28706
  const selectedHost = (selectedHostId ? snapshot.hosts.find((host) => host.hostId === selectedHostId) : void 0) ?? snapshot.hosts.find((host) => host.active) ?? snapshot.hosts.find((host) => host.hostId === "local") ?? snapshot.hosts[0];
28211
28707
  if (!selectedHost) return;
28212
28708
  selectedHostId = selectedHost.hostId;
28213
- const layout = document2.createElement("div");
28214
- layout.className = "settings-connections-layout";
28215
- const list = document2.createElement("section");
28216
- list.className = "settings-connection-list";
28217
- const hostStrip = document2.createElement("div");
28218
- hostStrip.className = "settings-connection-host-strip";
28219
- const scrollLeft = createHostScrollButton(document2, "left", messages);
28220
- const tabs = document2.createElement("div");
28221
- tabs.className = "settings-connection-host-tabs";
28222
- tabs.setAttribute("role", "tablist");
28223
- tabs.setAttribute("aria-label", messages.connectionHosts);
28224
- const scrollRight = createHostScrollButton(document2, "right", messages);
28225
- const panelId = "codexhost-settings-connection-host-panel";
28226
- snapshot.hosts.forEach((host, index) => {
28227
- const tab = document2.createElement("button");
28228
- tab.type = "button";
28229
- tab.className = "settings-connection-host-tab";
28230
- tab.dataset.connectionHostTab = host.hostId;
28231
- tab.dataset.connectionHostActive = String(host.active);
28232
- tab.setAttribute("role", "tab");
28233
- tab.setAttribute("aria-controls", panelId);
28234
- tab.setAttribute("aria-selected", String(host.hostId === selectedHost.hostId));
28235
- tab.tabIndex = host.hostId === selectedHost.hostId ? 0 : -1;
28709
+ const layoutFirstMount = content.children[0] !== layout;
28710
+ reconcileElementChildren(content, [layout]);
28711
+ let tabsChanged = tabs.children.length !== snapshot.hosts.length;
28712
+ const nextTabs = snapshot.hosts.map((host) => {
28713
+ let tab = hostTabElements.get(host.hostId);
28714
+ if (!tab) {
28715
+ tab = document2.createElement("button");
28716
+ tab.type = "button";
28717
+ tab.className = "settings-connection-host-tab";
28718
+ tab.dataset.connectionHostTab = host.hostId;
28719
+ tab.setAttribute("role", "tab");
28720
+ tab.setAttribute("aria-controls", panelId);
28721
+ tab.addEventListener("click", () => {
28722
+ selectedHostId = host.hostId;
28723
+ render(latestSnapshot);
28724
+ });
28725
+ tab.addEventListener("keydown", (event) => {
28726
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
28727
+ event.preventDefault();
28728
+ const hosts = latestSnapshot?.hosts ?? [];
28729
+ const index = hosts.findIndex((candidate) => candidate.hostId === host.hostId);
28730
+ if (index < 0) return;
28731
+ const direction = event.key === "ArrowRight" ? 1 : -1;
28732
+ const next = hosts[(index + direction + hosts.length) % hosts.length];
28733
+ if (!next) return;
28734
+ selectedHostId = next.hostId;
28735
+ render(latestSnapshot);
28736
+ hostTabElements.get(next.hostId)?.focus();
28737
+ });
28738
+ hostTabElements.set(host.hostId, tab);
28739
+ tabsChanged = true;
28740
+ }
28741
+ const isSelected = host.hostId === selectedHost.hostId;
28742
+ const activeValue = String(host.active);
28743
+ if (tab.dataset.connectionHostActive !== activeValue) {
28744
+ tab.dataset.connectionHostActive = activeValue;
28745
+ }
28746
+ const selectedValue = String(isSelected);
28747
+ if (tab.getAttribute("aria-selected") !== selectedValue) {
28748
+ tab.setAttribute("aria-selected", selectedValue);
28749
+ }
28750
+ const nextTabIndex = isSelected ? 0 : -1;
28751
+ if (tab.tabIndex !== nextTabIndex) {
28752
+ tab.tabIndex = nextTabIndex;
28753
+ }
28236
28754
  const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
28237
- tab.textContent = hostName;
28238
- tab.title = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
28239
- tab.addEventListener("click", () => {
28240
- selectedHostId = host.hostId;
28241
- render(latestSnapshot);
28242
- });
28243
- tab.addEventListener("keydown", (event) => {
28244
- if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
28245
- event.preventDefault();
28246
- const direction = event.key === "ArrowRight" ? 1 : -1;
28247
- const next = snapshot.hosts[(index + direction + snapshot.hosts.length) % snapshot.hosts.length];
28248
- if (!next) return;
28249
- selectedHostId = next.hostId;
28250
- render(latestSnapshot);
28251
- const nextTab = [
28252
- ...content.querySelectorAll("[data-connection-host-tab]")
28253
- ].find((candidate) => candidate.dataset.connectionHostTab === next.hostId);
28254
- nextTab?.focus();
28255
- });
28256
- tabs.append(tab);
28755
+ if (tab.textContent !== hostName) {
28756
+ tab.textContent = hostName;
28757
+ tabsChanged = true;
28758
+ }
28759
+ const tabTitle = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
28760
+ if (tab.title !== tabTitle) {
28761
+ tab.title = tabTitle;
28762
+ }
28763
+ return tab;
28257
28764
  });
28258
- hostStrip.append(scrollLeft, tabs, scrollRight);
28259
- const tableHeader = document2.createElement("div");
28260
- tableHeader.className = "settings-connection-table-header";
28261
- tableHeader.setAttribute("role", "row");
28262
- const componentHeading = document2.createElement("span");
28263
- componentHeading.textContent = messages.connectionComponent;
28264
- componentHeading.setAttribute("role", "columnheader");
28265
- const statusHeading = document2.createElement("span");
28266
- statusHeading.textContent = messages.connectionStatus;
28267
- statusHeading.setAttribute("role", "columnheader");
28268
- const actionHeading = document2.createElement("span");
28269
- actionHeading.setAttribute("aria-hidden", "true");
28270
- tableHeader.append(componentHeading, statusHeading, actionHeading);
28271
- const rows = document2.createElement("div");
28272
- rows.className = "settings-connection-rows";
28273
- rows.id = panelId;
28274
- rows.dataset.connectionHost = selectedHost.hostId;
28275
- rows.setAttribute("role", "rowgroup");
28276
- const inspector = document2.createElement("aside");
28277
- inspector.className = "settings-connection-inspector";
28278
- inspector.setAttribute("aria-live", "polite");
28765
+ reconcileElementChildren(tabs, nextTabs);
28766
+ if (rows.dataset.connectionHost !== selectedHost.hostId) {
28767
+ rows.dataset.connectionHost = selectedHost.hostId;
28768
+ }
28279
28769
  const items = connectionItems(snapshot, selectedHost, messages, diagnostics).map(
28280
28770
  (item) => {
28281
28771
  const agent = item.agentSnapshot?.agent;
28282
28772
  if (!agent) return item;
28283
28773
  const state = installs?.get(selectedHost.hostId, agent);
28284
28774
  const availability = state?.status ?? item.availability;
28285
- const version2 = item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
28775
+ const updating = versions.isUpdating(selectedHost.hostId, agent);
28776
+ const version2 = updating || item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
28286
28777
  return {
28287
28778
  ...item,
28288
28779
  ...state ? { availability: state.status } : {},
@@ -28304,66 +28795,66 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28304
28795
  (item) => item.agentSnapshot?.availability === "notInstalled" || item.error !== null
28305
28796
  )?.key ?? items[0]?.key ?? null;
28306
28797
  }
28307
- const rowElements = /* @__PURE__ */ new Map();
28798
+ let hostRows = hostRowViews.get(selectedHost.hostId);
28799
+ if (!hostRows) {
28800
+ hostRows = /* @__PURE__ */ new Map();
28801
+ hostRowViews.set(selectedHost.hostId, hostRows);
28802
+ }
28803
+ currentHostRows = hostRows;
28308
28804
  const selectItem = (item) => {
28309
28805
  selectedItemKey = item.key;
28310
- for (const [key, row] of rowElements) {
28311
- const selected = key === item.key;
28312
- row.dataset.connectionSelected = String(selected);
28313
- row.tabIndex = selected ? 0 : -1;
28806
+ for (const [key, view] of currentHostRows) {
28807
+ view.setSelected(key === item.key);
28314
28808
  }
28315
- const existing = launchControls?.hostId === selectedHost.hostId && launchControls.itemKey === item.key ? launchControls.element : null;
28316
- const element = renderConnectionInspector(
28317
- document2,
28318
- inspector,
28319
- item,
28320
- selectedHost.hostId,
28321
- messages,
28322
- getDiagnostics(),
28323
- existing,
28324
- runRefresh
28325
- );
28326
- launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
28327
- if (item.version) inspector.append(item.version.element);
28809
+ syncSelectedInspector(selectedHost.hostId, item);
28328
28810
  };
28329
- const pinnedItem = items.find((item) => item.key === "renderer-adapter");
28330
- if (pinnedItem) {
28331
- const row = createConnectionRow(
28332
- document2,
28811
+ const ensureRowView = (key, groupable) => {
28812
+ let view = hostRows.get(key);
28813
+ if (!view) {
28814
+ view = createConnectionRowView(document2, messages, groupable);
28815
+ hostRows.set(key, view);
28816
+ }
28817
+ return view;
28818
+ };
28819
+ const activeKeys = /* @__PURE__ */ new Set();
28820
+ const nextRowChildren = [];
28821
+ const pinnedItems = items.filter((item) => item.agentSnapshot === void 0);
28822
+ for (const pinnedItem of pinnedItems) {
28823
+ activeKeys.add(pinnedItem.key);
28824
+ const view = ensureRowView(pinnedItem.key, false);
28825
+ view.update(
28333
28826
  pinnedItem,
28334
- messages,
28335
28827
  pinnedItem.key === selectedItemKey,
28336
- () => selectItem(pinnedItem)
28828
+ () => selectItem(pinnedItem),
28829
+ null
28337
28830
  );
28338
- rowElements.set(pinnedItem.key, row);
28339
- rows.append(row);
28831
+ nextRowChildren.push(view.element);
28340
28832
  }
28341
28833
  const groupableItems = items.filter(
28342
28834
  (item) => item.agentSnapshot !== void 0
28343
28835
  );
28344
28836
  const agentByKey = new Map(groupableItems.map((item) => [item.key, item]));
28345
- const catalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
28346
- const preferenceOrder = groupPreference.list(
28347
- new Set(
28348
- groupableItems.filter((item) => item.agentSnapshot.availability === "notInstalled").map((item) => item.agentSnapshot.agent)
28349
- ),
28350
- catalog
28351
- ).filter((entry) => agentByKey.has(entry.agent));
28352
- const mainEntries = preferenceOrder.filter((entry) => entry.section === "main");
28353
- const moreEntries = preferenceOrder.filter((entry) => entry.section === "more");
28837
+ currentCatalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
28838
+ const notInstalledAgents = /* @__PURE__ */ new Set();
28839
+ for (const item of groupableItems) {
28840
+ const agent = item.agentSnapshot.agent;
28841
+ const stateKey = `${selectedHost.hostId}:${agent}`;
28842
+ if (item.agentSnapshot.availability !== "checking") {
28843
+ knownNotInstalled.set(stateKey, item.agentSnapshot.availability === "notInstalled");
28844
+ }
28845
+ const isNotInstalled = item.agentSnapshot.availability === "checking" ? knownNotInstalled.get(stateKey) ?? false : item.agentSnapshot.availability === "notInstalled";
28846
+ if (isNotInstalled) notInstalledAgents.add(agent);
28847
+ }
28848
+ const preferenceOrder = groupPreference.list(notInstalledAgents, currentCatalog).filter((entry) => agentByKey.has(entry.agent));
28849
+ currentMainEntries = preferenceOrder.filter((entry) => entry.section === "main");
28850
+ currentMoreEntries = preferenceOrder.filter((entry) => entry.section === "more");
28354
28851
  const nextInSection = (section, agent) => {
28355
- const list2 = section === "main" ? mainEntries : moreEntries;
28356
- const index = list2.findIndex((entry) => entry.agent === agent);
28357
- return index >= 0 ? list2[index + 1]?.agent ?? null : null;
28358
- };
28359
- let draggingAgent = null;
28360
- let moreZone = null;
28361
- const clearDropIndicators = () => {
28362
- for (const row of rowElements.values()) row.dataset.connectionDropIndicator = "";
28363
- if (moreZone) moreZone.dataset.connectionDragOver = "false";
28852
+ const sectionEntries = section === "main" ? currentMainEntries : currentMoreEntries;
28853
+ const index = sectionEntries.findIndex((entry) => entry.agent === agent);
28854
+ return index >= 0 ? sectionEntries[index + 1]?.agent ?? null : null;
28364
28855
  };
28365
28856
  const dropTargetSection = (agent, event) => {
28366
- const row = rowElements.get(agent);
28857
+ const row = currentHostRows.get(agent)?.element;
28367
28858
  const rect = row && typeof row.getBoundingClientRect === "function" ? row.getBoundingClientRect() : null;
28368
28859
  const before = rect ? event.clientY - rect.top < rect.height / 2 : true;
28369
28860
  const section = row?.dataset.connectionGroupSection ?? "main";
@@ -28375,7 +28866,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28375
28866
  moveLabel: section === "main" ? messages.connectionGroupMoveToMore : messages.connectionGroupMoveToMain,
28376
28867
  dragHandleTitle: messages.connectionGroupDragHandle,
28377
28868
  toggleSection() {
28378
- groupPreference.moveAgent(agent, section === "main" ? "more" : "main", null, catalog);
28869
+ groupPreference.moveAgent(
28870
+ agent,
28871
+ section === "main" ? "more" : "main",
28872
+ null,
28873
+ currentCatalog
28874
+ );
28379
28875
  },
28380
28876
  onDragStart(event) {
28381
28877
  if (groupDisabled) {
@@ -28385,127 +28881,107 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28385
28881
  draggingAgent = agent;
28386
28882
  event.dataTransfer?.setData("text/plain", agent);
28387
28883
  if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
28388
- const row = rowElements.get(agent);
28884
+ const row = currentHostRows.get(agent)?.element;
28389
28885
  if (row) row.dataset.connectionDragging = "true";
28390
28886
  },
28391
28887
  onDragOver(event) {
28392
28888
  if (!draggingAgent || draggingAgent === agent) return;
28393
28889
  event.preventDefault();
28394
- const row = rowElements.get(agent);
28890
+ const row = currentHostRows.get(agent)?.element;
28395
28891
  if (!row) return;
28396
28892
  const { before } = dropTargetSection(agent, event);
28397
28893
  clearDropIndicators();
28398
28894
  row.dataset.connectionDropIndicator = before ? "before" : "after";
28399
28895
  },
28400
28896
  onDragLeave() {
28401
- const row = rowElements.get(agent);
28897
+ const row = currentHostRows.get(agent)?.element;
28402
28898
  if (row) row.dataset.connectionDropIndicator = "";
28403
28899
  },
28404
28900
  onDrop(event) {
28405
28901
  event.preventDefault();
28406
28902
  if (!draggingAgent) return;
28407
28903
  const { beforeAgent } = dropTargetSection(agent, event);
28408
- groupPreference.moveAgent(draggingAgent, section, beforeAgent, catalog);
28904
+ groupPreference.moveAgent(draggingAgent, section, beforeAgent, currentCatalog);
28409
28905
  draggingAgent = null;
28410
28906
  clearDropIndicators();
28411
28907
  },
28412
28908
  onDragEnd() {
28413
28909
  draggingAgent = null;
28414
- const row = rowElements.get(agent);
28910
+ const row = currentHostRows.get(agent)?.element;
28415
28911
  if (row) row.dataset.connectionDragging = "false";
28416
28912
  clearDropIndicators();
28913
+ scheduleRender();
28417
28914
  }
28418
28915
  });
28419
- const appendGroupRow = (agent, section) => {
28420
- const item = agentByKey.get(agent);
28421
- if (!item) return;
28422
- const row = createConnectionRow(
28423
- document2,
28916
+ for (const entry of currentMainEntries) {
28917
+ const item = agentByKey.get(entry.agent);
28918
+ if (!item) continue;
28919
+ activeKeys.add(item.key);
28920
+ const view = ensureRowView(item.key, true);
28921
+ view.update(
28424
28922
  item,
28425
- messages,
28426
28923
  item.key === selectedItemKey,
28427
28924
  () => selectItem(item),
28428
- createGroupController(agent, section)
28925
+ createGroupController(entry.agent, "main")
28429
28926
  );
28430
- rowElements.set(item.key, row);
28431
- rows.append(row);
28432
- };
28433
- for (const entry of mainEntries) appendGroupRow(entry.agent, "main");
28927
+ nextRowChildren.push(view.element);
28928
+ }
28434
28929
  if (groupableItems.length > 0) {
28435
- rows.append(createGroupDivider(document2, messages, moreEntries.length));
28436
- const zone = document2.createElement("div");
28437
- moreZone = zone;
28438
- zone.className = "settings-connection-group-more";
28439
- zone.setAttribute("role", "presentation");
28440
- zone.addEventListener("dragover", (event) => {
28441
- if (!draggingAgent) return;
28442
- event.preventDefault();
28443
- zone.dataset.connectionDragOver = "true";
28444
- });
28445
- zone.addEventListener("dragleave", () => {
28446
- zone.dataset.connectionDragOver = "false";
28447
- });
28448
- zone.addEventListener("drop", (event) => {
28449
- event.preventDefault();
28450
- zone.dataset.connectionDragOver = "false";
28451
- if (!draggingAgent) return;
28452
- groupPreference.moveAgent(draggingAgent, "more", null, catalog);
28453
- draggingAgent = null;
28454
- clearDropIndicators();
28455
- });
28456
- if (moreEntries.length === 0) {
28457
- zone.append(createGroupMoreHint(document2, messages));
28930
+ const dividerText = `${messages.connectionGroupMoreLabel} (${currentMoreEntries.length})`;
28931
+ if (groupDivider.textContent !== dividerText) {
28932
+ groupDivider.textContent = dividerText;
28933
+ }
28934
+ nextRowChildren.push(groupDivider);
28935
+ const nextMoreChildren = [];
28936
+ if (currentMoreEntries.length === 0) {
28937
+ nextMoreChildren.push(moreHint);
28458
28938
  } else {
28459
- for (const entry of moreEntries) {
28939
+ for (const entry of currentMoreEntries) {
28460
28940
  const item = agentByKey.get(entry.agent);
28461
28941
  if (!item) continue;
28462
- const row = createConnectionRow(
28463
- document2,
28942
+ activeKeys.add(item.key);
28943
+ const view = ensureRowView(item.key, true);
28944
+ view.update(
28464
28945
  item,
28465
- messages,
28466
28946
  item.key === selectedItemKey,
28467
28947
  () => selectItem(item),
28468
28948
  createGroupController(entry.agent, "more")
28469
28949
  );
28470
- rowElements.set(item.key, row);
28471
- zone.append(row);
28950
+ nextMoreChildren.push(view.element);
28472
28951
  }
28473
28952
  }
28474
- rows.append(zone);
28475
- const reset = createGroupResetButton(document2, messages, () => {
28476
- groupPreference.resetToDefault();
28477
- });
28478
- reset.disabled = groupDisabled;
28479
- rows.append(reset);
28953
+ if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
28954
+ reconcileElementChildren(moreZone, nextMoreChildren);
28955
+ }
28956
+ nextRowChildren.push(moreZone);
28957
+ resetButton.disabled = groupDisabled;
28958
+ nextRowChildren.push(resetButton);
28959
+ }
28960
+ for (const key of hostRows.keys()) {
28961
+ if (!activeKeys.has(key)) hostRows.delete(key);
28962
+ }
28963
+ if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
28964
+ reconcileElementChildren(rows, nextRowChildren);
28480
28965
  }
28481
28966
  const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
28482
28967
  if (selectedItem) selectItem(selectedItem);
28483
- const updateControls = updates.createControls(
28968
+ updateControls.update(
28484
28969
  selectedHost.hostId,
28485
28970
  items.flatMap((item) => item.version ? [item.version] : [])
28486
28971
  );
28487
- const hostHeader = document2.createElement("div");
28488
- hostHeader.className = "settings-connection-host-header";
28489
- hostHeader.append(hostStrip, updateControls.button);
28490
- list.append(hostHeader, updateControls.result, tableHeader, rows);
28491
- layout.append(list, inspector);
28492
- content.replaceChildren(layout);
28493
- disposeHostScroller = configureHostScroller(
28494
- document2,
28495
- hostStrip,
28496
- tabs,
28497
- scrollLeft,
28498
- scrollRight
28499
- );
28500
- const selectedTab = [...tabs.children].find(
28501
- (child) => child.getAttribute("aria-selected") === "true"
28502
- );
28503
- if (selectedTab) {
28504
- const left = selectedTab.offsetLeft;
28505
- const right = left + selectedTab.offsetWidth;
28506
- if (left < tabs.scrollLeft) tabs.scrollLeft = left;
28507
- else if (right > tabs.scrollLeft + tabs.clientWidth) {
28508
- tabs.scrollLeft = right - tabs.clientWidth;
28972
+ if (layoutFirstMount || tabsChanged) {
28973
+ hostScroller.update();
28974
+ }
28975
+ if (renderedHostId !== selectedHost.hostId) {
28976
+ renderedHostId = selectedHost.hostId;
28977
+ const selectedTab = hostTabElements.get(selectedHost.hostId);
28978
+ if (selectedTab) {
28979
+ const left = selectedTab.offsetLeft;
28980
+ const right = left + selectedTab.offsetWidth;
28981
+ if (left < tabs.scrollLeft) tabs.scrollLeft = left;
28982
+ else if (right > tabs.scrollLeft + tabs.clientWidth) {
28983
+ tabs.scrollLeft = right - tabs.clientWidth;
28984
+ }
28509
28985
  }
28510
28986
  }
28511
28987
  };
@@ -28526,7 +29002,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28526
29002
  refresh.disabled = true;
28527
29003
  return () => {
28528
29004
  cancelRender();
28529
- disposeHostScroller();
29005
+ hostScroller.dispose();
28530
29006
  unsubscribeGroup();
28531
29007
  };
28532
29008
  }
@@ -28535,7 +29011,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
28535
29011
  const unsubscribeInstalls = installs?.subscribe(scheduleRender);
28536
29012
  return () => {
28537
29013
  cancelRender();
28538
- disposeHostScroller();
29014
+ hostScroller.dispose();
28539
29015
  unsubscribeInstalls?.();
28540
29016
  unsubscribe();
28541
29017
  unsubscribeGroup();
@@ -30179,9 +30655,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
30179
30655
  resets: "Resets",
30180
30656
  details: "Account limit details",
30181
30657
  weekly: "Weekly limit",
30658
+ weeklyShort: "Weekly",
30182
30659
  monthly: "Monthly limit",
30660
+ monthlyShort: "Monthly",
30183
30661
  fiveHour: "5-hour limit",
30662
+ fiveHourShort: "5-hour",
30184
30663
  sevenDay: "7-day limit",
30664
+ sevenDayShort: "7-day",
30185
30665
  account: "Account limit"
30186
30666
  });
30187
30667
  var CHINESE_CREDITS_MESSAGES = Object.freeze({
@@ -30189,9 +30669,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
30189
30669
  resets: "\u91CD\u7F6E",
30190
30670
  details: "\u8D26\u53F7\u989D\u5EA6\u8BE6\u60C5",
30191
30671
  weekly: "\u5468\u989D\u5EA6",
30672
+ weeklyShort: "\u5468\u989D\u5EA6",
30192
30673
  monthly: "\u6708\u989D\u5EA6",
30674
+ monthlyShort: "\u6708\u989D\u5EA6",
30193
30675
  fiveHour: "5 \u5C0F\u65F6\u989D\u5EA6",
30676
+ fiveHourShort: "5 \u5C0F\u65F6",
30194
30677
  sevenDay: "7 \u5929\u989D\u5EA6",
30678
+ sevenDayShort: "7 \u5929",
30195
30679
  account: "\u8D26\u53F7\u989D\u5EA6"
30196
30680
  });
30197
30681
  function formatRendererCreditsReset(value, now = /* @__PURE__ */ new Date(), locale = "en") {
@@ -33166,6 +33650,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
33166
33650
  .settings-connection-inspector {
33167
33651
  position: sticky;
33168
33652
  top: 18px;
33653
+ overflow-anchor: none;
33169
33654
  }
33170
33655
 
33171
33656
  .settings-connection-inspector__header {