@codexhost/cli-darwin-x64 0.19.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.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +24 -3
- package/app/console-web.js +1095 -682
- package/app/desktop-controller.mjs +40 -4
- package/app/host-runtime.mjs +1572 -1120
- package/app/plugins/antigravity/plugin.mjs +8753 -4274
- package/app/plugins/claude-code/plugin.mjs +26 -3
- package/app/plugins/codebuddy/plugin.mjs +41 -5
- package/app/plugins/codex-usage/plugin.mjs +26 -3
- package/app/plugins/copilot/plugin.mjs +26 -3
- package/app/plugins/cursor-cli/plugin.mjs +26 -3
- package/app/plugins/deepseek-harness/plugin.mjs +26 -3
- package/app/plugins/devin/plugin.mjs +25 -3
- package/app/plugins/grok/plugin.mjs +26 -3
- package/app/plugins/hermes/plugin.mjs +25 -3
- package/app/plugins/kimi-code/plugin.mjs +26 -3
- package/app/plugins/kiro-cli/plugin.mjs +26 -3
- package/app/plugins/omp/plugin.mjs +44 -6
- package/app/plugins/opencode/plugin.mjs +26 -3
- package/app/plugins/pi/plugin.mjs +45 -6
- package/app/plugins/qoder/plugin.mjs +48 -4
- package/app/plugins/qoder-cn/plugin.mjs +48 -4
- package/app/plugins/qwen-code/plugin.mjs +26 -3
- package/app/plugins/workbuddy/plugin.mjs +45 -8
- package/app/plugins/zcode/plugin.mjs +26 -3
- package/app/renderer-extension.js +1411 -737
- package/app/web/assets/index-D6-hvggd.css +1 -0
- package/app/web/assets/index-D85gPBbQ.js +201 -0
- package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
- package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
- package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
- package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
- package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
- package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
- package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
- package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
- package/app/web/codexhost-settings.js +1101 -684
- package/app/web/index.html +4 -3
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +13 -13
- package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web-modules/server.mjs +138 -70
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BNQIOOHE.css +0 -1
- package/app/web/assets/index-Feo4BkqN.js +0 -199
|
@@ -14678,13 +14678,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14678
14678
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14679
14679
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
14680
14680
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14681
|
+
var usageOutputTimingSchema = external_exports.object({
|
|
14682
|
+
version: external_exports.literal(3).optional(),
|
|
14683
|
+
requestId: external_exports.string().min(1),
|
|
14684
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
14685
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
14686
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
14687
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
14688
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
14681
14689
|
var usageMeasurementSchema = external_exports.object({
|
|
14690
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
|
|
14682
14691
|
value: finiteNonNegativeNumberSchema,
|
|
14683
14692
|
turnId: external_exports.string().min(1).max(1024),
|
|
14684
14693
|
at: nonNegativeSafeIntegerSchema
|
|
14685
14694
|
}).strict();
|
|
14686
14695
|
var usageMeasurementsSchema = external_exports.object({
|
|
14687
|
-
|
|
14696
|
+
// Unversioned intervals can omit hidden thinking time; do not restore them into averages.
|
|
14697
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
|
|
14698
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
14699
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
|
|
14688
14700
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
14689
14701
|
}).strict();
|
|
14690
14702
|
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
@@ -14704,6 +14716,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14704
14716
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14705
14717
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14706
14718
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14719
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14707
14720
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14708
14721
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14709
14722
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15116,6 +15129,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15116
15129
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15117
15130
|
}).strict();
|
|
15118
15131
|
|
|
15132
|
+
// ../shared-contracts/dist/thread-archive-confirm.js
|
|
15133
|
+
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15134
|
+
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15135
|
+
|
|
15119
15136
|
// ../shared-contracts/dist/client-channel.js
|
|
15120
15137
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15121
15138
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
@@ -15255,7 +15272,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15255
15272
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
15256
15273
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
15257
15274
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
15258
|
-
command: external_exports.object({
|
|
15275
|
+
command: external_exports.object({
|
|
15276
|
+
name: external_exports.string().min(1),
|
|
15277
|
+
turn: clientTurnSchema,
|
|
15278
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
15279
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
15280
|
+
}).optional(),
|
|
15259
15281
|
thread: external_exports.object({
|
|
15260
15282
|
id: external_exports.string().min(1),
|
|
15261
15283
|
cwd: external_exports.string(),
|
|
@@ -15465,7 +15487,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15465
15487
|
quotaUntil: external_exports.string().optional()
|
|
15466
15488
|
}).strict().optional()
|
|
15467
15489
|
}).strict();
|
|
15468
|
-
var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
|
|
15469
15490
|
|
|
15470
15491
|
// ../shared-contracts/dist/delegation-read.js
|
|
15471
15492
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -16696,7 +16717,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16696
16717
|
await Promise.all(
|
|
16697
16718
|
plugins.map(async ({ id }) => {
|
|
16698
16719
|
try {
|
|
16699
|
-
const inspection = await client.inspectHarness({
|
|
16720
|
+
const inspection = await client.inspectHarness({
|
|
16721
|
+
harnessId: id,
|
|
16722
|
+
refresh,
|
|
16723
|
+
purpose: "availability"
|
|
16724
|
+
});
|
|
16700
16725
|
availability.set(id, inspection.status);
|
|
16701
16726
|
webUi.set(id, inspection.status === "ready" && inspection.webUi?.open === true);
|
|
16702
16727
|
const error51 = inspection.status === "ready" ? null : inspection.error;
|
|
@@ -21372,6 +21397,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
21372
21397
|
latestCacheHit: "Latest cache hit (CH)",
|
|
21373
21398
|
sessionCacheHit: "Average cache hit",
|
|
21374
21399
|
outputSpeed: "Output speed (TPS)",
|
|
21400
|
+
averageOutputSpeed: "Average output speed (TPS)",
|
|
21375
21401
|
apiOutputSpeed: "API average speed",
|
|
21376
21402
|
apiOutputSpeedDescription: "Output tokens / native API time, including first-token wait; not generation TPS.",
|
|
21377
21403
|
timeToFirstOutput: "Time to first token (TTFT)",
|
|
@@ -21397,6 +21423,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
21397
21423
|
latestCacheHit: "\u6700\u8FD1\u7F13\u5B58\u547D\u4E2D\uFF08CH\uFF09",
|
|
21398
21424
|
sessionCacheHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
|
|
21399
21425
|
outputSpeed: "\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
21426
|
+
averageOutputSpeed: "\u5E73\u5747\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
21400
21427
|
apiOutputSpeed: "API \u5E73\u5747\u901F\u5EA6",
|
|
21401
21428
|
apiOutputSpeedDescription: "\u8F93\u51FA Token \xF7 \u539F\u751F API \u8017\u65F6\uFF0C\u542B\u9996\u5B57\u7B49\u5F85\uFF1B\u4E0D\u662F\u751F\u6210 TPS\u3002",
|
|
21402
21429
|
timeToFirstOutput: "\u9996 token\uFF08TTFT\uFF09",
|
|
@@ -25413,242 +25440,474 @@ ${detail}` : ""}`
|
|
|
25413
25440
|
return fallback;
|
|
25414
25441
|
}
|
|
25415
25442
|
|
|
25416
|
-
// src/settings/
|
|
25417
|
-
function
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
25428
|
-
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
25429
|
-
label.append(input);
|
|
25430
|
-
const help = document2.createElement("p");
|
|
25431
|
-
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.";
|
|
25432
|
-
const actions = document2.createElement("div");
|
|
25433
|
-
actions.className = "settings-harness-launch__actions";
|
|
25434
|
-
const save = document2.createElement("button");
|
|
25435
|
-
save.type = "button";
|
|
25436
|
-
save.className = "settings-command-button";
|
|
25437
|
-
save.textContent = messages.launchPathSave;
|
|
25438
|
-
const reset = document2.createElement("button");
|
|
25439
|
-
reset.type = "button";
|
|
25440
|
-
reset.className = "settings-command-button settings-command-button--secondary";
|
|
25441
|
-
reset.textContent = messages.launchPathReset;
|
|
25442
|
-
const status = document2.createElement("p");
|
|
25443
|
-
status.setAttribute("role", "status");
|
|
25444
|
-
status.setAttribute("aria-live", "polite");
|
|
25445
|
-
actions.append(save, reset);
|
|
25446
|
-
section.append(label, help, actions, status);
|
|
25447
|
-
let busy = true;
|
|
25448
|
-
let loaded = false;
|
|
25449
|
-
const controls = () => {
|
|
25450
|
-
input.disabled = busy || !loaded;
|
|
25451
|
-
save.disabled = busy || !loaded || !input.value.trim();
|
|
25452
|
-
reset.disabled = busy || !loaded;
|
|
25453
|
-
};
|
|
25454
|
-
const show = (value) => {
|
|
25455
|
-
input.value = value.path ?? "";
|
|
25456
|
-
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
25457
|
-
};
|
|
25458
|
-
const persist = async (value) => {
|
|
25459
|
-
if (busy || !loaded) return;
|
|
25460
|
-
busy = true;
|
|
25461
|
-
controls();
|
|
25462
|
-
status.textContent = messages.launchPathSaving;
|
|
25463
|
-
try {
|
|
25464
|
-
show(await settings.set(value));
|
|
25465
|
-
} catch {
|
|
25466
|
-
status.textContent = messages.launchPathSaveError;
|
|
25467
|
-
} finally {
|
|
25468
|
-
busy = false;
|
|
25469
|
-
controls();
|
|
25470
|
-
}
|
|
25471
|
-
};
|
|
25472
|
-
input.addEventListener("input", controls);
|
|
25473
|
-
save.addEventListener("click", () => {
|
|
25474
|
-
if (input.value.trim()) void persist(input.value.trim());
|
|
25475
|
-
});
|
|
25476
|
-
reset.addEventListener("click", () => {
|
|
25477
|
-
void persist(null);
|
|
25478
|
-
});
|
|
25479
|
-
controls();
|
|
25480
|
-
status.textContent = messages.launchPathLoading;
|
|
25481
|
-
void settings.get().then((value) => {
|
|
25482
|
-
loaded = true;
|
|
25483
|
-
show(value);
|
|
25484
|
-
}).catch(() => {
|
|
25485
|
-
loaded = true;
|
|
25486
|
-
status.textContent = messages.launchPathLoadError;
|
|
25487
|
-
}).finally(() => {
|
|
25488
|
-
busy = false;
|
|
25489
|
-
controls();
|
|
25490
|
-
});
|
|
25491
|
-
return section;
|
|
25492
|
-
}
|
|
25493
|
-
|
|
25494
|
-
// src/settings/harness-installation-guides.ts
|
|
25495
|
-
function harnessHasInstallCommands(plugin) {
|
|
25496
|
-
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
25443
|
+
// src/settings/connection-row.ts
|
|
25444
|
+
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
25445
|
+
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
25446
|
+
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
25447
|
+
if (availability === "ready") return messages.connectionStatusReady;
|
|
25448
|
+
if (availability === "checking") return messages.connectionStatusChecking;
|
|
25449
|
+
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
25450
|
+
if (availability === "unavailable" || availability === "error") {
|
|
25451
|
+
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
25452
|
+
}
|
|
25453
|
+
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
25497
25454
|
}
|
|
25498
|
-
function
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
return
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
before: text(guide?.before),
|
|
25506
|
-
after: text(guide?.after)
|
|
25507
|
-
};
|
|
25455
|
+
function connectionStatusTone(availability, hasError = false) {
|
|
25456
|
+
if (availability === "updating") return "checking";
|
|
25457
|
+
if (hasError && availability !== "notInstalled") return "failed";
|
|
25458
|
+
if (availability === "ready") return "ready";
|
|
25459
|
+
if (availability === "checking" || availability === "installing") return "checking";
|
|
25460
|
+
if (availability === "notInstalled") return "setup";
|
|
25461
|
+
return "failed";
|
|
25508
25462
|
}
|
|
25509
|
-
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25518
|
-
|
|
25519
|
-
panel.append(p);
|
|
25520
|
-
};
|
|
25521
|
-
if (hostId2 !== "local") {
|
|
25522
|
-
paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
|
|
25463
|
+
function createConnectionIdentityIcon(document2, item, size) {
|
|
25464
|
+
const container = document2.createElement("span");
|
|
25465
|
+
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
25466
|
+
container.setAttribute("aria-hidden", "true");
|
|
25467
|
+
if (item.agentSnapshot) {
|
|
25468
|
+
container.append(
|
|
25469
|
+
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
25470
|
+
);
|
|
25471
|
+
} else {
|
|
25472
|
+
container.textContent = "CH";
|
|
25523
25473
|
}
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
install.disabled = installation.status !== "idle";
|
|
25531
|
-
install.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
|
|
25532
|
-
install.addEventListener("click", () => {
|
|
25533
|
-
if (install.disabled) return;
|
|
25534
|
-
install.disabled = true;
|
|
25535
|
-
install.textContent = messages.connectionStatusInstalling;
|
|
25536
|
-
installation.run();
|
|
25537
|
-
});
|
|
25538
|
-
if (guide.commands.length > 1) panel.append(install);
|
|
25474
|
+
return container;
|
|
25475
|
+
}
|
|
25476
|
+
function sameElementChildren(container, next) {
|
|
25477
|
+
if (container.children.length !== next.length) return false;
|
|
25478
|
+
for (let index = 0; index < next.length; index++) {
|
|
25479
|
+
if (container.children[index] !== next[index]) return false;
|
|
25539
25480
|
}
|
|
25540
|
-
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
|
|
25544
|
-
|
|
25545
|
-
|
|
25546
|
-
|
|
25547
|
-
code.textContent = command;
|
|
25548
|
-
pre.append(code);
|
|
25549
|
-
const button2 = document2.createElement("button");
|
|
25550
|
-
button2.type = "button";
|
|
25551
|
-
button2.className = "settings-command-button settings-command-button--secondary";
|
|
25552
|
-
button2.dataset.connectionAction = "copy-install";
|
|
25553
|
-
const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
|
|
25554
|
-
button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
|
|
25555
|
-
button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
|
|
25556
|
-
button2.addEventListener("click", () => copy(button2, command, copyLabel));
|
|
25557
|
-
const actions = document2.createElement("div");
|
|
25558
|
-
actions.className = "settings-harness-installation-actions";
|
|
25559
|
-
if (install && guide.commands.length === 1) actions.append(install);
|
|
25560
|
-
actions.append(button2);
|
|
25561
|
-
block.append(label, pre, actions);
|
|
25562
|
-
panel.append(block);
|
|
25481
|
+
return true;
|
|
25482
|
+
}
|
|
25483
|
+
function reconcileElementChildren(container, next) {
|
|
25484
|
+
if (sameElementChildren(container, next)) return;
|
|
25485
|
+
if (typeof container.insertBefore !== "function") {
|
|
25486
|
+
container.replaceChildren(...next);
|
|
25487
|
+
return;
|
|
25563
25488
|
}
|
|
25564
|
-
|
|
25565
|
-
|
|
25566
|
-
|
|
25567
|
-
link.href = download2.url;
|
|
25568
|
-
link.target = "_blank";
|
|
25569
|
-
link.rel = "noopener noreferrer";
|
|
25570
|
-
link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
|
|
25571
|
-
link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
|
|
25572
|
-
panel.append(link);
|
|
25489
|
+
const nextSet = new Set(next);
|
|
25490
|
+
for (const child of [...container.children]) {
|
|
25491
|
+
if (!nextSet.has(child)) child.remove();
|
|
25573
25492
|
}
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
|
|
25578
|
-
|
|
25579
|
-
|
|
25580
|
-
|
|
25581
|
-
panel.append(link);
|
|
25493
|
+
for (let index = 0; index < next.length; index++) {
|
|
25494
|
+
const desired = next[index];
|
|
25495
|
+
if (!desired) continue;
|
|
25496
|
+
const current = container.children[index] ?? null;
|
|
25497
|
+
if (current !== desired) {
|
|
25498
|
+
container.insertBefore(desired, current);
|
|
25499
|
+
}
|
|
25582
25500
|
}
|
|
25583
|
-
return panel;
|
|
25584
|
-
}
|
|
25585
|
-
|
|
25586
|
-
// src/settings/harness-install-store.ts
|
|
25587
|
-
function errorMessage(error51) {
|
|
25588
|
-
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.";
|
|
25589
25501
|
}
|
|
25590
|
-
function
|
|
25591
|
-
|
|
25502
|
+
function identityIconSignature(item) {
|
|
25503
|
+
if (!item.agentSnapshot) return "adapter";
|
|
25504
|
+
const plugin = item.agentSnapshot.plugin;
|
|
25505
|
+
return `${item.agentSnapshot.agent}:${String(plugin?.icon ?? "")}:${String(plugin?.iconStyle ?? "")}`;
|
|
25592
25506
|
}
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
const
|
|
25598
|
-
|
|
25507
|
+
function createConnectionRowView(document2, messages, groupable) {
|
|
25508
|
+
const row = document2.createElement("div");
|
|
25509
|
+
row.className = "settings-connection-row";
|
|
25510
|
+
row.setAttribute("role", "row");
|
|
25511
|
+
const identity2 = document2.createElement("div");
|
|
25512
|
+
identity2.className = "settings-connection-row__identity";
|
|
25513
|
+
identity2.setAttribute("role", "cell");
|
|
25514
|
+
let handle = null;
|
|
25515
|
+
if (groupable) {
|
|
25516
|
+
handle = document2.createElement("span");
|
|
25517
|
+
handle.className = "settings-connection-row__handle";
|
|
25518
|
+
handle.setAttribute("aria-hidden", "true");
|
|
25519
|
+
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
25520
|
+
identity2.append(handle);
|
|
25521
|
+
}
|
|
25522
|
+
let iconElement = null;
|
|
25523
|
+
let renderedIconKey = null;
|
|
25524
|
+
const label = document2.createElement("strong");
|
|
25525
|
+
const status = document2.createElement("span");
|
|
25526
|
+
status.className = "settings-connection-row__status";
|
|
25527
|
+
status.setAttribute("role", "cell");
|
|
25528
|
+
const action = document2.createElement("div");
|
|
25529
|
+
action.className = "settings-connection-row__action";
|
|
25530
|
+
action.setAttribute("role", "cell");
|
|
25531
|
+
row.append(identity2, status, action);
|
|
25532
|
+
let currentItem = null;
|
|
25533
|
+
let currentSelect = () => void 0;
|
|
25534
|
+
let currentGroup = null;
|
|
25535
|
+
let installButton = null;
|
|
25536
|
+
let viewErrorButton = null;
|
|
25537
|
+
let versionAvailableBadge = null;
|
|
25538
|
+
let updateButton = null;
|
|
25539
|
+
let groupToggleButton = null;
|
|
25540
|
+
let groupToggleSection = null;
|
|
25541
|
+
row.addEventListener("click", (event) => {
|
|
25542
|
+
const target2 = event.target;
|
|
25543
|
+
if (target2?.closest?.("a")) return;
|
|
25544
|
+
currentSelect();
|
|
25545
|
+
});
|
|
25546
|
+
row.addEventListener("keydown", (event) => {
|
|
25547
|
+
if (event.target?.closest?.("button, a")) return;
|
|
25548
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
25549
|
+
event.preventDefault();
|
|
25550
|
+
currentSelect();
|
|
25551
|
+
});
|
|
25552
|
+
if (groupable) {
|
|
25553
|
+
row.addEventListener("dragstart", (event) => currentGroup?.onDragStart(event));
|
|
25554
|
+
row.addEventListener("dragover", (event) => currentGroup?.onDragOver(event));
|
|
25555
|
+
row.addEventListener("dragleave", (event) => currentGroup?.onDragLeave(event));
|
|
25556
|
+
row.addEventListener("drop", (event) => currentGroup?.onDrop(event));
|
|
25557
|
+
row.addEventListener("dragend", (event) => currentGroup?.onDragEnd(event));
|
|
25558
|
+
}
|
|
25559
|
+
const setSelected = (selected) => {
|
|
25560
|
+
const nextSelected = String(selected);
|
|
25561
|
+
if (row.dataset.connectionSelected !== nextSelected) {
|
|
25562
|
+
row.dataset.connectionSelected = nextSelected;
|
|
25563
|
+
}
|
|
25564
|
+
const nextTabIndex = selected ? 0 : -1;
|
|
25565
|
+
if (row.tabIndex !== nextTabIndex) {
|
|
25566
|
+
row.tabIndex = nextTabIndex;
|
|
25567
|
+
}
|
|
25568
|
+
};
|
|
25599
25569
|
return {
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
|
|
25618
|
-
try {
|
|
25619
|
-
await diagnostics.installation(host, agent, "install");
|
|
25620
|
-
states2.set(id, { status: "checking" });
|
|
25621
|
-
notify2();
|
|
25622
|
-
} catch (error51) {
|
|
25623
|
-
failure = errorMessage(error51);
|
|
25570
|
+
element: row,
|
|
25571
|
+
setSelected,
|
|
25572
|
+
update(item, selected, select, group) {
|
|
25573
|
+
currentItem = item;
|
|
25574
|
+
currentSelect = select;
|
|
25575
|
+
currentGroup = group;
|
|
25576
|
+
if (row.dataset.connectionItem !== item.key) {
|
|
25577
|
+
row.dataset.connectionItem = item.key;
|
|
25578
|
+
}
|
|
25579
|
+
setSelected(selected);
|
|
25580
|
+
const nextIconKey = identityIconSignature(item);
|
|
25581
|
+
if (renderedIconKey !== nextIconKey || !iconElement) {
|
|
25582
|
+
renderedIconKey = nextIconKey;
|
|
25583
|
+
iconElement = createConnectionIdentityIcon(document2, item, 19);
|
|
25584
|
+
reconcileElementChildren(
|
|
25585
|
+
identity2,
|
|
25586
|
+
handle ? [handle, iconElement, label] : [iconElement, label]
|
|
25587
|
+
);
|
|
25624
25588
|
}
|
|
25625
|
-
|
|
25626
|
-
|
|
25627
|
-
|
|
25628
|
-
|
|
25629
|
-
|
|
25630
|
-
|
|
25589
|
+
if (handle && group && handle.title !== group.dragHandleTitle) {
|
|
25590
|
+
handle.title = group.dragHandleTitle;
|
|
25591
|
+
}
|
|
25592
|
+
if (label.textContent !== item.name) {
|
|
25593
|
+
label.textContent = item.name;
|
|
25594
|
+
}
|
|
25595
|
+
const tone = connectionStatusTone(item.availability, item.error !== null);
|
|
25596
|
+
if (status.dataset.connectionTone !== tone) {
|
|
25597
|
+
status.dataset.connectionTone = tone;
|
|
25598
|
+
}
|
|
25599
|
+
const statusText = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
25600
|
+
if (status.textContent !== statusText) {
|
|
25601
|
+
status.textContent = statusText;
|
|
25602
|
+
}
|
|
25603
|
+
const nextActions = [];
|
|
25604
|
+
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
25605
|
+
if (!installButton) {
|
|
25606
|
+
const button2 = document2.createElement("button");
|
|
25607
|
+
button2.type = "button";
|
|
25608
|
+
button2.className = "settings-connection-install-link";
|
|
25609
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
25610
|
+
button2.addEventListener("click", (event) => {
|
|
25611
|
+
event.stopPropagation();
|
|
25612
|
+
currentSelect();
|
|
25613
|
+
currentItem?.install?.();
|
|
25614
|
+
});
|
|
25615
|
+
installButton = button2;
|
|
25616
|
+
}
|
|
25617
|
+
installButton.disabled = item.availability === "installing" || item.availability === "checking";
|
|
25618
|
+
const installLabel = messages.connectionInstall;
|
|
25619
|
+
const ariaLabel = `${installLabel}: ${item.name}`;
|
|
25620
|
+
if (installButton.getAttribute("aria-label") !== ariaLabel) {
|
|
25621
|
+
installButton.setAttribute("aria-label", ariaLabel);
|
|
25622
|
+
}
|
|
25623
|
+
if (installButton.title !== installLabel) {
|
|
25624
|
+
installButton.title = installLabel;
|
|
25625
|
+
}
|
|
25626
|
+
nextActions.push(installButton);
|
|
25627
|
+
} else if (item.error) {
|
|
25628
|
+
if (!viewErrorButton) {
|
|
25629
|
+
const button2 = document2.createElement("button");
|
|
25630
|
+
button2.type = "button";
|
|
25631
|
+
button2.className = "settings-connection-view-error";
|
|
25632
|
+
button2.textContent = messages.connectionViewError;
|
|
25633
|
+
button2.addEventListener("click", (event) => {
|
|
25634
|
+
event.stopPropagation();
|
|
25635
|
+
currentSelect();
|
|
25636
|
+
});
|
|
25637
|
+
viewErrorButton = button2;
|
|
25638
|
+
}
|
|
25639
|
+
nextActions.push(viewErrorButton);
|
|
25640
|
+
}
|
|
25641
|
+
const version2 = item.version;
|
|
25642
|
+
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
25643
|
+
if (!versionAvailableBadge) {
|
|
25644
|
+
const badge = document2.createElement("span");
|
|
25645
|
+
badge.className = "settings-connection-version-available";
|
|
25646
|
+
badge.textContent = messages.harnessVersionAvailable;
|
|
25647
|
+
versionAvailableBadge = badge;
|
|
25648
|
+
}
|
|
25649
|
+
const badgeTitle = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
25650
|
+
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
25651
|
+
if (versionAvailableBadge.title !== badgeTitle) {
|
|
25652
|
+
versionAvailableBadge.title = badgeTitle;
|
|
25653
|
+
}
|
|
25654
|
+
nextActions.push(versionAvailableBadge);
|
|
25655
|
+
}
|
|
25656
|
+
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
25657
|
+
if (!updateButton) {
|
|
25658
|
+
const button2 = document2.createElement("button");
|
|
25659
|
+
button2.type = "button";
|
|
25660
|
+
button2.className = "settings-connection-install-link";
|
|
25661
|
+
button2.dataset.connectionAction = "update";
|
|
25662
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
25663
|
+
button2.addEventListener("click", (event) => {
|
|
25664
|
+
event.stopPropagation();
|
|
25665
|
+
if (button2.disabled) return;
|
|
25666
|
+
void currentItem?.version?.update();
|
|
25667
|
+
currentSelect();
|
|
25668
|
+
});
|
|
25669
|
+
updateButton = button2;
|
|
25670
|
+
}
|
|
25671
|
+
updateButton.disabled = version2.updating;
|
|
25672
|
+
if (updateButton.title !== messages.harnessVersionUpdate) {
|
|
25673
|
+
updateButton.title = messages.harnessVersionUpdate;
|
|
25674
|
+
}
|
|
25675
|
+
const updateAriaLabel = `${messages.harnessVersionUpdate}: ${item.name}`;
|
|
25676
|
+
if (updateButton.getAttribute("aria-label") !== updateAriaLabel) {
|
|
25677
|
+
updateButton.setAttribute("aria-label", updateAriaLabel);
|
|
25678
|
+
}
|
|
25679
|
+
nextActions.push(updateButton);
|
|
25680
|
+
}
|
|
25681
|
+
if (group) {
|
|
25682
|
+
if (!groupToggleButton) {
|
|
25683
|
+
const button2 = document2.createElement("button");
|
|
25684
|
+
button2.type = "button";
|
|
25685
|
+
button2.className = "settings-connection-row__group-toggle";
|
|
25686
|
+
button2.addEventListener("click", (event) => {
|
|
25687
|
+
event.stopPropagation();
|
|
25688
|
+
currentGroup?.toggleSection();
|
|
25689
|
+
});
|
|
25690
|
+
groupToggleButton = button2;
|
|
25691
|
+
}
|
|
25692
|
+
groupToggleButton.disabled = group.disabled;
|
|
25693
|
+
if (groupToggleButton.title !== group.moveLabel) {
|
|
25694
|
+
groupToggleButton.title = group.moveLabel;
|
|
25695
|
+
}
|
|
25696
|
+
if (groupToggleButton.getAttribute("aria-label") !== group.moveLabel) {
|
|
25697
|
+
groupToggleButton.setAttribute("aria-label", group.moveLabel);
|
|
25698
|
+
}
|
|
25699
|
+
if (groupToggleSection !== group.section) {
|
|
25700
|
+
groupToggleSection = group.section;
|
|
25701
|
+
groupToggleButton.replaceChildren(
|
|
25702
|
+
createRendererSettingsIcon(
|
|
25703
|
+
group.section === "main" ? "chevron-down" : "chevron-up",
|
|
25704
|
+
15
|
|
25705
|
+
)
|
|
25706
|
+
);
|
|
25707
|
+
}
|
|
25708
|
+
nextActions.push(groupToggleButton);
|
|
25709
|
+
}
|
|
25710
|
+
reconcileElementChildren(action, nextActions);
|
|
25711
|
+
if (group) {
|
|
25712
|
+
row.draggable = !group.disabled;
|
|
25713
|
+
if (row.dataset.connectionGroupSection !== group.section) {
|
|
25714
|
+
row.dataset.connectionGroupSection = group.section;
|
|
25631
25715
|
}
|
|
25632
|
-
} catch (error51) {
|
|
25633
|
-
failure ??= errorMessage(error51);
|
|
25634
25716
|
}
|
|
25635
|
-
if (failure) states2.set(id, { status: "error", error: failure });
|
|
25636
|
-
else states2.delete(id);
|
|
25637
|
-
notify2();
|
|
25638
25717
|
}
|
|
25639
25718
|
};
|
|
25640
25719
|
}
|
|
25641
|
-
|
|
25642
|
-
|
|
25720
|
+
|
|
25721
|
+
// src/settings/connection-updates.ts
|
|
25722
|
+
var sharedBatchStores = /* @__PURE__ */ new WeakMap();
|
|
25723
|
+
function getBatchStore(diagnostics) {
|
|
25724
|
+
if (!diagnostics) {
|
|
25725
|
+
return { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
25726
|
+
}
|
|
25727
|
+
let store = sharedBatchStores.get(diagnostics);
|
|
25643
25728
|
if (!store) {
|
|
25644
|
-
store =
|
|
25645
|
-
|
|
25729
|
+
store = { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
25730
|
+
sharedBatchStores.set(diagnostics, store);
|
|
25646
25731
|
}
|
|
25647
25732
|
return store;
|
|
25648
25733
|
}
|
|
25734
|
+
function createConnectionUpdates(document2, messages, signal, onChange, diagnostics = null) {
|
|
25735
|
+
const store = getBatchStore(diagnostics);
|
|
25736
|
+
const notify2 = () => {
|
|
25737
|
+
for (const listener of [...store.listeners]) listener();
|
|
25738
|
+
};
|
|
25739
|
+
if (!signal.aborted) {
|
|
25740
|
+
const listener = () => {
|
|
25741
|
+
if (!signal.aborted) onChange();
|
|
25742
|
+
};
|
|
25743
|
+
store.listeners.add(listener);
|
|
25744
|
+
signal.addEventListener(
|
|
25745
|
+
"abort",
|
|
25746
|
+
() => {
|
|
25747
|
+
store.listeners.delete(listener);
|
|
25748
|
+
},
|
|
25749
|
+
{ once: true }
|
|
25750
|
+
);
|
|
25751
|
+
}
|
|
25752
|
+
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
25753
|
+
const start = async (hostId2, panels) => {
|
|
25754
|
+
if (signal.aborted || store.batches.get(hostId2)?.running) return;
|
|
25755
|
+
const targets = eligible(panels);
|
|
25756
|
+
if (!targets.length) return;
|
|
25757
|
+
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
25758
|
+
store.batches.set(hostId2, batch);
|
|
25759
|
+
notify2();
|
|
25760
|
+
await Promise.all(
|
|
25761
|
+
targets.map(async (panel) => {
|
|
25762
|
+
try {
|
|
25763
|
+
if (await panel.update()) batch.succeeded++;
|
|
25764
|
+
else batch.failed++;
|
|
25765
|
+
} catch {
|
|
25766
|
+
batch.failed++;
|
|
25767
|
+
}
|
|
25768
|
+
notify2();
|
|
25769
|
+
})
|
|
25770
|
+
);
|
|
25771
|
+
batch.running = false;
|
|
25772
|
+
notify2();
|
|
25773
|
+
};
|
|
25774
|
+
return {
|
|
25775
|
+
createControls(hostId2, panels) {
|
|
25776
|
+
let currentHostId = hostId2;
|
|
25777
|
+
let currentPanels = panels;
|
|
25778
|
+
let renderedLabel = null;
|
|
25779
|
+
const button2 = document2.createElement("button");
|
|
25780
|
+
button2.type = "button";
|
|
25781
|
+
button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
|
|
25782
|
+
button2.dataset.connectionAction = "update-all";
|
|
25783
|
+
button2.title = messages.harnessUpdateAllDescription;
|
|
25784
|
+
button2.addEventListener("click", () => {
|
|
25785
|
+
if (!button2.disabled) void start(currentHostId, currentPanels);
|
|
25786
|
+
});
|
|
25787
|
+
const result = document2.createElement("p");
|
|
25788
|
+
result.className = "settings-connection-update-result";
|
|
25789
|
+
result.setAttribute("role", "status");
|
|
25790
|
+
const update = (nextHostId, nextPanels) => {
|
|
25791
|
+
currentHostId = nextHostId;
|
|
25792
|
+
currentPanels = nextPanels;
|
|
25793
|
+
const batch = store.batches.get(nextHostId);
|
|
25794
|
+
const count3 = eligible(nextPanels).length;
|
|
25795
|
+
button2.disabled = signal.aborted || Boolean(batch?.running) || !count3;
|
|
25796
|
+
const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count3 ? `${messages.harnessUpdateAll} (${count3})` : messages.harnessUpdateAll;
|
|
25797
|
+
if (renderedLabel !== label) {
|
|
25798
|
+
renderedLabel = label;
|
|
25799
|
+
button2.replaceChildren(createRendererSettingsIcon("download", 15), label);
|
|
25800
|
+
}
|
|
25801
|
+
const hidden = !batch || batch.running;
|
|
25802
|
+
result.hidden = hidden;
|
|
25803
|
+
const resultText = batch && !batch.running ? messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed)) : "";
|
|
25804
|
+
if (result.textContent !== resultText) {
|
|
25805
|
+
result.textContent = resultText;
|
|
25806
|
+
}
|
|
25807
|
+
};
|
|
25808
|
+
update(hostId2, panels);
|
|
25809
|
+
return { button: button2, result, update };
|
|
25810
|
+
}
|
|
25811
|
+
};
|
|
25812
|
+
}
|
|
25649
25813
|
|
|
25650
25814
|
// src/settings/harness-version-panel.ts
|
|
25651
|
-
function
|
|
25815
|
+
function isUnsupportedInstallationError(error51) {
|
|
25816
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
25817
|
+
}
|
|
25818
|
+
function createHarnessVersionSession(client, options) {
|
|
25819
|
+
let state;
|
|
25820
|
+
let statusKind = "checking";
|
|
25821
|
+
let checkPromise = null;
|
|
25822
|
+
let updatePromise = null;
|
|
25823
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
25824
|
+
const signal = options?.signal;
|
|
25825
|
+
const notify2 = (pageChange) => {
|
|
25826
|
+
if (signal?.aborted) return;
|
|
25827
|
+
for (const listener of [...listeners]) listener(pageChange);
|
|
25828
|
+
};
|
|
25829
|
+
const check2 = () => {
|
|
25830
|
+
if (signal?.aborted || updatePromise) return Promise.resolve();
|
|
25831
|
+
if (checkPromise) return checkPromise;
|
|
25832
|
+
statusKind = "checking";
|
|
25833
|
+
notify2(false);
|
|
25834
|
+
checkPromise = (async () => {
|
|
25835
|
+
try {
|
|
25836
|
+
const result = await client.run("check");
|
|
25837
|
+
if (signal?.aborted || updatePromise) return;
|
|
25838
|
+
state = result;
|
|
25839
|
+
statusKind = "idle";
|
|
25840
|
+
} catch (error51) {
|
|
25841
|
+
if (signal?.aborted || updatePromise) return;
|
|
25842
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
25843
|
+
if (state) state = { ...state, canUpdate: false };
|
|
25844
|
+
} finally {
|
|
25845
|
+
checkPromise = null;
|
|
25846
|
+
if (!signal?.aborted && !updatePromise) {
|
|
25847
|
+
notify2(true);
|
|
25848
|
+
}
|
|
25849
|
+
}
|
|
25850
|
+
})();
|
|
25851
|
+
return checkPromise;
|
|
25852
|
+
};
|
|
25853
|
+
const update = () => {
|
|
25854
|
+
if (updatePromise) return updatePromise;
|
|
25855
|
+
updatePromise = (async () => {
|
|
25856
|
+
if (signal?.aborted) return false;
|
|
25857
|
+
if (checkPromise) await checkPromise;
|
|
25858
|
+
if (signal?.aborted || statusKind === "unsupported" || !state?.canUpdate || !state.updateAvailable) {
|
|
25859
|
+
return false;
|
|
25860
|
+
}
|
|
25861
|
+
statusKind = "updating";
|
|
25862
|
+
notify2(true);
|
|
25863
|
+
try {
|
|
25864
|
+
const result = await client.run("update");
|
|
25865
|
+
if (signal?.aborted) return false;
|
|
25866
|
+
state = result;
|
|
25867
|
+
statusKind = !result.canUpdate ? "updated" : result.updateAvailable ? "failed" : "updated";
|
|
25868
|
+
return result.canUpdate && !result.updateAvailable;
|
|
25869
|
+
} catch (error51) {
|
|
25870
|
+
if (signal?.aborted) return false;
|
|
25871
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
25872
|
+
if (state) state = { ...state, canUpdate: false };
|
|
25873
|
+
return false;
|
|
25874
|
+
} finally {
|
|
25875
|
+
updatePromise = null;
|
|
25876
|
+
if (!signal?.aborted) {
|
|
25877
|
+
notify2(true);
|
|
25878
|
+
}
|
|
25879
|
+
}
|
|
25880
|
+
})();
|
|
25881
|
+
return updatePromise;
|
|
25882
|
+
};
|
|
25883
|
+
return {
|
|
25884
|
+
get state() {
|
|
25885
|
+
return state;
|
|
25886
|
+
},
|
|
25887
|
+
get statusKind() {
|
|
25888
|
+
return statusKind;
|
|
25889
|
+
},
|
|
25890
|
+
get updating() {
|
|
25891
|
+
return statusKind === "updating";
|
|
25892
|
+
},
|
|
25893
|
+
prepareMount() {
|
|
25894
|
+
if (updatePromise || checkPromise) return false;
|
|
25895
|
+
statusKind = "checking";
|
|
25896
|
+
return true;
|
|
25897
|
+
},
|
|
25898
|
+
check: check2,
|
|
25899
|
+
update,
|
|
25900
|
+
subscribe(listener) {
|
|
25901
|
+
listeners.add(listener);
|
|
25902
|
+
return () => {
|
|
25903
|
+
listeners.delete(listener);
|
|
25904
|
+
};
|
|
25905
|
+
}
|
|
25906
|
+
};
|
|
25907
|
+
}
|
|
25908
|
+
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0, sharedSession) {
|
|
25909
|
+
const session = sharedSession ?? createHarnessVersionSession(client, { signal });
|
|
25910
|
+
const shouldScheduleCheck = session.prepareMount();
|
|
25652
25911
|
const panel = document2.createElement("section");
|
|
25653
25912
|
panel.className = "settings-harness-version";
|
|
25654
25913
|
panel.dataset.harnessVersion = agent;
|
|
@@ -25672,15 +25931,14 @@ ${detail}` : ""}`
|
|
|
25672
25931
|
note.textContent = messages.harnessVersionNote;
|
|
25673
25932
|
actions.append(update);
|
|
25674
25933
|
panel.append(heading, versions, status, actions, note);
|
|
25675
|
-
let state;
|
|
25676
|
-
let busy = false;
|
|
25677
|
-
let updating = false;
|
|
25678
|
-
let unsupported = false;
|
|
25679
|
-
let updatePromise = null;
|
|
25680
25934
|
const render = () => {
|
|
25935
|
+
const state = session.state;
|
|
25936
|
+
const statusKind = session.statusKind;
|
|
25937
|
+
const busy = statusKind === "checking" || statusKind === "updating";
|
|
25681
25938
|
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
25682
25939
|
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
25683
25940
|
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
25941
|
+
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 : "";
|
|
25684
25942
|
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
25685
25943
|
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
25686
25944
|
actions.replaceChildren(update);
|
|
@@ -25699,99 +25957,92 @@ ${detail}` : ""}`
|
|
|
25699
25957
|
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
25700
25958
|
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
25701
25959
|
};
|
|
25702
|
-
|
|
25703
|
-
if (
|
|
25704
|
-
|
|
25705
|
-
|
|
25706
|
-
|
|
25707
|
-
onChange();
|
|
25708
|
-
status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
|
|
25960
|
+
update.addEventListener("click", () => {
|
|
25961
|
+
if (!signal.aborted) void session.update();
|
|
25962
|
+
});
|
|
25963
|
+
const unsubscribe = session.subscribe((pageChange) => {
|
|
25964
|
+
if (signal.aborted) return;
|
|
25709
25965
|
render();
|
|
25710
|
-
|
|
25711
|
-
|
|
25712
|
-
if (signal.aborted) return false;
|
|
25713
|
-
state = result;
|
|
25714
|
-
status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
|
|
25715
|
-
return result.canUpdate && !result.updateAvailable;
|
|
25716
|
-
} catch (error51) {
|
|
25717
|
-
if (signal.aborted) return false;
|
|
25718
|
-
unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
25719
|
-
status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
|
|
25720
|
-
if (state) state = { ...state, canUpdate: false };
|
|
25721
|
-
return false;
|
|
25722
|
-
} finally {
|
|
25723
|
-
busy = false;
|
|
25724
|
-
updating = false;
|
|
25725
|
-
if (!signal.aborted) {
|
|
25726
|
-
render();
|
|
25727
|
-
onChange();
|
|
25728
|
-
}
|
|
25729
|
-
}
|
|
25730
|
-
};
|
|
25731
|
-
const updateVersion = () => {
|
|
25732
|
-
updatePromise ??= run("update").finally(() => {
|
|
25733
|
-
updatePromise = null;
|
|
25734
|
-
});
|
|
25735
|
-
return updatePromise;
|
|
25736
|
-
};
|
|
25737
|
-
update.addEventListener("click", () => void updateVersion());
|
|
25966
|
+
if (pageChange) onChange();
|
|
25967
|
+
});
|
|
25738
25968
|
const owner = document2.defaultView;
|
|
25739
25969
|
let checkFrame = null;
|
|
25740
25970
|
let checkTimer = null;
|
|
25741
25971
|
signal.addEventListener(
|
|
25742
25972
|
"abort",
|
|
25743
25973
|
() => {
|
|
25974
|
+
unsubscribe();
|
|
25744
25975
|
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
25745
25976
|
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
25746
25977
|
render();
|
|
25747
25978
|
},
|
|
25748
25979
|
{ once: true }
|
|
25749
25980
|
);
|
|
25750
|
-
status.textContent = messages.harnessVersionChecking;
|
|
25751
25981
|
render();
|
|
25752
|
-
if (!signal.aborted
|
|
25753
|
-
|
|
25754
|
-
checkFrame =
|
|
25755
|
-
|
|
25756
|
-
|
|
25757
|
-
checkTimer =
|
|
25758
|
-
|
|
25759
|
-
|
|
25760
|
-
|
|
25761
|
-
|
|
25762
|
-
|
|
25982
|
+
if (shouldScheduleCheck && !signal.aborted) {
|
|
25983
|
+
if (owner?.requestAnimationFrame) {
|
|
25984
|
+
checkFrame = owner.requestAnimationFrame(() => {
|
|
25985
|
+
checkFrame = null;
|
|
25986
|
+
if (signal.aborted) return;
|
|
25987
|
+
checkTimer = owner.setTimeout(() => {
|
|
25988
|
+
checkTimer = null;
|
|
25989
|
+
if (!signal.aborted) void session.check();
|
|
25990
|
+
}, 0);
|
|
25991
|
+
});
|
|
25992
|
+
} else {
|
|
25993
|
+
void session.check();
|
|
25994
|
+
}
|
|
25763
25995
|
}
|
|
25764
25996
|
return {
|
|
25765
25997
|
element: panel,
|
|
25766
25998
|
get state() {
|
|
25767
|
-
return state;
|
|
25999
|
+
return session.state;
|
|
25768
26000
|
},
|
|
25769
26001
|
get updating() {
|
|
25770
|
-
return updating;
|
|
26002
|
+
return session.updating;
|
|
25771
26003
|
},
|
|
25772
|
-
update:
|
|
26004
|
+
update: () => signal.aborted ? Promise.resolve(false) : session.update()
|
|
25773
26005
|
};
|
|
25774
26006
|
}
|
|
25775
26007
|
|
|
25776
26008
|
// src/settings/connection-versions.ts
|
|
26009
|
+
var sessionStores = /* @__PURE__ */ new WeakMap();
|
|
26010
|
+
function getSessionStore(diagnostics) {
|
|
26011
|
+
let store = sessionStores.get(diagnostics);
|
|
26012
|
+
if (!store) {
|
|
26013
|
+
store = /* @__PURE__ */ new Map();
|
|
26014
|
+
sessionStores.set(diagnostics, store);
|
|
26015
|
+
}
|
|
26016
|
+
return store;
|
|
26017
|
+
}
|
|
25777
26018
|
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
25778
26019
|
const panels = /* @__PURE__ */ new Map();
|
|
25779
26020
|
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
26021
|
+
const sessions = diagnostics ? getSessionStore(diagnostics) : null;
|
|
26022
|
+
const sessionKey = (hostId2, agent) => JSON.stringify([hostId2, agent]);
|
|
25780
26023
|
return {
|
|
26024
|
+
isUpdating(hostId2, agent) {
|
|
26025
|
+
return Boolean(sessions?.get(sessionKey(hostId2, agent))?.updating);
|
|
26026
|
+
},
|
|
25781
26027
|
get(hostId2, agent) {
|
|
25782
26028
|
if (!installation || signal.aborted) return void 0;
|
|
25783
|
-
const key =
|
|
26029
|
+
const key = sessionKey(hostId2, agent);
|
|
25784
26030
|
let panel = panels.get(key);
|
|
25785
26031
|
if (!panel) {
|
|
26032
|
+
const run = (action) => installation(hostId2, agent, action);
|
|
26033
|
+
let session = sessions?.get(key);
|
|
26034
|
+
if (!session) {
|
|
26035
|
+
session = createHarnessVersionSession({ run });
|
|
26036
|
+
sessions?.set(key, session);
|
|
26037
|
+
}
|
|
25786
26038
|
panel = createHarnessVersionPanel(
|
|
25787
26039
|
document2,
|
|
25788
26040
|
messages,
|
|
25789
26041
|
signal,
|
|
25790
26042
|
agent,
|
|
25791
|
-
{
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
onChange
|
|
26043
|
+
{ run },
|
|
26044
|
+
onChange,
|
|
26045
|
+
session
|
|
25795
26046
|
);
|
|
25796
26047
|
panels.set(key, panel);
|
|
25797
26048
|
}
|
|
@@ -25800,79 +26051,242 @@ ${detail}` : ""}`
|
|
|
25800
26051
|
};
|
|
25801
26052
|
}
|
|
25802
26053
|
|
|
25803
|
-
// src/settings/
|
|
25804
|
-
function
|
|
25805
|
-
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
|
|
25809
|
-
|
|
25810
|
-
|
|
25811
|
-
|
|
25812
|
-
|
|
25813
|
-
|
|
25814
|
-
|
|
25815
|
-
|
|
25816
|
-
|
|
25817
|
-
|
|
25818
|
-
|
|
25819
|
-
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
|
|
25826
|
-
|
|
26054
|
+
// src/settings/harness-install-store.ts
|
|
26055
|
+
function errorMessage(error51) {
|
|
26056
|
+
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.";
|
|
26057
|
+
}
|
|
26058
|
+
function unknownInstallOutcome(message2) {
|
|
26059
|
+
return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
|
|
26060
|
+
}
|
|
26061
|
+
var stores = /* @__PURE__ */ new WeakMap();
|
|
26062
|
+
function createStore(diagnostics) {
|
|
26063
|
+
const states2 = /* @__PURE__ */ new Map();
|
|
26064
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
26065
|
+
const key = (host, agent) => JSON.stringify([host, agent]);
|
|
26066
|
+
const notify2 = () => listeners.forEach((listener) => listener());
|
|
26067
|
+
return {
|
|
26068
|
+
get: (host, agent) => states2.get(key(host, agent)),
|
|
26069
|
+
clearErrors() {
|
|
26070
|
+
for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
|
|
26071
|
+
notify2();
|
|
26072
|
+
},
|
|
26073
|
+
subscribe(listener) {
|
|
26074
|
+
listeners.add(listener);
|
|
26075
|
+
return () => {
|
|
26076
|
+
listeners.delete(listener);
|
|
26077
|
+
};
|
|
26078
|
+
},
|
|
26079
|
+
async install(host, agent) {
|
|
26080
|
+
const id = key(host, agent);
|
|
26081
|
+
const previous = states2.get(id);
|
|
26082
|
+
if (!diagnostics.installation || previous && previous.status !== "error") return;
|
|
26083
|
+
states2.set(id, { status: "installing" });
|
|
26084
|
+
notify2();
|
|
26085
|
+
let failure;
|
|
26086
|
+
try {
|
|
26087
|
+
await diagnostics.installation(host, agent, "install");
|
|
26088
|
+
states2.set(id, { status: "checking" });
|
|
26089
|
+
notify2();
|
|
26090
|
+
} catch (error51) {
|
|
26091
|
+
failure = errorMessage(error51);
|
|
26092
|
+
}
|
|
26093
|
+
try {
|
|
26094
|
+
await diagnostics.refresh(host);
|
|
26095
|
+
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
26096
|
+
if (refreshed?.availability === "ready") failure = void 0;
|
|
26097
|
+
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
26098
|
+
failure = void 0;
|
|
26099
|
+
}
|
|
26100
|
+
} catch (error51) {
|
|
26101
|
+
failure ??= errorMessage(error51);
|
|
26102
|
+
}
|
|
26103
|
+
if (failure) states2.set(id, { status: "error", error: failure });
|
|
26104
|
+
else states2.delete(id);
|
|
26105
|
+
notify2();
|
|
26106
|
+
}
|
|
26107
|
+
};
|
|
26108
|
+
}
|
|
26109
|
+
function harnessInstallStore(diagnostics) {
|
|
26110
|
+
let store = stores.get(diagnostics);
|
|
26111
|
+
if (!store) {
|
|
26112
|
+
store = createStore(diagnostics);
|
|
26113
|
+
stores.set(diagnostics, store);
|
|
26114
|
+
}
|
|
26115
|
+
return store;
|
|
26116
|
+
}
|
|
26117
|
+
|
|
26118
|
+
// src/settings/harness-installation-guides.ts
|
|
26119
|
+
function harnessHasInstallCommands(plugin) {
|
|
26120
|
+
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
26121
|
+
}
|
|
26122
|
+
function harnessInstallationGuide(plugin, locale) {
|
|
26123
|
+
const guide = plugin?.installation;
|
|
26124
|
+
const text = (value) => value?.[locale] ?? value?.en;
|
|
26125
|
+
return {
|
|
26126
|
+
url: plugin?.links?.installation ?? plugin?.links?.documentation ?? plugin?.links?.website,
|
|
26127
|
+
commands: guide?.commands ?? [],
|
|
26128
|
+
downloads: guide?.downloads ?? [],
|
|
26129
|
+
before: text(guide?.before),
|
|
26130
|
+
after: text(guide?.after)
|
|
26131
|
+
};
|
|
26132
|
+
}
|
|
26133
|
+
|
|
26134
|
+
// src/settings/harness-installation-panel.ts
|
|
26135
|
+
function createHarnessInstallationPanel(document2, plugin, hostId2, messages, copy, installation) {
|
|
26136
|
+
const zh = messages.locale === "zh-CN";
|
|
26137
|
+
const guide = harnessInstallationGuide(plugin, messages.locale);
|
|
26138
|
+
const panel = document2.createElement("div");
|
|
26139
|
+
panel.className = "settings-harness-installation";
|
|
26140
|
+
const paragraph = (text) => {
|
|
26141
|
+
const p = document2.createElement("p");
|
|
26142
|
+
p.textContent = text;
|
|
26143
|
+
panel.append(p);
|
|
26144
|
+
};
|
|
26145
|
+
if (hostId2 !== "local") {
|
|
26146
|
+
paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
|
|
26147
|
+
}
|
|
26148
|
+
if (guide.before) paragraph(guide.before);
|
|
26149
|
+
const install = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
|
|
26150
|
+
if (install && installation) {
|
|
26151
|
+
install.type = "button";
|
|
26152
|
+
install.className = "settings-command-button";
|
|
26153
|
+
install.dataset.connectionAction = "install";
|
|
26154
|
+
install.disabled = installation.status !== "idle";
|
|
26155
|
+
install.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
|
|
26156
|
+
install.addEventListener("click", () => {
|
|
26157
|
+
if (install.disabled) return;
|
|
26158
|
+
install.disabled = true;
|
|
26159
|
+
install.textContent = messages.connectionStatusInstalling;
|
|
26160
|
+
installation.run();
|
|
26161
|
+
});
|
|
26162
|
+
if (guide.commands.length > 1) panel.append(install);
|
|
26163
|
+
}
|
|
26164
|
+
for (const { terminal, command } of guide.commands) {
|
|
26165
|
+
const block = document2.createElement("div");
|
|
26166
|
+
block.className = "settings-harness-installation-command";
|
|
26167
|
+
const label = document2.createElement("strong");
|
|
26168
|
+
label.textContent = terminal;
|
|
26169
|
+
const pre = document2.createElement("pre");
|
|
26170
|
+
const code = document2.createElement("code");
|
|
26171
|
+
code.textContent = command;
|
|
26172
|
+
pre.append(code);
|
|
26173
|
+
const button2 = document2.createElement("button");
|
|
26174
|
+
button2.type = "button";
|
|
26175
|
+
button2.className = "settings-command-button settings-command-button--secondary";
|
|
26176
|
+
button2.dataset.connectionAction = "copy-install";
|
|
26177
|
+
const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
|
|
26178
|
+
button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
|
|
26179
|
+
button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
|
|
26180
|
+
button2.addEventListener("click", () => copy(button2, command, copyLabel));
|
|
26181
|
+
const actions = document2.createElement("div");
|
|
26182
|
+
actions.className = "settings-harness-installation-actions";
|
|
26183
|
+
if (install && guide.commands.length === 1) actions.append(install);
|
|
26184
|
+
actions.append(button2);
|
|
26185
|
+
block.append(label, pre, actions);
|
|
26186
|
+
panel.append(block);
|
|
26187
|
+
}
|
|
26188
|
+
for (const download2 of guide.downloads ?? []) {
|
|
26189
|
+
const link = document2.createElement("a");
|
|
26190
|
+
link.className = "settings-command-button settings-command-button--secondary";
|
|
26191
|
+
link.href = download2.url;
|
|
26192
|
+
link.target = "_blank";
|
|
26193
|
+
link.rel = "noopener noreferrer";
|
|
26194
|
+
link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
|
|
26195
|
+
link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
|
|
26196
|
+
panel.append(link);
|
|
26197
|
+
}
|
|
26198
|
+
if (guide.after) paragraph(guide.after);
|
|
26199
|
+
if (!plugin?.installation && guide.url) {
|
|
26200
|
+
const link = document2.createElement("a");
|
|
26201
|
+
link.href = guide.url;
|
|
26202
|
+
link.target = "_blank";
|
|
26203
|
+
link.rel = "noopener noreferrer";
|
|
26204
|
+
link.textContent = zh ? "\u5B89\u88C5\u8BF4\u660E" : "Installation instructions";
|
|
26205
|
+
panel.append(link);
|
|
26206
|
+
}
|
|
26207
|
+
return panel;
|
|
26208
|
+
}
|
|
26209
|
+
|
|
26210
|
+
// src/settings/harness-launch-controls.ts
|
|
26211
|
+
function createHarnessLaunchControls(document2, messages, agent, settings) {
|
|
26212
|
+
const section = document2.createElement("section");
|
|
26213
|
+
section.className = "settings-harness-launch";
|
|
26214
|
+
section.dataset.harnessLaunch = agent;
|
|
26215
|
+
const label = document2.createElement("label");
|
|
26216
|
+
label.textContent = messages.launchPathLabel;
|
|
26217
|
+
const input = document2.createElement("input");
|
|
26218
|
+
input.type = "text";
|
|
26219
|
+
input.autocomplete = "off";
|
|
26220
|
+
input.spellcheck = false;
|
|
26221
|
+
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
26222
|
+
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
26223
|
+
label.append(input);
|
|
26224
|
+
const help = document2.createElement("p");
|
|
26225
|
+
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.";
|
|
26226
|
+
const actions = document2.createElement("div");
|
|
26227
|
+
actions.className = "settings-harness-launch__actions";
|
|
26228
|
+
const save = document2.createElement("button");
|
|
26229
|
+
save.type = "button";
|
|
26230
|
+
save.className = "settings-command-button";
|
|
26231
|
+
save.textContent = messages.launchPathSave;
|
|
26232
|
+
const reset = document2.createElement("button");
|
|
26233
|
+
reset.type = "button";
|
|
26234
|
+
reset.className = "settings-command-button settings-command-button--secondary";
|
|
26235
|
+
reset.textContent = messages.launchPathReset;
|
|
26236
|
+
const status = document2.createElement("p");
|
|
26237
|
+
status.setAttribute("role", "status");
|
|
26238
|
+
status.setAttribute("aria-live", "polite");
|
|
26239
|
+
actions.append(save, reset);
|
|
26240
|
+
section.append(label, help, actions, status);
|
|
26241
|
+
let busy = true;
|
|
26242
|
+
let loaded = false;
|
|
26243
|
+
const controls = () => {
|
|
26244
|
+
input.disabled = busy || !loaded;
|
|
26245
|
+
save.disabled = busy || !loaded || !input.value.trim();
|
|
26246
|
+
reset.disabled = busy || !loaded;
|
|
25827
26247
|
};
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
25841
|
-
|
|
25842
|
-
|
|
25843
|
-
|
|
25844
|
-
result.className = "settings-connection-update-result";
|
|
25845
|
-
result.setAttribute("role", "status");
|
|
25846
|
-
result.hidden = !batch || batch.running;
|
|
25847
|
-
if (batch && !batch.running) {
|
|
25848
|
-
result.textContent = messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed));
|
|
25849
|
-
}
|
|
25850
|
-
return { button: button2, result };
|
|
26248
|
+
const show = (value) => {
|
|
26249
|
+
input.value = value.path ?? "";
|
|
26250
|
+
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
26251
|
+
};
|
|
26252
|
+
const persist = async (value) => {
|
|
26253
|
+
if (busy || !loaded) return;
|
|
26254
|
+
busy = true;
|
|
26255
|
+
controls();
|
|
26256
|
+
status.textContent = messages.launchPathSaving;
|
|
26257
|
+
try {
|
|
26258
|
+
show(await settings.set(value));
|
|
26259
|
+
} catch {
|
|
26260
|
+
status.textContent = messages.launchPathSaveError;
|
|
26261
|
+
} finally {
|
|
26262
|
+
busy = false;
|
|
26263
|
+
controls();
|
|
25851
26264
|
}
|
|
25852
26265
|
};
|
|
26266
|
+
input.addEventListener("input", controls);
|
|
26267
|
+
save.addEventListener("click", () => {
|
|
26268
|
+
if (input.value.trim()) void persist(input.value.trim());
|
|
26269
|
+
});
|
|
26270
|
+
reset.addEventListener("click", () => {
|
|
26271
|
+
void persist(null);
|
|
26272
|
+
});
|
|
26273
|
+
controls();
|
|
26274
|
+
status.textContent = messages.launchPathLoading;
|
|
26275
|
+
void settings.get().then((value) => {
|
|
26276
|
+
loaded = true;
|
|
26277
|
+
show(value);
|
|
26278
|
+
}).catch(() => {
|
|
26279
|
+
loaded = true;
|
|
26280
|
+
status.textContent = messages.launchPathLoadError;
|
|
26281
|
+
}).finally(() => {
|
|
26282
|
+
busy = false;
|
|
26283
|
+
controls();
|
|
26284
|
+
});
|
|
26285
|
+
return section;
|
|
25853
26286
|
}
|
|
25854
26287
|
|
|
25855
26288
|
// src/settings/connections-page.ts
|
|
25856
26289
|
var CODEXHOST_GITHUB_ISSUES_NEW_URL = "https://github.com/BytePioneer-AI/codex-host/issues/new";
|
|
25857
|
-
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
25858
|
-
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
25859
|
-
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
25860
|
-
if (availability === "ready") return messages.connectionStatusReady;
|
|
25861
|
-
if (availability === "checking") return messages.connectionStatusChecking;
|
|
25862
|
-
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
25863
|
-
if (availability === "unavailable" || availability === "error") {
|
|
25864
|
-
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
25865
|
-
}
|
|
25866
|
-
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
25867
|
-
}
|
|
25868
|
-
function connectionStatusTone(availability, hasError = false) {
|
|
25869
|
-
if (availability === "updating") return "checking";
|
|
25870
|
-
if (hasError && availability !== "notInstalled") return "failed";
|
|
25871
|
-
if (availability === "ready") return "ready";
|
|
25872
|
-
if (availability === "checking" || availability === "installing") return "checking";
|
|
25873
|
-
if (availability === "notInstalled") return "setup";
|
|
25874
|
-
return "failed";
|
|
25875
|
-
}
|
|
25876
26290
|
function diagnosticText(hostId2, item) {
|
|
25877
26291
|
const error51 = item.error;
|
|
25878
26292
|
return [
|
|
@@ -25968,148 +26382,21 @@ ${error51.stderrTail}`] : []
|
|
|
25968
26382
|
tabs.addEventListener("wheel", onWheel, { passive: false });
|
|
25969
26383
|
const ownerWindow = document2.defaultView;
|
|
25970
26384
|
ownerWindow?.addEventListener("resize", updateButtons);
|
|
25971
|
-
|
|
25972
|
-
|
|
25973
|
-
|
|
25974
|
-
|
|
25975
|
-
|
|
25976
|
-
|
|
25977
|
-
|
|
25978
|
-
|
|
26385
|
+
const refreshLayout = () => {
|
|
26386
|
+
ownerWindow?.setTimeout(updateButtons, 0);
|
|
26387
|
+
updateButtons();
|
|
26388
|
+
};
|
|
26389
|
+
refreshLayout();
|
|
26390
|
+
return {
|
|
26391
|
+
update: refreshLayout,
|
|
26392
|
+
dispose() {
|
|
26393
|
+
left.removeEventListener("click", onLeft);
|
|
26394
|
+
right.removeEventListener("click", onRight);
|
|
26395
|
+
tabs.removeEventListener("scroll", updateButtons);
|
|
26396
|
+
tabs.removeEventListener("wheel", onWheel);
|
|
26397
|
+
ownerWindow?.removeEventListener("resize", updateButtons);
|
|
26398
|
+
}
|
|
25979
26399
|
};
|
|
25980
|
-
}
|
|
25981
|
-
function createConnectionIdentityIcon(document2, item, size) {
|
|
25982
|
-
const container = document2.createElement("span");
|
|
25983
|
-
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
25984
|
-
container.setAttribute("aria-hidden", "true");
|
|
25985
|
-
if (item.agentSnapshot) {
|
|
25986
|
-
container.append(
|
|
25987
|
-
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
25988
|
-
);
|
|
25989
|
-
} else {
|
|
25990
|
-
container.textContent = "CH";
|
|
25991
|
-
}
|
|
25992
|
-
return container;
|
|
25993
|
-
}
|
|
25994
|
-
function createConnectionRow(document2, item, messages, selected, select, group = null) {
|
|
25995
|
-
const row = document2.createElement("div");
|
|
25996
|
-
row.className = "settings-connection-row";
|
|
25997
|
-
row.dataset.connectionItem = item.key;
|
|
25998
|
-
row.dataset.connectionSelected = String(selected);
|
|
25999
|
-
row.tabIndex = selected ? 0 : -1;
|
|
26000
|
-
row.setAttribute("role", "row");
|
|
26001
|
-
const identity2 = document2.createElement("div");
|
|
26002
|
-
identity2.className = "settings-connection-row__identity";
|
|
26003
|
-
identity2.setAttribute("role", "cell");
|
|
26004
|
-
if (group) {
|
|
26005
|
-
const handle = document2.createElement("span");
|
|
26006
|
-
handle.className = "settings-connection-row__handle";
|
|
26007
|
-
handle.setAttribute("aria-hidden", "true");
|
|
26008
|
-
handle.title = group.dragHandleTitle;
|
|
26009
|
-
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
26010
|
-
identity2.append(handle);
|
|
26011
|
-
}
|
|
26012
|
-
const label = document2.createElement("strong");
|
|
26013
|
-
label.textContent = item.name;
|
|
26014
|
-
identity2.append(createConnectionIdentityIcon(document2, item, 19), label);
|
|
26015
|
-
const status = document2.createElement("span");
|
|
26016
|
-
status.className = "settings-connection-row__status";
|
|
26017
|
-
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
26018
|
-
status.setAttribute("role", "cell");
|
|
26019
|
-
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
26020
|
-
const version2 = item.version;
|
|
26021
|
-
const action = document2.createElement("div");
|
|
26022
|
-
action.className = "settings-connection-row__action";
|
|
26023
|
-
action.setAttribute("role", "cell");
|
|
26024
|
-
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
26025
|
-
const install = document2.createElement("button");
|
|
26026
|
-
install.type = "button";
|
|
26027
|
-
install.className = "settings-connection-install-link";
|
|
26028
|
-
install.addEventListener("click", (event) => {
|
|
26029
|
-
event.stopPropagation();
|
|
26030
|
-
select();
|
|
26031
|
-
item.install?.();
|
|
26032
|
-
});
|
|
26033
|
-
install.disabled = item.availability === "installing" || item.availability === "checking";
|
|
26034
|
-
const installLabel = messages.connectionInstall;
|
|
26035
|
-
install.setAttribute("aria-label", `${installLabel}: ${item.name}`);
|
|
26036
|
-
install.title = installLabel;
|
|
26037
|
-
install.append(createRendererSettingsIcon("download", 17));
|
|
26038
|
-
action.append(install);
|
|
26039
|
-
} else if (item.error) {
|
|
26040
|
-
const viewError = document2.createElement("button");
|
|
26041
|
-
viewError.type = "button";
|
|
26042
|
-
viewError.className = "settings-connection-view-error";
|
|
26043
|
-
viewError.textContent = messages.connectionViewError;
|
|
26044
|
-
viewError.addEventListener("click", (event) => {
|
|
26045
|
-
event.stopPropagation();
|
|
26046
|
-
select();
|
|
26047
|
-
});
|
|
26048
|
-
action.append(viewError);
|
|
26049
|
-
}
|
|
26050
|
-
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
26051
|
-
const available = document2.createElement("span");
|
|
26052
|
-
available.className = "settings-connection-version-available";
|
|
26053
|
-
available.textContent = messages.harnessVersionAvailable;
|
|
26054
|
-
available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
26055
|
-
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
26056
|
-
action.append(available);
|
|
26057
|
-
}
|
|
26058
|
-
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
26059
|
-
const update = document2.createElement("button");
|
|
26060
|
-
update.type = "button";
|
|
26061
|
-
update.className = "settings-connection-install-link";
|
|
26062
|
-
update.dataset.connectionAction = "update";
|
|
26063
|
-
update.disabled = version2.updating;
|
|
26064
|
-
update.title = messages.harnessVersionUpdate;
|
|
26065
|
-
update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
|
|
26066
|
-
update.append(createRendererSettingsIcon("download", 17));
|
|
26067
|
-
update.addEventListener("click", (event) => {
|
|
26068
|
-
event.stopPropagation();
|
|
26069
|
-
if (update.disabled) return;
|
|
26070
|
-
void version2.update();
|
|
26071
|
-
select();
|
|
26072
|
-
});
|
|
26073
|
-
action.append(update);
|
|
26074
|
-
}
|
|
26075
|
-
if (group) {
|
|
26076
|
-
const toggle = document2.createElement("button");
|
|
26077
|
-
toggle.type = "button";
|
|
26078
|
-
toggle.disabled = group.disabled;
|
|
26079
|
-
toggle.className = "settings-connection-row__group-toggle";
|
|
26080
|
-
toggle.title = group.moveLabel;
|
|
26081
|
-
toggle.setAttribute("aria-label", group.moveLabel);
|
|
26082
|
-
toggle.append(
|
|
26083
|
-
createRendererSettingsIcon(group.section === "main" ? "chevron-down" : "chevron-up", 15)
|
|
26084
|
-
);
|
|
26085
|
-
toggle.addEventListener("click", (event) => {
|
|
26086
|
-
event.stopPropagation();
|
|
26087
|
-
group.toggleSection();
|
|
26088
|
-
});
|
|
26089
|
-
action.append(toggle);
|
|
26090
|
-
}
|
|
26091
|
-
row.addEventListener("click", (event) => {
|
|
26092
|
-
const target2 = event.target;
|
|
26093
|
-
if (target2?.closest?.("a")) return;
|
|
26094
|
-
select();
|
|
26095
|
-
});
|
|
26096
|
-
row.addEventListener("keydown", (event) => {
|
|
26097
|
-
if (event.target?.closest?.("button, a")) return;
|
|
26098
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
26099
|
-
event.preventDefault();
|
|
26100
|
-
select();
|
|
26101
|
-
});
|
|
26102
|
-
if (group) {
|
|
26103
|
-
row.draggable = !group.disabled;
|
|
26104
|
-
row.dataset.connectionGroupSection = group.section;
|
|
26105
|
-
row.addEventListener("dragstart", group.onDragStart);
|
|
26106
|
-
row.addEventListener("dragover", group.onDragOver);
|
|
26107
|
-
row.addEventListener("dragleave", group.onDragLeave);
|
|
26108
|
-
row.addEventListener("drop", group.onDrop);
|
|
26109
|
-
row.addEventListener("dragend", group.onDragEnd);
|
|
26110
|
-
}
|
|
26111
|
-
row.append(identity2, status, action);
|
|
26112
|
-
return row;
|
|
26113
26400
|
}
|
|
26114
26401
|
function createInspectorHeader(document2, item, messages) {
|
|
26115
26402
|
const header = document2.createElement("header");
|
|
@@ -26139,6 +26426,29 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26139
26426
|
header.append(identity2, status);
|
|
26140
26427
|
return header;
|
|
26141
26428
|
}
|
|
26429
|
+
function inspectorRenderSignature(hostId2, item, messages, diagnostics) {
|
|
26430
|
+
const plugin = item.agentSnapshot?.plugin;
|
|
26431
|
+
const notice = plugin?.notice ? plugin.notice[messages.locale] ?? plugin.notice.en : "";
|
|
26432
|
+
const websiteUrl = plugin?.links?.website ?? plugin?.links?.documentation ?? "";
|
|
26433
|
+
const hasLaunchControls = hostId2 === "local" && Boolean(item.agentSnapshot?.agent) && Boolean(plugin?.launchCommand) && Boolean(diagnostics?.getLaunchSettings && diagnostics?.setLaunchSettings);
|
|
26434
|
+
return JSON.stringify([
|
|
26435
|
+
hostId2,
|
|
26436
|
+
item.key,
|
|
26437
|
+
item.name,
|
|
26438
|
+
item.availability,
|
|
26439
|
+
item.agentSnapshot?.availability ?? null,
|
|
26440
|
+
String(plugin?.icon ?? ""),
|
|
26441
|
+
String(plugin?.iconStyle ?? ""),
|
|
26442
|
+
websiteUrl,
|
|
26443
|
+
notice,
|
|
26444
|
+
item.installError ?? "",
|
|
26445
|
+
Boolean(item.install),
|
|
26446
|
+
plugin?.installation ?? null,
|
|
26447
|
+
Boolean(item.openWebUi),
|
|
26448
|
+
hasLaunchControls,
|
|
26449
|
+
item.error ? diagnosticText(hostId2, item) : ""
|
|
26450
|
+
]);
|
|
26451
|
+
}
|
|
26142
26452
|
function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
|
|
26143
26453
|
inspector.replaceChildren(createInspectorHeader(document2, item, messages));
|
|
26144
26454
|
const body = document2.createElement("div");
|
|
@@ -26301,11 +26611,10 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26301
26611
|
];
|
|
26302
26612
|
}
|
|
26303
26613
|
var pendingFocusAgent = null;
|
|
26304
|
-
function createGroupDivider(document2
|
|
26614
|
+
function createGroupDivider(document2) {
|
|
26305
26615
|
const divider = document2.createElement("div");
|
|
26306
26616
|
divider.className = "settings-connection-group-divider";
|
|
26307
26617
|
divider.setAttribute("role", "presentation");
|
|
26308
|
-
divider.textContent = `${messages.connectionGroupMoreLabel} (${count3})`;
|
|
26309
26618
|
return divider;
|
|
26310
26619
|
}
|
|
26311
26620
|
function createGroupMoreHint(document2, messages) {
|
|
@@ -26358,11 +26667,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26358
26667
|
context.content.append(header, syncMessage, content);
|
|
26359
26668
|
let pending = false;
|
|
26360
26669
|
let selectedHostId = null;
|
|
26670
|
+
let renderedHostId = null;
|
|
26361
26671
|
let selectedItemKey = null;
|
|
26362
26672
|
let launchControls = null;
|
|
26673
|
+
let renderedInspector = null;
|
|
26363
26674
|
const hostNames = /* @__PURE__ */ new Map();
|
|
26675
|
+
const knownNotInstalled = /* @__PURE__ */ new Map();
|
|
26364
26676
|
let latestSnapshot = null;
|
|
26365
|
-
let disposeHostScroller = () => void 0;
|
|
26366
26677
|
let disposed = false;
|
|
26367
26678
|
let renderQueued = false;
|
|
26368
26679
|
let renderFrame = null;
|
|
@@ -26396,7 +26707,99 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26396
26707
|
scheduleRender
|
|
26397
26708
|
);
|
|
26398
26709
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
26399
|
-
const updates = createConnectionUpdates(
|
|
26710
|
+
const updates = createConnectionUpdates(
|
|
26711
|
+
document2,
|
|
26712
|
+
messages,
|
|
26713
|
+
context.signal,
|
|
26714
|
+
scheduleRender,
|
|
26715
|
+
diagnostics
|
|
26716
|
+
);
|
|
26717
|
+
const panelId = "codexhost-settings-connection-host-panel";
|
|
26718
|
+
const empty = document2.createElement("div");
|
|
26719
|
+
empty.className = "settings-empty";
|
|
26720
|
+
empty.textContent = messages.connectionNoRuntime;
|
|
26721
|
+
const layout = document2.createElement("div");
|
|
26722
|
+
layout.className = "settings-connections-layout";
|
|
26723
|
+
const list = document2.createElement("section");
|
|
26724
|
+
list.className = "settings-connection-list";
|
|
26725
|
+
const hostStrip = document2.createElement("div");
|
|
26726
|
+
hostStrip.className = "settings-connection-host-strip";
|
|
26727
|
+
const scrollLeft = createHostScrollButton(document2, "left", messages);
|
|
26728
|
+
const tabs = document2.createElement("div");
|
|
26729
|
+
tabs.className = "settings-connection-host-tabs";
|
|
26730
|
+
tabs.setAttribute("role", "tablist");
|
|
26731
|
+
tabs.setAttribute("aria-label", messages.connectionHosts);
|
|
26732
|
+
const scrollRight = createHostScrollButton(document2, "right", messages);
|
|
26733
|
+
hostStrip.append(scrollLeft, tabs, scrollRight);
|
|
26734
|
+
const updateControls = updates.createControls("local", []);
|
|
26735
|
+
const hostHeader = document2.createElement("div");
|
|
26736
|
+
hostHeader.className = "settings-connection-host-header";
|
|
26737
|
+
hostHeader.append(hostStrip, updateControls.button);
|
|
26738
|
+
const tableHeader = document2.createElement("div");
|
|
26739
|
+
tableHeader.className = "settings-connection-table-header";
|
|
26740
|
+
tableHeader.setAttribute("role", "row");
|
|
26741
|
+
const componentHeading = document2.createElement("span");
|
|
26742
|
+
componentHeading.textContent = messages.connectionComponent;
|
|
26743
|
+
componentHeading.setAttribute("role", "columnheader");
|
|
26744
|
+
const statusHeading = document2.createElement("span");
|
|
26745
|
+
statusHeading.textContent = messages.connectionStatus;
|
|
26746
|
+
statusHeading.setAttribute("role", "columnheader");
|
|
26747
|
+
const actionHeading = document2.createElement("span");
|
|
26748
|
+
actionHeading.setAttribute("aria-hidden", "true");
|
|
26749
|
+
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
26750
|
+
const rows = document2.createElement("div");
|
|
26751
|
+
rows.className = "settings-connection-rows";
|
|
26752
|
+
rows.id = panelId;
|
|
26753
|
+
rows.setAttribute("role", "rowgroup");
|
|
26754
|
+
list.append(hostHeader, updateControls.result, tableHeader, rows);
|
|
26755
|
+
const inspector = document2.createElement("aside");
|
|
26756
|
+
inspector.className = "settings-connection-inspector";
|
|
26757
|
+
inspector.setAttribute("aria-live", "polite");
|
|
26758
|
+
layout.append(list, inspector);
|
|
26759
|
+
const hostScroller = configureHostScroller(
|
|
26760
|
+
document2,
|
|
26761
|
+
hostStrip,
|
|
26762
|
+
tabs,
|
|
26763
|
+
scrollLeft,
|
|
26764
|
+
scrollRight
|
|
26765
|
+
);
|
|
26766
|
+
const hostTabElements = /* @__PURE__ */ new Map();
|
|
26767
|
+
const hostRowViews = /* @__PURE__ */ new Map();
|
|
26768
|
+
const groupDivider = createGroupDivider(document2);
|
|
26769
|
+
const moreHint = createGroupMoreHint(document2, messages);
|
|
26770
|
+
const moreZone = document2.createElement("div");
|
|
26771
|
+
moreZone.className = "settings-connection-group-more";
|
|
26772
|
+
moreZone.setAttribute("role", "presentation");
|
|
26773
|
+
const resetButton = createGroupResetButton(document2, messages, () => {
|
|
26774
|
+
groupPreference.resetToDefault();
|
|
26775
|
+
});
|
|
26776
|
+
let draggingAgent = null;
|
|
26777
|
+
let currentCatalog = [];
|
|
26778
|
+
let currentMainEntries = [];
|
|
26779
|
+
let currentMoreEntries = [];
|
|
26780
|
+
let currentHostRows = /* @__PURE__ */ new Map();
|
|
26781
|
+
const clearDropIndicators = () => {
|
|
26782
|
+
for (const view of currentHostRows.values()) {
|
|
26783
|
+
view.element.dataset.connectionDropIndicator = "";
|
|
26784
|
+
}
|
|
26785
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
26786
|
+
};
|
|
26787
|
+
moreZone.addEventListener("dragover", (event) => {
|
|
26788
|
+
if (!draggingAgent) return;
|
|
26789
|
+
event.preventDefault();
|
|
26790
|
+
moreZone.dataset.connectionDragOver = "true";
|
|
26791
|
+
});
|
|
26792
|
+
moreZone.addEventListener("dragleave", () => {
|
|
26793
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
26794
|
+
});
|
|
26795
|
+
moreZone.addEventListener("drop", (event) => {
|
|
26796
|
+
event.preventDefault();
|
|
26797
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
26798
|
+
if (!draggingAgent) return;
|
|
26799
|
+
groupPreference.moveAgent(draggingAgent, "more", null, currentCatalog);
|
|
26800
|
+
draggingAgent = null;
|
|
26801
|
+
clearDropIndicators();
|
|
26802
|
+
});
|
|
26400
26803
|
const runRefresh = () => {
|
|
26401
26804
|
if (pending || !diagnostics) return;
|
|
26402
26805
|
pending = true;
|
|
@@ -26409,6 +26812,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26409
26812
|
success() {
|
|
26410
26813
|
installs?.clearErrors();
|
|
26411
26814
|
pending = false;
|
|
26815
|
+
renderedInspector = null;
|
|
26412
26816
|
refresh.disabled = false;
|
|
26413
26817
|
refresh.replaceChildren(
|
|
26414
26818
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -26418,6 +26822,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26418
26822
|
},
|
|
26419
26823
|
failure(error51) {
|
|
26420
26824
|
pending = false;
|
|
26825
|
+
renderedInspector = null;
|
|
26421
26826
|
refresh.disabled = false;
|
|
26422
26827
|
refresh.replaceChildren(
|
|
26423
26828
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -26443,97 +26848,111 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26443
26848
|
}
|
|
26444
26849
|
});
|
|
26445
26850
|
};
|
|
26851
|
+
const syncSelectedInspector = (hostId2, item) => {
|
|
26852
|
+
const currentDiagnostics = getDiagnostics();
|
|
26853
|
+
const signature = inspectorRenderSignature(hostId2, item, messages, currentDiagnostics);
|
|
26854
|
+
const versionElement = item.version?.element ?? null;
|
|
26855
|
+
if (renderedInspector?.signature === signature && renderedInspector.versionElement === versionElement) {
|
|
26856
|
+
return;
|
|
26857
|
+
}
|
|
26858
|
+
const existing = launchControls?.hostId === hostId2 && launchControls.itemKey === item.key ? launchControls.element : null;
|
|
26859
|
+
const element = renderConnectionInspector(
|
|
26860
|
+
document2,
|
|
26861
|
+
inspector,
|
|
26862
|
+
item,
|
|
26863
|
+
hostId2,
|
|
26864
|
+
messages,
|
|
26865
|
+
currentDiagnostics,
|
|
26866
|
+
existing,
|
|
26867
|
+
runRefresh
|
|
26868
|
+
);
|
|
26869
|
+
launchControls = { hostId: hostId2, itemKey: item.key, element };
|
|
26870
|
+
if (versionElement) inspector.append(versionElement);
|
|
26871
|
+
renderedInspector = { signature, versionElement };
|
|
26872
|
+
};
|
|
26446
26873
|
const render = (snapshot) => {
|
|
26447
26874
|
const syncStatus = groupPreference.syncStatus();
|
|
26448
26875
|
const groupDisabled = syncStatus === "loading" || syncStatus === "saving";
|
|
26449
26876
|
syncMessage.hidden = syncStatus === "ready";
|
|
26450
26877
|
syncMessage.textContent = syncStatus === "error" ? messages.connectionGroupSyncFailed : syncStatus === "saving" ? messages.connectionGroupSaving : messages.connectionGroupLoading;
|
|
26451
26878
|
latestSnapshot = snapshot;
|
|
26452
|
-
disposeHostScroller();
|
|
26453
|
-
disposeHostScroller = () => void 0;
|
|
26454
26879
|
if (!snapshot) {
|
|
26455
|
-
|
|
26456
|
-
|
|
26457
|
-
empty
|
|
26458
|
-
content.replaceChildren(empty);
|
|
26880
|
+
renderedHostId = null;
|
|
26881
|
+
renderedInspector = null;
|
|
26882
|
+
reconcileElementChildren(content, [empty]);
|
|
26459
26883
|
return;
|
|
26460
26884
|
}
|
|
26461
26885
|
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];
|
|
26462
26886
|
if (!selectedHost) return;
|
|
26463
26887
|
selectedHostId = selectedHost.hostId;
|
|
26464
|
-
const
|
|
26465
|
-
|
|
26466
|
-
|
|
26467
|
-
|
|
26468
|
-
|
|
26469
|
-
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
|
|
26473
|
-
|
|
26474
|
-
|
|
26475
|
-
|
|
26476
|
-
|
|
26477
|
-
|
|
26478
|
-
|
|
26479
|
-
|
|
26480
|
-
|
|
26481
|
-
|
|
26482
|
-
|
|
26483
|
-
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
26888
|
+
const layoutFirstMount = content.children[0] !== layout;
|
|
26889
|
+
reconcileElementChildren(content, [layout]);
|
|
26890
|
+
let tabsChanged = tabs.children.length !== snapshot.hosts.length;
|
|
26891
|
+
const nextTabs = snapshot.hosts.map((host) => {
|
|
26892
|
+
let tab = hostTabElements.get(host.hostId);
|
|
26893
|
+
if (!tab) {
|
|
26894
|
+
tab = document2.createElement("button");
|
|
26895
|
+
tab.type = "button";
|
|
26896
|
+
tab.className = "settings-connection-host-tab";
|
|
26897
|
+
tab.dataset.connectionHostTab = host.hostId;
|
|
26898
|
+
tab.setAttribute("role", "tab");
|
|
26899
|
+
tab.setAttribute("aria-controls", panelId);
|
|
26900
|
+
tab.addEventListener("click", () => {
|
|
26901
|
+
selectedHostId = host.hostId;
|
|
26902
|
+
render(latestSnapshot);
|
|
26903
|
+
});
|
|
26904
|
+
tab.addEventListener("keydown", (event) => {
|
|
26905
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
26906
|
+
event.preventDefault();
|
|
26907
|
+
const hosts = latestSnapshot?.hosts ?? [];
|
|
26908
|
+
const index = hosts.findIndex((candidate) => candidate.hostId === host.hostId);
|
|
26909
|
+
if (index < 0) return;
|
|
26910
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
26911
|
+
const next = hosts[(index + direction + hosts.length) % hosts.length];
|
|
26912
|
+
if (!next) return;
|
|
26913
|
+
selectedHostId = next.hostId;
|
|
26914
|
+
render(latestSnapshot);
|
|
26915
|
+
hostTabElements.get(next.hostId)?.focus();
|
|
26916
|
+
});
|
|
26917
|
+
hostTabElements.set(host.hostId, tab);
|
|
26918
|
+
tabsChanged = true;
|
|
26919
|
+
}
|
|
26920
|
+
const isSelected = host.hostId === selectedHost.hostId;
|
|
26921
|
+
const activeValue = String(host.active);
|
|
26922
|
+
if (tab.dataset.connectionHostActive !== activeValue) {
|
|
26923
|
+
tab.dataset.connectionHostActive = activeValue;
|
|
26924
|
+
}
|
|
26925
|
+
const selectedValue = String(isSelected);
|
|
26926
|
+
if (tab.getAttribute("aria-selected") !== selectedValue) {
|
|
26927
|
+
tab.setAttribute("aria-selected", selectedValue);
|
|
26928
|
+
}
|
|
26929
|
+
const nextTabIndex = isSelected ? 0 : -1;
|
|
26930
|
+
if (tab.tabIndex !== nextTabIndex) {
|
|
26931
|
+
tab.tabIndex = nextTabIndex;
|
|
26932
|
+
}
|
|
26487
26933
|
const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
|
|
26488
|
-
tab.textContent
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
26498
|
-
const next = snapshot.hosts[(index + direction + snapshot.hosts.length) % snapshot.hosts.length];
|
|
26499
|
-
if (!next) return;
|
|
26500
|
-
selectedHostId = next.hostId;
|
|
26501
|
-
render(latestSnapshot);
|
|
26502
|
-
const nextTab = [
|
|
26503
|
-
...content.querySelectorAll("[data-connection-host-tab]")
|
|
26504
|
-
].find((candidate) => candidate.dataset.connectionHostTab === next.hostId);
|
|
26505
|
-
nextTab?.focus();
|
|
26506
|
-
});
|
|
26507
|
-
tabs.append(tab);
|
|
26934
|
+
if (tab.textContent !== hostName) {
|
|
26935
|
+
tab.textContent = hostName;
|
|
26936
|
+
tabsChanged = true;
|
|
26937
|
+
}
|
|
26938
|
+
const tabTitle = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
|
|
26939
|
+
if (tab.title !== tabTitle) {
|
|
26940
|
+
tab.title = tabTitle;
|
|
26941
|
+
}
|
|
26942
|
+
return tab;
|
|
26508
26943
|
});
|
|
26509
|
-
|
|
26510
|
-
|
|
26511
|
-
|
|
26512
|
-
|
|
26513
|
-
const componentHeading = document2.createElement("span");
|
|
26514
|
-
componentHeading.textContent = messages.connectionComponent;
|
|
26515
|
-
componentHeading.setAttribute("role", "columnheader");
|
|
26516
|
-
const statusHeading = document2.createElement("span");
|
|
26517
|
-
statusHeading.textContent = messages.connectionStatus;
|
|
26518
|
-
statusHeading.setAttribute("role", "columnheader");
|
|
26519
|
-
const actionHeading = document2.createElement("span");
|
|
26520
|
-
actionHeading.setAttribute("aria-hidden", "true");
|
|
26521
|
-
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
26522
|
-
const rows = document2.createElement("div");
|
|
26523
|
-
rows.className = "settings-connection-rows";
|
|
26524
|
-
rows.id = panelId;
|
|
26525
|
-
rows.dataset.connectionHost = selectedHost.hostId;
|
|
26526
|
-
rows.setAttribute("role", "rowgroup");
|
|
26527
|
-
const inspector = document2.createElement("aside");
|
|
26528
|
-
inspector.className = "settings-connection-inspector";
|
|
26529
|
-
inspector.setAttribute("aria-live", "polite");
|
|
26944
|
+
reconcileElementChildren(tabs, nextTabs);
|
|
26945
|
+
if (rows.dataset.connectionHost !== selectedHost.hostId) {
|
|
26946
|
+
rows.dataset.connectionHost = selectedHost.hostId;
|
|
26947
|
+
}
|
|
26530
26948
|
const items = connectionItems(snapshot, selectedHost, messages, diagnostics).map(
|
|
26531
26949
|
(item) => {
|
|
26532
26950
|
const agent = item.agentSnapshot?.agent;
|
|
26533
26951
|
if (!agent) return item;
|
|
26534
26952
|
const state = installs?.get(selectedHost.hostId, agent);
|
|
26535
26953
|
const availability = state?.status ?? item.availability;
|
|
26536
|
-
const
|
|
26954
|
+
const updating = versions.isUpdating(selectedHost.hostId, agent);
|
|
26955
|
+
const version2 = updating || item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
|
|
26537
26956
|
return {
|
|
26538
26957
|
...item,
|
|
26539
26958
|
...state ? { availability: state.status } : {},
|
|
@@ -26555,66 +26974,66 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26555
26974
|
(item) => item.agentSnapshot?.availability === "notInstalled" || item.error !== null
|
|
26556
26975
|
)?.key ?? items[0]?.key ?? null;
|
|
26557
26976
|
}
|
|
26558
|
-
|
|
26977
|
+
let hostRows = hostRowViews.get(selectedHost.hostId);
|
|
26978
|
+
if (!hostRows) {
|
|
26979
|
+
hostRows = /* @__PURE__ */ new Map();
|
|
26980
|
+
hostRowViews.set(selectedHost.hostId, hostRows);
|
|
26981
|
+
}
|
|
26982
|
+
currentHostRows = hostRows;
|
|
26559
26983
|
const selectItem = (item) => {
|
|
26560
26984
|
selectedItemKey = item.key;
|
|
26561
|
-
for (const [key,
|
|
26562
|
-
|
|
26563
|
-
row.dataset.connectionSelected = String(selected);
|
|
26564
|
-
row.tabIndex = selected ? 0 : -1;
|
|
26985
|
+
for (const [key, view] of currentHostRows) {
|
|
26986
|
+
view.setSelected(key === item.key);
|
|
26565
26987
|
}
|
|
26566
|
-
|
|
26567
|
-
const element = renderConnectionInspector(
|
|
26568
|
-
document2,
|
|
26569
|
-
inspector,
|
|
26570
|
-
item,
|
|
26571
|
-
selectedHost.hostId,
|
|
26572
|
-
messages,
|
|
26573
|
-
getDiagnostics(),
|
|
26574
|
-
existing,
|
|
26575
|
-
runRefresh
|
|
26576
|
-
);
|
|
26577
|
-
launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
|
|
26578
|
-
if (item.version) inspector.append(item.version.element);
|
|
26988
|
+
syncSelectedInspector(selectedHost.hostId, item);
|
|
26579
26989
|
};
|
|
26580
|
-
const
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
document2,
|
|
26990
|
+
const ensureRowView = (key, groupable) => {
|
|
26991
|
+
let view = hostRows.get(key);
|
|
26992
|
+
if (!view) {
|
|
26993
|
+
view = createConnectionRowView(document2, messages, groupable);
|
|
26994
|
+
hostRows.set(key, view);
|
|
26995
|
+
}
|
|
26996
|
+
return view;
|
|
26997
|
+
};
|
|
26998
|
+
const activeKeys = /* @__PURE__ */ new Set();
|
|
26999
|
+
const nextRowChildren = [];
|
|
27000
|
+
const pinnedItems = items.filter((item) => item.agentSnapshot === void 0);
|
|
27001
|
+
for (const pinnedItem of pinnedItems) {
|
|
27002
|
+
activeKeys.add(pinnedItem.key);
|
|
27003
|
+
const view = ensureRowView(pinnedItem.key, false);
|
|
27004
|
+
view.update(
|
|
26584
27005
|
pinnedItem,
|
|
26585
|
-
messages,
|
|
26586
27006
|
pinnedItem.key === selectedItemKey,
|
|
26587
|
-
() => selectItem(pinnedItem)
|
|
27007
|
+
() => selectItem(pinnedItem),
|
|
27008
|
+
null
|
|
26588
27009
|
);
|
|
26589
|
-
|
|
26590
|
-
rows.append(row);
|
|
27010
|
+
nextRowChildren.push(view.element);
|
|
26591
27011
|
}
|
|
26592
27012
|
const groupableItems = items.filter(
|
|
26593
27013
|
(item) => item.agentSnapshot !== void 0
|
|
26594
27014
|
);
|
|
26595
27015
|
const agentByKey = new Map(groupableItems.map((item) => [item.key, item]));
|
|
26596
|
-
|
|
26597
|
-
const
|
|
26598
|
-
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
27016
|
+
currentCatalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
|
|
27017
|
+
const notInstalledAgents = /* @__PURE__ */ new Set();
|
|
27018
|
+
for (const item of groupableItems) {
|
|
27019
|
+
const agent = item.agentSnapshot.agent;
|
|
27020
|
+
const stateKey = `${selectedHost.hostId}:${agent}`;
|
|
27021
|
+
if (item.agentSnapshot.availability !== "checking") {
|
|
27022
|
+
knownNotInstalled.set(stateKey, item.agentSnapshot.availability === "notInstalled");
|
|
27023
|
+
}
|
|
27024
|
+
const isNotInstalled = item.agentSnapshot.availability === "checking" ? knownNotInstalled.get(stateKey) ?? false : item.agentSnapshot.availability === "notInstalled";
|
|
27025
|
+
if (isNotInstalled) notInstalledAgents.add(agent);
|
|
27026
|
+
}
|
|
27027
|
+
const preferenceOrder = groupPreference.list(notInstalledAgents, currentCatalog).filter((entry) => agentByKey.has(entry.agent));
|
|
27028
|
+
currentMainEntries = preferenceOrder.filter((entry) => entry.section === "main");
|
|
27029
|
+
currentMoreEntries = preferenceOrder.filter((entry) => entry.section === "more");
|
|
26605
27030
|
const nextInSection = (section, agent) => {
|
|
26606
|
-
const
|
|
26607
|
-
const index =
|
|
26608
|
-
return index >= 0 ?
|
|
26609
|
-
};
|
|
26610
|
-
let draggingAgent = null;
|
|
26611
|
-
let moreZone = null;
|
|
26612
|
-
const clearDropIndicators = () => {
|
|
26613
|
-
for (const row of rowElements.values()) row.dataset.connectionDropIndicator = "";
|
|
26614
|
-
if (moreZone) moreZone.dataset.connectionDragOver = "false";
|
|
27031
|
+
const sectionEntries = section === "main" ? currentMainEntries : currentMoreEntries;
|
|
27032
|
+
const index = sectionEntries.findIndex((entry) => entry.agent === agent);
|
|
27033
|
+
return index >= 0 ? sectionEntries[index + 1]?.agent ?? null : null;
|
|
26615
27034
|
};
|
|
26616
27035
|
const dropTargetSection = (agent, event) => {
|
|
26617
|
-
const row =
|
|
27036
|
+
const row = currentHostRows.get(agent)?.element;
|
|
26618
27037
|
const rect = row && typeof row.getBoundingClientRect === "function" ? row.getBoundingClientRect() : null;
|
|
26619
27038
|
const before = rect ? event.clientY - rect.top < rect.height / 2 : true;
|
|
26620
27039
|
const section = row?.dataset.connectionGroupSection ?? "main";
|
|
@@ -26626,7 +27045,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26626
27045
|
moveLabel: section === "main" ? messages.connectionGroupMoveToMore : messages.connectionGroupMoveToMain,
|
|
26627
27046
|
dragHandleTitle: messages.connectionGroupDragHandle,
|
|
26628
27047
|
toggleSection() {
|
|
26629
|
-
groupPreference.moveAgent(
|
|
27048
|
+
groupPreference.moveAgent(
|
|
27049
|
+
agent,
|
|
27050
|
+
section === "main" ? "more" : "main",
|
|
27051
|
+
null,
|
|
27052
|
+
currentCatalog
|
|
27053
|
+
);
|
|
26630
27054
|
},
|
|
26631
27055
|
onDragStart(event) {
|
|
26632
27056
|
if (groupDisabled) {
|
|
@@ -26636,127 +27060,107 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26636
27060
|
draggingAgent = agent;
|
|
26637
27061
|
event.dataTransfer?.setData("text/plain", agent);
|
|
26638
27062
|
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
26639
|
-
const row =
|
|
27063
|
+
const row = currentHostRows.get(agent)?.element;
|
|
26640
27064
|
if (row) row.dataset.connectionDragging = "true";
|
|
26641
27065
|
},
|
|
26642
27066
|
onDragOver(event) {
|
|
26643
27067
|
if (!draggingAgent || draggingAgent === agent) return;
|
|
26644
27068
|
event.preventDefault();
|
|
26645
|
-
const row =
|
|
27069
|
+
const row = currentHostRows.get(agent)?.element;
|
|
26646
27070
|
if (!row) return;
|
|
26647
27071
|
const { before } = dropTargetSection(agent, event);
|
|
26648
27072
|
clearDropIndicators();
|
|
26649
27073
|
row.dataset.connectionDropIndicator = before ? "before" : "after";
|
|
26650
27074
|
},
|
|
26651
27075
|
onDragLeave() {
|
|
26652
|
-
const row =
|
|
27076
|
+
const row = currentHostRows.get(agent)?.element;
|
|
26653
27077
|
if (row) row.dataset.connectionDropIndicator = "";
|
|
26654
27078
|
},
|
|
26655
27079
|
onDrop(event) {
|
|
26656
27080
|
event.preventDefault();
|
|
26657
27081
|
if (!draggingAgent) return;
|
|
26658
27082
|
const { beforeAgent } = dropTargetSection(agent, event);
|
|
26659
|
-
groupPreference.moveAgent(draggingAgent, section, beforeAgent,
|
|
27083
|
+
groupPreference.moveAgent(draggingAgent, section, beforeAgent, currentCatalog);
|
|
26660
27084
|
draggingAgent = null;
|
|
26661
27085
|
clearDropIndicators();
|
|
26662
27086
|
},
|
|
26663
27087
|
onDragEnd() {
|
|
26664
27088
|
draggingAgent = null;
|
|
26665
|
-
const row =
|
|
27089
|
+
const row = currentHostRows.get(agent)?.element;
|
|
26666
27090
|
if (row) row.dataset.connectionDragging = "false";
|
|
26667
27091
|
clearDropIndicators();
|
|
27092
|
+
scheduleRender();
|
|
26668
27093
|
}
|
|
26669
27094
|
});
|
|
26670
|
-
const
|
|
26671
|
-
const item = agentByKey.get(agent);
|
|
26672
|
-
if (!item)
|
|
26673
|
-
|
|
26674
|
-
|
|
27095
|
+
for (const entry of currentMainEntries) {
|
|
27096
|
+
const item = agentByKey.get(entry.agent);
|
|
27097
|
+
if (!item) continue;
|
|
27098
|
+
activeKeys.add(item.key);
|
|
27099
|
+
const view = ensureRowView(item.key, true);
|
|
27100
|
+
view.update(
|
|
26675
27101
|
item,
|
|
26676
|
-
messages,
|
|
26677
27102
|
item.key === selectedItemKey,
|
|
26678
27103
|
() => selectItem(item),
|
|
26679
|
-
createGroupController(agent,
|
|
27104
|
+
createGroupController(entry.agent, "main")
|
|
26680
27105
|
);
|
|
26681
|
-
|
|
26682
|
-
|
|
26683
|
-
};
|
|
26684
|
-
for (const entry of mainEntries) appendGroupRow(entry.agent, "main");
|
|
27106
|
+
nextRowChildren.push(view.element);
|
|
27107
|
+
}
|
|
26685
27108
|
if (groupableItems.length > 0) {
|
|
26686
|
-
|
|
26687
|
-
|
|
26688
|
-
|
|
26689
|
-
|
|
26690
|
-
|
|
26691
|
-
|
|
26692
|
-
|
|
26693
|
-
|
|
26694
|
-
zone.dataset.connectionDragOver = "true";
|
|
26695
|
-
});
|
|
26696
|
-
zone.addEventListener("dragleave", () => {
|
|
26697
|
-
zone.dataset.connectionDragOver = "false";
|
|
26698
|
-
});
|
|
26699
|
-
zone.addEventListener("drop", (event) => {
|
|
26700
|
-
event.preventDefault();
|
|
26701
|
-
zone.dataset.connectionDragOver = "false";
|
|
26702
|
-
if (!draggingAgent) return;
|
|
26703
|
-
groupPreference.moveAgent(draggingAgent, "more", null, catalog);
|
|
26704
|
-
draggingAgent = null;
|
|
26705
|
-
clearDropIndicators();
|
|
26706
|
-
});
|
|
26707
|
-
if (moreEntries.length === 0) {
|
|
26708
|
-
zone.append(createGroupMoreHint(document2, messages));
|
|
27109
|
+
const dividerText = `${messages.connectionGroupMoreLabel} (${currentMoreEntries.length})`;
|
|
27110
|
+
if (groupDivider.textContent !== dividerText) {
|
|
27111
|
+
groupDivider.textContent = dividerText;
|
|
27112
|
+
}
|
|
27113
|
+
nextRowChildren.push(groupDivider);
|
|
27114
|
+
const nextMoreChildren = [];
|
|
27115
|
+
if (currentMoreEntries.length === 0) {
|
|
27116
|
+
nextMoreChildren.push(moreHint);
|
|
26709
27117
|
} else {
|
|
26710
|
-
for (const entry of
|
|
27118
|
+
for (const entry of currentMoreEntries) {
|
|
26711
27119
|
const item = agentByKey.get(entry.agent);
|
|
26712
27120
|
if (!item) continue;
|
|
26713
|
-
|
|
26714
|
-
|
|
27121
|
+
activeKeys.add(item.key);
|
|
27122
|
+
const view = ensureRowView(item.key, true);
|
|
27123
|
+
view.update(
|
|
26715
27124
|
item,
|
|
26716
|
-
messages,
|
|
26717
27125
|
item.key === selectedItemKey,
|
|
26718
27126
|
() => selectItem(item),
|
|
26719
27127
|
createGroupController(entry.agent, "more")
|
|
26720
27128
|
);
|
|
26721
|
-
|
|
26722
|
-
zone.append(row);
|
|
27129
|
+
nextMoreChildren.push(view.element);
|
|
26723
27130
|
}
|
|
26724
27131
|
}
|
|
26725
|
-
|
|
26726
|
-
|
|
26727
|
-
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
|
|
27132
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
27133
|
+
reconcileElementChildren(moreZone, nextMoreChildren);
|
|
27134
|
+
}
|
|
27135
|
+
nextRowChildren.push(moreZone);
|
|
27136
|
+
resetButton.disabled = groupDisabled;
|
|
27137
|
+
nextRowChildren.push(resetButton);
|
|
27138
|
+
}
|
|
27139
|
+
for (const key of hostRows.keys()) {
|
|
27140
|
+
if (!activeKeys.has(key)) hostRows.delete(key);
|
|
27141
|
+
}
|
|
27142
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
27143
|
+
reconcileElementChildren(rows, nextRowChildren);
|
|
26731
27144
|
}
|
|
26732
27145
|
const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
|
|
26733
27146
|
if (selectedItem) selectItem(selectedItem);
|
|
26734
|
-
|
|
27147
|
+
updateControls.update(
|
|
26735
27148
|
selectedHost.hostId,
|
|
26736
27149
|
items.flatMap((item) => item.version ? [item.version] : [])
|
|
26737
27150
|
);
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
const selectedTab = [...tabs.children].find(
|
|
26752
|
-
(child) => child.getAttribute("aria-selected") === "true"
|
|
26753
|
-
);
|
|
26754
|
-
if (selectedTab) {
|
|
26755
|
-
const left = selectedTab.offsetLeft;
|
|
26756
|
-
const right = left + selectedTab.offsetWidth;
|
|
26757
|
-
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
26758
|
-
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
26759
|
-
tabs.scrollLeft = right - tabs.clientWidth;
|
|
27151
|
+
if (layoutFirstMount || tabsChanged) {
|
|
27152
|
+
hostScroller.update();
|
|
27153
|
+
}
|
|
27154
|
+
if (renderedHostId !== selectedHost.hostId) {
|
|
27155
|
+
renderedHostId = selectedHost.hostId;
|
|
27156
|
+
const selectedTab = hostTabElements.get(selectedHost.hostId);
|
|
27157
|
+
if (selectedTab) {
|
|
27158
|
+
const left = selectedTab.offsetLeft;
|
|
27159
|
+
const right = left + selectedTab.offsetWidth;
|
|
27160
|
+
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
27161
|
+
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
27162
|
+
tabs.scrollLeft = right - tabs.clientWidth;
|
|
27163
|
+
}
|
|
26760
27164
|
}
|
|
26761
27165
|
}
|
|
26762
27166
|
};
|
|
@@ -26777,7 +27181,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26777
27181
|
refresh.disabled = true;
|
|
26778
27182
|
return () => {
|
|
26779
27183
|
cancelRender();
|
|
26780
|
-
|
|
27184
|
+
hostScroller.dispose();
|
|
26781
27185
|
unsubscribeGroup();
|
|
26782
27186
|
};
|
|
26783
27187
|
}
|
|
@@ -26786,7 +27190,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
26786
27190
|
const unsubscribeInstalls = installs?.subscribe(scheduleRender);
|
|
26787
27191
|
return () => {
|
|
26788
27192
|
cancelRender();
|
|
26789
|
-
|
|
27193
|
+
hostScroller.dispose();
|
|
26790
27194
|
unsubscribeInstalls?.();
|
|
26791
27195
|
unsubscribe();
|
|
26792
27196
|
unsubscribeGroup();
|
|
@@ -28343,9 +28747,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28343
28747
|
resets: "Resets",
|
|
28344
28748
|
details: "Account limit details",
|
|
28345
28749
|
weekly: "Weekly limit",
|
|
28750
|
+
weeklyShort: "Weekly",
|
|
28346
28751
|
monthly: "Monthly limit",
|
|
28752
|
+
monthlyShort: "Monthly",
|
|
28347
28753
|
fiveHour: "5-hour limit",
|
|
28754
|
+
fiveHourShort: "5-hour",
|
|
28348
28755
|
sevenDay: "7-day limit",
|
|
28756
|
+
sevenDayShort: "7-day",
|
|
28349
28757
|
account: "Account limit"
|
|
28350
28758
|
});
|
|
28351
28759
|
var CHINESE_CREDITS_MESSAGES = Object.freeze({
|
|
@@ -28353,9 +28761,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28353
28761
|
resets: "\u91CD\u7F6E",
|
|
28354
28762
|
details: "\u8D26\u53F7\u989D\u5EA6\u8BE6\u60C5",
|
|
28355
28763
|
weekly: "\u5468\u989D\u5EA6",
|
|
28764
|
+
weeklyShort: "\u5468\u989D\u5EA6",
|
|
28356
28765
|
monthly: "\u6708\u989D\u5EA6",
|
|
28766
|
+
monthlyShort: "\u6708\u989D\u5EA6",
|
|
28357
28767
|
fiveHour: "5 \u5C0F\u65F6\u989D\u5EA6",
|
|
28768
|
+
fiveHourShort: "5 \u5C0F\u65F6",
|
|
28358
28769
|
sevenDay: "7 \u5929\u989D\u5EA6",
|
|
28770
|
+
sevenDayShort: "7 \u5929",
|
|
28359
28771
|
account: "\u8D26\u53F7\u989D\u5EA6"
|
|
28360
28772
|
});
|
|
28361
28773
|
function formatRendererCreditsReset(value, now = /* @__PURE__ */ new Date(), locale = "en") {
|
|
@@ -31330,6 +31742,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
31330
31742
|
.settings-connection-inspector {
|
|
31331
31743
|
position: sticky;
|
|
31332
31744
|
top: 18px;
|
|
31745
|
+
overflow-anchor: none;
|
|
31333
31746
|
}
|
|
31334
31747
|
|
|
31335
31748
|
.settings-connection-inspector__header {
|
|
@@ -32685,6 +33098,11 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32685
33098
|
// src/web-settings-entry.ts
|
|
32686
33099
|
var WEB_LAYOUT_CSS = `.settings-page { background: transparent; overflow: visible; container: codexhost-settings-page / inline-size; }
|
|
32687
33100
|
.settings-page__content { width: 100%; padding: 0; }`;
|
|
33101
|
+
var sharedConnectionDiagnostics = null;
|
|
33102
|
+
function getWebConnectionDiagnostics(client) {
|
|
33103
|
+
sharedConnectionDiagnostics ??= createConsoleConnectionDiagnostics(client);
|
|
33104
|
+
return sharedConnectionDiagnostics;
|
|
33105
|
+
}
|
|
32688
33106
|
function resourcesPage(messages, client) {
|
|
32689
33107
|
return {
|
|
32690
33108
|
id: "resources",
|
|
@@ -32714,7 +33132,6 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32714
33132
|
() => modelClient,
|
|
32715
33133
|
{ migrateLegacy: false }
|
|
32716
33134
|
);
|
|
32717
|
-
const diagnostics = createConsoleConnectionDiagnostics(modelClient);
|
|
32718
33135
|
const updateClient = {
|
|
32719
33136
|
checkUpdate: () => modelClient.checkUpdate(),
|
|
32720
33137
|
startUpdate: () => modelClient.startUpdate(),
|
|
@@ -32724,7 +33141,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32724
33141
|
...createDefaultRendererSettingsPages(
|
|
32725
33142
|
messages,
|
|
32726
33143
|
() => updateClient,
|
|
32727
|
-
() =>
|
|
33144
|
+
() => getWebConnectionDiagnostics(modelClient),
|
|
32728
33145
|
() => modelClient,
|
|
32729
33146
|
() => null,
|
|
32730
33147
|
null,
|