@karlorz/codexhost-cli-darwin-x64 0.19.0-1 → 0.20.0-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 +1280 -826
- package/app/cpa-live-voice-hook.js +24 -3
- package/app/desktop-controller.mjs +24 -3
- package/app/host-runtime.mjs +1586 -1189
- package/app/plugins/antigravity/plugin.mjs +8782 -4311
- 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 +43 -5
- 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 +1698 -983
- package/app/voice-qualification.json +151 -1
- package/app/web/assets/index-B5OfOGb8.js +201 -0
- package/app/web/assets/index-D6-hvggd.css +1 -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 +1285 -827
- 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 +68 -68
- 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 +135 -69
- 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-BCyiiDDL.js +0 -199
- package/app/web/assets/index-BNQIOOHE.css +0 -1
|
@@ -15050,13 +15050,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15050
15050
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15051
15051
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15052
15052
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15053
|
+
var usageOutputTimingSchema = external_exports.object({
|
|
15054
|
+
version: external_exports.literal(3).optional(),
|
|
15055
|
+
requestId: external_exports.string().min(1),
|
|
15056
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
15057
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
15058
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
15059
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
15060
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
15053
15061
|
var usageMeasurementSchema = external_exports.object({
|
|
15062
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
|
|
15054
15063
|
value: finiteNonNegativeNumberSchema,
|
|
15055
15064
|
turnId: external_exports.string().min(1).max(1024),
|
|
15056
15065
|
at: nonNegativeSafeIntegerSchema
|
|
15057
15066
|
}).strict();
|
|
15058
15067
|
var usageMeasurementsSchema = external_exports.object({
|
|
15059
|
-
|
|
15068
|
+
// Unversioned intervals can omit hidden thinking time; do not restore them into averages.
|
|
15069
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
|
|
15070
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
15071
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
|
|
15060
15072
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15061
15073
|
}).strict();
|
|
15062
15074
|
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
@@ -15076,6 +15088,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15076
15088
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15077
15089
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15078
15090
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15091
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15079
15092
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15080
15093
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15081
15094
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15536,6 +15549,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15536
15549
|
})
|
|
15537
15550
|
});
|
|
15538
15551
|
|
|
15552
|
+
// ../shared-contracts/dist/thread-archive-confirm.js
|
|
15553
|
+
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15554
|
+
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15555
|
+
|
|
15539
15556
|
// ../shared-contracts/dist/client-channel.js
|
|
15540
15557
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15541
15558
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
@@ -15675,7 +15692,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15675
15692
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
15676
15693
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
15677
15694
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
15678
|
-
command: external_exports.object({
|
|
15695
|
+
command: external_exports.object({
|
|
15696
|
+
name: external_exports.string().min(1),
|
|
15697
|
+
turn: clientTurnSchema,
|
|
15698
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
15699
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
15700
|
+
}).optional(),
|
|
15679
15701
|
thread: external_exports.object({
|
|
15680
15702
|
id: external_exports.string().min(1),
|
|
15681
15703
|
cwd: external_exports.string(),
|
|
@@ -15885,7 +15907,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15885
15907
|
quotaUntil: external_exports.string().optional()
|
|
15886
15908
|
}).strict().optional()
|
|
15887
15909
|
}).strict();
|
|
15888
|
-
var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
|
|
15889
15910
|
|
|
15890
15911
|
// ../shared-contracts/dist/delegation-read.js
|
|
15891
15912
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -17196,7 +17217,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17196
17217
|
await Promise.all(
|
|
17197
17218
|
plugins.map(async ({ id }) => {
|
|
17198
17219
|
try {
|
|
17199
|
-
const inspection = await client.inspectHarness({
|
|
17220
|
+
const inspection = await client.inspectHarness({
|
|
17221
|
+
harnessId: id,
|
|
17222
|
+
refresh,
|
|
17223
|
+
purpose: "availability"
|
|
17224
|
+
});
|
|
17200
17225
|
availability.set(id, inspection.status);
|
|
17201
17226
|
webUi.set(id, inspection.status === "ready" && inspection.webUi?.open === true);
|
|
17202
17227
|
const error51 = inspection.status === "ready" ? null : inspection.error;
|
|
@@ -23633,6 +23658,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
23633
23658
|
latestCacheHit: "Latest cache hit (CH)",
|
|
23634
23659
|
sessionCacheHit: "Average cache hit",
|
|
23635
23660
|
outputSpeed: "Output speed (TPS)",
|
|
23661
|
+
averageOutputSpeed: "Average output speed (TPS)",
|
|
23636
23662
|
apiOutputSpeed: "API average speed",
|
|
23637
23663
|
apiOutputSpeedDescription: "Output tokens / native API time, including first-token wait; not generation TPS.",
|
|
23638
23664
|
timeToFirstOutput: "Time to first token (TTFT)",
|
|
@@ -23658,6 +23684,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
23658
23684
|
latestCacheHit: "\u6700\u8FD1\u7F13\u5B58\u547D\u4E2D\uFF08CH\uFF09",
|
|
23659
23685
|
sessionCacheHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
|
|
23660
23686
|
outputSpeed: "\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
23687
|
+
averageOutputSpeed: "\u5E73\u5747\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
23661
23688
|
apiOutputSpeed: "API \u5E73\u5747\u901F\u5EA6",
|
|
23662
23689
|
apiOutputSpeedDescription: "\u8F93\u51FA Token \xF7 \u539F\u751F API \u8017\u65F6\uFF0C\u542B\u9996\u5B57\u7B49\u5F85\uFF1B\u4E0D\u662F\u751F\u6210 TPS\u3002",
|
|
23663
23690
|
timeToFirstOutput: "\u9996 token\uFF08TTFT\uFF09",
|
|
@@ -27708,196 +27735,729 @@ ${detail}` : ""}`
|
|
|
27708
27735
|
return fallback;
|
|
27709
27736
|
}
|
|
27710
27737
|
|
|
27711
|
-
// src/settings/
|
|
27712
|
-
function
|
|
27713
|
-
|
|
27714
|
-
|
|
27715
|
-
|
|
27716
|
-
|
|
27717
|
-
|
|
27718
|
-
|
|
27719
|
-
|
|
27720
|
-
|
|
27721
|
-
|
|
27722
|
-
|
|
27723
|
-
|
|
27724
|
-
|
|
27725
|
-
|
|
27726
|
-
|
|
27727
|
-
|
|
27728
|
-
|
|
27729
|
-
|
|
27730
|
-
|
|
27731
|
-
|
|
27732
|
-
|
|
27733
|
-
|
|
27734
|
-
|
|
27735
|
-
|
|
27736
|
-
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27740
|
-
|
|
27741
|
-
|
|
27742
|
-
|
|
27743
|
-
|
|
27744
|
-
|
|
27745
|
-
|
|
27746
|
-
|
|
27747
|
-
|
|
27748
|
-
}
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27759
|
-
|
|
27760
|
-
|
|
27761
|
-
|
|
27762
|
-
|
|
27763
|
-
|
|
27764
|
-
|
|
27738
|
+
// src/settings/connection-row.ts
|
|
27739
|
+
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
27740
|
+
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
27741
|
+
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
27742
|
+
if (availability === "ready") return messages.connectionStatusReady;
|
|
27743
|
+
if (availability === "checking") return messages.connectionStatusChecking;
|
|
27744
|
+
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
27745
|
+
if (availability === "unavailable" || availability === "error") {
|
|
27746
|
+
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
27747
|
+
}
|
|
27748
|
+
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
27749
|
+
}
|
|
27750
|
+
function connectionStatusTone(availability, hasError = false) {
|
|
27751
|
+
if (availability === "updating") return "checking";
|
|
27752
|
+
if (hasError && availability !== "notInstalled") return "failed";
|
|
27753
|
+
if (availability === "ready") return "ready";
|
|
27754
|
+
if (availability === "checking" || availability === "installing") return "checking";
|
|
27755
|
+
if (availability === "notInstalled") return "setup";
|
|
27756
|
+
return "failed";
|
|
27757
|
+
}
|
|
27758
|
+
function createConnectionIdentityIcon(document2, item, size) {
|
|
27759
|
+
const container = document2.createElement("span");
|
|
27760
|
+
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
27761
|
+
container.setAttribute("aria-hidden", "true");
|
|
27762
|
+
if (item.agentSnapshot) {
|
|
27763
|
+
container.append(
|
|
27764
|
+
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
27765
|
+
);
|
|
27766
|
+
} else {
|
|
27767
|
+
container.textContent = "CH";
|
|
27768
|
+
}
|
|
27769
|
+
return container;
|
|
27770
|
+
}
|
|
27771
|
+
function sameElementChildren(container, next) {
|
|
27772
|
+
if (container.children.length !== next.length) return false;
|
|
27773
|
+
for (let index = 0; index < next.length; index++) {
|
|
27774
|
+
if (container.children[index] !== next[index]) return false;
|
|
27775
|
+
}
|
|
27776
|
+
return true;
|
|
27777
|
+
}
|
|
27778
|
+
function reconcileElementChildren(container, next) {
|
|
27779
|
+
if (sameElementChildren(container, next)) return;
|
|
27780
|
+
if (typeof container.insertBefore !== "function") {
|
|
27781
|
+
container.replaceChildren(...next);
|
|
27782
|
+
return;
|
|
27783
|
+
}
|
|
27784
|
+
const nextSet = new Set(next);
|
|
27785
|
+
for (const child of [...container.children]) {
|
|
27786
|
+
if (!nextSet.has(child)) child.remove();
|
|
27787
|
+
}
|
|
27788
|
+
for (let index = 0; index < next.length; index++) {
|
|
27789
|
+
const desired = next[index];
|
|
27790
|
+
if (!desired) continue;
|
|
27791
|
+
const current = container.children[index] ?? null;
|
|
27792
|
+
if (current !== desired) {
|
|
27793
|
+
container.insertBefore(desired, current);
|
|
27765
27794
|
}
|
|
27766
|
-
}
|
|
27767
|
-
|
|
27768
|
-
|
|
27769
|
-
|
|
27770
|
-
|
|
27771
|
-
|
|
27772
|
-
|
|
27795
|
+
}
|
|
27796
|
+
}
|
|
27797
|
+
function identityIconSignature(item) {
|
|
27798
|
+
if (!item.agentSnapshot) return "adapter";
|
|
27799
|
+
const plugin = item.agentSnapshot.plugin;
|
|
27800
|
+
return `${item.agentSnapshot.agent}:${String(plugin?.icon ?? "")}:${String(plugin?.iconStyle ?? "")}`;
|
|
27801
|
+
}
|
|
27802
|
+
function createConnectionRowView(document2, messages, groupable) {
|
|
27803
|
+
const row = document2.createElement("div");
|
|
27804
|
+
row.className = "settings-connection-row";
|
|
27805
|
+
row.setAttribute("role", "row");
|
|
27806
|
+
const identity2 = document2.createElement("div");
|
|
27807
|
+
identity2.className = "settings-connection-row__identity";
|
|
27808
|
+
identity2.setAttribute("role", "cell");
|
|
27809
|
+
let handle = null;
|
|
27810
|
+
if (groupable) {
|
|
27811
|
+
handle = document2.createElement("span");
|
|
27812
|
+
handle.className = "settings-connection-row__handle";
|
|
27813
|
+
handle.setAttribute("aria-hidden", "true");
|
|
27814
|
+
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
27815
|
+
identity2.append(handle);
|
|
27816
|
+
}
|
|
27817
|
+
let iconElement = null;
|
|
27818
|
+
let renderedIconKey = null;
|
|
27819
|
+
const label = document2.createElement("strong");
|
|
27820
|
+
const status = document2.createElement("span");
|
|
27821
|
+
status.className = "settings-connection-row__status";
|
|
27822
|
+
status.setAttribute("role", "cell");
|
|
27823
|
+
const action = document2.createElement("div");
|
|
27824
|
+
action.className = "settings-connection-row__action";
|
|
27825
|
+
action.setAttribute("role", "cell");
|
|
27826
|
+
row.append(identity2, status, action);
|
|
27827
|
+
let currentItem = null;
|
|
27828
|
+
let currentSelect = () => void 0;
|
|
27829
|
+
let currentGroup = null;
|
|
27830
|
+
let installButton = null;
|
|
27831
|
+
let viewErrorButton = null;
|
|
27832
|
+
let versionAvailableBadge = null;
|
|
27833
|
+
let updateButton = null;
|
|
27834
|
+
let groupToggleButton = null;
|
|
27835
|
+
let groupToggleSection = null;
|
|
27836
|
+
row.addEventListener("click", (event) => {
|
|
27837
|
+
const target2 = event.target;
|
|
27838
|
+
if (target2?.closest?.("a")) return;
|
|
27839
|
+
currentSelect();
|
|
27773
27840
|
});
|
|
27774
|
-
|
|
27775
|
-
|
|
27776
|
-
|
|
27777
|
-
|
|
27778
|
-
|
|
27779
|
-
}).catch(() => {
|
|
27780
|
-
loaded = true;
|
|
27781
|
-
status.textContent = messages.launchPathLoadError;
|
|
27782
|
-
}).finally(() => {
|
|
27783
|
-
busy = false;
|
|
27784
|
-
controls();
|
|
27841
|
+
row.addEventListener("keydown", (event) => {
|
|
27842
|
+
if (event.target?.closest?.("button, a")) return;
|
|
27843
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
27844
|
+
event.preventDefault();
|
|
27845
|
+
currentSelect();
|
|
27785
27846
|
});
|
|
27786
|
-
|
|
27787
|
-
|
|
27788
|
-
|
|
27789
|
-
|
|
27790
|
-
|
|
27791
|
-
|
|
27792
|
-
|
|
27793
|
-
|
|
27794
|
-
|
|
27795
|
-
|
|
27796
|
-
|
|
27797
|
-
copy.className = "settings-grok-computer-use__copy";
|
|
27798
|
-
const title = document2.createElement("h3");
|
|
27799
|
-
title.className = "settings-grok-computer-use__title";
|
|
27800
|
-
title.id = "grok-computer-use-title";
|
|
27801
|
-
title.textContent = messages.grokComputerUseTitle;
|
|
27802
|
-
const description = document2.createElement("p");
|
|
27803
|
-
description.className = "settings-grok-computer-use__description";
|
|
27804
|
-
description.id = "grok-computer-use-description";
|
|
27805
|
-
description.textContent = messages.grokComputerUseDescription;
|
|
27806
|
-
copy.append(title, description);
|
|
27807
|
-
const input = createPreferenceSwitch(
|
|
27808
|
-
document2,
|
|
27809
|
-
"grok-computer-use-enabled",
|
|
27810
|
-
"grok-computer-use-description grok-computer-use-help grok-computer-use-status"
|
|
27811
|
-
);
|
|
27812
|
-
input.setAttribute("aria-labelledby", title.id);
|
|
27813
|
-
input.setAttribute("aria-label", messages.grokComputerUseLabel);
|
|
27814
|
-
header.append(copy, input);
|
|
27815
|
-
const help = document2.createElement("p");
|
|
27816
|
-
help.className = "settings-grok-computer-use__help";
|
|
27817
|
-
help.id = "grok-computer-use-help";
|
|
27818
|
-
help.textContent = messages.grokComputerUseHelp;
|
|
27819
|
-
const status = document2.createElement("p");
|
|
27820
|
-
status.className = "settings-grok-computer-use__status";
|
|
27821
|
-
status.id = "grok-computer-use-status";
|
|
27822
|
-
status.setAttribute("role", "status");
|
|
27823
|
-
status.setAttribute("aria-live", "polite");
|
|
27824
|
-
const browserHeader = document2.createElement("div");
|
|
27825
|
-
browserHeader.className = "settings-grok-computer-use__header settings-grok-computer-use__browser";
|
|
27826
|
-
const browserCopy = document2.createElement("div");
|
|
27827
|
-
browserCopy.className = "settings-grok-computer-use__copy";
|
|
27828
|
-
const browserTitle = document2.createElement("h3");
|
|
27829
|
-
browserTitle.className = "settings-grok-computer-use__title";
|
|
27830
|
-
browserTitle.id = "grok-browser-title";
|
|
27831
|
-
browserTitle.textContent = messages.grokBrowserTitle;
|
|
27832
|
-
const browserDescription = document2.createElement("p");
|
|
27833
|
-
browserDescription.className = "settings-grok-computer-use__description";
|
|
27834
|
-
browserDescription.id = "grok-browser-description";
|
|
27835
|
-
browserDescription.textContent = messages.grokBrowserDescription;
|
|
27836
|
-
browserCopy.append(browserTitle, browserDescription);
|
|
27837
|
-
const browserInput = createPreferenceSwitch(
|
|
27838
|
-
document2,
|
|
27839
|
-
"grok-browser-enabled",
|
|
27840
|
-
"grok-browser-description grok-browser-help grok-browser-status"
|
|
27841
|
-
);
|
|
27842
|
-
browserInput.setAttribute("aria-labelledby", browserTitle.id);
|
|
27843
|
-
browserInput.setAttribute("aria-label", messages.grokBrowserLabel);
|
|
27844
|
-
browserHeader.append(browserCopy, browserInput);
|
|
27845
|
-
const browserHelp = document2.createElement("p");
|
|
27846
|
-
browserHelp.className = "settings-grok-computer-use__help";
|
|
27847
|
-
browserHelp.id = "grok-browser-help";
|
|
27848
|
-
browserHelp.textContent = messages.grokBrowserHelp;
|
|
27849
|
-
const browserStatus = document2.createElement("p");
|
|
27850
|
-
browserStatus.className = "settings-grok-computer-use__status";
|
|
27851
|
-
browserStatus.id = "grok-browser-status";
|
|
27852
|
-
browserStatus.setAttribute("role", "status");
|
|
27853
|
-
browserStatus.setAttribute("aria-live", "polite");
|
|
27854
|
-
section.append(header, help, status, browserHeader, browserHelp, browserStatus);
|
|
27855
|
-
let busy = true;
|
|
27856
|
-
let loaded = false;
|
|
27857
|
-
let last;
|
|
27858
|
-
const show = (value) => {
|
|
27859
|
-
last = value;
|
|
27860
|
-
input.checked = value.enabled;
|
|
27861
|
-
input.disabled = busy || !loaded || !value.available && !value.enabled;
|
|
27862
|
-
const browserOn = value.browser === true;
|
|
27863
|
-
const browserFiles = value.browserFilesPresent === true;
|
|
27864
|
-
browserInput.checked = browserOn;
|
|
27865
|
-
browserInput.disabled = busy || !loaded || !browserFiles && !browserOn;
|
|
27866
|
-
if (!browserFiles) {
|
|
27867
|
-
browserStatus.dataset.state = "unavailable";
|
|
27868
|
-
browserStatus.textContent = value.browserUnavailableReason ?? messages.grokBrowserUnavailable;
|
|
27869
|
-
} else if (value.browserAvailable !== true) {
|
|
27870
|
-
browserStatus.dataset.state = browserOn ? "unavailable" : "off";
|
|
27871
|
-
browserStatus.textContent = browserOn ? value.browserUnavailableReason ?? messages.grokBrowserBlocked : messages.grokBrowserOff;
|
|
27872
|
-
} else {
|
|
27873
|
-
browserStatus.dataset.state = browserOn ? "on" : "off";
|
|
27874
|
-
browserStatus.textContent = browserOn ? messages.grokBrowserOn : messages.grokBrowserOff;
|
|
27875
|
-
}
|
|
27876
|
-
if (value.applyFailed) {
|
|
27877
|
-
status.dataset.state = "unavailable";
|
|
27878
|
-
status.textContent = value.applyError ?? messages.grokComputerUseApplyFailed;
|
|
27879
|
-
return;
|
|
27847
|
+
if (groupable) {
|
|
27848
|
+
row.addEventListener("dragstart", (event) => currentGroup?.onDragStart(event));
|
|
27849
|
+
row.addEventListener("dragover", (event) => currentGroup?.onDragOver(event));
|
|
27850
|
+
row.addEventListener("dragleave", (event) => currentGroup?.onDragLeave(event));
|
|
27851
|
+
row.addEventListener("drop", (event) => currentGroup?.onDrop(event));
|
|
27852
|
+
row.addEventListener("dragend", (event) => currentGroup?.onDragEnd(event));
|
|
27853
|
+
}
|
|
27854
|
+
const setSelected = (selected) => {
|
|
27855
|
+
const nextSelected = String(selected);
|
|
27856
|
+
if (row.dataset.connectionSelected !== nextSelected) {
|
|
27857
|
+
row.dataset.connectionSelected = nextSelected;
|
|
27880
27858
|
}
|
|
27881
|
-
|
|
27882
|
-
|
|
27883
|
-
|
|
27884
|
-
return;
|
|
27859
|
+
const nextTabIndex = selected ? 0 : -1;
|
|
27860
|
+
if (row.tabIndex !== nextTabIndex) {
|
|
27861
|
+
row.tabIndex = nextTabIndex;
|
|
27885
27862
|
}
|
|
27886
|
-
status.dataset.state = value.enabled ? "on" : "off";
|
|
27887
|
-
status.textContent = value.enabled ? messages.grokComputerUseOn : messages.grokComputerUseOff;
|
|
27888
27863
|
};
|
|
27889
|
-
|
|
27890
|
-
|
|
27891
|
-
|
|
27892
|
-
|
|
27893
|
-
|
|
27894
|
-
|
|
27895
|
-
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27900
|
-
|
|
27864
|
+
return {
|
|
27865
|
+
element: row,
|
|
27866
|
+
setSelected,
|
|
27867
|
+
update(item, selected, select, group) {
|
|
27868
|
+
currentItem = item;
|
|
27869
|
+
currentSelect = select;
|
|
27870
|
+
currentGroup = group;
|
|
27871
|
+
if (row.dataset.connectionItem !== item.key) {
|
|
27872
|
+
row.dataset.connectionItem = item.key;
|
|
27873
|
+
}
|
|
27874
|
+
setSelected(selected);
|
|
27875
|
+
const nextIconKey = identityIconSignature(item);
|
|
27876
|
+
if (renderedIconKey !== nextIconKey || !iconElement) {
|
|
27877
|
+
renderedIconKey = nextIconKey;
|
|
27878
|
+
iconElement = createConnectionIdentityIcon(document2, item, 19);
|
|
27879
|
+
reconcileElementChildren(
|
|
27880
|
+
identity2,
|
|
27881
|
+
handle ? [handle, iconElement, label] : [iconElement, label]
|
|
27882
|
+
);
|
|
27883
|
+
}
|
|
27884
|
+
if (handle && group && handle.title !== group.dragHandleTitle) {
|
|
27885
|
+
handle.title = group.dragHandleTitle;
|
|
27886
|
+
}
|
|
27887
|
+
if (label.textContent !== item.name) {
|
|
27888
|
+
label.textContent = item.name;
|
|
27889
|
+
}
|
|
27890
|
+
const tone = connectionStatusTone(item.availability, item.error !== null);
|
|
27891
|
+
if (status.dataset.connectionTone !== tone) {
|
|
27892
|
+
status.dataset.connectionTone = tone;
|
|
27893
|
+
}
|
|
27894
|
+
const statusText = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
27895
|
+
if (status.textContent !== statusText) {
|
|
27896
|
+
status.textContent = statusText;
|
|
27897
|
+
}
|
|
27898
|
+
const nextActions = [];
|
|
27899
|
+
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
27900
|
+
if (!installButton) {
|
|
27901
|
+
const button2 = document2.createElement("button");
|
|
27902
|
+
button2.type = "button";
|
|
27903
|
+
button2.className = "settings-connection-install-link";
|
|
27904
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
27905
|
+
button2.addEventListener("click", (event) => {
|
|
27906
|
+
event.stopPropagation();
|
|
27907
|
+
currentSelect();
|
|
27908
|
+
currentItem?.install?.();
|
|
27909
|
+
});
|
|
27910
|
+
installButton = button2;
|
|
27911
|
+
}
|
|
27912
|
+
installButton.disabled = item.availability === "installing" || item.availability === "checking";
|
|
27913
|
+
const installLabel = messages.connectionInstall;
|
|
27914
|
+
const ariaLabel = `${installLabel}: ${item.name}`;
|
|
27915
|
+
if (installButton.getAttribute("aria-label") !== ariaLabel) {
|
|
27916
|
+
installButton.setAttribute("aria-label", ariaLabel);
|
|
27917
|
+
}
|
|
27918
|
+
if (installButton.title !== installLabel) {
|
|
27919
|
+
installButton.title = installLabel;
|
|
27920
|
+
}
|
|
27921
|
+
nextActions.push(installButton);
|
|
27922
|
+
} else if (item.error) {
|
|
27923
|
+
if (!viewErrorButton) {
|
|
27924
|
+
const button2 = document2.createElement("button");
|
|
27925
|
+
button2.type = "button";
|
|
27926
|
+
button2.className = "settings-connection-view-error";
|
|
27927
|
+
button2.textContent = messages.connectionViewError;
|
|
27928
|
+
button2.addEventListener("click", (event) => {
|
|
27929
|
+
event.stopPropagation();
|
|
27930
|
+
currentSelect();
|
|
27931
|
+
});
|
|
27932
|
+
viewErrorButton = button2;
|
|
27933
|
+
}
|
|
27934
|
+
nextActions.push(viewErrorButton);
|
|
27935
|
+
}
|
|
27936
|
+
const version2 = item.version;
|
|
27937
|
+
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
27938
|
+
if (!versionAvailableBadge) {
|
|
27939
|
+
const badge = document2.createElement("span");
|
|
27940
|
+
badge.className = "settings-connection-version-available";
|
|
27941
|
+
badge.textContent = messages.harnessVersionAvailable;
|
|
27942
|
+
versionAvailableBadge = badge;
|
|
27943
|
+
}
|
|
27944
|
+
const badgeTitle = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
27945
|
+
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
27946
|
+
if (versionAvailableBadge.title !== badgeTitle) {
|
|
27947
|
+
versionAvailableBadge.title = badgeTitle;
|
|
27948
|
+
}
|
|
27949
|
+
nextActions.push(versionAvailableBadge);
|
|
27950
|
+
}
|
|
27951
|
+
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
27952
|
+
if (!updateButton) {
|
|
27953
|
+
const button2 = document2.createElement("button");
|
|
27954
|
+
button2.type = "button";
|
|
27955
|
+
button2.className = "settings-connection-install-link";
|
|
27956
|
+
button2.dataset.connectionAction = "update";
|
|
27957
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
27958
|
+
button2.addEventListener("click", (event) => {
|
|
27959
|
+
event.stopPropagation();
|
|
27960
|
+
if (button2.disabled) return;
|
|
27961
|
+
void currentItem?.version?.update();
|
|
27962
|
+
currentSelect();
|
|
27963
|
+
});
|
|
27964
|
+
updateButton = button2;
|
|
27965
|
+
}
|
|
27966
|
+
updateButton.disabled = version2.updating;
|
|
27967
|
+
if (updateButton.title !== messages.harnessVersionUpdate) {
|
|
27968
|
+
updateButton.title = messages.harnessVersionUpdate;
|
|
27969
|
+
}
|
|
27970
|
+
const updateAriaLabel = `${messages.harnessVersionUpdate}: ${item.name}`;
|
|
27971
|
+
if (updateButton.getAttribute("aria-label") !== updateAriaLabel) {
|
|
27972
|
+
updateButton.setAttribute("aria-label", updateAriaLabel);
|
|
27973
|
+
}
|
|
27974
|
+
nextActions.push(updateButton);
|
|
27975
|
+
}
|
|
27976
|
+
if (group) {
|
|
27977
|
+
if (!groupToggleButton) {
|
|
27978
|
+
const button2 = document2.createElement("button");
|
|
27979
|
+
button2.type = "button";
|
|
27980
|
+
button2.className = "settings-connection-row__group-toggle";
|
|
27981
|
+
button2.addEventListener("click", (event) => {
|
|
27982
|
+
event.stopPropagation();
|
|
27983
|
+
currentGroup?.toggleSection();
|
|
27984
|
+
});
|
|
27985
|
+
groupToggleButton = button2;
|
|
27986
|
+
}
|
|
27987
|
+
groupToggleButton.disabled = group.disabled;
|
|
27988
|
+
if (groupToggleButton.title !== group.moveLabel) {
|
|
27989
|
+
groupToggleButton.title = group.moveLabel;
|
|
27990
|
+
}
|
|
27991
|
+
if (groupToggleButton.getAttribute("aria-label") !== group.moveLabel) {
|
|
27992
|
+
groupToggleButton.setAttribute("aria-label", group.moveLabel);
|
|
27993
|
+
}
|
|
27994
|
+
if (groupToggleSection !== group.section) {
|
|
27995
|
+
groupToggleSection = group.section;
|
|
27996
|
+
groupToggleButton.replaceChildren(
|
|
27997
|
+
createRendererSettingsIcon(
|
|
27998
|
+
group.section === "main" ? "chevron-down" : "chevron-up",
|
|
27999
|
+
15
|
|
28000
|
+
)
|
|
28001
|
+
);
|
|
28002
|
+
}
|
|
28003
|
+
nextActions.push(groupToggleButton);
|
|
28004
|
+
}
|
|
28005
|
+
reconcileElementChildren(action, nextActions);
|
|
28006
|
+
if (group) {
|
|
28007
|
+
row.draggable = !group.disabled;
|
|
28008
|
+
if (row.dataset.connectionGroupSection !== group.section) {
|
|
28009
|
+
row.dataset.connectionGroupSection = group.section;
|
|
28010
|
+
}
|
|
28011
|
+
}
|
|
28012
|
+
}
|
|
28013
|
+
};
|
|
28014
|
+
}
|
|
28015
|
+
|
|
28016
|
+
// src/settings/connection-updates.ts
|
|
28017
|
+
var sharedBatchStores = /* @__PURE__ */ new WeakMap();
|
|
28018
|
+
function getBatchStore(diagnostics) {
|
|
28019
|
+
if (!diagnostics) {
|
|
28020
|
+
return { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
28021
|
+
}
|
|
28022
|
+
let store = sharedBatchStores.get(diagnostics);
|
|
28023
|
+
if (!store) {
|
|
28024
|
+
store = { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
28025
|
+
sharedBatchStores.set(diagnostics, store);
|
|
28026
|
+
}
|
|
28027
|
+
return store;
|
|
28028
|
+
}
|
|
28029
|
+
function createConnectionUpdates(document2, messages, signal, onChange, diagnostics = null) {
|
|
28030
|
+
const store = getBatchStore(diagnostics);
|
|
28031
|
+
const notify2 = () => {
|
|
28032
|
+
for (const listener of [...store.listeners]) listener();
|
|
28033
|
+
};
|
|
28034
|
+
if (!signal.aborted) {
|
|
28035
|
+
const listener = () => {
|
|
28036
|
+
if (!signal.aborted) onChange();
|
|
28037
|
+
};
|
|
28038
|
+
store.listeners.add(listener);
|
|
28039
|
+
signal.addEventListener(
|
|
28040
|
+
"abort",
|
|
28041
|
+
() => {
|
|
28042
|
+
store.listeners.delete(listener);
|
|
28043
|
+
},
|
|
28044
|
+
{ once: true }
|
|
28045
|
+
);
|
|
28046
|
+
}
|
|
28047
|
+
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
28048
|
+
const start = async (hostId2, panels) => {
|
|
28049
|
+
if (signal.aborted || store.batches.get(hostId2)?.running) return;
|
|
28050
|
+
const targets = eligible(panels);
|
|
28051
|
+
if (!targets.length) return;
|
|
28052
|
+
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
28053
|
+
store.batches.set(hostId2, batch);
|
|
28054
|
+
notify2();
|
|
28055
|
+
await Promise.all(
|
|
28056
|
+
targets.map(async (panel) => {
|
|
28057
|
+
try {
|
|
28058
|
+
if (await panel.update()) batch.succeeded++;
|
|
28059
|
+
else batch.failed++;
|
|
28060
|
+
} catch {
|
|
28061
|
+
batch.failed++;
|
|
28062
|
+
}
|
|
28063
|
+
notify2();
|
|
28064
|
+
})
|
|
28065
|
+
);
|
|
28066
|
+
batch.running = false;
|
|
28067
|
+
notify2();
|
|
28068
|
+
};
|
|
28069
|
+
return {
|
|
28070
|
+
createControls(hostId2, panels) {
|
|
28071
|
+
let currentHostId = hostId2;
|
|
28072
|
+
let currentPanels = panels;
|
|
28073
|
+
let renderedLabel = null;
|
|
28074
|
+
const button2 = document2.createElement("button");
|
|
28075
|
+
button2.type = "button";
|
|
28076
|
+
button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
|
|
28077
|
+
button2.dataset.connectionAction = "update-all";
|
|
28078
|
+
button2.title = messages.harnessUpdateAllDescription;
|
|
28079
|
+
button2.addEventListener("click", () => {
|
|
28080
|
+
if (!button2.disabled) void start(currentHostId, currentPanels);
|
|
28081
|
+
});
|
|
28082
|
+
const result = document2.createElement("p");
|
|
28083
|
+
result.className = "settings-connection-update-result";
|
|
28084
|
+
result.setAttribute("role", "status");
|
|
28085
|
+
const update = (nextHostId, nextPanels) => {
|
|
28086
|
+
currentHostId = nextHostId;
|
|
28087
|
+
currentPanels = nextPanels;
|
|
28088
|
+
const batch = store.batches.get(nextHostId);
|
|
28089
|
+
const count4 = eligible(nextPanels).length;
|
|
28090
|
+
button2.disabled = signal.aborted || Boolean(batch?.running) || !count4;
|
|
28091
|
+
const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count4 ? `${messages.harnessUpdateAll} (${count4})` : messages.harnessUpdateAll;
|
|
28092
|
+
if (renderedLabel !== label) {
|
|
28093
|
+
renderedLabel = label;
|
|
28094
|
+
button2.replaceChildren(createRendererSettingsIcon("download", 15), label);
|
|
28095
|
+
}
|
|
28096
|
+
const hidden = !batch || batch.running;
|
|
28097
|
+
result.hidden = hidden;
|
|
28098
|
+
const resultText = batch && !batch.running ? messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed)) : "";
|
|
28099
|
+
if (result.textContent !== resultText) {
|
|
28100
|
+
result.textContent = resultText;
|
|
28101
|
+
}
|
|
28102
|
+
};
|
|
28103
|
+
update(hostId2, panels);
|
|
28104
|
+
return { button: button2, result, update };
|
|
28105
|
+
}
|
|
28106
|
+
};
|
|
28107
|
+
}
|
|
28108
|
+
|
|
28109
|
+
// src/settings/harness-version-panel.ts
|
|
28110
|
+
function isUnsupportedInstallationError(error51) {
|
|
28111
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
28112
|
+
}
|
|
28113
|
+
function createHarnessVersionSession(client, options) {
|
|
28114
|
+
let state;
|
|
28115
|
+
let statusKind = "checking";
|
|
28116
|
+
let checkPromise = null;
|
|
28117
|
+
let updatePromise = null;
|
|
28118
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
28119
|
+
const signal = options?.signal;
|
|
28120
|
+
const notify2 = (pageChange) => {
|
|
28121
|
+
if (signal?.aborted) return;
|
|
28122
|
+
for (const listener of [...listeners]) listener(pageChange);
|
|
28123
|
+
};
|
|
28124
|
+
const check2 = () => {
|
|
28125
|
+
if (signal?.aborted || updatePromise) return Promise.resolve();
|
|
28126
|
+
if (checkPromise) return checkPromise;
|
|
28127
|
+
statusKind = "checking";
|
|
28128
|
+
notify2(false);
|
|
28129
|
+
checkPromise = (async () => {
|
|
28130
|
+
try {
|
|
28131
|
+
const result = await client.run("check");
|
|
28132
|
+
if (signal?.aborted || updatePromise) return;
|
|
28133
|
+
state = result;
|
|
28134
|
+
statusKind = "idle";
|
|
28135
|
+
} catch (error51) {
|
|
28136
|
+
if (signal?.aborted || updatePromise) return;
|
|
28137
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
28138
|
+
if (state) state = { ...state, canUpdate: false };
|
|
28139
|
+
} finally {
|
|
28140
|
+
checkPromise = null;
|
|
28141
|
+
if (!signal?.aborted && !updatePromise) {
|
|
28142
|
+
notify2(true);
|
|
28143
|
+
}
|
|
28144
|
+
}
|
|
28145
|
+
})();
|
|
28146
|
+
return checkPromise;
|
|
28147
|
+
};
|
|
28148
|
+
const update = () => {
|
|
28149
|
+
if (updatePromise) return updatePromise;
|
|
28150
|
+
updatePromise = (async () => {
|
|
28151
|
+
if (signal?.aborted) return false;
|
|
28152
|
+
if (checkPromise) await checkPromise;
|
|
28153
|
+
if (signal?.aborted || statusKind === "unsupported" || !state?.canUpdate || !state.updateAvailable) {
|
|
28154
|
+
return false;
|
|
28155
|
+
}
|
|
28156
|
+
statusKind = "updating";
|
|
28157
|
+
notify2(true);
|
|
28158
|
+
try {
|
|
28159
|
+
const result = await client.run("update");
|
|
28160
|
+
if (signal?.aborted) return false;
|
|
28161
|
+
state = result;
|
|
28162
|
+
statusKind = !result.canUpdate ? "updated" : result.updateAvailable ? "failed" : "updated";
|
|
28163
|
+
return result.canUpdate && !result.updateAvailable;
|
|
28164
|
+
} catch (error51) {
|
|
28165
|
+
if (signal?.aborted) return false;
|
|
28166
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
28167
|
+
if (state) state = { ...state, canUpdate: false };
|
|
28168
|
+
return false;
|
|
28169
|
+
} finally {
|
|
28170
|
+
updatePromise = null;
|
|
28171
|
+
if (!signal?.aborted) {
|
|
28172
|
+
notify2(true);
|
|
28173
|
+
}
|
|
28174
|
+
}
|
|
28175
|
+
})();
|
|
28176
|
+
return updatePromise;
|
|
28177
|
+
};
|
|
28178
|
+
return {
|
|
28179
|
+
get state() {
|
|
28180
|
+
return state;
|
|
28181
|
+
},
|
|
28182
|
+
get statusKind() {
|
|
28183
|
+
return statusKind;
|
|
28184
|
+
},
|
|
28185
|
+
get updating() {
|
|
28186
|
+
return statusKind === "updating";
|
|
28187
|
+
},
|
|
28188
|
+
prepareMount() {
|
|
28189
|
+
if (updatePromise || checkPromise) return false;
|
|
28190
|
+
statusKind = "checking";
|
|
28191
|
+
return true;
|
|
28192
|
+
},
|
|
28193
|
+
check: check2,
|
|
28194
|
+
update,
|
|
28195
|
+
subscribe(listener) {
|
|
28196
|
+
listeners.add(listener);
|
|
28197
|
+
return () => {
|
|
28198
|
+
listeners.delete(listener);
|
|
28199
|
+
};
|
|
28200
|
+
}
|
|
28201
|
+
};
|
|
28202
|
+
}
|
|
28203
|
+
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0, sharedSession) {
|
|
28204
|
+
const session = sharedSession ?? createHarnessVersionSession(client, { signal });
|
|
28205
|
+
const shouldScheduleCheck = session.prepareMount();
|
|
28206
|
+
const panel = document2.createElement("section");
|
|
28207
|
+
panel.className = "settings-harness-version";
|
|
28208
|
+
panel.dataset.harnessVersion = agent;
|
|
28209
|
+
const heading = document2.createElement("strong");
|
|
28210
|
+
heading.textContent = messages.harnessVersionTitle;
|
|
28211
|
+
const versions = document2.createElement("div");
|
|
28212
|
+
versions.className = "settings-harness-version__values";
|
|
28213
|
+
const current = document2.createElement("span");
|
|
28214
|
+
const latest = document2.createElement("span");
|
|
28215
|
+
versions.append(current, latest);
|
|
28216
|
+
const status = document2.createElement("p");
|
|
28217
|
+
status.setAttribute("role", "status");
|
|
28218
|
+
const actions = document2.createElement("div");
|
|
28219
|
+
actions.className = "settings-connection-error-actions";
|
|
28220
|
+
const update = document2.createElement("button");
|
|
28221
|
+
update.type = "button";
|
|
28222
|
+
update.className = "settings-command-button settings-command-button--secondary";
|
|
28223
|
+
update.dataset.harnessVersionAction = "update";
|
|
28224
|
+
const note = document2.createElement("p");
|
|
28225
|
+
note.className = "settings-connection-issue-note";
|
|
28226
|
+
note.textContent = messages.harnessVersionNote;
|
|
28227
|
+
actions.append(update);
|
|
28228
|
+
panel.append(heading, versions, status, actions, note);
|
|
28229
|
+
const render = () => {
|
|
28230
|
+
const state = session.state;
|
|
28231
|
+
const statusKind = session.statusKind;
|
|
28232
|
+
const busy = statusKind === "checking" || statusKind === "updating";
|
|
28233
|
+
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
28234
|
+
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
28235
|
+
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
28236
|
+
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 : "";
|
|
28237
|
+
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
28238
|
+
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
28239
|
+
actions.replaceChildren(update);
|
|
28240
|
+
update.hidden = !busy && !signal.aborted && Boolean(manualUrl);
|
|
28241
|
+
if (update.hidden && manualUrl) {
|
|
28242
|
+
const download2 = document2.createElement("a");
|
|
28243
|
+
download2.className = "settings-command-button settings-command-button--secondary";
|
|
28244
|
+
download2.dataset.harnessVersionAction = "download-update";
|
|
28245
|
+
download2.textContent = messages.harnessVersionDownloadUpdate;
|
|
28246
|
+
download2.href = manualUrl;
|
|
28247
|
+
download2.target = "_blank";
|
|
28248
|
+
download2.rel = "noopener noreferrer";
|
|
28249
|
+
actions.append(download2);
|
|
28250
|
+
}
|
|
28251
|
+
update.textContent = state?.canUpdate && state.latestVersion !== "Unknown" && !state.updateAvailable ? messages.harnessVersionUpToDate : messages.harnessVersionUpdate;
|
|
28252
|
+
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
28253
|
+
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
28254
|
+
};
|
|
28255
|
+
update.addEventListener("click", () => {
|
|
28256
|
+
if (!signal.aborted) void session.update();
|
|
28257
|
+
});
|
|
28258
|
+
const unsubscribe = session.subscribe((pageChange) => {
|
|
28259
|
+
if (signal.aborted) return;
|
|
28260
|
+
render();
|
|
28261
|
+
if (pageChange) onChange();
|
|
28262
|
+
});
|
|
28263
|
+
const owner = document2.defaultView;
|
|
28264
|
+
let checkFrame = null;
|
|
28265
|
+
let checkTimer = null;
|
|
28266
|
+
signal.addEventListener(
|
|
28267
|
+
"abort",
|
|
28268
|
+
() => {
|
|
28269
|
+
unsubscribe();
|
|
28270
|
+
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
28271
|
+
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
28272
|
+
render();
|
|
28273
|
+
},
|
|
28274
|
+
{ once: true }
|
|
28275
|
+
);
|
|
28276
|
+
render();
|
|
28277
|
+
if (shouldScheduleCheck && !signal.aborted) {
|
|
28278
|
+
if (owner?.requestAnimationFrame) {
|
|
28279
|
+
checkFrame = owner.requestAnimationFrame(() => {
|
|
28280
|
+
checkFrame = null;
|
|
28281
|
+
if (signal.aborted) return;
|
|
28282
|
+
checkTimer = owner.setTimeout(() => {
|
|
28283
|
+
checkTimer = null;
|
|
28284
|
+
if (!signal.aborted) void session.check();
|
|
28285
|
+
}, 0);
|
|
28286
|
+
});
|
|
28287
|
+
} else {
|
|
28288
|
+
void session.check();
|
|
28289
|
+
}
|
|
28290
|
+
}
|
|
28291
|
+
return {
|
|
28292
|
+
element: panel,
|
|
28293
|
+
get state() {
|
|
28294
|
+
return session.state;
|
|
28295
|
+
},
|
|
28296
|
+
get updating() {
|
|
28297
|
+
return session.updating;
|
|
28298
|
+
},
|
|
28299
|
+
update: () => signal.aborted ? Promise.resolve(false) : session.update()
|
|
28300
|
+
};
|
|
28301
|
+
}
|
|
28302
|
+
|
|
28303
|
+
// src/settings/connection-versions.ts
|
|
28304
|
+
var sessionStores = /* @__PURE__ */ new WeakMap();
|
|
28305
|
+
function getSessionStore(diagnostics) {
|
|
28306
|
+
let store = sessionStores.get(diagnostics);
|
|
28307
|
+
if (!store) {
|
|
28308
|
+
store = /* @__PURE__ */ new Map();
|
|
28309
|
+
sessionStores.set(diagnostics, store);
|
|
28310
|
+
}
|
|
28311
|
+
return store;
|
|
28312
|
+
}
|
|
28313
|
+
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
28314
|
+
const panels = /* @__PURE__ */ new Map();
|
|
28315
|
+
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
28316
|
+
const sessions = diagnostics ? getSessionStore(diagnostics) : null;
|
|
28317
|
+
const sessionKey = (hostId2, agent) => JSON.stringify([hostId2, agent]);
|
|
28318
|
+
return {
|
|
28319
|
+
isUpdating(hostId2, agent) {
|
|
28320
|
+
return Boolean(sessions?.get(sessionKey(hostId2, agent))?.updating);
|
|
28321
|
+
},
|
|
28322
|
+
get(hostId2, agent) {
|
|
28323
|
+
if (!installation || signal.aborted) return void 0;
|
|
28324
|
+
const key = sessionKey(hostId2, agent);
|
|
28325
|
+
let panel = panels.get(key);
|
|
28326
|
+
if (!panel) {
|
|
28327
|
+
const run = (action) => installation(hostId2, agent, action);
|
|
28328
|
+
let session = sessions?.get(key);
|
|
28329
|
+
if (!session) {
|
|
28330
|
+
session = createHarnessVersionSession({ run });
|
|
28331
|
+
sessions?.set(key, session);
|
|
28332
|
+
}
|
|
28333
|
+
panel = createHarnessVersionPanel(
|
|
28334
|
+
document2,
|
|
28335
|
+
messages,
|
|
28336
|
+
signal,
|
|
28337
|
+
agent,
|
|
28338
|
+
{ run },
|
|
28339
|
+
onChange,
|
|
28340
|
+
session
|
|
28341
|
+
);
|
|
28342
|
+
panels.set(key, panel);
|
|
28343
|
+
}
|
|
28344
|
+
return panel;
|
|
28345
|
+
}
|
|
28346
|
+
};
|
|
28347
|
+
}
|
|
28348
|
+
|
|
28349
|
+
// src/settings/grok-computer-use-controls.ts
|
|
28350
|
+
function createGrokComputerUseControls(document2, messages, settings) {
|
|
28351
|
+
const section = document2.createElement("section");
|
|
28352
|
+
section.className = "settings-grok-computer-use";
|
|
28353
|
+
section.dataset.grokComputerUse = "true";
|
|
28354
|
+
const header = document2.createElement("div");
|
|
28355
|
+
header.className = "settings-grok-computer-use__header";
|
|
28356
|
+
const copy = document2.createElement("div");
|
|
28357
|
+
copy.className = "settings-grok-computer-use__copy";
|
|
28358
|
+
const title = document2.createElement("h3");
|
|
28359
|
+
title.className = "settings-grok-computer-use__title";
|
|
28360
|
+
title.id = "grok-computer-use-title";
|
|
28361
|
+
title.textContent = messages.grokComputerUseTitle;
|
|
28362
|
+
const description = document2.createElement("p");
|
|
28363
|
+
description.className = "settings-grok-computer-use__description";
|
|
28364
|
+
description.id = "grok-computer-use-description";
|
|
28365
|
+
description.textContent = messages.grokComputerUseDescription;
|
|
28366
|
+
copy.append(title, description);
|
|
28367
|
+
const input = createPreferenceSwitch(
|
|
28368
|
+
document2,
|
|
28369
|
+
"grok-computer-use-enabled",
|
|
28370
|
+
"grok-computer-use-description grok-computer-use-help grok-computer-use-status"
|
|
28371
|
+
);
|
|
28372
|
+
input.setAttribute("aria-labelledby", title.id);
|
|
28373
|
+
input.setAttribute("aria-label", messages.grokComputerUseLabel);
|
|
28374
|
+
header.append(copy, input);
|
|
28375
|
+
const help = document2.createElement("p");
|
|
28376
|
+
help.className = "settings-grok-computer-use__help";
|
|
28377
|
+
help.id = "grok-computer-use-help";
|
|
28378
|
+
help.textContent = messages.grokComputerUseHelp;
|
|
28379
|
+
const status = document2.createElement("p");
|
|
28380
|
+
status.className = "settings-grok-computer-use__status";
|
|
28381
|
+
status.id = "grok-computer-use-status";
|
|
28382
|
+
status.setAttribute("role", "status");
|
|
28383
|
+
status.setAttribute("aria-live", "polite");
|
|
28384
|
+
const browserHeader = document2.createElement("div");
|
|
28385
|
+
browserHeader.className = "settings-grok-computer-use__header settings-grok-computer-use__browser";
|
|
28386
|
+
const browserCopy = document2.createElement("div");
|
|
28387
|
+
browserCopy.className = "settings-grok-computer-use__copy";
|
|
28388
|
+
const browserTitle = document2.createElement("h3");
|
|
28389
|
+
browserTitle.className = "settings-grok-computer-use__title";
|
|
28390
|
+
browserTitle.id = "grok-browser-title";
|
|
28391
|
+
browserTitle.textContent = messages.grokBrowserTitle;
|
|
28392
|
+
const browserDescription = document2.createElement("p");
|
|
28393
|
+
browserDescription.className = "settings-grok-computer-use__description";
|
|
28394
|
+
browserDescription.id = "grok-browser-description";
|
|
28395
|
+
browserDescription.textContent = messages.grokBrowserDescription;
|
|
28396
|
+
browserCopy.append(browserTitle, browserDescription);
|
|
28397
|
+
const browserInput = createPreferenceSwitch(
|
|
28398
|
+
document2,
|
|
28399
|
+
"grok-browser-enabled",
|
|
28400
|
+
"grok-browser-description grok-browser-help grok-browser-status"
|
|
28401
|
+
);
|
|
28402
|
+
browserInput.setAttribute("aria-labelledby", browserTitle.id);
|
|
28403
|
+
browserInput.setAttribute("aria-label", messages.grokBrowserLabel);
|
|
28404
|
+
browserHeader.append(browserCopy, browserInput);
|
|
28405
|
+
const browserHelp = document2.createElement("p");
|
|
28406
|
+
browserHelp.className = "settings-grok-computer-use__help";
|
|
28407
|
+
browserHelp.id = "grok-browser-help";
|
|
28408
|
+
browserHelp.textContent = messages.grokBrowserHelp;
|
|
28409
|
+
const browserStatus = document2.createElement("p");
|
|
28410
|
+
browserStatus.className = "settings-grok-computer-use__status";
|
|
28411
|
+
browserStatus.id = "grok-browser-status";
|
|
28412
|
+
browserStatus.setAttribute("role", "status");
|
|
28413
|
+
browserStatus.setAttribute("aria-live", "polite");
|
|
28414
|
+
section.append(header, help, status, browserHeader, browserHelp, browserStatus);
|
|
28415
|
+
let busy = true;
|
|
28416
|
+
let loaded = false;
|
|
28417
|
+
let last;
|
|
28418
|
+
const show = (value) => {
|
|
28419
|
+
last = value;
|
|
28420
|
+
input.checked = value.enabled;
|
|
28421
|
+
input.disabled = busy || !loaded || !value.available && !value.enabled;
|
|
28422
|
+
const browserOn = value.browser === true;
|
|
28423
|
+
const browserFiles = value.browserFilesPresent === true;
|
|
28424
|
+
browserInput.checked = browserOn;
|
|
28425
|
+
browserInput.disabled = busy || !loaded || !browserFiles && !browserOn;
|
|
28426
|
+
if (!browserFiles) {
|
|
28427
|
+
browserStatus.dataset.state = "unavailable";
|
|
28428
|
+
browserStatus.textContent = value.browserUnavailableReason ?? messages.grokBrowserUnavailable;
|
|
28429
|
+
} else if (value.browserAvailable !== true) {
|
|
28430
|
+
browserStatus.dataset.state = browserOn ? "unavailable" : "off";
|
|
28431
|
+
browserStatus.textContent = browserOn ? value.browserUnavailableReason ?? messages.grokBrowserBlocked : messages.grokBrowserOff;
|
|
28432
|
+
} else {
|
|
28433
|
+
browserStatus.dataset.state = browserOn ? "on" : "off";
|
|
28434
|
+
browserStatus.textContent = browserOn ? messages.grokBrowserOn : messages.grokBrowserOff;
|
|
28435
|
+
}
|
|
28436
|
+
if (value.applyFailed) {
|
|
28437
|
+
status.dataset.state = "unavailable";
|
|
28438
|
+
status.textContent = value.applyError ?? messages.grokComputerUseApplyFailed;
|
|
28439
|
+
return;
|
|
28440
|
+
}
|
|
28441
|
+
if (!value.available) {
|
|
28442
|
+
status.dataset.state = "unavailable";
|
|
28443
|
+
status.textContent = value.unavailableReason ?? messages.grokComputerUseUnavailable;
|
|
28444
|
+
return;
|
|
28445
|
+
}
|
|
28446
|
+
status.dataset.state = value.enabled ? "on" : "off";
|
|
28447
|
+
status.textContent = value.enabled ? messages.grokComputerUseOn : messages.grokComputerUseOff;
|
|
28448
|
+
};
|
|
28449
|
+
const save = (update, target2) => {
|
|
28450
|
+
if (busy || !loaded) return;
|
|
28451
|
+
busy = true;
|
|
28452
|
+
input.disabled = true;
|
|
28453
|
+
browserInput.disabled = true;
|
|
28454
|
+
target2.textContent = messages.grokComputerUseSaving;
|
|
28455
|
+
void settings.set(update).then((value) => {
|
|
28456
|
+
busy = false;
|
|
28457
|
+
show(value);
|
|
28458
|
+
}).catch(() => {
|
|
28459
|
+
busy = false;
|
|
28460
|
+
if (last) show(last);
|
|
27901
28461
|
else {
|
|
27902
28462
|
input.disabled = false;
|
|
27903
28463
|
browserInput.disabled = false;
|
|
@@ -27924,6 +28484,70 @@ ${detail}` : ""}`
|
|
|
27924
28484
|
return section;
|
|
27925
28485
|
}
|
|
27926
28486
|
|
|
28487
|
+
// src/settings/harness-install-store.ts
|
|
28488
|
+
function errorMessage(error51) {
|
|
28489
|
+
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.";
|
|
28490
|
+
}
|
|
28491
|
+
function unknownInstallOutcome(message2) {
|
|
28492
|
+
return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
|
|
28493
|
+
}
|
|
28494
|
+
var stores = /* @__PURE__ */ new WeakMap();
|
|
28495
|
+
function createStore(diagnostics) {
|
|
28496
|
+
const states2 = /* @__PURE__ */ new Map();
|
|
28497
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
28498
|
+
const key = (host, agent) => JSON.stringify([host, agent]);
|
|
28499
|
+
const notify2 = () => listeners.forEach((listener) => listener());
|
|
28500
|
+
return {
|
|
28501
|
+
get: (host, agent) => states2.get(key(host, agent)),
|
|
28502
|
+
clearErrors() {
|
|
28503
|
+
for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
|
|
28504
|
+
notify2();
|
|
28505
|
+
},
|
|
28506
|
+
subscribe(listener) {
|
|
28507
|
+
listeners.add(listener);
|
|
28508
|
+
return () => {
|
|
28509
|
+
listeners.delete(listener);
|
|
28510
|
+
};
|
|
28511
|
+
},
|
|
28512
|
+
async install(host, agent) {
|
|
28513
|
+
const id = key(host, agent);
|
|
28514
|
+
const previous = states2.get(id);
|
|
28515
|
+
if (!diagnostics.installation || previous && previous.status !== "error") return;
|
|
28516
|
+
states2.set(id, { status: "installing" });
|
|
28517
|
+
notify2();
|
|
28518
|
+
let failure;
|
|
28519
|
+
try {
|
|
28520
|
+
await diagnostics.installation(host, agent, "install");
|
|
28521
|
+
states2.set(id, { status: "checking" });
|
|
28522
|
+
notify2();
|
|
28523
|
+
} catch (error51) {
|
|
28524
|
+
failure = errorMessage(error51);
|
|
28525
|
+
}
|
|
28526
|
+
try {
|
|
28527
|
+
await diagnostics.refresh(host);
|
|
28528
|
+
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
28529
|
+
if (refreshed?.availability === "ready") failure = void 0;
|
|
28530
|
+
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
28531
|
+
failure = void 0;
|
|
28532
|
+
}
|
|
28533
|
+
} catch (error51) {
|
|
28534
|
+
failure ??= errorMessage(error51);
|
|
28535
|
+
}
|
|
28536
|
+
if (failure) states2.set(id, { status: "error", error: failure });
|
|
28537
|
+
else states2.delete(id);
|
|
28538
|
+
notify2();
|
|
28539
|
+
}
|
|
28540
|
+
};
|
|
28541
|
+
}
|
|
28542
|
+
function harnessInstallStore(diagnostics) {
|
|
28543
|
+
let store = stores.get(diagnostics);
|
|
28544
|
+
if (!store) {
|
|
28545
|
+
store = createStore(diagnostics);
|
|
28546
|
+
stores.set(diagnostics, store);
|
|
28547
|
+
}
|
|
28548
|
+
return store;
|
|
28549
|
+
}
|
|
28550
|
+
|
|
27927
28551
|
// src/settings/harness-installation-guides.ts
|
|
27928
28552
|
function harnessHasInstallCommands(plugin) {
|
|
27929
28553
|
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
@@ -28016,296 +28640,86 @@ ${detail}` : ""}`
|
|
|
28016
28640
|
return panel;
|
|
28017
28641
|
}
|
|
28018
28642
|
|
|
28019
|
-
// src/settings/harness-
|
|
28020
|
-
function
|
|
28021
|
-
|
|
28022
|
-
|
|
28023
|
-
|
|
28024
|
-
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
|
|
28028
|
-
|
|
28029
|
-
|
|
28030
|
-
|
|
28031
|
-
|
|
28032
|
-
|
|
28033
|
-
|
|
28034
|
-
|
|
28035
|
-
|
|
28036
|
-
|
|
28037
|
-
|
|
28038
|
-
|
|
28039
|
-
|
|
28040
|
-
|
|
28041
|
-
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28052
|
-
|
|
28053
|
-
|
|
28054
|
-
|
|
28055
|
-
|
|
28056
|
-
failure = errorMessage(error51);
|
|
28057
|
-
}
|
|
28058
|
-
try {
|
|
28059
|
-
await diagnostics.refresh(host);
|
|
28060
|
-
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
28061
|
-
if (refreshed?.availability === "ready") failure = void 0;
|
|
28062
|
-
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
28063
|
-
failure = void 0;
|
|
28064
|
-
}
|
|
28065
|
-
} catch (error51) {
|
|
28066
|
-
failure ??= errorMessage(error51);
|
|
28067
|
-
}
|
|
28068
|
-
if (failure) states2.set(id, { status: "error", error: failure });
|
|
28069
|
-
else states2.delete(id);
|
|
28070
|
-
notify2();
|
|
28071
|
-
}
|
|
28072
|
-
};
|
|
28073
|
-
}
|
|
28074
|
-
function harnessInstallStore(diagnostics) {
|
|
28075
|
-
let store = stores.get(diagnostics);
|
|
28076
|
-
if (!store) {
|
|
28077
|
-
store = createStore(diagnostics);
|
|
28078
|
-
stores.set(diagnostics, store);
|
|
28079
|
-
}
|
|
28080
|
-
return store;
|
|
28081
|
-
}
|
|
28082
|
-
|
|
28083
|
-
// src/settings/harness-version-panel.ts
|
|
28084
|
-
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0) {
|
|
28085
|
-
const panel = document2.createElement("section");
|
|
28086
|
-
panel.className = "settings-harness-version";
|
|
28087
|
-
panel.dataset.harnessVersion = agent;
|
|
28088
|
-
const heading = document2.createElement("strong");
|
|
28089
|
-
heading.textContent = messages.harnessVersionTitle;
|
|
28090
|
-
const versions = document2.createElement("div");
|
|
28091
|
-
versions.className = "settings-harness-version__values";
|
|
28092
|
-
const current = document2.createElement("span");
|
|
28093
|
-
const latest = document2.createElement("span");
|
|
28094
|
-
versions.append(current, latest);
|
|
28095
|
-
const status = document2.createElement("p");
|
|
28096
|
-
status.setAttribute("role", "status");
|
|
28097
|
-
const actions = document2.createElement("div");
|
|
28098
|
-
actions.className = "settings-connection-error-actions";
|
|
28099
|
-
const update = document2.createElement("button");
|
|
28100
|
-
update.type = "button";
|
|
28101
|
-
update.className = "settings-command-button settings-command-button--secondary";
|
|
28102
|
-
update.dataset.harnessVersionAction = "update";
|
|
28103
|
-
const note = document2.createElement("p");
|
|
28104
|
-
note.className = "settings-connection-issue-note";
|
|
28105
|
-
note.textContent = messages.harnessVersionNote;
|
|
28106
|
-
actions.append(update);
|
|
28107
|
-
panel.append(heading, versions, status, actions, note);
|
|
28108
|
-
let state;
|
|
28109
|
-
let busy = false;
|
|
28110
|
-
let updating = false;
|
|
28111
|
-
let unsupported = false;
|
|
28112
|
-
let updatePromise = null;
|
|
28113
|
-
const render = () => {
|
|
28114
|
-
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
28115
|
-
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
28116
|
-
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
28117
|
-
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
28118
|
-
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
28119
|
-
actions.replaceChildren(update);
|
|
28120
|
-
update.hidden = !busy && !signal.aborted && Boolean(manualUrl);
|
|
28121
|
-
if (update.hidden && manualUrl) {
|
|
28122
|
-
const download2 = document2.createElement("a");
|
|
28123
|
-
download2.className = "settings-command-button settings-command-button--secondary";
|
|
28124
|
-
download2.dataset.harnessVersionAction = "download-update";
|
|
28125
|
-
download2.textContent = messages.harnessVersionDownloadUpdate;
|
|
28126
|
-
download2.href = manualUrl;
|
|
28127
|
-
download2.target = "_blank";
|
|
28128
|
-
download2.rel = "noopener noreferrer";
|
|
28129
|
-
actions.append(download2);
|
|
28130
|
-
}
|
|
28131
|
-
update.textContent = state?.canUpdate && state.latestVersion !== "Unknown" && !state.updateAvailable ? messages.harnessVersionUpToDate : messages.harnessVersionUpdate;
|
|
28132
|
-
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
28133
|
-
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
28134
|
-
};
|
|
28135
|
-
const run = async (action) => {
|
|
28136
|
-
if (busy || unsupported || signal.aborted) return false;
|
|
28137
|
-
if (action === "update" && (!state?.canUpdate || !state.updateAvailable)) return false;
|
|
28138
|
-
busy = true;
|
|
28139
|
-
updating = action === "update";
|
|
28140
|
-
onChange();
|
|
28141
|
-
status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
|
|
28142
|
-
render();
|
|
28143
|
-
try {
|
|
28144
|
-
const result = await client.run(action);
|
|
28145
|
-
if (signal.aborted) return false;
|
|
28146
|
-
state = result;
|
|
28147
|
-
status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
|
|
28148
|
-
return result.canUpdate && !result.updateAvailable;
|
|
28149
|
-
} catch (error51) {
|
|
28150
|
-
if (signal.aborted) return false;
|
|
28151
|
-
unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
28152
|
-
status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
|
|
28153
|
-
if (state) state = { ...state, canUpdate: false };
|
|
28154
|
-
return false;
|
|
28155
|
-
} finally {
|
|
28156
|
-
busy = false;
|
|
28157
|
-
updating = false;
|
|
28158
|
-
if (!signal.aborted) {
|
|
28159
|
-
render();
|
|
28160
|
-
onChange();
|
|
28161
|
-
}
|
|
28162
|
-
}
|
|
28163
|
-
};
|
|
28164
|
-
const updateVersion = () => {
|
|
28165
|
-
updatePromise ??= run("update").finally(() => {
|
|
28166
|
-
updatePromise = null;
|
|
28167
|
-
});
|
|
28168
|
-
return updatePromise;
|
|
28169
|
-
};
|
|
28170
|
-
update.addEventListener("click", () => void updateVersion());
|
|
28171
|
-
const owner = document2.defaultView;
|
|
28172
|
-
let checkFrame = null;
|
|
28173
|
-
let checkTimer = null;
|
|
28174
|
-
signal.addEventListener(
|
|
28175
|
-
"abort",
|
|
28176
|
-
() => {
|
|
28177
|
-
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
28178
|
-
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
28179
|
-
render();
|
|
28180
|
-
},
|
|
28181
|
-
{ once: true }
|
|
28182
|
-
);
|
|
28183
|
-
status.textContent = messages.harnessVersionChecking;
|
|
28184
|
-
render();
|
|
28185
|
-
if (!signal.aborted && owner?.requestAnimationFrame) {
|
|
28186
|
-
checkFrame = owner.requestAnimationFrame(() => {
|
|
28187
|
-
checkFrame = null;
|
|
28188
|
-
if (signal.aborted) return;
|
|
28189
|
-
checkTimer = owner.setTimeout(() => {
|
|
28190
|
-
checkTimer = null;
|
|
28191
|
-
void run("check");
|
|
28192
|
-
}, 0);
|
|
28193
|
-
});
|
|
28194
|
-
} else {
|
|
28195
|
-
void run("check");
|
|
28196
|
-
}
|
|
28197
|
-
return {
|
|
28198
|
-
element: panel,
|
|
28199
|
-
get state() {
|
|
28200
|
-
return state;
|
|
28201
|
-
},
|
|
28202
|
-
get updating() {
|
|
28203
|
-
return updating;
|
|
28204
|
-
},
|
|
28205
|
-
update: updateVersion
|
|
28206
|
-
};
|
|
28207
|
-
}
|
|
28208
|
-
|
|
28209
|
-
// src/settings/connection-versions.ts
|
|
28210
|
-
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
28211
|
-
const panels = /* @__PURE__ */ new Map();
|
|
28212
|
-
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
28213
|
-
return {
|
|
28214
|
-
get(hostId2, agent) {
|
|
28215
|
-
if (!installation || signal.aborted) return void 0;
|
|
28216
|
-
const key = JSON.stringify([hostId2, agent]);
|
|
28217
|
-
let panel = panels.get(key);
|
|
28218
|
-
if (!panel) {
|
|
28219
|
-
panel = createHarnessVersionPanel(
|
|
28220
|
-
document2,
|
|
28221
|
-
messages,
|
|
28222
|
-
signal,
|
|
28223
|
-
agent,
|
|
28224
|
-
{
|
|
28225
|
-
run: (action) => installation(hostId2, agent, action)
|
|
28226
|
-
},
|
|
28227
|
-
onChange
|
|
28228
|
-
);
|
|
28229
|
-
panels.set(key, panel);
|
|
28230
|
-
}
|
|
28231
|
-
return panel;
|
|
28232
|
-
}
|
|
28643
|
+
// src/settings/harness-launch-controls.ts
|
|
28644
|
+
function createHarnessLaunchControls(document2, messages, agent, settings) {
|
|
28645
|
+
const section = document2.createElement("section");
|
|
28646
|
+
section.className = "settings-harness-launch";
|
|
28647
|
+
section.dataset.harnessLaunch = agent;
|
|
28648
|
+
const label = document2.createElement("label");
|
|
28649
|
+
label.textContent = messages.launchPathLabel;
|
|
28650
|
+
const input = document2.createElement("input");
|
|
28651
|
+
input.type = "text";
|
|
28652
|
+
input.autocomplete = "off";
|
|
28653
|
+
input.spellcheck = false;
|
|
28654
|
+
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
28655
|
+
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
28656
|
+
label.append(input);
|
|
28657
|
+
const help = document2.createElement("p");
|
|
28658
|
+
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.";
|
|
28659
|
+
const actions = document2.createElement("div");
|
|
28660
|
+
actions.className = "settings-harness-launch__actions";
|
|
28661
|
+
const save = document2.createElement("button");
|
|
28662
|
+
save.type = "button";
|
|
28663
|
+
save.className = "settings-command-button";
|
|
28664
|
+
save.textContent = messages.launchPathSave;
|
|
28665
|
+
const reset = document2.createElement("button");
|
|
28666
|
+
reset.type = "button";
|
|
28667
|
+
reset.className = "settings-command-button settings-command-button--secondary";
|
|
28668
|
+
reset.textContent = messages.launchPathReset;
|
|
28669
|
+
const status = document2.createElement("p");
|
|
28670
|
+
status.setAttribute("role", "status");
|
|
28671
|
+
status.setAttribute("aria-live", "polite");
|
|
28672
|
+
actions.append(save, reset);
|
|
28673
|
+
section.append(label, help, actions, status);
|
|
28674
|
+
let busy = true;
|
|
28675
|
+
let loaded = false;
|
|
28676
|
+
const controls = () => {
|
|
28677
|
+
input.disabled = busy || !loaded;
|
|
28678
|
+
save.disabled = busy || !loaded || !input.value.trim();
|
|
28679
|
+
reset.disabled = busy || !loaded;
|
|
28233
28680
|
};
|
|
28234
|
-
|
|
28235
|
-
|
|
28236
|
-
|
|
28237
|
-
function createConnectionUpdates(document2, messages, signal, onChange) {
|
|
28238
|
-
const batches = /* @__PURE__ */ new Map();
|
|
28239
|
-
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
28240
|
-
const start = async (hostId2, panels) => {
|
|
28241
|
-
if (signal.aborted || batches.get(hostId2)?.running) return;
|
|
28242
|
-
const targets = eligible(panels);
|
|
28243
|
-
if (!targets.length) return;
|
|
28244
|
-
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
28245
|
-
batches.set(hostId2, batch);
|
|
28246
|
-
onChange();
|
|
28247
|
-
await Promise.all(
|
|
28248
|
-
targets.map(async (panel) => {
|
|
28249
|
-
try {
|
|
28250
|
-
if (await panel.update()) batch.succeeded++;
|
|
28251
|
-
else batch.failed++;
|
|
28252
|
-
} catch {
|
|
28253
|
-
batch.failed++;
|
|
28254
|
-
}
|
|
28255
|
-
if (!signal.aborted) onChange();
|
|
28256
|
-
})
|
|
28257
|
-
);
|
|
28258
|
-
batch.running = false;
|
|
28259
|
-
if (!signal.aborted) onChange();
|
|
28681
|
+
const show = (value) => {
|
|
28682
|
+
input.value = value.path ?? "";
|
|
28683
|
+
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
28260
28684
|
};
|
|
28261
|
-
|
|
28262
|
-
|
|
28263
|
-
|
|
28264
|
-
|
|
28265
|
-
|
|
28266
|
-
|
|
28267
|
-
|
|
28268
|
-
|
|
28269
|
-
|
|
28270
|
-
|
|
28271
|
-
|
|
28272
|
-
|
|
28273
|
-
button2.addEventListener("click", () => {
|
|
28274
|
-
if (!button2.disabled) void start(hostId2, panels);
|
|
28275
|
-
});
|
|
28276
|
-
const result = document2.createElement("p");
|
|
28277
|
-
result.className = "settings-connection-update-result";
|
|
28278
|
-
result.setAttribute("role", "status");
|
|
28279
|
-
result.hidden = !batch || batch.running;
|
|
28280
|
-
if (batch && !batch.running) {
|
|
28281
|
-
result.textContent = messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed));
|
|
28282
|
-
}
|
|
28283
|
-
return { button: button2, result };
|
|
28685
|
+
const persist = async (value) => {
|
|
28686
|
+
if (busy || !loaded) return;
|
|
28687
|
+
busy = true;
|
|
28688
|
+
controls();
|
|
28689
|
+
status.textContent = messages.launchPathSaving;
|
|
28690
|
+
try {
|
|
28691
|
+
show(await settings.set(value));
|
|
28692
|
+
} catch {
|
|
28693
|
+
status.textContent = messages.launchPathSaveError;
|
|
28694
|
+
} finally {
|
|
28695
|
+
busy = false;
|
|
28696
|
+
controls();
|
|
28284
28697
|
}
|
|
28285
28698
|
};
|
|
28699
|
+
input.addEventListener("input", controls);
|
|
28700
|
+
save.addEventListener("click", () => {
|
|
28701
|
+
if (input.value.trim()) void persist(input.value.trim());
|
|
28702
|
+
});
|
|
28703
|
+
reset.addEventListener("click", () => {
|
|
28704
|
+
void persist(null);
|
|
28705
|
+
});
|
|
28706
|
+
controls();
|
|
28707
|
+
status.textContent = messages.launchPathLoading;
|
|
28708
|
+
void settings.get().then((value) => {
|
|
28709
|
+
loaded = true;
|
|
28710
|
+
show(value);
|
|
28711
|
+
}).catch(() => {
|
|
28712
|
+
loaded = true;
|
|
28713
|
+
status.textContent = messages.launchPathLoadError;
|
|
28714
|
+
}).finally(() => {
|
|
28715
|
+
busy = false;
|
|
28716
|
+
controls();
|
|
28717
|
+
});
|
|
28718
|
+
return section;
|
|
28286
28719
|
}
|
|
28287
28720
|
|
|
28288
28721
|
// src/settings/connections-page.ts
|
|
28289
28722
|
var CODEXHOST_GITHUB_ISSUES_NEW_URL = "https://github.com/karlorz/codex-host/issues/new";
|
|
28290
|
-
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
28291
|
-
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
28292
|
-
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
28293
|
-
if (availability === "ready") return messages.connectionStatusReady;
|
|
28294
|
-
if (availability === "checking") return messages.connectionStatusChecking;
|
|
28295
|
-
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
28296
|
-
if (availability === "unavailable" || availability === "error") {
|
|
28297
|
-
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
28298
|
-
}
|
|
28299
|
-
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
28300
|
-
}
|
|
28301
|
-
function connectionStatusTone(availability, hasError = false) {
|
|
28302
|
-
if (availability === "updating") return "checking";
|
|
28303
|
-
if (hasError && availability !== "notInstalled") return "failed";
|
|
28304
|
-
if (availability === "ready") return "ready";
|
|
28305
|
-
if (availability === "checking" || availability === "installing") return "checking";
|
|
28306
|
-
if (availability === "notInstalled") return "setup";
|
|
28307
|
-
return "failed";
|
|
28308
|
-
}
|
|
28309
28723
|
function diagnosticText(hostId2, item) {
|
|
28310
28724
|
const error51 = item.error;
|
|
28311
28725
|
return [
|
|
@@ -28401,148 +28815,21 @@ ${error51.stderrTail}`] : []
|
|
|
28401
28815
|
tabs.addEventListener("wheel", onWheel, { passive: false });
|
|
28402
28816
|
const ownerWindow = document2.defaultView;
|
|
28403
28817
|
ownerWindow?.addEventListener("resize", updateButtons);
|
|
28404
|
-
|
|
28405
|
-
|
|
28406
|
-
|
|
28407
|
-
|
|
28408
|
-
|
|
28409
|
-
|
|
28410
|
-
|
|
28411
|
-
|
|
28818
|
+
const refreshLayout = () => {
|
|
28819
|
+
ownerWindow?.setTimeout(updateButtons, 0);
|
|
28820
|
+
updateButtons();
|
|
28821
|
+
};
|
|
28822
|
+
refreshLayout();
|
|
28823
|
+
return {
|
|
28824
|
+
update: refreshLayout,
|
|
28825
|
+
dispose() {
|
|
28826
|
+
left.removeEventListener("click", onLeft);
|
|
28827
|
+
right.removeEventListener("click", onRight);
|
|
28828
|
+
tabs.removeEventListener("scroll", updateButtons);
|
|
28829
|
+
tabs.removeEventListener("wheel", onWheel);
|
|
28830
|
+
ownerWindow?.removeEventListener("resize", updateButtons);
|
|
28831
|
+
}
|
|
28412
28832
|
};
|
|
28413
|
-
}
|
|
28414
|
-
function createConnectionIdentityIcon(document2, item, size) {
|
|
28415
|
-
const container = document2.createElement("span");
|
|
28416
|
-
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
28417
|
-
container.setAttribute("aria-hidden", "true");
|
|
28418
|
-
if (item.agentSnapshot) {
|
|
28419
|
-
container.append(
|
|
28420
|
-
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
28421
|
-
);
|
|
28422
|
-
} else {
|
|
28423
|
-
container.textContent = "CH";
|
|
28424
|
-
}
|
|
28425
|
-
return container;
|
|
28426
|
-
}
|
|
28427
|
-
function createConnectionRow(document2, item, messages, selected, select, group = null) {
|
|
28428
|
-
const row = document2.createElement("div");
|
|
28429
|
-
row.className = "settings-connection-row";
|
|
28430
|
-
row.dataset.connectionItem = item.key;
|
|
28431
|
-
row.dataset.connectionSelected = String(selected);
|
|
28432
|
-
row.tabIndex = selected ? 0 : -1;
|
|
28433
|
-
row.setAttribute("role", "row");
|
|
28434
|
-
const identity2 = document2.createElement("div");
|
|
28435
|
-
identity2.className = "settings-connection-row__identity";
|
|
28436
|
-
identity2.setAttribute("role", "cell");
|
|
28437
|
-
if (group) {
|
|
28438
|
-
const handle = document2.createElement("span");
|
|
28439
|
-
handle.className = "settings-connection-row__handle";
|
|
28440
|
-
handle.setAttribute("aria-hidden", "true");
|
|
28441
|
-
handle.title = group.dragHandleTitle;
|
|
28442
|
-
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
28443
|
-
identity2.append(handle);
|
|
28444
|
-
}
|
|
28445
|
-
const label = document2.createElement("strong");
|
|
28446
|
-
label.textContent = item.name;
|
|
28447
|
-
identity2.append(createConnectionIdentityIcon(document2, item, 19), label);
|
|
28448
|
-
const status = document2.createElement("span");
|
|
28449
|
-
status.className = "settings-connection-row__status";
|
|
28450
|
-
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
28451
|
-
status.setAttribute("role", "cell");
|
|
28452
|
-
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
28453
|
-
const version2 = item.version;
|
|
28454
|
-
const action = document2.createElement("div");
|
|
28455
|
-
action.className = "settings-connection-row__action";
|
|
28456
|
-
action.setAttribute("role", "cell");
|
|
28457
|
-
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
28458
|
-
const install = document2.createElement("button");
|
|
28459
|
-
install.type = "button";
|
|
28460
|
-
install.className = "settings-connection-install-link";
|
|
28461
|
-
install.addEventListener("click", (event) => {
|
|
28462
|
-
event.stopPropagation();
|
|
28463
|
-
select();
|
|
28464
|
-
item.install?.();
|
|
28465
|
-
});
|
|
28466
|
-
install.disabled = item.availability === "installing" || item.availability === "checking";
|
|
28467
|
-
const installLabel = messages.connectionInstall;
|
|
28468
|
-
install.setAttribute("aria-label", `${installLabel}: ${item.name}`);
|
|
28469
|
-
install.title = installLabel;
|
|
28470
|
-
install.append(createRendererSettingsIcon("download", 17));
|
|
28471
|
-
action.append(install);
|
|
28472
|
-
} else if (item.error) {
|
|
28473
|
-
const viewError = document2.createElement("button");
|
|
28474
|
-
viewError.type = "button";
|
|
28475
|
-
viewError.className = "settings-connection-view-error";
|
|
28476
|
-
viewError.textContent = messages.connectionViewError;
|
|
28477
|
-
viewError.addEventListener("click", (event) => {
|
|
28478
|
-
event.stopPropagation();
|
|
28479
|
-
select();
|
|
28480
|
-
});
|
|
28481
|
-
action.append(viewError);
|
|
28482
|
-
}
|
|
28483
|
-
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
28484
|
-
const available = document2.createElement("span");
|
|
28485
|
-
available.className = "settings-connection-version-available";
|
|
28486
|
-
available.textContent = messages.harnessVersionAvailable;
|
|
28487
|
-
available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
28488
|
-
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
28489
|
-
action.append(available);
|
|
28490
|
-
}
|
|
28491
|
-
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
28492
|
-
const update = document2.createElement("button");
|
|
28493
|
-
update.type = "button";
|
|
28494
|
-
update.className = "settings-connection-install-link";
|
|
28495
|
-
update.dataset.connectionAction = "update";
|
|
28496
|
-
update.disabled = version2.updating;
|
|
28497
|
-
update.title = messages.harnessVersionUpdate;
|
|
28498
|
-
update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
|
|
28499
|
-
update.append(createRendererSettingsIcon("download", 17));
|
|
28500
|
-
update.addEventListener("click", (event) => {
|
|
28501
|
-
event.stopPropagation();
|
|
28502
|
-
if (update.disabled) return;
|
|
28503
|
-
void version2.update();
|
|
28504
|
-
select();
|
|
28505
|
-
});
|
|
28506
|
-
action.append(update);
|
|
28507
|
-
}
|
|
28508
|
-
if (group) {
|
|
28509
|
-
const toggle = document2.createElement("button");
|
|
28510
|
-
toggle.type = "button";
|
|
28511
|
-
toggle.disabled = group.disabled;
|
|
28512
|
-
toggle.className = "settings-connection-row__group-toggle";
|
|
28513
|
-
toggle.title = group.moveLabel;
|
|
28514
|
-
toggle.setAttribute("aria-label", group.moveLabel);
|
|
28515
|
-
toggle.append(
|
|
28516
|
-
createRendererSettingsIcon(group.section === "main" ? "chevron-down" : "chevron-up", 15)
|
|
28517
|
-
);
|
|
28518
|
-
toggle.addEventListener("click", (event) => {
|
|
28519
|
-
event.stopPropagation();
|
|
28520
|
-
group.toggleSection();
|
|
28521
|
-
});
|
|
28522
|
-
action.append(toggle);
|
|
28523
|
-
}
|
|
28524
|
-
row.addEventListener("click", (event) => {
|
|
28525
|
-
const target2 = event.target;
|
|
28526
|
-
if (target2?.closest?.("a")) return;
|
|
28527
|
-
select();
|
|
28528
|
-
});
|
|
28529
|
-
row.addEventListener("keydown", (event) => {
|
|
28530
|
-
if (event.target?.closest?.("button, a")) return;
|
|
28531
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
28532
|
-
event.preventDefault();
|
|
28533
|
-
select();
|
|
28534
|
-
});
|
|
28535
|
-
if (group) {
|
|
28536
|
-
row.draggable = !group.disabled;
|
|
28537
|
-
row.dataset.connectionGroupSection = group.section;
|
|
28538
|
-
row.addEventListener("dragstart", group.onDragStart);
|
|
28539
|
-
row.addEventListener("dragover", group.onDragOver);
|
|
28540
|
-
row.addEventListener("dragleave", group.onDragLeave);
|
|
28541
|
-
row.addEventListener("drop", group.onDrop);
|
|
28542
|
-
row.addEventListener("dragend", group.onDragEnd);
|
|
28543
|
-
}
|
|
28544
|
-
row.append(identity2, status, action);
|
|
28545
|
-
return row;
|
|
28546
28833
|
}
|
|
28547
28834
|
function createInspectorHeader(document2, item, messages) {
|
|
28548
28835
|
const header = document2.createElement("header");
|
|
@@ -28572,6 +28859,29 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28572
28859
|
header.append(identity2, status);
|
|
28573
28860
|
return header;
|
|
28574
28861
|
}
|
|
28862
|
+
function inspectorRenderSignature(hostId2, item, messages, diagnostics) {
|
|
28863
|
+
const plugin = item.agentSnapshot?.plugin;
|
|
28864
|
+
const notice = plugin?.notice ? plugin.notice[messages.locale] ?? plugin.notice.en : "";
|
|
28865
|
+
const websiteUrl = plugin?.links?.website ?? plugin?.links?.documentation ?? "";
|
|
28866
|
+
const hasLaunchControls = hostId2 === "local" && Boolean(item.agentSnapshot?.agent) && Boolean(plugin?.launchCommand) && Boolean(diagnostics?.getLaunchSettings && diagnostics?.setLaunchSettings);
|
|
28867
|
+
return JSON.stringify([
|
|
28868
|
+
hostId2,
|
|
28869
|
+
item.key,
|
|
28870
|
+
item.name,
|
|
28871
|
+
item.availability,
|
|
28872
|
+
item.agentSnapshot?.availability ?? null,
|
|
28873
|
+
String(plugin?.icon ?? ""),
|
|
28874
|
+
String(plugin?.iconStyle ?? ""),
|
|
28875
|
+
websiteUrl,
|
|
28876
|
+
notice,
|
|
28877
|
+
item.installError ?? "",
|
|
28878
|
+
Boolean(item.install),
|
|
28879
|
+
plugin?.installation ?? null,
|
|
28880
|
+
Boolean(item.openWebUi),
|
|
28881
|
+
hasLaunchControls,
|
|
28882
|
+
item.error ? diagnosticText(hostId2, item) : ""
|
|
28883
|
+
]);
|
|
28884
|
+
}
|
|
28575
28885
|
function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
|
|
28576
28886
|
inspector.replaceChildren(createInspectorHeader(document2, item, messages));
|
|
28577
28887
|
const body = document2.createElement("div");
|
|
@@ -28744,11 +29054,10 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28744
29054
|
];
|
|
28745
29055
|
}
|
|
28746
29056
|
var pendingFocusAgent = null;
|
|
28747
|
-
function createGroupDivider(document2
|
|
29057
|
+
function createGroupDivider(document2) {
|
|
28748
29058
|
const divider = document2.createElement("div");
|
|
28749
29059
|
divider.className = "settings-connection-group-divider";
|
|
28750
29060
|
divider.setAttribute("role", "presentation");
|
|
28751
|
-
divider.textContent = `${messages.connectionGroupMoreLabel} (${count4})`;
|
|
28752
29061
|
return divider;
|
|
28753
29062
|
}
|
|
28754
29063
|
function createGroupMoreHint(document2, messages) {
|
|
@@ -28801,11 +29110,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28801
29110
|
context.content.append(header, syncMessage, content);
|
|
28802
29111
|
let pending = false;
|
|
28803
29112
|
let selectedHostId = null;
|
|
29113
|
+
let renderedHostId = null;
|
|
28804
29114
|
let selectedItemKey = null;
|
|
28805
29115
|
let launchControls = null;
|
|
29116
|
+
let renderedInspector = null;
|
|
28806
29117
|
const hostNames = /* @__PURE__ */ new Map();
|
|
29118
|
+
const knownNotInstalled = /* @__PURE__ */ new Map();
|
|
28807
29119
|
let latestSnapshot = null;
|
|
28808
|
-
let disposeHostScroller = () => void 0;
|
|
28809
29120
|
let disposed = false;
|
|
28810
29121
|
let renderQueued = false;
|
|
28811
29122
|
let renderFrame = null;
|
|
@@ -28839,7 +29150,99 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28839
29150
|
scheduleRender
|
|
28840
29151
|
);
|
|
28841
29152
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
28842
|
-
const updates = createConnectionUpdates(
|
|
29153
|
+
const updates = createConnectionUpdates(
|
|
29154
|
+
document2,
|
|
29155
|
+
messages,
|
|
29156
|
+
context.signal,
|
|
29157
|
+
scheduleRender,
|
|
29158
|
+
diagnostics
|
|
29159
|
+
);
|
|
29160
|
+
const panelId = "codexhost-settings-connection-host-panel";
|
|
29161
|
+
const empty = document2.createElement("div");
|
|
29162
|
+
empty.className = "settings-empty";
|
|
29163
|
+
empty.textContent = messages.connectionNoRuntime;
|
|
29164
|
+
const layout = document2.createElement("div");
|
|
29165
|
+
layout.className = "settings-connections-layout";
|
|
29166
|
+
const list = document2.createElement("section");
|
|
29167
|
+
list.className = "settings-connection-list";
|
|
29168
|
+
const hostStrip = document2.createElement("div");
|
|
29169
|
+
hostStrip.className = "settings-connection-host-strip";
|
|
29170
|
+
const scrollLeft = createHostScrollButton(document2, "left", messages);
|
|
29171
|
+
const tabs = document2.createElement("div");
|
|
29172
|
+
tabs.className = "settings-connection-host-tabs";
|
|
29173
|
+
tabs.setAttribute("role", "tablist");
|
|
29174
|
+
tabs.setAttribute("aria-label", messages.connectionHosts);
|
|
29175
|
+
const scrollRight = createHostScrollButton(document2, "right", messages);
|
|
29176
|
+
hostStrip.append(scrollLeft, tabs, scrollRight);
|
|
29177
|
+
const updateControls = updates.createControls("local", []);
|
|
29178
|
+
const hostHeader = document2.createElement("div");
|
|
29179
|
+
hostHeader.className = "settings-connection-host-header";
|
|
29180
|
+
hostHeader.append(hostStrip, updateControls.button);
|
|
29181
|
+
const tableHeader = document2.createElement("div");
|
|
29182
|
+
tableHeader.className = "settings-connection-table-header";
|
|
29183
|
+
tableHeader.setAttribute("role", "row");
|
|
29184
|
+
const componentHeading = document2.createElement("span");
|
|
29185
|
+
componentHeading.textContent = messages.connectionComponent;
|
|
29186
|
+
componentHeading.setAttribute("role", "columnheader");
|
|
29187
|
+
const statusHeading = document2.createElement("span");
|
|
29188
|
+
statusHeading.textContent = messages.connectionStatus;
|
|
29189
|
+
statusHeading.setAttribute("role", "columnheader");
|
|
29190
|
+
const actionHeading = document2.createElement("span");
|
|
29191
|
+
actionHeading.setAttribute("aria-hidden", "true");
|
|
29192
|
+
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
29193
|
+
const rows = document2.createElement("div");
|
|
29194
|
+
rows.className = "settings-connection-rows";
|
|
29195
|
+
rows.id = panelId;
|
|
29196
|
+
rows.setAttribute("role", "rowgroup");
|
|
29197
|
+
list.append(hostHeader, updateControls.result, tableHeader, rows);
|
|
29198
|
+
const inspector = document2.createElement("aside");
|
|
29199
|
+
inspector.className = "settings-connection-inspector";
|
|
29200
|
+
inspector.setAttribute("aria-live", "polite");
|
|
29201
|
+
layout.append(list, inspector);
|
|
29202
|
+
const hostScroller = configureHostScroller(
|
|
29203
|
+
document2,
|
|
29204
|
+
hostStrip,
|
|
29205
|
+
tabs,
|
|
29206
|
+
scrollLeft,
|
|
29207
|
+
scrollRight
|
|
29208
|
+
);
|
|
29209
|
+
const hostTabElements = /* @__PURE__ */ new Map();
|
|
29210
|
+
const hostRowViews = /* @__PURE__ */ new Map();
|
|
29211
|
+
const groupDivider = createGroupDivider(document2);
|
|
29212
|
+
const moreHint = createGroupMoreHint(document2, messages);
|
|
29213
|
+
const moreZone = document2.createElement("div");
|
|
29214
|
+
moreZone.className = "settings-connection-group-more";
|
|
29215
|
+
moreZone.setAttribute("role", "presentation");
|
|
29216
|
+
const resetButton = createGroupResetButton(document2, messages, () => {
|
|
29217
|
+
groupPreference.resetToDefault();
|
|
29218
|
+
});
|
|
29219
|
+
let draggingAgent = null;
|
|
29220
|
+
let currentCatalog = [];
|
|
29221
|
+
let currentMainEntries = [];
|
|
29222
|
+
let currentMoreEntries = [];
|
|
29223
|
+
let currentHostRows = /* @__PURE__ */ new Map();
|
|
29224
|
+
const clearDropIndicators = () => {
|
|
29225
|
+
for (const view of currentHostRows.values()) {
|
|
29226
|
+
view.element.dataset.connectionDropIndicator = "";
|
|
29227
|
+
}
|
|
29228
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
29229
|
+
};
|
|
29230
|
+
moreZone.addEventListener("dragover", (event) => {
|
|
29231
|
+
if (!draggingAgent) return;
|
|
29232
|
+
event.preventDefault();
|
|
29233
|
+
moreZone.dataset.connectionDragOver = "true";
|
|
29234
|
+
});
|
|
29235
|
+
moreZone.addEventListener("dragleave", () => {
|
|
29236
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
29237
|
+
});
|
|
29238
|
+
moreZone.addEventListener("drop", (event) => {
|
|
29239
|
+
event.preventDefault();
|
|
29240
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
29241
|
+
if (!draggingAgent) return;
|
|
29242
|
+
groupPreference.moveAgent(draggingAgent, "more", null, currentCatalog);
|
|
29243
|
+
draggingAgent = null;
|
|
29244
|
+
clearDropIndicators();
|
|
29245
|
+
});
|
|
28843
29246
|
const runRefresh = () => {
|
|
28844
29247
|
if (pending || !diagnostics) return;
|
|
28845
29248
|
pending = true;
|
|
@@ -28852,6 +29255,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28852
29255
|
success() {
|
|
28853
29256
|
installs?.clearErrors();
|
|
28854
29257
|
pending = false;
|
|
29258
|
+
renderedInspector = null;
|
|
28855
29259
|
refresh.disabled = false;
|
|
28856
29260
|
refresh.replaceChildren(
|
|
28857
29261
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -28861,6 +29265,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28861
29265
|
},
|
|
28862
29266
|
failure(error51) {
|
|
28863
29267
|
pending = false;
|
|
29268
|
+
renderedInspector = null;
|
|
28864
29269
|
refresh.disabled = false;
|
|
28865
29270
|
refresh.replaceChildren(
|
|
28866
29271
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -28886,97 +29291,111 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28886
29291
|
}
|
|
28887
29292
|
});
|
|
28888
29293
|
};
|
|
29294
|
+
const syncSelectedInspector = (hostId2, item) => {
|
|
29295
|
+
const currentDiagnostics = getDiagnostics();
|
|
29296
|
+
const signature = inspectorRenderSignature(hostId2, item, messages, currentDiagnostics);
|
|
29297
|
+
const versionElement = item.version?.element ?? null;
|
|
29298
|
+
if (renderedInspector?.signature === signature && renderedInspector.versionElement === versionElement) {
|
|
29299
|
+
return;
|
|
29300
|
+
}
|
|
29301
|
+
const existing = launchControls?.hostId === hostId2 && launchControls.itemKey === item.key ? launchControls.element : null;
|
|
29302
|
+
const element = renderConnectionInspector(
|
|
29303
|
+
document2,
|
|
29304
|
+
inspector,
|
|
29305
|
+
item,
|
|
29306
|
+
hostId2,
|
|
29307
|
+
messages,
|
|
29308
|
+
currentDiagnostics,
|
|
29309
|
+
existing,
|
|
29310
|
+
runRefresh
|
|
29311
|
+
);
|
|
29312
|
+
launchControls = { hostId: hostId2, itemKey: item.key, element };
|
|
29313
|
+
if (versionElement) inspector.append(versionElement);
|
|
29314
|
+
renderedInspector = { signature, versionElement };
|
|
29315
|
+
};
|
|
28889
29316
|
const render = (snapshot) => {
|
|
28890
29317
|
const syncStatus = groupPreference.syncStatus();
|
|
28891
29318
|
const groupDisabled = syncStatus === "loading" || syncStatus === "saving";
|
|
28892
29319
|
syncMessage.hidden = syncStatus === "ready";
|
|
28893
29320
|
syncMessage.textContent = syncStatus === "error" ? messages.connectionGroupSyncFailed : syncStatus === "saving" ? messages.connectionGroupSaving : messages.connectionGroupLoading;
|
|
28894
29321
|
latestSnapshot = snapshot;
|
|
28895
|
-
disposeHostScroller();
|
|
28896
|
-
disposeHostScroller = () => void 0;
|
|
28897
29322
|
if (!snapshot) {
|
|
28898
|
-
|
|
28899
|
-
|
|
28900
|
-
empty
|
|
28901
|
-
content.replaceChildren(empty);
|
|
29323
|
+
renderedHostId = null;
|
|
29324
|
+
renderedInspector = null;
|
|
29325
|
+
reconcileElementChildren(content, [empty]);
|
|
28902
29326
|
return;
|
|
28903
29327
|
}
|
|
28904
29328
|
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];
|
|
28905
29329
|
if (!selectedHost) return;
|
|
28906
29330
|
selectedHostId = selectedHost.hostId;
|
|
28907
|
-
const
|
|
28908
|
-
|
|
28909
|
-
|
|
28910
|
-
|
|
28911
|
-
|
|
28912
|
-
|
|
28913
|
-
|
|
28914
|
-
|
|
28915
|
-
|
|
28916
|
-
|
|
28917
|
-
|
|
28918
|
-
|
|
28919
|
-
|
|
28920
|
-
|
|
28921
|
-
|
|
28922
|
-
|
|
28923
|
-
|
|
28924
|
-
|
|
28925
|
-
|
|
28926
|
-
|
|
28927
|
-
|
|
28928
|
-
|
|
28929
|
-
|
|
29331
|
+
const layoutFirstMount = content.children[0] !== layout;
|
|
29332
|
+
reconcileElementChildren(content, [layout]);
|
|
29333
|
+
let tabsChanged = tabs.children.length !== snapshot.hosts.length;
|
|
29334
|
+
const nextTabs = snapshot.hosts.map((host) => {
|
|
29335
|
+
let tab = hostTabElements.get(host.hostId);
|
|
29336
|
+
if (!tab) {
|
|
29337
|
+
tab = document2.createElement("button");
|
|
29338
|
+
tab.type = "button";
|
|
29339
|
+
tab.className = "settings-connection-host-tab";
|
|
29340
|
+
tab.dataset.connectionHostTab = host.hostId;
|
|
29341
|
+
tab.setAttribute("role", "tab");
|
|
29342
|
+
tab.setAttribute("aria-controls", panelId);
|
|
29343
|
+
tab.addEventListener("click", () => {
|
|
29344
|
+
selectedHostId = host.hostId;
|
|
29345
|
+
render(latestSnapshot);
|
|
29346
|
+
});
|
|
29347
|
+
tab.addEventListener("keydown", (event) => {
|
|
29348
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
29349
|
+
event.preventDefault();
|
|
29350
|
+
const hosts = latestSnapshot?.hosts ?? [];
|
|
29351
|
+
const index = hosts.findIndex((candidate) => candidate.hostId === host.hostId);
|
|
29352
|
+
if (index < 0) return;
|
|
29353
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
29354
|
+
const next = hosts[(index + direction + hosts.length) % hosts.length];
|
|
29355
|
+
if (!next) return;
|
|
29356
|
+
selectedHostId = next.hostId;
|
|
29357
|
+
render(latestSnapshot);
|
|
29358
|
+
hostTabElements.get(next.hostId)?.focus();
|
|
29359
|
+
});
|
|
29360
|
+
hostTabElements.set(host.hostId, tab);
|
|
29361
|
+
tabsChanged = true;
|
|
29362
|
+
}
|
|
29363
|
+
const isSelected = host.hostId === selectedHost.hostId;
|
|
29364
|
+
const activeValue = String(host.active);
|
|
29365
|
+
if (tab.dataset.connectionHostActive !== activeValue) {
|
|
29366
|
+
tab.dataset.connectionHostActive = activeValue;
|
|
29367
|
+
}
|
|
29368
|
+
const selectedValue = String(isSelected);
|
|
29369
|
+
if (tab.getAttribute("aria-selected") !== selectedValue) {
|
|
29370
|
+
tab.setAttribute("aria-selected", selectedValue);
|
|
29371
|
+
}
|
|
29372
|
+
const nextTabIndex = isSelected ? 0 : -1;
|
|
29373
|
+
if (tab.tabIndex !== nextTabIndex) {
|
|
29374
|
+
tab.tabIndex = nextTabIndex;
|
|
29375
|
+
}
|
|
28930
29376
|
const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
|
|
28931
|
-
tab.textContent
|
|
28932
|
-
|
|
28933
|
-
|
|
28934
|
-
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
28940
|
-
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
28941
|
-
const next = snapshot.hosts[(index + direction + snapshot.hosts.length) % snapshot.hosts.length];
|
|
28942
|
-
if (!next) return;
|
|
28943
|
-
selectedHostId = next.hostId;
|
|
28944
|
-
render(latestSnapshot);
|
|
28945
|
-
const nextTab = [
|
|
28946
|
-
...content.querySelectorAll("[data-connection-host-tab]")
|
|
28947
|
-
].find((candidate) => candidate.dataset.connectionHostTab === next.hostId);
|
|
28948
|
-
nextTab?.focus();
|
|
28949
|
-
});
|
|
28950
|
-
tabs.append(tab);
|
|
29377
|
+
if (tab.textContent !== hostName) {
|
|
29378
|
+
tab.textContent = hostName;
|
|
29379
|
+
tabsChanged = true;
|
|
29380
|
+
}
|
|
29381
|
+
const tabTitle = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
|
|
29382
|
+
if (tab.title !== tabTitle) {
|
|
29383
|
+
tab.title = tabTitle;
|
|
29384
|
+
}
|
|
29385
|
+
return tab;
|
|
28951
29386
|
});
|
|
28952
|
-
|
|
28953
|
-
|
|
28954
|
-
|
|
28955
|
-
|
|
28956
|
-
const componentHeading = document2.createElement("span");
|
|
28957
|
-
componentHeading.textContent = messages.connectionComponent;
|
|
28958
|
-
componentHeading.setAttribute("role", "columnheader");
|
|
28959
|
-
const statusHeading = document2.createElement("span");
|
|
28960
|
-
statusHeading.textContent = messages.connectionStatus;
|
|
28961
|
-
statusHeading.setAttribute("role", "columnheader");
|
|
28962
|
-
const actionHeading = document2.createElement("span");
|
|
28963
|
-
actionHeading.setAttribute("aria-hidden", "true");
|
|
28964
|
-
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
28965
|
-
const rows = document2.createElement("div");
|
|
28966
|
-
rows.className = "settings-connection-rows";
|
|
28967
|
-
rows.id = panelId;
|
|
28968
|
-
rows.dataset.connectionHost = selectedHost.hostId;
|
|
28969
|
-
rows.setAttribute("role", "rowgroup");
|
|
28970
|
-
const inspector = document2.createElement("aside");
|
|
28971
|
-
inspector.className = "settings-connection-inspector";
|
|
28972
|
-
inspector.setAttribute("aria-live", "polite");
|
|
29387
|
+
reconcileElementChildren(tabs, nextTabs);
|
|
29388
|
+
if (rows.dataset.connectionHost !== selectedHost.hostId) {
|
|
29389
|
+
rows.dataset.connectionHost = selectedHost.hostId;
|
|
29390
|
+
}
|
|
28973
29391
|
const items = connectionItems(snapshot, selectedHost, messages, diagnostics).map(
|
|
28974
29392
|
(item) => {
|
|
28975
29393
|
const agent = item.agentSnapshot?.agent;
|
|
28976
29394
|
if (!agent) return item;
|
|
28977
29395
|
const state = installs?.get(selectedHost.hostId, agent);
|
|
28978
29396
|
const availability = state?.status ?? item.availability;
|
|
28979
|
-
const
|
|
29397
|
+
const updating = versions.isUpdating(selectedHost.hostId, agent);
|
|
29398
|
+
const version2 = updating || item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
|
|
28980
29399
|
return {
|
|
28981
29400
|
...item,
|
|
28982
29401
|
...state ? { availability: state.status } : {},
|
|
@@ -28998,66 +29417,66 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
28998
29417
|
(item) => item.agentSnapshot?.availability === "notInstalled" || item.error !== null
|
|
28999
29418
|
)?.key ?? items[0]?.key ?? null;
|
|
29000
29419
|
}
|
|
29001
|
-
|
|
29420
|
+
let hostRows = hostRowViews.get(selectedHost.hostId);
|
|
29421
|
+
if (!hostRows) {
|
|
29422
|
+
hostRows = /* @__PURE__ */ new Map();
|
|
29423
|
+
hostRowViews.set(selectedHost.hostId, hostRows);
|
|
29424
|
+
}
|
|
29425
|
+
currentHostRows = hostRows;
|
|
29002
29426
|
const selectItem = (item) => {
|
|
29003
29427
|
selectedItemKey = item.key;
|
|
29004
|
-
for (const [key,
|
|
29005
|
-
|
|
29006
|
-
row.dataset.connectionSelected = String(selected);
|
|
29007
|
-
row.tabIndex = selected ? 0 : -1;
|
|
29428
|
+
for (const [key, view] of currentHostRows) {
|
|
29429
|
+
view.setSelected(key === item.key);
|
|
29008
29430
|
}
|
|
29009
|
-
|
|
29010
|
-
const element = renderConnectionInspector(
|
|
29011
|
-
document2,
|
|
29012
|
-
inspector,
|
|
29013
|
-
item,
|
|
29014
|
-
selectedHost.hostId,
|
|
29015
|
-
messages,
|
|
29016
|
-
getDiagnostics(),
|
|
29017
|
-
existing,
|
|
29018
|
-
runRefresh
|
|
29019
|
-
);
|
|
29020
|
-
launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
|
|
29021
|
-
if (item.version) inspector.append(item.version.element);
|
|
29431
|
+
syncSelectedInspector(selectedHost.hostId, item);
|
|
29022
29432
|
};
|
|
29023
|
-
const
|
|
29024
|
-
|
|
29025
|
-
|
|
29026
|
-
document2,
|
|
29433
|
+
const ensureRowView = (key, groupable) => {
|
|
29434
|
+
let view = hostRows.get(key);
|
|
29435
|
+
if (!view) {
|
|
29436
|
+
view = createConnectionRowView(document2, messages, groupable);
|
|
29437
|
+
hostRows.set(key, view);
|
|
29438
|
+
}
|
|
29439
|
+
return view;
|
|
29440
|
+
};
|
|
29441
|
+
const activeKeys = /* @__PURE__ */ new Set();
|
|
29442
|
+
const nextRowChildren = [];
|
|
29443
|
+
const pinnedItems = items.filter((item) => item.agentSnapshot === void 0);
|
|
29444
|
+
for (const pinnedItem of pinnedItems) {
|
|
29445
|
+
activeKeys.add(pinnedItem.key);
|
|
29446
|
+
const view = ensureRowView(pinnedItem.key, false);
|
|
29447
|
+
view.update(
|
|
29027
29448
|
pinnedItem,
|
|
29028
|
-
messages,
|
|
29029
29449
|
pinnedItem.key === selectedItemKey,
|
|
29030
|
-
() => selectItem(pinnedItem)
|
|
29450
|
+
() => selectItem(pinnedItem),
|
|
29451
|
+
null
|
|
29031
29452
|
);
|
|
29032
|
-
|
|
29033
|
-
rows.append(row);
|
|
29453
|
+
nextRowChildren.push(view.element);
|
|
29034
29454
|
}
|
|
29035
29455
|
const groupableItems = items.filter(
|
|
29036
29456
|
(item) => item.agentSnapshot !== void 0
|
|
29037
29457
|
);
|
|
29038
29458
|
const agentByKey = new Map(groupableItems.map((item) => [item.key, item]));
|
|
29039
|
-
|
|
29040
|
-
const
|
|
29041
|
-
|
|
29042
|
-
|
|
29043
|
-
|
|
29044
|
-
|
|
29045
|
-
|
|
29046
|
-
|
|
29047
|
-
|
|
29459
|
+
currentCatalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
|
|
29460
|
+
const notInstalledAgents = /* @__PURE__ */ new Set();
|
|
29461
|
+
for (const item of groupableItems) {
|
|
29462
|
+
const agent = item.agentSnapshot.agent;
|
|
29463
|
+
const stateKey = `${selectedHost.hostId}:${agent}`;
|
|
29464
|
+
if (item.agentSnapshot.availability !== "checking") {
|
|
29465
|
+
knownNotInstalled.set(stateKey, item.agentSnapshot.availability === "notInstalled");
|
|
29466
|
+
}
|
|
29467
|
+
const isNotInstalled = item.agentSnapshot.availability === "checking" ? knownNotInstalled.get(stateKey) ?? false : item.agentSnapshot.availability === "notInstalled";
|
|
29468
|
+
if (isNotInstalled) notInstalledAgents.add(agent);
|
|
29469
|
+
}
|
|
29470
|
+
const preferenceOrder = groupPreference.list(notInstalledAgents, currentCatalog).filter((entry) => agentByKey.has(entry.agent));
|
|
29471
|
+
currentMainEntries = preferenceOrder.filter((entry) => entry.section === "main");
|
|
29472
|
+
currentMoreEntries = preferenceOrder.filter((entry) => entry.section === "more");
|
|
29048
29473
|
const nextInSection = (section, agent) => {
|
|
29049
|
-
const
|
|
29050
|
-
const index =
|
|
29051
|
-
return index >= 0 ?
|
|
29052
|
-
};
|
|
29053
|
-
let draggingAgent = null;
|
|
29054
|
-
let moreZone = null;
|
|
29055
|
-
const clearDropIndicators = () => {
|
|
29056
|
-
for (const row of rowElements.values()) row.dataset.connectionDropIndicator = "";
|
|
29057
|
-
if (moreZone) moreZone.dataset.connectionDragOver = "false";
|
|
29474
|
+
const sectionEntries = section === "main" ? currentMainEntries : currentMoreEntries;
|
|
29475
|
+
const index = sectionEntries.findIndex((entry) => entry.agent === agent);
|
|
29476
|
+
return index >= 0 ? sectionEntries[index + 1]?.agent ?? null : null;
|
|
29058
29477
|
};
|
|
29059
29478
|
const dropTargetSection = (agent, event) => {
|
|
29060
|
-
const row =
|
|
29479
|
+
const row = currentHostRows.get(agent)?.element;
|
|
29061
29480
|
const rect = row && typeof row.getBoundingClientRect === "function" ? row.getBoundingClientRect() : null;
|
|
29062
29481
|
const before = rect ? event.clientY - rect.top < rect.height / 2 : true;
|
|
29063
29482
|
const section = row?.dataset.connectionGroupSection ?? "main";
|
|
@@ -29069,7 +29488,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
29069
29488
|
moveLabel: section === "main" ? messages.connectionGroupMoveToMore : messages.connectionGroupMoveToMain,
|
|
29070
29489
|
dragHandleTitle: messages.connectionGroupDragHandle,
|
|
29071
29490
|
toggleSection() {
|
|
29072
|
-
groupPreference.moveAgent(
|
|
29491
|
+
groupPreference.moveAgent(
|
|
29492
|
+
agent,
|
|
29493
|
+
section === "main" ? "more" : "main",
|
|
29494
|
+
null,
|
|
29495
|
+
currentCatalog
|
|
29496
|
+
);
|
|
29073
29497
|
},
|
|
29074
29498
|
onDragStart(event) {
|
|
29075
29499
|
if (groupDisabled) {
|
|
@@ -29079,127 +29503,107 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
29079
29503
|
draggingAgent = agent;
|
|
29080
29504
|
event.dataTransfer?.setData("text/plain", agent);
|
|
29081
29505
|
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
29082
|
-
const row =
|
|
29506
|
+
const row = currentHostRows.get(agent)?.element;
|
|
29083
29507
|
if (row) row.dataset.connectionDragging = "true";
|
|
29084
29508
|
},
|
|
29085
29509
|
onDragOver(event) {
|
|
29086
29510
|
if (!draggingAgent || draggingAgent === agent) return;
|
|
29087
29511
|
event.preventDefault();
|
|
29088
|
-
const row =
|
|
29512
|
+
const row = currentHostRows.get(agent)?.element;
|
|
29089
29513
|
if (!row) return;
|
|
29090
29514
|
const { before } = dropTargetSection(agent, event);
|
|
29091
29515
|
clearDropIndicators();
|
|
29092
29516
|
row.dataset.connectionDropIndicator = before ? "before" : "after";
|
|
29093
29517
|
},
|
|
29094
29518
|
onDragLeave() {
|
|
29095
|
-
const row =
|
|
29519
|
+
const row = currentHostRows.get(agent)?.element;
|
|
29096
29520
|
if (row) row.dataset.connectionDropIndicator = "";
|
|
29097
29521
|
},
|
|
29098
29522
|
onDrop(event) {
|
|
29099
29523
|
event.preventDefault();
|
|
29100
29524
|
if (!draggingAgent) return;
|
|
29101
29525
|
const { beforeAgent } = dropTargetSection(agent, event);
|
|
29102
|
-
groupPreference.moveAgent(draggingAgent, section, beforeAgent,
|
|
29526
|
+
groupPreference.moveAgent(draggingAgent, section, beforeAgent, currentCatalog);
|
|
29103
29527
|
draggingAgent = null;
|
|
29104
29528
|
clearDropIndicators();
|
|
29105
29529
|
},
|
|
29106
29530
|
onDragEnd() {
|
|
29107
29531
|
draggingAgent = null;
|
|
29108
|
-
const row =
|
|
29532
|
+
const row = currentHostRows.get(agent)?.element;
|
|
29109
29533
|
if (row) row.dataset.connectionDragging = "false";
|
|
29110
29534
|
clearDropIndicators();
|
|
29535
|
+
scheduleRender();
|
|
29111
29536
|
}
|
|
29112
29537
|
});
|
|
29113
|
-
const
|
|
29114
|
-
const item = agentByKey.get(agent);
|
|
29115
|
-
if (!item)
|
|
29116
|
-
|
|
29117
|
-
|
|
29538
|
+
for (const entry of currentMainEntries) {
|
|
29539
|
+
const item = agentByKey.get(entry.agent);
|
|
29540
|
+
if (!item) continue;
|
|
29541
|
+
activeKeys.add(item.key);
|
|
29542
|
+
const view = ensureRowView(item.key, true);
|
|
29543
|
+
view.update(
|
|
29118
29544
|
item,
|
|
29119
|
-
messages,
|
|
29120
29545
|
item.key === selectedItemKey,
|
|
29121
29546
|
() => selectItem(item),
|
|
29122
|
-
createGroupController(agent,
|
|
29547
|
+
createGroupController(entry.agent, "main")
|
|
29123
29548
|
);
|
|
29124
|
-
|
|
29125
|
-
|
|
29126
|
-
};
|
|
29127
|
-
for (const entry of mainEntries) appendGroupRow(entry.agent, "main");
|
|
29549
|
+
nextRowChildren.push(view.element);
|
|
29550
|
+
}
|
|
29128
29551
|
if (groupableItems.length > 0) {
|
|
29129
|
-
|
|
29130
|
-
|
|
29131
|
-
|
|
29132
|
-
|
|
29133
|
-
|
|
29134
|
-
|
|
29135
|
-
|
|
29136
|
-
|
|
29137
|
-
zone.dataset.connectionDragOver = "true";
|
|
29138
|
-
});
|
|
29139
|
-
zone.addEventListener("dragleave", () => {
|
|
29140
|
-
zone.dataset.connectionDragOver = "false";
|
|
29141
|
-
});
|
|
29142
|
-
zone.addEventListener("drop", (event) => {
|
|
29143
|
-
event.preventDefault();
|
|
29144
|
-
zone.dataset.connectionDragOver = "false";
|
|
29145
|
-
if (!draggingAgent) return;
|
|
29146
|
-
groupPreference.moveAgent(draggingAgent, "more", null, catalog);
|
|
29147
|
-
draggingAgent = null;
|
|
29148
|
-
clearDropIndicators();
|
|
29149
|
-
});
|
|
29150
|
-
if (moreEntries.length === 0) {
|
|
29151
|
-
zone.append(createGroupMoreHint(document2, messages));
|
|
29552
|
+
const dividerText = `${messages.connectionGroupMoreLabel} (${currentMoreEntries.length})`;
|
|
29553
|
+
if (groupDivider.textContent !== dividerText) {
|
|
29554
|
+
groupDivider.textContent = dividerText;
|
|
29555
|
+
}
|
|
29556
|
+
nextRowChildren.push(groupDivider);
|
|
29557
|
+
const nextMoreChildren = [];
|
|
29558
|
+
if (currentMoreEntries.length === 0) {
|
|
29559
|
+
nextMoreChildren.push(moreHint);
|
|
29152
29560
|
} else {
|
|
29153
|
-
for (const entry of
|
|
29561
|
+
for (const entry of currentMoreEntries) {
|
|
29154
29562
|
const item = agentByKey.get(entry.agent);
|
|
29155
29563
|
if (!item) continue;
|
|
29156
|
-
|
|
29157
|
-
|
|
29564
|
+
activeKeys.add(item.key);
|
|
29565
|
+
const view = ensureRowView(item.key, true);
|
|
29566
|
+
view.update(
|
|
29158
29567
|
item,
|
|
29159
|
-
messages,
|
|
29160
29568
|
item.key === selectedItemKey,
|
|
29161
29569
|
() => selectItem(item),
|
|
29162
29570
|
createGroupController(entry.agent, "more")
|
|
29163
29571
|
);
|
|
29164
|
-
|
|
29165
|
-
zone.append(row);
|
|
29572
|
+
nextMoreChildren.push(view.element);
|
|
29166
29573
|
}
|
|
29167
29574
|
}
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29575
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
29576
|
+
reconcileElementChildren(moreZone, nextMoreChildren);
|
|
29577
|
+
}
|
|
29578
|
+
nextRowChildren.push(moreZone);
|
|
29579
|
+
resetButton.disabled = groupDisabled;
|
|
29580
|
+
nextRowChildren.push(resetButton);
|
|
29581
|
+
}
|
|
29582
|
+
for (const key of hostRows.keys()) {
|
|
29583
|
+
if (!activeKeys.has(key)) hostRows.delete(key);
|
|
29584
|
+
}
|
|
29585
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
29586
|
+
reconcileElementChildren(rows, nextRowChildren);
|
|
29174
29587
|
}
|
|
29175
29588
|
const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
|
|
29176
29589
|
if (selectedItem) selectItem(selectedItem);
|
|
29177
|
-
|
|
29590
|
+
updateControls.update(
|
|
29178
29591
|
selectedHost.hostId,
|
|
29179
29592
|
items.flatMap((item) => item.version ? [item.version] : [])
|
|
29180
29593
|
);
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
const selectedTab = [...tabs.children].find(
|
|
29195
|
-
(child) => child.getAttribute("aria-selected") === "true"
|
|
29196
|
-
);
|
|
29197
|
-
if (selectedTab) {
|
|
29198
|
-
const left = selectedTab.offsetLeft;
|
|
29199
|
-
const right = left + selectedTab.offsetWidth;
|
|
29200
|
-
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
29201
|
-
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
29202
|
-
tabs.scrollLeft = right - tabs.clientWidth;
|
|
29594
|
+
if (layoutFirstMount || tabsChanged) {
|
|
29595
|
+
hostScroller.update();
|
|
29596
|
+
}
|
|
29597
|
+
if (renderedHostId !== selectedHost.hostId) {
|
|
29598
|
+
renderedHostId = selectedHost.hostId;
|
|
29599
|
+
const selectedTab = hostTabElements.get(selectedHost.hostId);
|
|
29600
|
+
if (selectedTab) {
|
|
29601
|
+
const left = selectedTab.offsetLeft;
|
|
29602
|
+
const right = left + selectedTab.offsetWidth;
|
|
29603
|
+
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
29604
|
+
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
29605
|
+
tabs.scrollLeft = right - tabs.clientWidth;
|
|
29606
|
+
}
|
|
29203
29607
|
}
|
|
29204
29608
|
}
|
|
29205
29609
|
};
|
|
@@ -29220,7 +29624,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
29220
29624
|
refresh.disabled = true;
|
|
29221
29625
|
return () => {
|
|
29222
29626
|
cancelRender();
|
|
29223
|
-
|
|
29627
|
+
hostScroller.dispose();
|
|
29224
29628
|
unsubscribeGroup();
|
|
29225
29629
|
};
|
|
29226
29630
|
}
|
|
@@ -29229,7 +29633,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
29229
29633
|
const unsubscribeInstalls = installs?.subscribe(scheduleRender);
|
|
29230
29634
|
return () => {
|
|
29231
29635
|
cancelRender();
|
|
29232
|
-
|
|
29636
|
+
hostScroller.dispose();
|
|
29233
29637
|
unsubscribeInstalls?.();
|
|
29234
29638
|
unsubscribe();
|
|
29235
29639
|
unsubscribeGroup();
|
|
@@ -30925,9 +31329,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30925
31329
|
resets: "Resets",
|
|
30926
31330
|
details: "Account limit details",
|
|
30927
31331
|
weekly: "Weekly limit",
|
|
31332
|
+
weeklyShort: "Weekly",
|
|
30928
31333
|
monthly: "Monthly limit",
|
|
31334
|
+
monthlyShort: "Monthly",
|
|
30929
31335
|
fiveHour: "5-hour limit",
|
|
31336
|
+
fiveHourShort: "5-hour",
|
|
30930
31337
|
sevenDay: "7-day limit",
|
|
31338
|
+
sevenDayShort: "7-day",
|
|
30931
31339
|
account: "Account limit"
|
|
30932
31340
|
});
|
|
30933
31341
|
var CHINESE_CREDITS_MESSAGES = Object.freeze({
|
|
@@ -30935,9 +31343,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30935
31343
|
resets: "\u91CD\u7F6E",
|
|
30936
31344
|
details: "\u8D26\u53F7\u989D\u5EA6\u8BE6\u60C5",
|
|
30937
31345
|
weekly: "\u5468\u989D\u5EA6",
|
|
31346
|
+
weeklyShort: "\u5468\u989D\u5EA6",
|
|
30938
31347
|
monthly: "\u6708\u989D\u5EA6",
|
|
31348
|
+
monthlyShort: "\u6708\u989D\u5EA6",
|
|
30939
31349
|
fiveHour: "5 \u5C0F\u65F6\u989D\u5EA6",
|
|
31350
|
+
fiveHourShort: "5 \u5C0F\u65F6",
|
|
30940
31351
|
sevenDay: "7 \u5929\u989D\u5EA6",
|
|
31352
|
+
sevenDayShort: "7 \u5929",
|
|
30941
31353
|
account: "\u8D26\u53F7\u989D\u5EA6"
|
|
30942
31354
|
});
|
|
30943
31355
|
function formatRendererCreditsReset(value, now = /* @__PURE__ */ new Date(), locale = "en") {
|
|
@@ -32186,6 +32598,25 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32186
32598
|
node.textContent = label;
|
|
32187
32599
|
return node;
|
|
32188
32600
|
}
|
|
32601
|
+
function labeledField(document2, input) {
|
|
32602
|
+
const field2 = document2.createElement("div");
|
|
32603
|
+
field2.className = input.wide ? "settings-mcp-clients-field settings-mcp-clients-field--wide" : "settings-mcp-clients-field";
|
|
32604
|
+
const controlId = input.control.id || preferenceId("mcp-client");
|
|
32605
|
+
input.control.id = controlId;
|
|
32606
|
+
const label = document2.createElement("label");
|
|
32607
|
+
label.htmlFor = controlId;
|
|
32608
|
+
label.textContent = input.label;
|
|
32609
|
+
field2.append(label, input.control);
|
|
32610
|
+
if (input.hint) {
|
|
32611
|
+
const hint = document2.createElement("p");
|
|
32612
|
+
hint.className = "settings-mcp-clients-hint";
|
|
32613
|
+
hint.id = preferenceId("mcp-client-hint");
|
|
32614
|
+
hint.textContent = input.hint;
|
|
32615
|
+
input.control.setAttribute("aria-describedby", hint.id);
|
|
32616
|
+
field2.append(hint);
|
|
32617
|
+
}
|
|
32618
|
+
return field2;
|
|
32619
|
+
}
|
|
32189
32620
|
function createMcpClientsSettingsPage(messages, getClient) {
|
|
32190
32621
|
return Object.freeze({
|
|
32191
32622
|
id: "mcp-clients",
|
|
@@ -32223,10 +32654,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32223
32654
|
status.textContent = message2;
|
|
32224
32655
|
};
|
|
32225
32656
|
const form = document2.createElement("form");
|
|
32226
|
-
form.className = "settings-
|
|
32657
|
+
form.className = "settings-mcp-clients-form";
|
|
32658
|
+
form.setAttribute("aria-label", copy.add);
|
|
32227
32659
|
const nameInput = document2.createElement("input");
|
|
32228
32660
|
nameInput.type = "text";
|
|
32229
32661
|
nameInput.required = true;
|
|
32662
|
+
nameInput.autocomplete = "off";
|
|
32230
32663
|
nameInput.placeholder = copy.name;
|
|
32231
32664
|
nameInput.setAttribute("aria-label", copy.name);
|
|
32232
32665
|
const accessSelect = document2.createElement("select");
|
|
@@ -32237,7 +32670,6 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32237
32670
|
);
|
|
32238
32671
|
const workspaces = document2.createElement("textarea");
|
|
32239
32672
|
workspaces.rows = 3;
|
|
32240
|
-
workspaces.placeholder = copy.workspacesHint;
|
|
32241
32673
|
workspaces.setAttribute("aria-label", copy.workspaces);
|
|
32242
32674
|
const connectionSelect = document2.createElement("select");
|
|
32243
32675
|
connectionSelect.setAttribute("aria-label", copy.connection);
|
|
@@ -32254,25 +32686,46 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32254
32686
|
);
|
|
32255
32687
|
const directUrlInput = document2.createElement("input");
|
|
32256
32688
|
directUrlInput.type = "url";
|
|
32257
|
-
directUrlInput.placeholder = copy.directUrlHint;
|
|
32258
32689
|
directUrlInput.setAttribute("aria-label", copy.directUrl);
|
|
32259
32690
|
const oauthInput = document2.createElement("input");
|
|
32260
32691
|
oauthInput.type = "text";
|
|
32261
|
-
oauthInput.
|
|
32692
|
+
oauthInput.autocomplete = "off";
|
|
32262
32693
|
oauthInput.setAttribute("aria-label", copy.oauthClientId);
|
|
32263
32694
|
const add = document2.createElement("button");
|
|
32264
32695
|
add.type = "submit";
|
|
32265
32696
|
add.className = "settings-command-button";
|
|
32266
32697
|
add.textContent = copy.add;
|
|
32698
|
+
const workspacesField = labeledField(document2, {
|
|
32699
|
+
label: copy.workspaces,
|
|
32700
|
+
control: workspaces,
|
|
32701
|
+
hint: copy.workspacesHint,
|
|
32702
|
+
wide: true
|
|
32703
|
+
});
|
|
32704
|
+
const directUrlField = labeledField(document2, {
|
|
32705
|
+
label: copy.directUrl,
|
|
32706
|
+
control: directUrlInput,
|
|
32707
|
+
hint: copy.directUrlHint,
|
|
32708
|
+
wide: true
|
|
32709
|
+
});
|
|
32710
|
+
const actions = document2.createElement("div");
|
|
32711
|
+
actions.className = "settings-mcp-clients-actions";
|
|
32712
|
+
actions.append(add);
|
|
32713
|
+
const syncOptionalFields = () => {
|
|
32714
|
+
workspacesField.hidden = accessSelect.value !== "selected-workspaces";
|
|
32715
|
+
directUrlField.hidden = connectionSelect.value !== "direct";
|
|
32716
|
+
};
|
|
32717
|
+
accessSelect.addEventListener("change", syncOptionalFields);
|
|
32718
|
+
connectionSelect.addEventListener("change", syncOptionalFields);
|
|
32719
|
+
syncOptionalFields();
|
|
32267
32720
|
form.append(
|
|
32268
|
-
nameInput,
|
|
32269
|
-
accessSelect,
|
|
32270
|
-
|
|
32271
|
-
connectionSelect,
|
|
32272
|
-
grantSelect,
|
|
32273
|
-
|
|
32274
|
-
oauthInput,
|
|
32275
|
-
|
|
32721
|
+
labeledField(document2, { label: copy.name, control: nameInput }),
|
|
32722
|
+
labeledField(document2, { label: copy.access, control: accessSelect }),
|
|
32723
|
+
workspacesField,
|
|
32724
|
+
labeledField(document2, { label: copy.connection, control: connectionSelect }),
|
|
32725
|
+
labeledField(document2, { label: copy.grant, control: grantSelect }),
|
|
32726
|
+
directUrlField,
|
|
32727
|
+
labeledField(document2, { label: copy.oauthClientId, control: oauthInput }),
|
|
32728
|
+
actions
|
|
32276
32729
|
);
|
|
32277
32730
|
const tableWrap = document2.createElement("div");
|
|
32278
32731
|
tableWrap.className = "settings-enrollment-table-wrap";
|
|
@@ -32332,15 +32785,15 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32332
32785
|
grantCell.textContent = grantLabel(view.dispatchGrant, copy);
|
|
32333
32786
|
const urlCell = document2.createElement("td");
|
|
32334
32787
|
urlCell.textContent = view.mcpUrl ?? view.mcpUrlNote ?? "\u2014";
|
|
32335
|
-
const
|
|
32336
|
-
|
|
32788
|
+
const actions2 = document2.createElement("td");
|
|
32789
|
+
actions2.className = "settings-enrollment-actions";
|
|
32337
32790
|
if (view.mcpUrl) {
|
|
32338
32791
|
const copyButton = document2.createElement("button");
|
|
32339
32792
|
copyButton.type = "button";
|
|
32340
32793
|
copyButton.className = "settings-command-button settings-command-button--secondary";
|
|
32341
32794
|
copyButton.textContent = copy.copyUrl;
|
|
32342
32795
|
copyButton.addEventListener("click", () => void copyUrl(view.mcpUrl));
|
|
32343
|
-
|
|
32796
|
+
actions2.append(copyButton);
|
|
32344
32797
|
}
|
|
32345
32798
|
const full = document2.createElement("button");
|
|
32346
32799
|
full.type = "button";
|
|
@@ -32396,8 +32849,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
32396
32849
|
}
|
|
32397
32850
|
);
|
|
32398
32851
|
});
|
|
32399
|
-
|
|
32400
|
-
row.append(nameCell, accessCell, connectionCell, grantCell, urlCell,
|
|
32852
|
+
actions2.append(full, revoke);
|
|
32853
|
+
row.append(nameCell, accessCell, connectionCell, grantCell, urlCell, actions2);
|
|
32401
32854
|
tbody.append(row);
|
|
32402
32855
|
}
|
|
32403
32856
|
};
|
|
@@ -34413,6 +34866,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34413
34866
|
.settings-connection-inspector {
|
|
34414
34867
|
position: sticky;
|
|
34415
34868
|
top: 18px;
|
|
34869
|
+
overflow-anchor: none;
|
|
34416
34870
|
}
|
|
34417
34871
|
|
|
34418
34872
|
.settings-connection-inspector__header {
|
|
@@ -35935,6 +36389,11 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
35935
36389
|
// src/web-settings-entry.ts
|
|
35936
36390
|
var WEB_LAYOUT_CSS = `.settings-page { background: transparent; overflow: visible; container: codexhost-settings-page / inline-size; }
|
|
35937
36391
|
.settings-page__content { width: 100%; padding: 0; }`;
|
|
36392
|
+
var sharedConnectionDiagnostics = null;
|
|
36393
|
+
function getWebConnectionDiagnostics(client) {
|
|
36394
|
+
sharedConnectionDiagnostics ??= createConsoleConnectionDiagnostics(client);
|
|
36395
|
+
return sharedConnectionDiagnostics;
|
|
36396
|
+
}
|
|
35938
36397
|
function resourcesPage(messages, client) {
|
|
35939
36398
|
return {
|
|
35940
36399
|
id: "resources",
|
|
@@ -35964,7 +36423,6 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
35964
36423
|
() => modelClient,
|
|
35965
36424
|
{ migrateLegacy: false }
|
|
35966
36425
|
);
|
|
35967
|
-
const diagnostics = createConsoleConnectionDiagnostics(modelClient);
|
|
35968
36426
|
const updateClient = {
|
|
35969
36427
|
checkUpdate: () => modelClient.checkUpdate(),
|
|
35970
36428
|
startUpdate: () => modelClient.startUpdate(),
|
|
@@ -35974,7 +36432,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
35974
36432
|
...createDefaultRendererSettingsPages(
|
|
35975
36433
|
messages,
|
|
35976
36434
|
() => updateClient,
|
|
35977
|
-
() =>
|
|
36435
|
+
() => getWebConnectionDiagnostics(modelClient),
|
|
35978
36436
|
() => modelClient,
|
|
35979
36437
|
() => null,
|
|
35980
36438
|
null,
|