@karlorz/codexhost-cli-darwin-x64 0.19.0-2 → 0.20.0-1
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 +60 -11
- 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/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
package/app/console-web.js
CHANGED
|
@@ -15143,13 +15143,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15143
15143
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15144
15144
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15145
15145
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15146
|
+
var usageOutputTimingSchema = external_exports.object({
|
|
15147
|
+
version: external_exports.literal(3).optional(),
|
|
15148
|
+
requestId: external_exports.string().min(1),
|
|
15149
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
15150
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
15151
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
15152
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
15153
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
15146
15154
|
var usageMeasurementSchema = external_exports.object({
|
|
15155
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
|
|
15147
15156
|
value: finiteNonNegativeNumberSchema,
|
|
15148
15157
|
turnId: external_exports.string().min(1).max(1024),
|
|
15149
15158
|
at: nonNegativeSafeIntegerSchema
|
|
15150
15159
|
}).strict();
|
|
15151
15160
|
var usageMeasurementsSchema = external_exports.object({
|
|
15152
|
-
|
|
15161
|
+
// Unversioned intervals can omit hidden thinking time; do not restore them into averages.
|
|
15162
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
|
|
15163
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
15164
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
|
|
15153
15165
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15154
15166
|
}).strict();
|
|
15155
15167
|
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
@@ -15169,6 +15181,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15169
15181
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15170
15182
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15171
15183
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15184
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15172
15185
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15173
15186
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15174
15187
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15629,6 +15642,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15629
15642
|
})
|
|
15630
15643
|
});
|
|
15631
15644
|
|
|
15645
|
+
// ../shared-contracts/dist/thread-archive-confirm.js
|
|
15646
|
+
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15647
|
+
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15648
|
+
|
|
15632
15649
|
// ../shared-contracts/dist/client-channel.js
|
|
15633
15650
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15634
15651
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
@@ -15768,7 +15785,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15768
15785
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
15769
15786
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
15770
15787
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
15771
|
-
command: external_exports.object({
|
|
15788
|
+
command: external_exports.object({
|
|
15789
|
+
name: external_exports.string().min(1),
|
|
15790
|
+
turn: clientTurnSchema,
|
|
15791
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
15792
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
15793
|
+
}).optional(),
|
|
15772
15794
|
thread: external_exports.object({
|
|
15773
15795
|
id: external_exports.string().min(1),
|
|
15774
15796
|
cwd: external_exports.string(),
|
|
@@ -15978,7 +16000,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15978
16000
|
quotaUntil: external_exports.string().optional()
|
|
15979
16001
|
}).strict().optional()
|
|
15980
16002
|
}).strict();
|
|
15981
|
-
var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
|
|
15982
16003
|
|
|
15983
16004
|
// ../shared-contracts/dist/delegation-read.js
|
|
15984
16005
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -18242,7 +18263,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18242
18263
|
await Promise.all(
|
|
18243
18264
|
plugins.map(async ({ id }) => {
|
|
18244
18265
|
try {
|
|
18245
|
-
const inspection = await client.inspectHarness({
|
|
18266
|
+
const inspection = await client.inspectHarness({
|
|
18267
|
+
harnessId: id,
|
|
18268
|
+
refresh,
|
|
18269
|
+
purpose: "availability"
|
|
18270
|
+
});
|
|
18246
18271
|
availability.set(id, inspection.status);
|
|
18247
18272
|
webUi.set(id, inspection.status === "ready" && inspection.webUi?.open === true);
|
|
18248
18273
|
const error51 = inspection.status === "ready" ? null : inspection.error;
|
|
@@ -25049,7 +25074,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
25049
25074
|
`;
|
|
25050
25075
|
|
|
25051
25076
|
// src/settings/enrollment.css
|
|
25052
|
-
var enrollment_default = ".settings-enrollment-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 24px;\n margin-bottom: 8px;\n}\n.settings-enrollment-copy {\n min-width: 0;\n flex: 1 1 auto;\n}\n.settings-enrollment-title {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.settings-enrollment-header .settings-section-label {\n padding-bottom: 0;\n}\n.settings-enrollment-header .settings-page-description {\n margin: 5px 0 0;\n}\n.settings-enrollment-status {\n min-height: 1.2em;\n margin: 0 0 8px;\n color: light-dark(#676773, #a5a5af);\n font-size: 12px;\n}\n.settings-enrollment-status.is-error {\n color: light-dark(#8a3b32, #f0b4ae);\n}\n.settings-enrollment-table-wrap {\n border: 1px solid light-dark(#e2e2e8, #36363b);\n border-radius: 11px;\n overflow-x: auto;\n container-type: inline-size;\n}\n.settings-enrollment-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 12px;\n}\n.settings-enrollment-table th {\n padding: 12px 16px;\n color: light-dark(#676773, #a5a5af);\n background: light-dark(#f8f8fa, #202024);\n font-size: 11px;\n font-weight: 500;\n text-align: left;\n}\n.settings-enrollment-table th:last-child,\n.settings-enrollment-actions {\n text-align: right;\n}\n.settings-enrollment-table td {\n padding: 14px 16px;\n vertical-align: middle;\n border-top: 1px solid var(--settings-divider, light-dark(#ececf0, #2e2e33));\n}\n.settings-enrollment-executable,\n.settings-enrollment-allowlist {\n color: light-dark(#676773, #a5a5af);\n font-size: 11px;\n word-break: break-all;\n}\n.settings-enrollment-empty {\n color: light-dark(#676773, #a5a5af);\n text-align: center;\n}\n\n@container (max-width: 720px) {\n .settings-enrollment-table,\n .settings-enrollment-table tbody {\n display: block;\n }\n .settings-enrollment-table thead {\n display: none;\n }\n .settings-enrollment-row {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: 10px;\n padding: 16px;\n border-top: 1px solid var(--settings-divider, light-dark(#ececf0, #2e2e33));\n }\n .settings-enrollment-row:first-child {\n border-top: 0;\n }\n .settings-enrollment-table .settings-enrollment-row > td {\n display: block;\n padding: 0;\n border: 0;\n text-align: left;\n }\n .settings-enrollment-actions {\n text-align: left;\n }\n}\n";
|
|
25077
|
+
var enrollment_default = ".settings-enrollment-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 24px;\n margin-bottom: 8px;\n}\n.settings-enrollment-copy {\n min-width: 0;\n flex: 1 1 auto;\n}\n.settings-enrollment-title {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.settings-enrollment-header .settings-section-label {\n padding-bottom: 0;\n}\n.settings-enrollment-header .settings-page-description {\n margin: 5px 0 0;\n}\n.settings-enrollment-status {\n min-height: 1.2em;\n margin: 0 0 8px;\n color: light-dark(#676773, #a5a5af);\n font-size: 12px;\n}\n.settings-enrollment-status.is-error {\n color: light-dark(#8a3b32, #f0b4ae);\n}\n.settings-enrollment-table-wrap {\n border: 1px solid light-dark(#e2e2e8, #36363b);\n border-radius: 11px;\n overflow-x: auto;\n container-type: inline-size;\n}\n.settings-enrollment-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 12px;\n}\n.settings-enrollment-table th {\n padding: 12px 16px;\n color: light-dark(#676773, #a5a5af);\n background: light-dark(#f8f8fa, #202024);\n font-size: 11px;\n font-weight: 500;\n text-align: left;\n}\n.settings-enrollment-table th:last-child,\n.settings-enrollment-actions {\n text-align: right;\n}\n.settings-enrollment-table td {\n padding: 14px 16px;\n vertical-align: middle;\n border-top: 1px solid var(--settings-divider, light-dark(#ececf0, #2e2e33));\n}\n.settings-enrollment-executable,\n.settings-enrollment-allowlist {\n color: light-dark(#676773, #a5a5af);\n font-size: 11px;\n word-break: break-all;\n}\n.settings-enrollment-empty {\n color: light-dark(#676773, #a5a5af);\n text-align: center;\n}\n\n@container (max-width: 720px) {\n .settings-enrollment-table,\n .settings-enrollment-table tbody {\n display: block;\n }\n .settings-enrollment-table thead {\n display: none;\n }\n .settings-enrollment-row {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: 10px;\n padding: 16px;\n border-top: 1px solid var(--settings-divider, light-dark(#ececf0, #2e2e33));\n }\n .settings-enrollment-row:first-child {\n border-top: 0;\n }\n .settings-enrollment-table .settings-enrollment-row > td {\n display: block;\n padding: 0;\n border: 0;\n text-align: left;\n }\n .settings-enrollment-actions {\n text-align: left;\n }\n}\n\n.settings-mcp-clients-form {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 12px;\n margin: 0 0 16px;\n align-items: flex-end;\n}\n@media (max-width: 720px) {\n .settings-mcp-clients-form {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n.settings-mcp-clients-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n min-width: 0;\n}\n.settings-mcp-clients-field--wide {\n grid-column: 1 / -1;\n}\n.settings-mcp-clients-field > label {\n color: var(--settings-muted);\n font-size: 11px;\n font-weight: 500;\n}\n.settings-mcp-clients-field input,\n.settings-mcp-clients-field select,\n.settings-mcp-clients-field textarea {\n width: 100%;\n min-width: 0;\n min-height: 36px;\n padding: 6px 10px;\n color: var(--settings-text);\n background: var(--settings-bg);\n border: 1px solid var(--settings-border);\n border-radius: 6px;\n font: inherit;\n font-size: 13px;\n}\n.settings-mcp-clients-field textarea {\n min-height: 72px;\n resize: vertical;\n}\n.settings-mcp-clients-field input::placeholder,\n.settings-mcp-clients-field textarea::placeholder {\n color: var(--settings-muted);\n}\n.settings-mcp-clients-field input:focus-visible,\n.settings-mcp-clients-field select:focus-visible,\n.settings-mcp-clients-field textarea:focus-visible {\n outline: 2px solid var(--settings-focus);\n outline-offset: 2px;\n}\n.settings-mcp-clients-hint {\n margin: 0;\n color: var(--settings-muted);\n font-size: 11px;\n line-height: 16px;\n}\n.settings-mcp-clients-actions {\n display: flex;\n align-items: flex-end;\n justify-content: flex-start;\n}\n";
|
|
25053
25078
|
|
|
25054
25079
|
// src/settings/core.ts
|
|
25055
25080
|
var RendererSettingsPageScope = class {
|
|
@@ -26073,6 +26098,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
26073
26098
|
latestCacheHit: "Latest cache hit (CH)",
|
|
26074
26099
|
sessionCacheHit: "Average cache hit",
|
|
26075
26100
|
outputSpeed: "Output speed (TPS)",
|
|
26101
|
+
averageOutputSpeed: "Average output speed (TPS)",
|
|
26076
26102
|
apiOutputSpeed: "API average speed",
|
|
26077
26103
|
apiOutputSpeedDescription: "Output tokens / native API time, including first-token wait; not generation TPS.",
|
|
26078
26104
|
timeToFirstOutput: "Time to first token (TTFT)",
|
|
@@ -26098,6 +26124,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
26098
26124
|
latestCacheHit: "\u6700\u8FD1\u7F13\u5B58\u547D\u4E2D\uFF08CH\uFF09",
|
|
26099
26125
|
sessionCacheHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
|
|
26100
26126
|
outputSpeed: "\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
26127
|
+
averageOutputSpeed: "\u5E73\u5747\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
26101
26128
|
apiOutputSpeed: "API \u5E73\u5747\u901F\u5EA6",
|
|
26102
26129
|
apiOutputSpeedDescription: "\u8F93\u51FA Token \xF7 \u539F\u751F API \u8017\u65F6\uFF0C\u542B\u9996\u5B57\u7B49\u5F85\uFF1B\u4E0D\u662F\u751F\u6210 TPS\u3002",
|
|
26103
26130
|
timeToFirstOutput: "\u9996 token\uFF08TTFT\uFF09",
|
|
@@ -29739,196 +29766,729 @@ ${detail}` : ""}`
|
|
|
29739
29766
|
return fallback;
|
|
29740
29767
|
}
|
|
29741
29768
|
|
|
29742
|
-
// src/settings/
|
|
29743
|
-
function
|
|
29744
|
-
|
|
29745
|
-
|
|
29746
|
-
|
|
29747
|
-
|
|
29748
|
-
|
|
29749
|
-
|
|
29750
|
-
|
|
29751
|
-
|
|
29752
|
-
|
|
29753
|
-
|
|
29754
|
-
|
|
29755
|
-
|
|
29756
|
-
|
|
29757
|
-
|
|
29758
|
-
|
|
29759
|
-
|
|
29760
|
-
|
|
29761
|
-
|
|
29762
|
-
|
|
29763
|
-
|
|
29764
|
-
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
|
|
29768
|
-
|
|
29769
|
-
|
|
29770
|
-
|
|
29771
|
-
|
|
29772
|
-
|
|
29773
|
-
|
|
29774
|
-
|
|
29775
|
-
|
|
29776
|
-
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
}
|
|
29780
|
-
|
|
29781
|
-
|
|
29782
|
-
|
|
29783
|
-
|
|
29784
|
-
|
|
29785
|
-
|
|
29786
|
-
|
|
29787
|
-
|
|
29788
|
-
|
|
29789
|
-
|
|
29790
|
-
|
|
29791
|
-
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29795
|
-
|
|
29769
|
+
// src/settings/connection-row.ts
|
|
29770
|
+
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
29771
|
+
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
29772
|
+
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
29773
|
+
if (availability === "ready") return messages.connectionStatusReady;
|
|
29774
|
+
if (availability === "checking") return messages.connectionStatusChecking;
|
|
29775
|
+
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
29776
|
+
if (availability === "unavailable" || availability === "error") {
|
|
29777
|
+
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
29778
|
+
}
|
|
29779
|
+
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
29780
|
+
}
|
|
29781
|
+
function connectionStatusTone(availability, hasError = false) {
|
|
29782
|
+
if (availability === "updating") return "checking";
|
|
29783
|
+
if (hasError && availability !== "notInstalled") return "failed";
|
|
29784
|
+
if (availability === "ready") return "ready";
|
|
29785
|
+
if (availability === "checking" || availability === "installing") return "checking";
|
|
29786
|
+
if (availability === "notInstalled") return "setup";
|
|
29787
|
+
return "failed";
|
|
29788
|
+
}
|
|
29789
|
+
function createConnectionIdentityIcon(document2, item, size) {
|
|
29790
|
+
const container = document2.createElement("span");
|
|
29791
|
+
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
29792
|
+
container.setAttribute("aria-hidden", "true");
|
|
29793
|
+
if (item.agentSnapshot) {
|
|
29794
|
+
container.append(
|
|
29795
|
+
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
29796
|
+
);
|
|
29797
|
+
} else {
|
|
29798
|
+
container.textContent = "CH";
|
|
29799
|
+
}
|
|
29800
|
+
return container;
|
|
29801
|
+
}
|
|
29802
|
+
function sameElementChildren(container, next) {
|
|
29803
|
+
if (container.children.length !== next.length) return false;
|
|
29804
|
+
for (let index = 0; index < next.length; index++) {
|
|
29805
|
+
if (container.children[index] !== next[index]) return false;
|
|
29806
|
+
}
|
|
29807
|
+
return true;
|
|
29808
|
+
}
|
|
29809
|
+
function reconcileElementChildren(container, next) {
|
|
29810
|
+
if (sameElementChildren(container, next)) return;
|
|
29811
|
+
if (typeof container.insertBefore !== "function") {
|
|
29812
|
+
container.replaceChildren(...next);
|
|
29813
|
+
return;
|
|
29814
|
+
}
|
|
29815
|
+
const nextSet = new Set(next);
|
|
29816
|
+
for (const child of [...container.children]) {
|
|
29817
|
+
if (!nextSet.has(child)) child.remove();
|
|
29818
|
+
}
|
|
29819
|
+
for (let index = 0; index < next.length; index++) {
|
|
29820
|
+
const desired = next[index];
|
|
29821
|
+
if (!desired) continue;
|
|
29822
|
+
const current = container.children[index] ?? null;
|
|
29823
|
+
if (current !== desired) {
|
|
29824
|
+
container.insertBefore(desired, current);
|
|
29796
29825
|
}
|
|
29797
|
-
}
|
|
29798
|
-
|
|
29799
|
-
|
|
29800
|
-
|
|
29801
|
-
|
|
29802
|
-
|
|
29803
|
-
|
|
29826
|
+
}
|
|
29827
|
+
}
|
|
29828
|
+
function identityIconSignature(item) {
|
|
29829
|
+
if (!item.agentSnapshot) return "adapter";
|
|
29830
|
+
const plugin = item.agentSnapshot.plugin;
|
|
29831
|
+
return `${item.agentSnapshot.agent}:${String(plugin?.icon ?? "")}:${String(plugin?.iconStyle ?? "")}`;
|
|
29832
|
+
}
|
|
29833
|
+
function createConnectionRowView(document2, messages, groupable) {
|
|
29834
|
+
const row = document2.createElement("div");
|
|
29835
|
+
row.className = "settings-connection-row";
|
|
29836
|
+
row.setAttribute("role", "row");
|
|
29837
|
+
const identity2 = document2.createElement("div");
|
|
29838
|
+
identity2.className = "settings-connection-row__identity";
|
|
29839
|
+
identity2.setAttribute("role", "cell");
|
|
29840
|
+
let handle = null;
|
|
29841
|
+
if (groupable) {
|
|
29842
|
+
handle = document2.createElement("span");
|
|
29843
|
+
handle.className = "settings-connection-row__handle";
|
|
29844
|
+
handle.setAttribute("aria-hidden", "true");
|
|
29845
|
+
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
29846
|
+
identity2.append(handle);
|
|
29847
|
+
}
|
|
29848
|
+
let iconElement = null;
|
|
29849
|
+
let renderedIconKey = null;
|
|
29850
|
+
const label = document2.createElement("strong");
|
|
29851
|
+
const status = document2.createElement("span");
|
|
29852
|
+
status.className = "settings-connection-row__status";
|
|
29853
|
+
status.setAttribute("role", "cell");
|
|
29854
|
+
const action = document2.createElement("div");
|
|
29855
|
+
action.className = "settings-connection-row__action";
|
|
29856
|
+
action.setAttribute("role", "cell");
|
|
29857
|
+
row.append(identity2, status, action);
|
|
29858
|
+
let currentItem = null;
|
|
29859
|
+
let currentSelect = () => void 0;
|
|
29860
|
+
let currentGroup = null;
|
|
29861
|
+
let installButton = null;
|
|
29862
|
+
let viewErrorButton = null;
|
|
29863
|
+
let versionAvailableBadge = null;
|
|
29864
|
+
let updateButton = null;
|
|
29865
|
+
let groupToggleButton = null;
|
|
29866
|
+
let groupToggleSection = null;
|
|
29867
|
+
row.addEventListener("click", (event) => {
|
|
29868
|
+
const target2 = event.target;
|
|
29869
|
+
if (target2?.closest?.("a")) return;
|
|
29870
|
+
currentSelect();
|
|
29804
29871
|
});
|
|
29805
|
-
|
|
29806
|
-
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
|
|
29810
|
-
}).catch(() => {
|
|
29811
|
-
loaded = true;
|
|
29812
|
-
status.textContent = messages.launchPathLoadError;
|
|
29813
|
-
}).finally(() => {
|
|
29814
|
-
busy = false;
|
|
29815
|
-
controls();
|
|
29872
|
+
row.addEventListener("keydown", (event) => {
|
|
29873
|
+
if (event.target?.closest?.("button, a")) return;
|
|
29874
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
29875
|
+
event.preventDefault();
|
|
29876
|
+
currentSelect();
|
|
29816
29877
|
});
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
|
|
29820
|
-
|
|
29821
|
-
|
|
29822
|
-
|
|
29823
|
-
|
|
29824
|
-
|
|
29825
|
-
|
|
29826
|
-
|
|
29827
|
-
|
|
29828
|
-
copy.className = "settings-grok-computer-use__copy";
|
|
29829
|
-
const title = document2.createElement("h3");
|
|
29830
|
-
title.className = "settings-grok-computer-use__title";
|
|
29831
|
-
title.id = "grok-computer-use-title";
|
|
29832
|
-
title.textContent = messages.grokComputerUseTitle;
|
|
29833
|
-
const description = document2.createElement("p");
|
|
29834
|
-
description.className = "settings-grok-computer-use__description";
|
|
29835
|
-
description.id = "grok-computer-use-description";
|
|
29836
|
-
description.textContent = messages.grokComputerUseDescription;
|
|
29837
|
-
copy.append(title, description);
|
|
29838
|
-
const input = createPreferenceSwitch(
|
|
29839
|
-
document2,
|
|
29840
|
-
"grok-computer-use-enabled",
|
|
29841
|
-
"grok-computer-use-description grok-computer-use-help grok-computer-use-status"
|
|
29842
|
-
);
|
|
29843
|
-
input.setAttribute("aria-labelledby", title.id);
|
|
29844
|
-
input.setAttribute("aria-label", messages.grokComputerUseLabel);
|
|
29845
|
-
header.append(copy, input);
|
|
29846
|
-
const help = document2.createElement("p");
|
|
29847
|
-
help.className = "settings-grok-computer-use__help";
|
|
29848
|
-
help.id = "grok-computer-use-help";
|
|
29849
|
-
help.textContent = messages.grokComputerUseHelp;
|
|
29850
|
-
const status = document2.createElement("p");
|
|
29851
|
-
status.className = "settings-grok-computer-use__status";
|
|
29852
|
-
status.id = "grok-computer-use-status";
|
|
29853
|
-
status.setAttribute("role", "status");
|
|
29854
|
-
status.setAttribute("aria-live", "polite");
|
|
29855
|
-
const browserHeader = document2.createElement("div");
|
|
29856
|
-
browserHeader.className = "settings-grok-computer-use__header settings-grok-computer-use__browser";
|
|
29857
|
-
const browserCopy = document2.createElement("div");
|
|
29858
|
-
browserCopy.className = "settings-grok-computer-use__copy";
|
|
29859
|
-
const browserTitle = document2.createElement("h3");
|
|
29860
|
-
browserTitle.className = "settings-grok-computer-use__title";
|
|
29861
|
-
browserTitle.id = "grok-browser-title";
|
|
29862
|
-
browserTitle.textContent = messages.grokBrowserTitle;
|
|
29863
|
-
const browserDescription = document2.createElement("p");
|
|
29864
|
-
browserDescription.className = "settings-grok-computer-use__description";
|
|
29865
|
-
browserDescription.id = "grok-browser-description";
|
|
29866
|
-
browserDescription.textContent = messages.grokBrowserDescription;
|
|
29867
|
-
browserCopy.append(browserTitle, browserDescription);
|
|
29868
|
-
const browserInput = createPreferenceSwitch(
|
|
29869
|
-
document2,
|
|
29870
|
-
"grok-browser-enabled",
|
|
29871
|
-
"grok-browser-description grok-browser-help grok-browser-status"
|
|
29872
|
-
);
|
|
29873
|
-
browserInput.setAttribute("aria-labelledby", browserTitle.id);
|
|
29874
|
-
browserInput.setAttribute("aria-label", messages.grokBrowserLabel);
|
|
29875
|
-
browserHeader.append(browserCopy, browserInput);
|
|
29876
|
-
const browserHelp = document2.createElement("p");
|
|
29877
|
-
browserHelp.className = "settings-grok-computer-use__help";
|
|
29878
|
-
browserHelp.id = "grok-browser-help";
|
|
29879
|
-
browserHelp.textContent = messages.grokBrowserHelp;
|
|
29880
|
-
const browserStatus = document2.createElement("p");
|
|
29881
|
-
browserStatus.className = "settings-grok-computer-use__status";
|
|
29882
|
-
browserStatus.id = "grok-browser-status";
|
|
29883
|
-
browserStatus.setAttribute("role", "status");
|
|
29884
|
-
browserStatus.setAttribute("aria-live", "polite");
|
|
29885
|
-
section.append(header, help, status, browserHeader, browserHelp, browserStatus);
|
|
29886
|
-
let busy = true;
|
|
29887
|
-
let loaded = false;
|
|
29888
|
-
let last;
|
|
29889
|
-
const show = (value) => {
|
|
29890
|
-
last = value;
|
|
29891
|
-
input.checked = value.enabled;
|
|
29892
|
-
input.disabled = busy || !loaded || !value.available && !value.enabled;
|
|
29893
|
-
const browserOn = value.browser === true;
|
|
29894
|
-
const browserFiles = value.browserFilesPresent === true;
|
|
29895
|
-
browserInput.checked = browserOn;
|
|
29896
|
-
browserInput.disabled = busy || !loaded || !browserFiles && !browserOn;
|
|
29897
|
-
if (!browserFiles) {
|
|
29898
|
-
browserStatus.dataset.state = "unavailable";
|
|
29899
|
-
browserStatus.textContent = value.browserUnavailableReason ?? messages.grokBrowserUnavailable;
|
|
29900
|
-
} else if (value.browserAvailable !== true) {
|
|
29901
|
-
browserStatus.dataset.state = browserOn ? "unavailable" : "off";
|
|
29902
|
-
browserStatus.textContent = browserOn ? value.browserUnavailableReason ?? messages.grokBrowserBlocked : messages.grokBrowserOff;
|
|
29903
|
-
} else {
|
|
29904
|
-
browserStatus.dataset.state = browserOn ? "on" : "off";
|
|
29905
|
-
browserStatus.textContent = browserOn ? messages.grokBrowserOn : messages.grokBrowserOff;
|
|
29906
|
-
}
|
|
29907
|
-
if (value.applyFailed) {
|
|
29908
|
-
status.dataset.state = "unavailable";
|
|
29909
|
-
status.textContent = value.applyError ?? messages.grokComputerUseApplyFailed;
|
|
29910
|
-
return;
|
|
29878
|
+
if (groupable) {
|
|
29879
|
+
row.addEventListener("dragstart", (event) => currentGroup?.onDragStart(event));
|
|
29880
|
+
row.addEventListener("dragover", (event) => currentGroup?.onDragOver(event));
|
|
29881
|
+
row.addEventListener("dragleave", (event) => currentGroup?.onDragLeave(event));
|
|
29882
|
+
row.addEventListener("drop", (event) => currentGroup?.onDrop(event));
|
|
29883
|
+
row.addEventListener("dragend", (event) => currentGroup?.onDragEnd(event));
|
|
29884
|
+
}
|
|
29885
|
+
const setSelected = (selected) => {
|
|
29886
|
+
const nextSelected = String(selected);
|
|
29887
|
+
if (row.dataset.connectionSelected !== nextSelected) {
|
|
29888
|
+
row.dataset.connectionSelected = nextSelected;
|
|
29911
29889
|
}
|
|
29912
|
-
|
|
29913
|
-
|
|
29914
|
-
|
|
29915
|
-
return;
|
|
29890
|
+
const nextTabIndex = selected ? 0 : -1;
|
|
29891
|
+
if (row.tabIndex !== nextTabIndex) {
|
|
29892
|
+
row.tabIndex = nextTabIndex;
|
|
29916
29893
|
}
|
|
29917
|
-
status.dataset.state = value.enabled ? "on" : "off";
|
|
29918
|
-
status.textContent = value.enabled ? messages.grokComputerUseOn : messages.grokComputerUseOff;
|
|
29919
29894
|
};
|
|
29920
|
-
|
|
29921
|
-
|
|
29922
|
-
|
|
29923
|
-
|
|
29924
|
-
|
|
29925
|
-
|
|
29926
|
-
|
|
29927
|
-
|
|
29928
|
-
|
|
29929
|
-
|
|
29930
|
-
|
|
29931
|
-
|
|
29895
|
+
return {
|
|
29896
|
+
element: row,
|
|
29897
|
+
setSelected,
|
|
29898
|
+
update(item, selected, select, group) {
|
|
29899
|
+
currentItem = item;
|
|
29900
|
+
currentSelect = select;
|
|
29901
|
+
currentGroup = group;
|
|
29902
|
+
if (row.dataset.connectionItem !== item.key) {
|
|
29903
|
+
row.dataset.connectionItem = item.key;
|
|
29904
|
+
}
|
|
29905
|
+
setSelected(selected);
|
|
29906
|
+
const nextIconKey = identityIconSignature(item);
|
|
29907
|
+
if (renderedIconKey !== nextIconKey || !iconElement) {
|
|
29908
|
+
renderedIconKey = nextIconKey;
|
|
29909
|
+
iconElement = createConnectionIdentityIcon(document2, item, 19);
|
|
29910
|
+
reconcileElementChildren(
|
|
29911
|
+
identity2,
|
|
29912
|
+
handle ? [handle, iconElement, label] : [iconElement, label]
|
|
29913
|
+
);
|
|
29914
|
+
}
|
|
29915
|
+
if (handle && group && handle.title !== group.dragHandleTitle) {
|
|
29916
|
+
handle.title = group.dragHandleTitle;
|
|
29917
|
+
}
|
|
29918
|
+
if (label.textContent !== item.name) {
|
|
29919
|
+
label.textContent = item.name;
|
|
29920
|
+
}
|
|
29921
|
+
const tone = connectionStatusTone(item.availability, item.error !== null);
|
|
29922
|
+
if (status.dataset.connectionTone !== tone) {
|
|
29923
|
+
status.dataset.connectionTone = tone;
|
|
29924
|
+
}
|
|
29925
|
+
const statusText = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
29926
|
+
if (status.textContent !== statusText) {
|
|
29927
|
+
status.textContent = statusText;
|
|
29928
|
+
}
|
|
29929
|
+
const nextActions = [];
|
|
29930
|
+
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
29931
|
+
if (!installButton) {
|
|
29932
|
+
const button2 = document2.createElement("button");
|
|
29933
|
+
button2.type = "button";
|
|
29934
|
+
button2.className = "settings-connection-install-link";
|
|
29935
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
29936
|
+
button2.addEventListener("click", (event) => {
|
|
29937
|
+
event.stopPropagation();
|
|
29938
|
+
currentSelect();
|
|
29939
|
+
currentItem?.install?.();
|
|
29940
|
+
});
|
|
29941
|
+
installButton = button2;
|
|
29942
|
+
}
|
|
29943
|
+
installButton.disabled = item.availability === "installing" || item.availability === "checking";
|
|
29944
|
+
const installLabel = messages.connectionInstall;
|
|
29945
|
+
const ariaLabel = `${installLabel}: ${item.name}`;
|
|
29946
|
+
if (installButton.getAttribute("aria-label") !== ariaLabel) {
|
|
29947
|
+
installButton.setAttribute("aria-label", ariaLabel);
|
|
29948
|
+
}
|
|
29949
|
+
if (installButton.title !== installLabel) {
|
|
29950
|
+
installButton.title = installLabel;
|
|
29951
|
+
}
|
|
29952
|
+
nextActions.push(installButton);
|
|
29953
|
+
} else if (item.error) {
|
|
29954
|
+
if (!viewErrorButton) {
|
|
29955
|
+
const button2 = document2.createElement("button");
|
|
29956
|
+
button2.type = "button";
|
|
29957
|
+
button2.className = "settings-connection-view-error";
|
|
29958
|
+
button2.textContent = messages.connectionViewError;
|
|
29959
|
+
button2.addEventListener("click", (event) => {
|
|
29960
|
+
event.stopPropagation();
|
|
29961
|
+
currentSelect();
|
|
29962
|
+
});
|
|
29963
|
+
viewErrorButton = button2;
|
|
29964
|
+
}
|
|
29965
|
+
nextActions.push(viewErrorButton);
|
|
29966
|
+
}
|
|
29967
|
+
const version2 = item.version;
|
|
29968
|
+
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
29969
|
+
if (!versionAvailableBadge) {
|
|
29970
|
+
const badge = document2.createElement("span");
|
|
29971
|
+
badge.className = "settings-connection-version-available";
|
|
29972
|
+
badge.textContent = messages.harnessVersionAvailable;
|
|
29973
|
+
versionAvailableBadge = badge;
|
|
29974
|
+
}
|
|
29975
|
+
const badgeTitle = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
29976
|
+
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
29977
|
+
if (versionAvailableBadge.title !== badgeTitle) {
|
|
29978
|
+
versionAvailableBadge.title = badgeTitle;
|
|
29979
|
+
}
|
|
29980
|
+
nextActions.push(versionAvailableBadge);
|
|
29981
|
+
}
|
|
29982
|
+
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
29983
|
+
if (!updateButton) {
|
|
29984
|
+
const button2 = document2.createElement("button");
|
|
29985
|
+
button2.type = "button";
|
|
29986
|
+
button2.className = "settings-connection-install-link";
|
|
29987
|
+
button2.dataset.connectionAction = "update";
|
|
29988
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
29989
|
+
button2.addEventListener("click", (event) => {
|
|
29990
|
+
event.stopPropagation();
|
|
29991
|
+
if (button2.disabled) return;
|
|
29992
|
+
void currentItem?.version?.update();
|
|
29993
|
+
currentSelect();
|
|
29994
|
+
});
|
|
29995
|
+
updateButton = button2;
|
|
29996
|
+
}
|
|
29997
|
+
updateButton.disabled = version2.updating;
|
|
29998
|
+
if (updateButton.title !== messages.harnessVersionUpdate) {
|
|
29999
|
+
updateButton.title = messages.harnessVersionUpdate;
|
|
30000
|
+
}
|
|
30001
|
+
const updateAriaLabel = `${messages.harnessVersionUpdate}: ${item.name}`;
|
|
30002
|
+
if (updateButton.getAttribute("aria-label") !== updateAriaLabel) {
|
|
30003
|
+
updateButton.setAttribute("aria-label", updateAriaLabel);
|
|
30004
|
+
}
|
|
30005
|
+
nextActions.push(updateButton);
|
|
30006
|
+
}
|
|
30007
|
+
if (group) {
|
|
30008
|
+
if (!groupToggleButton) {
|
|
30009
|
+
const button2 = document2.createElement("button");
|
|
30010
|
+
button2.type = "button";
|
|
30011
|
+
button2.className = "settings-connection-row__group-toggle";
|
|
30012
|
+
button2.addEventListener("click", (event) => {
|
|
30013
|
+
event.stopPropagation();
|
|
30014
|
+
currentGroup?.toggleSection();
|
|
30015
|
+
});
|
|
30016
|
+
groupToggleButton = button2;
|
|
30017
|
+
}
|
|
30018
|
+
groupToggleButton.disabled = group.disabled;
|
|
30019
|
+
if (groupToggleButton.title !== group.moveLabel) {
|
|
30020
|
+
groupToggleButton.title = group.moveLabel;
|
|
30021
|
+
}
|
|
30022
|
+
if (groupToggleButton.getAttribute("aria-label") !== group.moveLabel) {
|
|
30023
|
+
groupToggleButton.setAttribute("aria-label", group.moveLabel);
|
|
30024
|
+
}
|
|
30025
|
+
if (groupToggleSection !== group.section) {
|
|
30026
|
+
groupToggleSection = group.section;
|
|
30027
|
+
groupToggleButton.replaceChildren(
|
|
30028
|
+
createRendererSettingsIcon(
|
|
30029
|
+
group.section === "main" ? "chevron-down" : "chevron-up",
|
|
30030
|
+
15
|
|
30031
|
+
)
|
|
30032
|
+
);
|
|
30033
|
+
}
|
|
30034
|
+
nextActions.push(groupToggleButton);
|
|
30035
|
+
}
|
|
30036
|
+
reconcileElementChildren(action, nextActions);
|
|
30037
|
+
if (group) {
|
|
30038
|
+
row.draggable = !group.disabled;
|
|
30039
|
+
if (row.dataset.connectionGroupSection !== group.section) {
|
|
30040
|
+
row.dataset.connectionGroupSection = group.section;
|
|
30041
|
+
}
|
|
30042
|
+
}
|
|
30043
|
+
}
|
|
30044
|
+
};
|
|
30045
|
+
}
|
|
30046
|
+
|
|
30047
|
+
// src/settings/connection-updates.ts
|
|
30048
|
+
var sharedBatchStores = /* @__PURE__ */ new WeakMap();
|
|
30049
|
+
function getBatchStore(diagnostics) {
|
|
30050
|
+
if (!diagnostics) {
|
|
30051
|
+
return { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
30052
|
+
}
|
|
30053
|
+
let store = sharedBatchStores.get(diagnostics);
|
|
30054
|
+
if (!store) {
|
|
30055
|
+
store = { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
30056
|
+
sharedBatchStores.set(diagnostics, store);
|
|
30057
|
+
}
|
|
30058
|
+
return store;
|
|
30059
|
+
}
|
|
30060
|
+
function createConnectionUpdates(document2, messages, signal, onChange, diagnostics = null) {
|
|
30061
|
+
const store = getBatchStore(diagnostics);
|
|
30062
|
+
const notify2 = () => {
|
|
30063
|
+
for (const listener of [...store.listeners]) listener();
|
|
30064
|
+
};
|
|
30065
|
+
if (!signal.aborted) {
|
|
30066
|
+
const listener = () => {
|
|
30067
|
+
if (!signal.aborted) onChange();
|
|
30068
|
+
};
|
|
30069
|
+
store.listeners.add(listener);
|
|
30070
|
+
signal.addEventListener(
|
|
30071
|
+
"abort",
|
|
30072
|
+
() => {
|
|
30073
|
+
store.listeners.delete(listener);
|
|
30074
|
+
},
|
|
30075
|
+
{ once: true }
|
|
30076
|
+
);
|
|
30077
|
+
}
|
|
30078
|
+
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
30079
|
+
const start = async (hostId2, panels) => {
|
|
30080
|
+
if (signal.aborted || store.batches.get(hostId2)?.running) return;
|
|
30081
|
+
const targets = eligible(panels);
|
|
30082
|
+
if (!targets.length) return;
|
|
30083
|
+
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
30084
|
+
store.batches.set(hostId2, batch);
|
|
30085
|
+
notify2();
|
|
30086
|
+
await Promise.all(
|
|
30087
|
+
targets.map(async (panel) => {
|
|
30088
|
+
try {
|
|
30089
|
+
if (await panel.update()) batch.succeeded++;
|
|
30090
|
+
else batch.failed++;
|
|
30091
|
+
} catch {
|
|
30092
|
+
batch.failed++;
|
|
30093
|
+
}
|
|
30094
|
+
notify2();
|
|
30095
|
+
})
|
|
30096
|
+
);
|
|
30097
|
+
batch.running = false;
|
|
30098
|
+
notify2();
|
|
30099
|
+
};
|
|
30100
|
+
return {
|
|
30101
|
+
createControls(hostId2, panels) {
|
|
30102
|
+
let currentHostId = hostId2;
|
|
30103
|
+
let currentPanels = panels;
|
|
30104
|
+
let renderedLabel = null;
|
|
30105
|
+
const button2 = document2.createElement("button");
|
|
30106
|
+
button2.type = "button";
|
|
30107
|
+
button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
|
|
30108
|
+
button2.dataset.connectionAction = "update-all";
|
|
30109
|
+
button2.title = messages.harnessUpdateAllDescription;
|
|
30110
|
+
button2.addEventListener("click", () => {
|
|
30111
|
+
if (!button2.disabled) void start(currentHostId, currentPanels);
|
|
30112
|
+
});
|
|
30113
|
+
const result = document2.createElement("p");
|
|
30114
|
+
result.className = "settings-connection-update-result";
|
|
30115
|
+
result.setAttribute("role", "status");
|
|
30116
|
+
const update = (nextHostId, nextPanels) => {
|
|
30117
|
+
currentHostId = nextHostId;
|
|
30118
|
+
currentPanels = nextPanels;
|
|
30119
|
+
const batch = store.batches.get(nextHostId);
|
|
30120
|
+
const count4 = eligible(nextPanels).length;
|
|
30121
|
+
button2.disabled = signal.aborted || Boolean(batch?.running) || !count4;
|
|
30122
|
+
const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count4 ? `${messages.harnessUpdateAll} (${count4})` : messages.harnessUpdateAll;
|
|
30123
|
+
if (renderedLabel !== label) {
|
|
30124
|
+
renderedLabel = label;
|
|
30125
|
+
button2.replaceChildren(createRendererSettingsIcon("download", 15), label);
|
|
30126
|
+
}
|
|
30127
|
+
const hidden = !batch || batch.running;
|
|
30128
|
+
result.hidden = hidden;
|
|
30129
|
+
const resultText = batch && !batch.running ? messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed)) : "";
|
|
30130
|
+
if (result.textContent !== resultText) {
|
|
30131
|
+
result.textContent = resultText;
|
|
30132
|
+
}
|
|
30133
|
+
};
|
|
30134
|
+
update(hostId2, panels);
|
|
30135
|
+
return { button: button2, result, update };
|
|
30136
|
+
}
|
|
30137
|
+
};
|
|
30138
|
+
}
|
|
30139
|
+
|
|
30140
|
+
// src/settings/harness-version-panel.ts
|
|
30141
|
+
function isUnsupportedInstallationError(error51) {
|
|
30142
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
30143
|
+
}
|
|
30144
|
+
function createHarnessVersionSession(client, options) {
|
|
30145
|
+
let state;
|
|
30146
|
+
let statusKind = "checking";
|
|
30147
|
+
let checkPromise = null;
|
|
30148
|
+
let updatePromise = null;
|
|
30149
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
30150
|
+
const signal = options?.signal;
|
|
30151
|
+
const notify2 = (pageChange) => {
|
|
30152
|
+
if (signal?.aborted) return;
|
|
30153
|
+
for (const listener of [...listeners]) listener(pageChange);
|
|
30154
|
+
};
|
|
30155
|
+
const check2 = () => {
|
|
30156
|
+
if (signal?.aborted || updatePromise) return Promise.resolve();
|
|
30157
|
+
if (checkPromise) return checkPromise;
|
|
30158
|
+
statusKind = "checking";
|
|
30159
|
+
notify2(false);
|
|
30160
|
+
checkPromise = (async () => {
|
|
30161
|
+
try {
|
|
30162
|
+
const result = await client.run("check");
|
|
30163
|
+
if (signal?.aborted || updatePromise) return;
|
|
30164
|
+
state = result;
|
|
30165
|
+
statusKind = "idle";
|
|
30166
|
+
} catch (error51) {
|
|
30167
|
+
if (signal?.aborted || updatePromise) return;
|
|
30168
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
30169
|
+
if (state) state = { ...state, canUpdate: false };
|
|
30170
|
+
} finally {
|
|
30171
|
+
checkPromise = null;
|
|
30172
|
+
if (!signal?.aborted && !updatePromise) {
|
|
30173
|
+
notify2(true);
|
|
30174
|
+
}
|
|
30175
|
+
}
|
|
30176
|
+
})();
|
|
30177
|
+
return checkPromise;
|
|
30178
|
+
};
|
|
30179
|
+
const update = () => {
|
|
30180
|
+
if (updatePromise) return updatePromise;
|
|
30181
|
+
updatePromise = (async () => {
|
|
30182
|
+
if (signal?.aborted) return false;
|
|
30183
|
+
if (checkPromise) await checkPromise;
|
|
30184
|
+
if (signal?.aborted || statusKind === "unsupported" || !state?.canUpdate || !state.updateAvailable) {
|
|
30185
|
+
return false;
|
|
30186
|
+
}
|
|
30187
|
+
statusKind = "updating";
|
|
30188
|
+
notify2(true);
|
|
30189
|
+
try {
|
|
30190
|
+
const result = await client.run("update");
|
|
30191
|
+
if (signal?.aborted) return false;
|
|
30192
|
+
state = result;
|
|
30193
|
+
statusKind = !result.canUpdate ? "updated" : result.updateAvailable ? "failed" : "updated";
|
|
30194
|
+
return result.canUpdate && !result.updateAvailable;
|
|
30195
|
+
} catch (error51) {
|
|
30196
|
+
if (signal?.aborted) return false;
|
|
30197
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
30198
|
+
if (state) state = { ...state, canUpdate: false };
|
|
30199
|
+
return false;
|
|
30200
|
+
} finally {
|
|
30201
|
+
updatePromise = null;
|
|
30202
|
+
if (!signal?.aborted) {
|
|
30203
|
+
notify2(true);
|
|
30204
|
+
}
|
|
30205
|
+
}
|
|
30206
|
+
})();
|
|
30207
|
+
return updatePromise;
|
|
30208
|
+
};
|
|
30209
|
+
return {
|
|
30210
|
+
get state() {
|
|
30211
|
+
return state;
|
|
30212
|
+
},
|
|
30213
|
+
get statusKind() {
|
|
30214
|
+
return statusKind;
|
|
30215
|
+
},
|
|
30216
|
+
get updating() {
|
|
30217
|
+
return statusKind === "updating";
|
|
30218
|
+
},
|
|
30219
|
+
prepareMount() {
|
|
30220
|
+
if (updatePromise || checkPromise) return false;
|
|
30221
|
+
statusKind = "checking";
|
|
30222
|
+
return true;
|
|
30223
|
+
},
|
|
30224
|
+
check: check2,
|
|
30225
|
+
update,
|
|
30226
|
+
subscribe(listener) {
|
|
30227
|
+
listeners.add(listener);
|
|
30228
|
+
return () => {
|
|
30229
|
+
listeners.delete(listener);
|
|
30230
|
+
};
|
|
30231
|
+
}
|
|
30232
|
+
};
|
|
30233
|
+
}
|
|
30234
|
+
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0, sharedSession) {
|
|
30235
|
+
const session = sharedSession ?? createHarnessVersionSession(client, { signal });
|
|
30236
|
+
const shouldScheduleCheck = session.prepareMount();
|
|
30237
|
+
const panel = document2.createElement("section");
|
|
30238
|
+
panel.className = "settings-harness-version";
|
|
30239
|
+
panel.dataset.harnessVersion = agent;
|
|
30240
|
+
const heading = document2.createElement("strong");
|
|
30241
|
+
heading.textContent = messages.harnessVersionTitle;
|
|
30242
|
+
const versions = document2.createElement("div");
|
|
30243
|
+
versions.className = "settings-harness-version__values";
|
|
30244
|
+
const current = document2.createElement("span");
|
|
30245
|
+
const latest = document2.createElement("span");
|
|
30246
|
+
versions.append(current, latest);
|
|
30247
|
+
const status = document2.createElement("p");
|
|
30248
|
+
status.setAttribute("role", "status");
|
|
30249
|
+
const actions = document2.createElement("div");
|
|
30250
|
+
actions.className = "settings-connection-error-actions";
|
|
30251
|
+
const update = document2.createElement("button");
|
|
30252
|
+
update.type = "button";
|
|
30253
|
+
update.className = "settings-command-button settings-command-button--secondary";
|
|
30254
|
+
update.dataset.harnessVersionAction = "update";
|
|
30255
|
+
const note = document2.createElement("p");
|
|
30256
|
+
note.className = "settings-connection-issue-note";
|
|
30257
|
+
note.textContent = messages.harnessVersionNote;
|
|
30258
|
+
actions.append(update);
|
|
30259
|
+
panel.append(heading, versions, status, actions, note);
|
|
30260
|
+
const render = () => {
|
|
30261
|
+
const state = session.state;
|
|
30262
|
+
const statusKind = session.statusKind;
|
|
30263
|
+
const busy = statusKind === "checking" || statusKind === "updating";
|
|
30264
|
+
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
30265
|
+
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
30266
|
+
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
30267
|
+
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 : "";
|
|
30268
|
+
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
30269
|
+
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
30270
|
+
actions.replaceChildren(update);
|
|
30271
|
+
update.hidden = !busy && !signal.aborted && Boolean(manualUrl);
|
|
30272
|
+
if (update.hidden && manualUrl) {
|
|
30273
|
+
const download2 = document2.createElement("a");
|
|
30274
|
+
download2.className = "settings-command-button settings-command-button--secondary";
|
|
30275
|
+
download2.dataset.harnessVersionAction = "download-update";
|
|
30276
|
+
download2.textContent = messages.harnessVersionDownloadUpdate;
|
|
30277
|
+
download2.href = manualUrl;
|
|
30278
|
+
download2.target = "_blank";
|
|
30279
|
+
download2.rel = "noopener noreferrer";
|
|
30280
|
+
actions.append(download2);
|
|
30281
|
+
}
|
|
30282
|
+
update.textContent = state?.canUpdate && state.latestVersion !== "Unknown" && !state.updateAvailable ? messages.harnessVersionUpToDate : messages.harnessVersionUpdate;
|
|
30283
|
+
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
30284
|
+
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
30285
|
+
};
|
|
30286
|
+
update.addEventListener("click", () => {
|
|
30287
|
+
if (!signal.aborted) void session.update();
|
|
30288
|
+
});
|
|
30289
|
+
const unsubscribe = session.subscribe((pageChange) => {
|
|
30290
|
+
if (signal.aborted) return;
|
|
30291
|
+
render();
|
|
30292
|
+
if (pageChange) onChange();
|
|
30293
|
+
});
|
|
30294
|
+
const owner = document2.defaultView;
|
|
30295
|
+
let checkFrame = null;
|
|
30296
|
+
let checkTimer = null;
|
|
30297
|
+
signal.addEventListener(
|
|
30298
|
+
"abort",
|
|
30299
|
+
() => {
|
|
30300
|
+
unsubscribe();
|
|
30301
|
+
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
30302
|
+
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
30303
|
+
render();
|
|
30304
|
+
},
|
|
30305
|
+
{ once: true }
|
|
30306
|
+
);
|
|
30307
|
+
render();
|
|
30308
|
+
if (shouldScheduleCheck && !signal.aborted) {
|
|
30309
|
+
if (owner?.requestAnimationFrame) {
|
|
30310
|
+
checkFrame = owner.requestAnimationFrame(() => {
|
|
30311
|
+
checkFrame = null;
|
|
30312
|
+
if (signal.aborted) return;
|
|
30313
|
+
checkTimer = owner.setTimeout(() => {
|
|
30314
|
+
checkTimer = null;
|
|
30315
|
+
if (!signal.aborted) void session.check();
|
|
30316
|
+
}, 0);
|
|
30317
|
+
});
|
|
30318
|
+
} else {
|
|
30319
|
+
void session.check();
|
|
30320
|
+
}
|
|
30321
|
+
}
|
|
30322
|
+
return {
|
|
30323
|
+
element: panel,
|
|
30324
|
+
get state() {
|
|
30325
|
+
return session.state;
|
|
30326
|
+
},
|
|
30327
|
+
get updating() {
|
|
30328
|
+
return session.updating;
|
|
30329
|
+
},
|
|
30330
|
+
update: () => signal.aborted ? Promise.resolve(false) : session.update()
|
|
30331
|
+
};
|
|
30332
|
+
}
|
|
30333
|
+
|
|
30334
|
+
// src/settings/connection-versions.ts
|
|
30335
|
+
var sessionStores = /* @__PURE__ */ new WeakMap();
|
|
30336
|
+
function getSessionStore(diagnostics) {
|
|
30337
|
+
let store = sessionStores.get(diagnostics);
|
|
30338
|
+
if (!store) {
|
|
30339
|
+
store = /* @__PURE__ */ new Map();
|
|
30340
|
+
sessionStores.set(diagnostics, store);
|
|
30341
|
+
}
|
|
30342
|
+
return store;
|
|
30343
|
+
}
|
|
30344
|
+
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
30345
|
+
const panels = /* @__PURE__ */ new Map();
|
|
30346
|
+
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
30347
|
+
const sessions = diagnostics ? getSessionStore(diagnostics) : null;
|
|
30348
|
+
const sessionKey = (hostId2, agent) => JSON.stringify([hostId2, agent]);
|
|
30349
|
+
return {
|
|
30350
|
+
isUpdating(hostId2, agent) {
|
|
30351
|
+
return Boolean(sessions?.get(sessionKey(hostId2, agent))?.updating);
|
|
30352
|
+
},
|
|
30353
|
+
get(hostId2, agent) {
|
|
30354
|
+
if (!installation || signal.aborted) return void 0;
|
|
30355
|
+
const key = sessionKey(hostId2, agent);
|
|
30356
|
+
let panel = panels.get(key);
|
|
30357
|
+
if (!panel) {
|
|
30358
|
+
const run = (action) => installation(hostId2, agent, action);
|
|
30359
|
+
let session = sessions?.get(key);
|
|
30360
|
+
if (!session) {
|
|
30361
|
+
session = createHarnessVersionSession({ run });
|
|
30362
|
+
sessions?.set(key, session);
|
|
30363
|
+
}
|
|
30364
|
+
panel = createHarnessVersionPanel(
|
|
30365
|
+
document2,
|
|
30366
|
+
messages,
|
|
30367
|
+
signal,
|
|
30368
|
+
agent,
|
|
30369
|
+
{ run },
|
|
30370
|
+
onChange,
|
|
30371
|
+
session
|
|
30372
|
+
);
|
|
30373
|
+
panels.set(key, panel);
|
|
30374
|
+
}
|
|
30375
|
+
return panel;
|
|
30376
|
+
}
|
|
30377
|
+
};
|
|
30378
|
+
}
|
|
30379
|
+
|
|
30380
|
+
// src/settings/grok-computer-use-controls.ts
|
|
30381
|
+
function createGrokComputerUseControls(document2, messages, settings) {
|
|
30382
|
+
const section = document2.createElement("section");
|
|
30383
|
+
section.className = "settings-grok-computer-use";
|
|
30384
|
+
section.dataset.grokComputerUse = "true";
|
|
30385
|
+
const header = document2.createElement("div");
|
|
30386
|
+
header.className = "settings-grok-computer-use__header";
|
|
30387
|
+
const copy = document2.createElement("div");
|
|
30388
|
+
copy.className = "settings-grok-computer-use__copy";
|
|
30389
|
+
const title = document2.createElement("h3");
|
|
30390
|
+
title.className = "settings-grok-computer-use__title";
|
|
30391
|
+
title.id = "grok-computer-use-title";
|
|
30392
|
+
title.textContent = messages.grokComputerUseTitle;
|
|
30393
|
+
const description = document2.createElement("p");
|
|
30394
|
+
description.className = "settings-grok-computer-use__description";
|
|
30395
|
+
description.id = "grok-computer-use-description";
|
|
30396
|
+
description.textContent = messages.grokComputerUseDescription;
|
|
30397
|
+
copy.append(title, description);
|
|
30398
|
+
const input = createPreferenceSwitch(
|
|
30399
|
+
document2,
|
|
30400
|
+
"grok-computer-use-enabled",
|
|
30401
|
+
"grok-computer-use-description grok-computer-use-help grok-computer-use-status"
|
|
30402
|
+
);
|
|
30403
|
+
input.setAttribute("aria-labelledby", title.id);
|
|
30404
|
+
input.setAttribute("aria-label", messages.grokComputerUseLabel);
|
|
30405
|
+
header.append(copy, input);
|
|
30406
|
+
const help = document2.createElement("p");
|
|
30407
|
+
help.className = "settings-grok-computer-use__help";
|
|
30408
|
+
help.id = "grok-computer-use-help";
|
|
30409
|
+
help.textContent = messages.grokComputerUseHelp;
|
|
30410
|
+
const status = document2.createElement("p");
|
|
30411
|
+
status.className = "settings-grok-computer-use__status";
|
|
30412
|
+
status.id = "grok-computer-use-status";
|
|
30413
|
+
status.setAttribute("role", "status");
|
|
30414
|
+
status.setAttribute("aria-live", "polite");
|
|
30415
|
+
const browserHeader = document2.createElement("div");
|
|
30416
|
+
browserHeader.className = "settings-grok-computer-use__header settings-grok-computer-use__browser";
|
|
30417
|
+
const browserCopy = document2.createElement("div");
|
|
30418
|
+
browserCopy.className = "settings-grok-computer-use__copy";
|
|
30419
|
+
const browserTitle = document2.createElement("h3");
|
|
30420
|
+
browserTitle.className = "settings-grok-computer-use__title";
|
|
30421
|
+
browserTitle.id = "grok-browser-title";
|
|
30422
|
+
browserTitle.textContent = messages.grokBrowserTitle;
|
|
30423
|
+
const browserDescription = document2.createElement("p");
|
|
30424
|
+
browserDescription.className = "settings-grok-computer-use__description";
|
|
30425
|
+
browserDescription.id = "grok-browser-description";
|
|
30426
|
+
browserDescription.textContent = messages.grokBrowserDescription;
|
|
30427
|
+
browserCopy.append(browserTitle, browserDescription);
|
|
30428
|
+
const browserInput = createPreferenceSwitch(
|
|
30429
|
+
document2,
|
|
30430
|
+
"grok-browser-enabled",
|
|
30431
|
+
"grok-browser-description grok-browser-help grok-browser-status"
|
|
30432
|
+
);
|
|
30433
|
+
browserInput.setAttribute("aria-labelledby", browserTitle.id);
|
|
30434
|
+
browserInput.setAttribute("aria-label", messages.grokBrowserLabel);
|
|
30435
|
+
browserHeader.append(browserCopy, browserInput);
|
|
30436
|
+
const browserHelp = document2.createElement("p");
|
|
30437
|
+
browserHelp.className = "settings-grok-computer-use__help";
|
|
30438
|
+
browserHelp.id = "grok-browser-help";
|
|
30439
|
+
browserHelp.textContent = messages.grokBrowserHelp;
|
|
30440
|
+
const browserStatus = document2.createElement("p");
|
|
30441
|
+
browserStatus.className = "settings-grok-computer-use__status";
|
|
30442
|
+
browserStatus.id = "grok-browser-status";
|
|
30443
|
+
browserStatus.setAttribute("role", "status");
|
|
30444
|
+
browserStatus.setAttribute("aria-live", "polite");
|
|
30445
|
+
section.append(header, help, status, browserHeader, browserHelp, browserStatus);
|
|
30446
|
+
let busy = true;
|
|
30447
|
+
let loaded = false;
|
|
30448
|
+
let last;
|
|
30449
|
+
const show = (value) => {
|
|
30450
|
+
last = value;
|
|
30451
|
+
input.checked = value.enabled;
|
|
30452
|
+
input.disabled = busy || !loaded || !value.available && !value.enabled;
|
|
30453
|
+
const browserOn = value.browser === true;
|
|
30454
|
+
const browserFiles = value.browserFilesPresent === true;
|
|
30455
|
+
browserInput.checked = browserOn;
|
|
30456
|
+
browserInput.disabled = busy || !loaded || !browserFiles && !browserOn;
|
|
30457
|
+
if (!browserFiles) {
|
|
30458
|
+
browserStatus.dataset.state = "unavailable";
|
|
30459
|
+
browserStatus.textContent = value.browserUnavailableReason ?? messages.grokBrowserUnavailable;
|
|
30460
|
+
} else if (value.browserAvailable !== true) {
|
|
30461
|
+
browserStatus.dataset.state = browserOn ? "unavailable" : "off";
|
|
30462
|
+
browserStatus.textContent = browserOn ? value.browserUnavailableReason ?? messages.grokBrowserBlocked : messages.grokBrowserOff;
|
|
30463
|
+
} else {
|
|
30464
|
+
browserStatus.dataset.state = browserOn ? "on" : "off";
|
|
30465
|
+
browserStatus.textContent = browserOn ? messages.grokBrowserOn : messages.grokBrowserOff;
|
|
30466
|
+
}
|
|
30467
|
+
if (value.applyFailed) {
|
|
30468
|
+
status.dataset.state = "unavailable";
|
|
30469
|
+
status.textContent = value.applyError ?? messages.grokComputerUseApplyFailed;
|
|
30470
|
+
return;
|
|
30471
|
+
}
|
|
30472
|
+
if (!value.available) {
|
|
30473
|
+
status.dataset.state = "unavailable";
|
|
30474
|
+
status.textContent = value.unavailableReason ?? messages.grokComputerUseUnavailable;
|
|
30475
|
+
return;
|
|
30476
|
+
}
|
|
30477
|
+
status.dataset.state = value.enabled ? "on" : "off";
|
|
30478
|
+
status.textContent = value.enabled ? messages.grokComputerUseOn : messages.grokComputerUseOff;
|
|
30479
|
+
};
|
|
30480
|
+
const save = (update, target2) => {
|
|
30481
|
+
if (busy || !loaded) return;
|
|
30482
|
+
busy = true;
|
|
30483
|
+
input.disabled = true;
|
|
30484
|
+
browserInput.disabled = true;
|
|
30485
|
+
target2.textContent = messages.grokComputerUseSaving;
|
|
30486
|
+
void settings.set(update).then((value) => {
|
|
30487
|
+
busy = false;
|
|
30488
|
+
show(value);
|
|
30489
|
+
}).catch(() => {
|
|
30490
|
+
busy = false;
|
|
30491
|
+
if (last) show(last);
|
|
29932
30492
|
else {
|
|
29933
30493
|
input.disabled = false;
|
|
29934
30494
|
browserInput.disabled = false;
|
|
@@ -29955,6 +30515,70 @@ ${detail}` : ""}`
|
|
|
29955
30515
|
return section;
|
|
29956
30516
|
}
|
|
29957
30517
|
|
|
30518
|
+
// src/settings/harness-install-store.ts
|
|
30519
|
+
function errorMessage2(error51) {
|
|
30520
|
+
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.";
|
|
30521
|
+
}
|
|
30522
|
+
function unknownInstallOutcome(message2) {
|
|
30523
|
+
return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
|
|
30524
|
+
}
|
|
30525
|
+
var stores = /* @__PURE__ */ new WeakMap();
|
|
30526
|
+
function createStore(diagnostics) {
|
|
30527
|
+
const states2 = /* @__PURE__ */ new Map();
|
|
30528
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
30529
|
+
const key = (host, agent) => JSON.stringify([host, agent]);
|
|
30530
|
+
const notify2 = () => listeners.forEach((listener) => listener());
|
|
30531
|
+
return {
|
|
30532
|
+
get: (host, agent) => states2.get(key(host, agent)),
|
|
30533
|
+
clearErrors() {
|
|
30534
|
+
for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
|
|
30535
|
+
notify2();
|
|
30536
|
+
},
|
|
30537
|
+
subscribe(listener) {
|
|
30538
|
+
listeners.add(listener);
|
|
30539
|
+
return () => {
|
|
30540
|
+
listeners.delete(listener);
|
|
30541
|
+
};
|
|
30542
|
+
},
|
|
30543
|
+
async install(host, agent) {
|
|
30544
|
+
const id = key(host, agent);
|
|
30545
|
+
const previous = states2.get(id);
|
|
30546
|
+
if (!diagnostics.installation || previous && previous.status !== "error") return;
|
|
30547
|
+
states2.set(id, { status: "installing" });
|
|
30548
|
+
notify2();
|
|
30549
|
+
let failure;
|
|
30550
|
+
try {
|
|
30551
|
+
await diagnostics.installation(host, agent, "install");
|
|
30552
|
+
states2.set(id, { status: "checking" });
|
|
30553
|
+
notify2();
|
|
30554
|
+
} catch (error51) {
|
|
30555
|
+
failure = errorMessage2(error51);
|
|
30556
|
+
}
|
|
30557
|
+
try {
|
|
30558
|
+
await diagnostics.refresh(host);
|
|
30559
|
+
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
30560
|
+
if (refreshed?.availability === "ready") failure = void 0;
|
|
30561
|
+
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
30562
|
+
failure = void 0;
|
|
30563
|
+
}
|
|
30564
|
+
} catch (error51) {
|
|
30565
|
+
failure ??= errorMessage2(error51);
|
|
30566
|
+
}
|
|
30567
|
+
if (failure) states2.set(id, { status: "error", error: failure });
|
|
30568
|
+
else states2.delete(id);
|
|
30569
|
+
notify2();
|
|
30570
|
+
}
|
|
30571
|
+
};
|
|
30572
|
+
}
|
|
30573
|
+
function harnessInstallStore(diagnostics) {
|
|
30574
|
+
let store = stores.get(diagnostics);
|
|
30575
|
+
if (!store) {
|
|
30576
|
+
store = createStore(diagnostics);
|
|
30577
|
+
stores.set(diagnostics, store);
|
|
30578
|
+
}
|
|
30579
|
+
return store;
|
|
30580
|
+
}
|
|
30581
|
+
|
|
29958
30582
|
// src/settings/harness-installation-guides.ts
|
|
29959
30583
|
function harnessHasInstallCommands(plugin) {
|
|
29960
30584
|
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
@@ -30047,296 +30671,86 @@ ${detail}` : ""}`
|
|
|
30047
30671
|
return panel;
|
|
30048
30672
|
}
|
|
30049
30673
|
|
|
30050
|
-
// src/settings/harness-
|
|
30051
|
-
function
|
|
30052
|
-
|
|
30053
|
-
|
|
30054
|
-
|
|
30055
|
-
|
|
30056
|
-
|
|
30057
|
-
|
|
30058
|
-
|
|
30059
|
-
|
|
30060
|
-
|
|
30061
|
-
|
|
30062
|
-
|
|
30063
|
-
|
|
30064
|
-
|
|
30065
|
-
|
|
30066
|
-
|
|
30067
|
-
|
|
30068
|
-
|
|
30069
|
-
|
|
30070
|
-
|
|
30071
|
-
|
|
30072
|
-
|
|
30073
|
-
|
|
30074
|
-
|
|
30075
|
-
|
|
30076
|
-
|
|
30077
|
-
|
|
30078
|
-
|
|
30079
|
-
|
|
30080
|
-
|
|
30081
|
-
|
|
30082
|
-
|
|
30083
|
-
|
|
30084
|
-
|
|
30085
|
-
|
|
30086
|
-
|
|
30087
|
-
failure = errorMessage2(error51);
|
|
30088
|
-
}
|
|
30089
|
-
try {
|
|
30090
|
-
await diagnostics.refresh(host);
|
|
30091
|
-
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
30092
|
-
if (refreshed?.availability === "ready") failure = void 0;
|
|
30093
|
-
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
30094
|
-
failure = void 0;
|
|
30095
|
-
}
|
|
30096
|
-
} catch (error51) {
|
|
30097
|
-
failure ??= errorMessage2(error51);
|
|
30098
|
-
}
|
|
30099
|
-
if (failure) states2.set(id, { status: "error", error: failure });
|
|
30100
|
-
else states2.delete(id);
|
|
30101
|
-
notify2();
|
|
30102
|
-
}
|
|
30103
|
-
};
|
|
30104
|
-
}
|
|
30105
|
-
function harnessInstallStore(diagnostics) {
|
|
30106
|
-
let store = stores.get(diagnostics);
|
|
30107
|
-
if (!store) {
|
|
30108
|
-
store = createStore(diagnostics);
|
|
30109
|
-
stores.set(diagnostics, store);
|
|
30110
|
-
}
|
|
30111
|
-
return store;
|
|
30112
|
-
}
|
|
30113
|
-
|
|
30114
|
-
// src/settings/harness-version-panel.ts
|
|
30115
|
-
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0) {
|
|
30116
|
-
const panel = document2.createElement("section");
|
|
30117
|
-
panel.className = "settings-harness-version";
|
|
30118
|
-
panel.dataset.harnessVersion = agent;
|
|
30119
|
-
const heading = document2.createElement("strong");
|
|
30120
|
-
heading.textContent = messages.harnessVersionTitle;
|
|
30121
|
-
const versions = document2.createElement("div");
|
|
30122
|
-
versions.className = "settings-harness-version__values";
|
|
30123
|
-
const current = document2.createElement("span");
|
|
30124
|
-
const latest = document2.createElement("span");
|
|
30125
|
-
versions.append(current, latest);
|
|
30126
|
-
const status = document2.createElement("p");
|
|
30127
|
-
status.setAttribute("role", "status");
|
|
30128
|
-
const actions = document2.createElement("div");
|
|
30129
|
-
actions.className = "settings-connection-error-actions";
|
|
30130
|
-
const update = document2.createElement("button");
|
|
30131
|
-
update.type = "button";
|
|
30132
|
-
update.className = "settings-command-button settings-command-button--secondary";
|
|
30133
|
-
update.dataset.harnessVersionAction = "update";
|
|
30134
|
-
const note = document2.createElement("p");
|
|
30135
|
-
note.className = "settings-connection-issue-note";
|
|
30136
|
-
note.textContent = messages.harnessVersionNote;
|
|
30137
|
-
actions.append(update);
|
|
30138
|
-
panel.append(heading, versions, status, actions, note);
|
|
30139
|
-
let state;
|
|
30140
|
-
let busy = false;
|
|
30141
|
-
let updating = false;
|
|
30142
|
-
let unsupported = false;
|
|
30143
|
-
let updatePromise = null;
|
|
30144
|
-
const render = () => {
|
|
30145
|
-
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
30146
|
-
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
30147
|
-
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
30148
|
-
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
30149
|
-
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
30150
|
-
actions.replaceChildren(update);
|
|
30151
|
-
update.hidden = !busy && !signal.aborted && Boolean(manualUrl);
|
|
30152
|
-
if (update.hidden && manualUrl) {
|
|
30153
|
-
const download2 = document2.createElement("a");
|
|
30154
|
-
download2.className = "settings-command-button settings-command-button--secondary";
|
|
30155
|
-
download2.dataset.harnessVersionAction = "download-update";
|
|
30156
|
-
download2.textContent = messages.harnessVersionDownloadUpdate;
|
|
30157
|
-
download2.href = manualUrl;
|
|
30158
|
-
download2.target = "_blank";
|
|
30159
|
-
download2.rel = "noopener noreferrer";
|
|
30160
|
-
actions.append(download2);
|
|
30161
|
-
}
|
|
30162
|
-
update.textContent = state?.canUpdate && state.latestVersion !== "Unknown" && !state.updateAvailable ? messages.harnessVersionUpToDate : messages.harnessVersionUpdate;
|
|
30163
|
-
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
30164
|
-
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
30165
|
-
};
|
|
30166
|
-
const run = async (action) => {
|
|
30167
|
-
if (busy || unsupported || signal.aborted) return false;
|
|
30168
|
-
if (action === "update" && (!state?.canUpdate || !state.updateAvailable)) return false;
|
|
30169
|
-
busy = true;
|
|
30170
|
-
updating = action === "update";
|
|
30171
|
-
onChange();
|
|
30172
|
-
status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
|
|
30173
|
-
render();
|
|
30174
|
-
try {
|
|
30175
|
-
const result = await client.run(action);
|
|
30176
|
-
if (signal.aborted) return false;
|
|
30177
|
-
state = result;
|
|
30178
|
-
status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
|
|
30179
|
-
return result.canUpdate && !result.updateAvailable;
|
|
30180
|
-
} catch (error51) {
|
|
30181
|
-
if (signal.aborted) return false;
|
|
30182
|
-
unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
30183
|
-
status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
|
|
30184
|
-
if (state) state = { ...state, canUpdate: false };
|
|
30185
|
-
return false;
|
|
30186
|
-
} finally {
|
|
30187
|
-
busy = false;
|
|
30188
|
-
updating = false;
|
|
30189
|
-
if (!signal.aborted) {
|
|
30190
|
-
render();
|
|
30191
|
-
onChange();
|
|
30192
|
-
}
|
|
30193
|
-
}
|
|
30194
|
-
};
|
|
30195
|
-
const updateVersion = () => {
|
|
30196
|
-
updatePromise ??= run("update").finally(() => {
|
|
30197
|
-
updatePromise = null;
|
|
30198
|
-
});
|
|
30199
|
-
return updatePromise;
|
|
30200
|
-
};
|
|
30201
|
-
update.addEventListener("click", () => void updateVersion());
|
|
30202
|
-
const owner = document2.defaultView;
|
|
30203
|
-
let checkFrame = null;
|
|
30204
|
-
let checkTimer = null;
|
|
30205
|
-
signal.addEventListener(
|
|
30206
|
-
"abort",
|
|
30207
|
-
() => {
|
|
30208
|
-
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
30209
|
-
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
30210
|
-
render();
|
|
30211
|
-
},
|
|
30212
|
-
{ once: true }
|
|
30213
|
-
);
|
|
30214
|
-
status.textContent = messages.harnessVersionChecking;
|
|
30215
|
-
render();
|
|
30216
|
-
if (!signal.aborted && owner?.requestAnimationFrame) {
|
|
30217
|
-
checkFrame = owner.requestAnimationFrame(() => {
|
|
30218
|
-
checkFrame = null;
|
|
30219
|
-
if (signal.aborted) return;
|
|
30220
|
-
checkTimer = owner.setTimeout(() => {
|
|
30221
|
-
checkTimer = null;
|
|
30222
|
-
void run("check");
|
|
30223
|
-
}, 0);
|
|
30224
|
-
});
|
|
30225
|
-
} else {
|
|
30226
|
-
void run("check");
|
|
30227
|
-
}
|
|
30228
|
-
return {
|
|
30229
|
-
element: panel,
|
|
30230
|
-
get state() {
|
|
30231
|
-
return state;
|
|
30232
|
-
},
|
|
30233
|
-
get updating() {
|
|
30234
|
-
return updating;
|
|
30235
|
-
},
|
|
30236
|
-
update: updateVersion
|
|
30237
|
-
};
|
|
30238
|
-
}
|
|
30239
|
-
|
|
30240
|
-
// src/settings/connection-versions.ts
|
|
30241
|
-
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
30242
|
-
const panels = /* @__PURE__ */ new Map();
|
|
30243
|
-
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
30244
|
-
return {
|
|
30245
|
-
get(hostId2, agent) {
|
|
30246
|
-
if (!installation || signal.aborted) return void 0;
|
|
30247
|
-
const key = JSON.stringify([hostId2, agent]);
|
|
30248
|
-
let panel = panels.get(key);
|
|
30249
|
-
if (!panel) {
|
|
30250
|
-
panel = createHarnessVersionPanel(
|
|
30251
|
-
document2,
|
|
30252
|
-
messages,
|
|
30253
|
-
signal,
|
|
30254
|
-
agent,
|
|
30255
|
-
{
|
|
30256
|
-
run: (action) => installation(hostId2, agent, action)
|
|
30257
|
-
},
|
|
30258
|
-
onChange
|
|
30259
|
-
);
|
|
30260
|
-
panels.set(key, panel);
|
|
30261
|
-
}
|
|
30262
|
-
return panel;
|
|
30263
|
-
}
|
|
30674
|
+
// src/settings/harness-launch-controls.ts
|
|
30675
|
+
function createHarnessLaunchControls(document2, messages, agent, settings) {
|
|
30676
|
+
const section = document2.createElement("section");
|
|
30677
|
+
section.className = "settings-harness-launch";
|
|
30678
|
+
section.dataset.harnessLaunch = agent;
|
|
30679
|
+
const label = document2.createElement("label");
|
|
30680
|
+
label.textContent = messages.launchPathLabel;
|
|
30681
|
+
const input = document2.createElement("input");
|
|
30682
|
+
input.type = "text";
|
|
30683
|
+
input.autocomplete = "off";
|
|
30684
|
+
input.spellcheck = false;
|
|
30685
|
+
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
30686
|
+
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
30687
|
+
label.append(input);
|
|
30688
|
+
const help = document2.createElement("p");
|
|
30689
|
+
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.";
|
|
30690
|
+
const actions = document2.createElement("div");
|
|
30691
|
+
actions.className = "settings-harness-launch__actions";
|
|
30692
|
+
const save = document2.createElement("button");
|
|
30693
|
+
save.type = "button";
|
|
30694
|
+
save.className = "settings-command-button";
|
|
30695
|
+
save.textContent = messages.launchPathSave;
|
|
30696
|
+
const reset = document2.createElement("button");
|
|
30697
|
+
reset.type = "button";
|
|
30698
|
+
reset.className = "settings-command-button settings-command-button--secondary";
|
|
30699
|
+
reset.textContent = messages.launchPathReset;
|
|
30700
|
+
const status = document2.createElement("p");
|
|
30701
|
+
status.setAttribute("role", "status");
|
|
30702
|
+
status.setAttribute("aria-live", "polite");
|
|
30703
|
+
actions.append(save, reset);
|
|
30704
|
+
section.append(label, help, actions, status);
|
|
30705
|
+
let busy = true;
|
|
30706
|
+
let loaded = false;
|
|
30707
|
+
const controls = () => {
|
|
30708
|
+
input.disabled = busy || !loaded;
|
|
30709
|
+
save.disabled = busy || !loaded || !input.value.trim();
|
|
30710
|
+
reset.disabled = busy || !loaded;
|
|
30264
30711
|
};
|
|
30265
|
-
|
|
30266
|
-
|
|
30267
|
-
|
|
30268
|
-
function createConnectionUpdates(document2, messages, signal, onChange) {
|
|
30269
|
-
const batches = /* @__PURE__ */ new Map();
|
|
30270
|
-
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
30271
|
-
const start = async (hostId2, panels) => {
|
|
30272
|
-
if (signal.aborted || batches.get(hostId2)?.running) return;
|
|
30273
|
-
const targets = eligible(panels);
|
|
30274
|
-
if (!targets.length) return;
|
|
30275
|
-
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
30276
|
-
batches.set(hostId2, batch);
|
|
30277
|
-
onChange();
|
|
30278
|
-
await Promise.all(
|
|
30279
|
-
targets.map(async (panel) => {
|
|
30280
|
-
try {
|
|
30281
|
-
if (await panel.update()) batch.succeeded++;
|
|
30282
|
-
else batch.failed++;
|
|
30283
|
-
} catch {
|
|
30284
|
-
batch.failed++;
|
|
30285
|
-
}
|
|
30286
|
-
if (!signal.aborted) onChange();
|
|
30287
|
-
})
|
|
30288
|
-
);
|
|
30289
|
-
batch.running = false;
|
|
30290
|
-
if (!signal.aborted) onChange();
|
|
30712
|
+
const show = (value) => {
|
|
30713
|
+
input.value = value.path ?? "";
|
|
30714
|
+
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
30291
30715
|
};
|
|
30292
|
-
|
|
30293
|
-
|
|
30294
|
-
|
|
30295
|
-
|
|
30296
|
-
|
|
30297
|
-
|
|
30298
|
-
|
|
30299
|
-
|
|
30300
|
-
|
|
30301
|
-
|
|
30302
|
-
|
|
30303
|
-
|
|
30304
|
-
button2.addEventListener("click", () => {
|
|
30305
|
-
if (!button2.disabled) void start(hostId2, panels);
|
|
30306
|
-
});
|
|
30307
|
-
const result = document2.createElement("p");
|
|
30308
|
-
result.className = "settings-connection-update-result";
|
|
30309
|
-
result.setAttribute("role", "status");
|
|
30310
|
-
result.hidden = !batch || batch.running;
|
|
30311
|
-
if (batch && !batch.running) {
|
|
30312
|
-
result.textContent = messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed));
|
|
30313
|
-
}
|
|
30314
|
-
return { button: button2, result };
|
|
30716
|
+
const persist = async (value) => {
|
|
30717
|
+
if (busy || !loaded) return;
|
|
30718
|
+
busy = true;
|
|
30719
|
+
controls();
|
|
30720
|
+
status.textContent = messages.launchPathSaving;
|
|
30721
|
+
try {
|
|
30722
|
+
show(await settings.set(value));
|
|
30723
|
+
} catch {
|
|
30724
|
+
status.textContent = messages.launchPathSaveError;
|
|
30725
|
+
} finally {
|
|
30726
|
+
busy = false;
|
|
30727
|
+
controls();
|
|
30315
30728
|
}
|
|
30316
30729
|
};
|
|
30730
|
+
input.addEventListener("input", controls);
|
|
30731
|
+
save.addEventListener("click", () => {
|
|
30732
|
+
if (input.value.trim()) void persist(input.value.trim());
|
|
30733
|
+
});
|
|
30734
|
+
reset.addEventListener("click", () => {
|
|
30735
|
+
void persist(null);
|
|
30736
|
+
});
|
|
30737
|
+
controls();
|
|
30738
|
+
status.textContent = messages.launchPathLoading;
|
|
30739
|
+
void settings.get().then((value) => {
|
|
30740
|
+
loaded = true;
|
|
30741
|
+
show(value);
|
|
30742
|
+
}).catch(() => {
|
|
30743
|
+
loaded = true;
|
|
30744
|
+
status.textContent = messages.launchPathLoadError;
|
|
30745
|
+
}).finally(() => {
|
|
30746
|
+
busy = false;
|
|
30747
|
+
controls();
|
|
30748
|
+
});
|
|
30749
|
+
return section;
|
|
30317
30750
|
}
|
|
30318
30751
|
|
|
30319
30752
|
// src/settings/connections-page.ts
|
|
30320
30753
|
var CODEXHOST_GITHUB_ISSUES_NEW_URL = "https://github.com/karlorz/codex-host/issues/new";
|
|
30321
|
-
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
30322
|
-
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
30323
|
-
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
30324
|
-
if (availability === "ready") return messages.connectionStatusReady;
|
|
30325
|
-
if (availability === "checking") return messages.connectionStatusChecking;
|
|
30326
|
-
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
30327
|
-
if (availability === "unavailable" || availability === "error") {
|
|
30328
|
-
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
30329
|
-
}
|
|
30330
|
-
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
30331
|
-
}
|
|
30332
|
-
function connectionStatusTone(availability, hasError = false) {
|
|
30333
|
-
if (availability === "updating") return "checking";
|
|
30334
|
-
if (hasError && availability !== "notInstalled") return "failed";
|
|
30335
|
-
if (availability === "ready") return "ready";
|
|
30336
|
-
if (availability === "checking" || availability === "installing") return "checking";
|
|
30337
|
-
if (availability === "notInstalled") return "setup";
|
|
30338
|
-
return "failed";
|
|
30339
|
-
}
|
|
30340
30754
|
function diagnosticText(hostId2, item) {
|
|
30341
30755
|
const error51 = item.error;
|
|
30342
30756
|
return [
|
|
@@ -30432,148 +30846,21 @@ ${error51.stderrTail}`] : []
|
|
|
30432
30846
|
tabs.addEventListener("wheel", onWheel, { passive: false });
|
|
30433
30847
|
const ownerWindow = document2.defaultView;
|
|
30434
30848
|
ownerWindow?.addEventListener("resize", updateButtons);
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
|
|
30442
|
-
|
|
30849
|
+
const refreshLayout = () => {
|
|
30850
|
+
ownerWindow?.setTimeout(updateButtons, 0);
|
|
30851
|
+
updateButtons();
|
|
30852
|
+
};
|
|
30853
|
+
refreshLayout();
|
|
30854
|
+
return {
|
|
30855
|
+
update: refreshLayout,
|
|
30856
|
+
dispose() {
|
|
30857
|
+
left.removeEventListener("click", onLeft);
|
|
30858
|
+
right.removeEventListener("click", onRight);
|
|
30859
|
+
tabs.removeEventListener("scroll", updateButtons);
|
|
30860
|
+
tabs.removeEventListener("wheel", onWheel);
|
|
30861
|
+
ownerWindow?.removeEventListener("resize", updateButtons);
|
|
30862
|
+
}
|
|
30443
30863
|
};
|
|
30444
|
-
}
|
|
30445
|
-
function createConnectionIdentityIcon(document2, item, size) {
|
|
30446
|
-
const container = document2.createElement("span");
|
|
30447
|
-
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
30448
|
-
container.setAttribute("aria-hidden", "true");
|
|
30449
|
-
if (item.agentSnapshot) {
|
|
30450
|
-
container.append(
|
|
30451
|
-
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
30452
|
-
);
|
|
30453
|
-
} else {
|
|
30454
|
-
container.textContent = "CH";
|
|
30455
|
-
}
|
|
30456
|
-
return container;
|
|
30457
|
-
}
|
|
30458
|
-
function createConnectionRow(document2, item, messages, selected, select, group = null) {
|
|
30459
|
-
const row = document2.createElement("div");
|
|
30460
|
-
row.className = "settings-connection-row";
|
|
30461
|
-
row.dataset.connectionItem = item.key;
|
|
30462
|
-
row.dataset.connectionSelected = String(selected);
|
|
30463
|
-
row.tabIndex = selected ? 0 : -1;
|
|
30464
|
-
row.setAttribute("role", "row");
|
|
30465
|
-
const identity2 = document2.createElement("div");
|
|
30466
|
-
identity2.className = "settings-connection-row__identity";
|
|
30467
|
-
identity2.setAttribute("role", "cell");
|
|
30468
|
-
if (group) {
|
|
30469
|
-
const handle = document2.createElement("span");
|
|
30470
|
-
handle.className = "settings-connection-row__handle";
|
|
30471
|
-
handle.setAttribute("aria-hidden", "true");
|
|
30472
|
-
handle.title = group.dragHandleTitle;
|
|
30473
|
-
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
30474
|
-
identity2.append(handle);
|
|
30475
|
-
}
|
|
30476
|
-
const label = document2.createElement("strong");
|
|
30477
|
-
label.textContent = item.name;
|
|
30478
|
-
identity2.append(createConnectionIdentityIcon(document2, item, 19), label);
|
|
30479
|
-
const status = document2.createElement("span");
|
|
30480
|
-
status.className = "settings-connection-row__status";
|
|
30481
|
-
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
30482
|
-
status.setAttribute("role", "cell");
|
|
30483
|
-
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
30484
|
-
const version2 = item.version;
|
|
30485
|
-
const action = document2.createElement("div");
|
|
30486
|
-
action.className = "settings-connection-row__action";
|
|
30487
|
-
action.setAttribute("role", "cell");
|
|
30488
|
-
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
30489
|
-
const install = document2.createElement("button");
|
|
30490
|
-
install.type = "button";
|
|
30491
|
-
install.className = "settings-connection-install-link";
|
|
30492
|
-
install.addEventListener("click", (event) => {
|
|
30493
|
-
event.stopPropagation();
|
|
30494
|
-
select();
|
|
30495
|
-
item.install?.();
|
|
30496
|
-
});
|
|
30497
|
-
install.disabled = item.availability === "installing" || item.availability === "checking";
|
|
30498
|
-
const installLabel = messages.connectionInstall;
|
|
30499
|
-
install.setAttribute("aria-label", `${installLabel}: ${item.name}`);
|
|
30500
|
-
install.title = installLabel;
|
|
30501
|
-
install.append(createRendererSettingsIcon("download", 17));
|
|
30502
|
-
action.append(install);
|
|
30503
|
-
} else if (item.error) {
|
|
30504
|
-
const viewError = document2.createElement("button");
|
|
30505
|
-
viewError.type = "button";
|
|
30506
|
-
viewError.className = "settings-connection-view-error";
|
|
30507
|
-
viewError.textContent = messages.connectionViewError;
|
|
30508
|
-
viewError.addEventListener("click", (event) => {
|
|
30509
|
-
event.stopPropagation();
|
|
30510
|
-
select();
|
|
30511
|
-
});
|
|
30512
|
-
action.append(viewError);
|
|
30513
|
-
}
|
|
30514
|
-
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
30515
|
-
const available = document2.createElement("span");
|
|
30516
|
-
available.className = "settings-connection-version-available";
|
|
30517
|
-
available.textContent = messages.harnessVersionAvailable;
|
|
30518
|
-
available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
30519
|
-
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
30520
|
-
action.append(available);
|
|
30521
|
-
}
|
|
30522
|
-
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
30523
|
-
const update = document2.createElement("button");
|
|
30524
|
-
update.type = "button";
|
|
30525
|
-
update.className = "settings-connection-install-link";
|
|
30526
|
-
update.dataset.connectionAction = "update";
|
|
30527
|
-
update.disabled = version2.updating;
|
|
30528
|
-
update.title = messages.harnessVersionUpdate;
|
|
30529
|
-
update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
|
|
30530
|
-
update.append(createRendererSettingsIcon("download", 17));
|
|
30531
|
-
update.addEventListener("click", (event) => {
|
|
30532
|
-
event.stopPropagation();
|
|
30533
|
-
if (update.disabled) return;
|
|
30534
|
-
void version2.update();
|
|
30535
|
-
select();
|
|
30536
|
-
});
|
|
30537
|
-
action.append(update);
|
|
30538
|
-
}
|
|
30539
|
-
if (group) {
|
|
30540
|
-
const toggle = document2.createElement("button");
|
|
30541
|
-
toggle.type = "button";
|
|
30542
|
-
toggle.disabled = group.disabled;
|
|
30543
|
-
toggle.className = "settings-connection-row__group-toggle";
|
|
30544
|
-
toggle.title = group.moveLabel;
|
|
30545
|
-
toggle.setAttribute("aria-label", group.moveLabel);
|
|
30546
|
-
toggle.append(
|
|
30547
|
-
createRendererSettingsIcon(group.section === "main" ? "chevron-down" : "chevron-up", 15)
|
|
30548
|
-
);
|
|
30549
|
-
toggle.addEventListener("click", (event) => {
|
|
30550
|
-
event.stopPropagation();
|
|
30551
|
-
group.toggleSection();
|
|
30552
|
-
});
|
|
30553
|
-
action.append(toggle);
|
|
30554
|
-
}
|
|
30555
|
-
row.addEventListener("click", (event) => {
|
|
30556
|
-
const target2 = event.target;
|
|
30557
|
-
if (target2?.closest?.("a")) return;
|
|
30558
|
-
select();
|
|
30559
|
-
});
|
|
30560
|
-
row.addEventListener("keydown", (event) => {
|
|
30561
|
-
if (event.target?.closest?.("button, a")) return;
|
|
30562
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
30563
|
-
event.preventDefault();
|
|
30564
|
-
select();
|
|
30565
|
-
});
|
|
30566
|
-
if (group) {
|
|
30567
|
-
row.draggable = !group.disabled;
|
|
30568
|
-
row.dataset.connectionGroupSection = group.section;
|
|
30569
|
-
row.addEventListener("dragstart", group.onDragStart);
|
|
30570
|
-
row.addEventListener("dragover", group.onDragOver);
|
|
30571
|
-
row.addEventListener("dragleave", group.onDragLeave);
|
|
30572
|
-
row.addEventListener("drop", group.onDrop);
|
|
30573
|
-
row.addEventListener("dragend", group.onDragEnd);
|
|
30574
|
-
}
|
|
30575
|
-
row.append(identity2, status, action);
|
|
30576
|
-
return row;
|
|
30577
30864
|
}
|
|
30578
30865
|
function createInspectorHeader(document2, item, messages) {
|
|
30579
30866
|
const header = document2.createElement("header");
|
|
@@ -30603,6 +30890,29 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30603
30890
|
header.append(identity2, status);
|
|
30604
30891
|
return header;
|
|
30605
30892
|
}
|
|
30893
|
+
function inspectorRenderSignature(hostId2, item, messages, diagnostics) {
|
|
30894
|
+
const plugin = item.agentSnapshot?.plugin;
|
|
30895
|
+
const notice = plugin?.notice ? plugin.notice[messages.locale] ?? plugin.notice.en : "";
|
|
30896
|
+
const websiteUrl = plugin?.links?.website ?? plugin?.links?.documentation ?? "";
|
|
30897
|
+
const hasLaunchControls = hostId2 === "local" && Boolean(item.agentSnapshot?.agent) && Boolean(plugin?.launchCommand) && Boolean(diagnostics?.getLaunchSettings && diagnostics?.setLaunchSettings);
|
|
30898
|
+
return JSON.stringify([
|
|
30899
|
+
hostId2,
|
|
30900
|
+
item.key,
|
|
30901
|
+
item.name,
|
|
30902
|
+
item.availability,
|
|
30903
|
+
item.agentSnapshot?.availability ?? null,
|
|
30904
|
+
String(plugin?.icon ?? ""),
|
|
30905
|
+
String(plugin?.iconStyle ?? ""),
|
|
30906
|
+
websiteUrl,
|
|
30907
|
+
notice,
|
|
30908
|
+
item.installError ?? "",
|
|
30909
|
+
Boolean(item.install),
|
|
30910
|
+
plugin?.installation ?? null,
|
|
30911
|
+
Boolean(item.openWebUi),
|
|
30912
|
+
hasLaunchControls,
|
|
30913
|
+
item.error ? diagnosticText(hostId2, item) : ""
|
|
30914
|
+
]);
|
|
30915
|
+
}
|
|
30606
30916
|
function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
|
|
30607
30917
|
inspector.replaceChildren(createInspectorHeader(document2, item, messages));
|
|
30608
30918
|
const body = document2.createElement("div");
|
|
@@ -30775,11 +31085,10 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30775
31085
|
];
|
|
30776
31086
|
}
|
|
30777
31087
|
var pendingFocusAgent = null;
|
|
30778
|
-
function createGroupDivider(document2
|
|
31088
|
+
function createGroupDivider(document2) {
|
|
30779
31089
|
const divider = document2.createElement("div");
|
|
30780
31090
|
divider.className = "settings-connection-group-divider";
|
|
30781
31091
|
divider.setAttribute("role", "presentation");
|
|
30782
|
-
divider.textContent = `${messages.connectionGroupMoreLabel} (${count4})`;
|
|
30783
31092
|
return divider;
|
|
30784
31093
|
}
|
|
30785
31094
|
function createGroupMoreHint(document2, messages) {
|
|
@@ -30832,11 +31141,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30832
31141
|
context.content.append(header, syncMessage, content);
|
|
30833
31142
|
let pending = false;
|
|
30834
31143
|
let selectedHostId = null;
|
|
31144
|
+
let renderedHostId = null;
|
|
30835
31145
|
let selectedItemKey = null;
|
|
30836
31146
|
let launchControls = null;
|
|
31147
|
+
let renderedInspector = null;
|
|
30837
31148
|
const hostNames = /* @__PURE__ */ new Map();
|
|
31149
|
+
const knownNotInstalled = /* @__PURE__ */ new Map();
|
|
30838
31150
|
let latestSnapshot = null;
|
|
30839
|
-
let disposeHostScroller = () => void 0;
|
|
30840
31151
|
let disposed = false;
|
|
30841
31152
|
let renderQueued = false;
|
|
30842
31153
|
let renderFrame = null;
|
|
@@ -30870,7 +31181,99 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30870
31181
|
scheduleRender
|
|
30871
31182
|
);
|
|
30872
31183
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
30873
|
-
const updates = createConnectionUpdates(
|
|
31184
|
+
const updates = createConnectionUpdates(
|
|
31185
|
+
document2,
|
|
31186
|
+
messages,
|
|
31187
|
+
context.signal,
|
|
31188
|
+
scheduleRender,
|
|
31189
|
+
diagnostics
|
|
31190
|
+
);
|
|
31191
|
+
const panelId = "codexhost-settings-connection-host-panel";
|
|
31192
|
+
const empty = document2.createElement("div");
|
|
31193
|
+
empty.className = "settings-empty";
|
|
31194
|
+
empty.textContent = messages.connectionNoRuntime;
|
|
31195
|
+
const layout = document2.createElement("div");
|
|
31196
|
+
layout.className = "settings-connections-layout";
|
|
31197
|
+
const list = document2.createElement("section");
|
|
31198
|
+
list.className = "settings-connection-list";
|
|
31199
|
+
const hostStrip = document2.createElement("div");
|
|
31200
|
+
hostStrip.className = "settings-connection-host-strip";
|
|
31201
|
+
const scrollLeft = createHostScrollButton(document2, "left", messages);
|
|
31202
|
+
const tabs = document2.createElement("div");
|
|
31203
|
+
tabs.className = "settings-connection-host-tabs";
|
|
31204
|
+
tabs.setAttribute("role", "tablist");
|
|
31205
|
+
tabs.setAttribute("aria-label", messages.connectionHosts);
|
|
31206
|
+
const scrollRight = createHostScrollButton(document2, "right", messages);
|
|
31207
|
+
hostStrip.append(scrollLeft, tabs, scrollRight);
|
|
31208
|
+
const updateControls = updates.createControls("local", []);
|
|
31209
|
+
const hostHeader = document2.createElement("div");
|
|
31210
|
+
hostHeader.className = "settings-connection-host-header";
|
|
31211
|
+
hostHeader.append(hostStrip, updateControls.button);
|
|
31212
|
+
const tableHeader = document2.createElement("div");
|
|
31213
|
+
tableHeader.className = "settings-connection-table-header";
|
|
31214
|
+
tableHeader.setAttribute("role", "row");
|
|
31215
|
+
const componentHeading = document2.createElement("span");
|
|
31216
|
+
componentHeading.textContent = messages.connectionComponent;
|
|
31217
|
+
componentHeading.setAttribute("role", "columnheader");
|
|
31218
|
+
const statusHeading = document2.createElement("span");
|
|
31219
|
+
statusHeading.textContent = messages.connectionStatus;
|
|
31220
|
+
statusHeading.setAttribute("role", "columnheader");
|
|
31221
|
+
const actionHeading = document2.createElement("span");
|
|
31222
|
+
actionHeading.setAttribute("aria-hidden", "true");
|
|
31223
|
+
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
31224
|
+
const rows = document2.createElement("div");
|
|
31225
|
+
rows.className = "settings-connection-rows";
|
|
31226
|
+
rows.id = panelId;
|
|
31227
|
+
rows.setAttribute("role", "rowgroup");
|
|
31228
|
+
list.append(hostHeader, updateControls.result, tableHeader, rows);
|
|
31229
|
+
const inspector = document2.createElement("aside");
|
|
31230
|
+
inspector.className = "settings-connection-inspector";
|
|
31231
|
+
inspector.setAttribute("aria-live", "polite");
|
|
31232
|
+
layout.append(list, inspector);
|
|
31233
|
+
const hostScroller = configureHostScroller(
|
|
31234
|
+
document2,
|
|
31235
|
+
hostStrip,
|
|
31236
|
+
tabs,
|
|
31237
|
+
scrollLeft,
|
|
31238
|
+
scrollRight
|
|
31239
|
+
);
|
|
31240
|
+
const hostTabElements = /* @__PURE__ */ new Map();
|
|
31241
|
+
const hostRowViews = /* @__PURE__ */ new Map();
|
|
31242
|
+
const groupDivider = createGroupDivider(document2);
|
|
31243
|
+
const moreHint = createGroupMoreHint(document2, messages);
|
|
31244
|
+
const moreZone = document2.createElement("div");
|
|
31245
|
+
moreZone.className = "settings-connection-group-more";
|
|
31246
|
+
moreZone.setAttribute("role", "presentation");
|
|
31247
|
+
const resetButton = createGroupResetButton(document2, messages, () => {
|
|
31248
|
+
groupPreference.resetToDefault();
|
|
31249
|
+
});
|
|
31250
|
+
let draggingAgent = null;
|
|
31251
|
+
let currentCatalog = [];
|
|
31252
|
+
let currentMainEntries = [];
|
|
31253
|
+
let currentMoreEntries = [];
|
|
31254
|
+
let currentHostRows = /* @__PURE__ */ new Map();
|
|
31255
|
+
const clearDropIndicators = () => {
|
|
31256
|
+
for (const view of currentHostRows.values()) {
|
|
31257
|
+
view.element.dataset.connectionDropIndicator = "";
|
|
31258
|
+
}
|
|
31259
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
31260
|
+
};
|
|
31261
|
+
moreZone.addEventListener("dragover", (event) => {
|
|
31262
|
+
if (!draggingAgent) return;
|
|
31263
|
+
event.preventDefault();
|
|
31264
|
+
moreZone.dataset.connectionDragOver = "true";
|
|
31265
|
+
});
|
|
31266
|
+
moreZone.addEventListener("dragleave", () => {
|
|
31267
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
31268
|
+
});
|
|
31269
|
+
moreZone.addEventListener("drop", (event) => {
|
|
31270
|
+
event.preventDefault();
|
|
31271
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
31272
|
+
if (!draggingAgent) return;
|
|
31273
|
+
groupPreference.moveAgent(draggingAgent, "more", null, currentCatalog);
|
|
31274
|
+
draggingAgent = null;
|
|
31275
|
+
clearDropIndicators();
|
|
31276
|
+
});
|
|
30874
31277
|
const runRefresh = () => {
|
|
30875
31278
|
if (pending || !diagnostics) return;
|
|
30876
31279
|
pending = true;
|
|
@@ -30883,6 +31286,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30883
31286
|
success() {
|
|
30884
31287
|
installs?.clearErrors();
|
|
30885
31288
|
pending = false;
|
|
31289
|
+
renderedInspector = null;
|
|
30886
31290
|
refresh.disabled = false;
|
|
30887
31291
|
refresh.replaceChildren(
|
|
30888
31292
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -30892,6 +31296,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30892
31296
|
},
|
|
30893
31297
|
failure(error51) {
|
|
30894
31298
|
pending = false;
|
|
31299
|
+
renderedInspector = null;
|
|
30895
31300
|
refresh.disabled = false;
|
|
30896
31301
|
refresh.replaceChildren(
|
|
30897
31302
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -30917,97 +31322,111 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
30917
31322
|
}
|
|
30918
31323
|
});
|
|
30919
31324
|
};
|
|
31325
|
+
const syncSelectedInspector = (hostId2, item) => {
|
|
31326
|
+
const currentDiagnostics = getDiagnostics();
|
|
31327
|
+
const signature = inspectorRenderSignature(hostId2, item, messages, currentDiagnostics);
|
|
31328
|
+
const versionElement = item.version?.element ?? null;
|
|
31329
|
+
if (renderedInspector?.signature === signature && renderedInspector.versionElement === versionElement) {
|
|
31330
|
+
return;
|
|
31331
|
+
}
|
|
31332
|
+
const existing = launchControls?.hostId === hostId2 && launchControls.itemKey === item.key ? launchControls.element : null;
|
|
31333
|
+
const element = renderConnectionInspector(
|
|
31334
|
+
document2,
|
|
31335
|
+
inspector,
|
|
31336
|
+
item,
|
|
31337
|
+
hostId2,
|
|
31338
|
+
messages,
|
|
31339
|
+
currentDiagnostics,
|
|
31340
|
+
existing,
|
|
31341
|
+
runRefresh
|
|
31342
|
+
);
|
|
31343
|
+
launchControls = { hostId: hostId2, itemKey: item.key, element };
|
|
31344
|
+
if (versionElement) inspector.append(versionElement);
|
|
31345
|
+
renderedInspector = { signature, versionElement };
|
|
31346
|
+
};
|
|
30920
31347
|
const render = (snapshot) => {
|
|
30921
31348
|
const syncStatus = groupPreference.syncStatus();
|
|
30922
31349
|
const groupDisabled = syncStatus === "loading" || syncStatus === "saving";
|
|
30923
31350
|
syncMessage.hidden = syncStatus === "ready";
|
|
30924
31351
|
syncMessage.textContent = syncStatus === "error" ? messages.connectionGroupSyncFailed : syncStatus === "saving" ? messages.connectionGroupSaving : messages.connectionGroupLoading;
|
|
30925
31352
|
latestSnapshot = snapshot;
|
|
30926
|
-
disposeHostScroller();
|
|
30927
|
-
disposeHostScroller = () => void 0;
|
|
30928
31353
|
if (!snapshot) {
|
|
30929
|
-
|
|
30930
|
-
|
|
30931
|
-
empty
|
|
30932
|
-
content.replaceChildren(empty);
|
|
31354
|
+
renderedHostId = null;
|
|
31355
|
+
renderedInspector = null;
|
|
31356
|
+
reconcileElementChildren(content, [empty]);
|
|
30933
31357
|
return;
|
|
30934
31358
|
}
|
|
30935
31359
|
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];
|
|
30936
31360
|
if (!selectedHost) return;
|
|
30937
31361
|
selectedHostId = selectedHost.hostId;
|
|
30938
|
-
const
|
|
30939
|
-
|
|
30940
|
-
|
|
30941
|
-
|
|
30942
|
-
|
|
30943
|
-
|
|
30944
|
-
|
|
30945
|
-
|
|
30946
|
-
|
|
30947
|
-
|
|
30948
|
-
|
|
30949
|
-
|
|
30950
|
-
|
|
30951
|
-
|
|
30952
|
-
|
|
30953
|
-
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
30957
|
-
|
|
30958
|
-
|
|
30959
|
-
|
|
30960
|
-
|
|
31362
|
+
const layoutFirstMount = content.children[0] !== layout;
|
|
31363
|
+
reconcileElementChildren(content, [layout]);
|
|
31364
|
+
let tabsChanged = tabs.children.length !== snapshot.hosts.length;
|
|
31365
|
+
const nextTabs = snapshot.hosts.map((host) => {
|
|
31366
|
+
let tab = hostTabElements.get(host.hostId);
|
|
31367
|
+
if (!tab) {
|
|
31368
|
+
tab = document2.createElement("button");
|
|
31369
|
+
tab.type = "button";
|
|
31370
|
+
tab.className = "settings-connection-host-tab";
|
|
31371
|
+
tab.dataset.connectionHostTab = host.hostId;
|
|
31372
|
+
tab.setAttribute("role", "tab");
|
|
31373
|
+
tab.setAttribute("aria-controls", panelId);
|
|
31374
|
+
tab.addEventListener("click", () => {
|
|
31375
|
+
selectedHostId = host.hostId;
|
|
31376
|
+
render(latestSnapshot);
|
|
31377
|
+
});
|
|
31378
|
+
tab.addEventListener("keydown", (event) => {
|
|
31379
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
31380
|
+
event.preventDefault();
|
|
31381
|
+
const hosts = latestSnapshot?.hosts ?? [];
|
|
31382
|
+
const index = hosts.findIndex((candidate) => candidate.hostId === host.hostId);
|
|
31383
|
+
if (index < 0) return;
|
|
31384
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
31385
|
+
const next = hosts[(index + direction + hosts.length) % hosts.length];
|
|
31386
|
+
if (!next) return;
|
|
31387
|
+
selectedHostId = next.hostId;
|
|
31388
|
+
render(latestSnapshot);
|
|
31389
|
+
hostTabElements.get(next.hostId)?.focus();
|
|
31390
|
+
});
|
|
31391
|
+
hostTabElements.set(host.hostId, tab);
|
|
31392
|
+
tabsChanged = true;
|
|
31393
|
+
}
|
|
31394
|
+
const isSelected = host.hostId === selectedHost.hostId;
|
|
31395
|
+
const activeValue = String(host.active);
|
|
31396
|
+
if (tab.dataset.connectionHostActive !== activeValue) {
|
|
31397
|
+
tab.dataset.connectionHostActive = activeValue;
|
|
31398
|
+
}
|
|
31399
|
+
const selectedValue = String(isSelected);
|
|
31400
|
+
if (tab.getAttribute("aria-selected") !== selectedValue) {
|
|
31401
|
+
tab.setAttribute("aria-selected", selectedValue);
|
|
31402
|
+
}
|
|
31403
|
+
const nextTabIndex = isSelected ? 0 : -1;
|
|
31404
|
+
if (tab.tabIndex !== nextTabIndex) {
|
|
31405
|
+
tab.tabIndex = nextTabIndex;
|
|
31406
|
+
}
|
|
30961
31407
|
const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
|
|
30962
|
-
tab.textContent
|
|
30963
|
-
|
|
30964
|
-
|
|
30965
|
-
|
|
30966
|
-
|
|
30967
|
-
|
|
30968
|
-
|
|
30969
|
-
|
|
30970
|
-
|
|
30971
|
-
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
30972
|
-
const next = snapshot.hosts[(index + direction + snapshot.hosts.length) % snapshot.hosts.length];
|
|
30973
|
-
if (!next) return;
|
|
30974
|
-
selectedHostId = next.hostId;
|
|
30975
|
-
render(latestSnapshot);
|
|
30976
|
-
const nextTab = [
|
|
30977
|
-
...content.querySelectorAll("[data-connection-host-tab]")
|
|
30978
|
-
].find((candidate) => candidate.dataset.connectionHostTab === next.hostId);
|
|
30979
|
-
nextTab?.focus();
|
|
30980
|
-
});
|
|
30981
|
-
tabs.append(tab);
|
|
31408
|
+
if (tab.textContent !== hostName) {
|
|
31409
|
+
tab.textContent = hostName;
|
|
31410
|
+
tabsChanged = true;
|
|
31411
|
+
}
|
|
31412
|
+
const tabTitle = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
|
|
31413
|
+
if (tab.title !== tabTitle) {
|
|
31414
|
+
tab.title = tabTitle;
|
|
31415
|
+
}
|
|
31416
|
+
return tab;
|
|
30982
31417
|
});
|
|
30983
|
-
|
|
30984
|
-
|
|
30985
|
-
|
|
30986
|
-
|
|
30987
|
-
const componentHeading = document2.createElement("span");
|
|
30988
|
-
componentHeading.textContent = messages.connectionComponent;
|
|
30989
|
-
componentHeading.setAttribute("role", "columnheader");
|
|
30990
|
-
const statusHeading = document2.createElement("span");
|
|
30991
|
-
statusHeading.textContent = messages.connectionStatus;
|
|
30992
|
-
statusHeading.setAttribute("role", "columnheader");
|
|
30993
|
-
const actionHeading = document2.createElement("span");
|
|
30994
|
-
actionHeading.setAttribute("aria-hidden", "true");
|
|
30995
|
-
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
30996
|
-
const rows = document2.createElement("div");
|
|
30997
|
-
rows.className = "settings-connection-rows";
|
|
30998
|
-
rows.id = panelId;
|
|
30999
|
-
rows.dataset.connectionHost = selectedHost.hostId;
|
|
31000
|
-
rows.setAttribute("role", "rowgroup");
|
|
31001
|
-
const inspector = document2.createElement("aside");
|
|
31002
|
-
inspector.className = "settings-connection-inspector";
|
|
31003
|
-
inspector.setAttribute("aria-live", "polite");
|
|
31418
|
+
reconcileElementChildren(tabs, nextTabs);
|
|
31419
|
+
if (rows.dataset.connectionHost !== selectedHost.hostId) {
|
|
31420
|
+
rows.dataset.connectionHost = selectedHost.hostId;
|
|
31421
|
+
}
|
|
31004
31422
|
const items = connectionItems(snapshot, selectedHost, messages, diagnostics).map(
|
|
31005
31423
|
(item) => {
|
|
31006
31424
|
const agent = item.agentSnapshot?.agent;
|
|
31007
31425
|
if (!agent) return item;
|
|
31008
31426
|
const state = installs?.get(selectedHost.hostId, agent);
|
|
31009
31427
|
const availability = state?.status ?? item.availability;
|
|
31010
|
-
const
|
|
31428
|
+
const updating = versions.isUpdating(selectedHost.hostId, agent);
|
|
31429
|
+
const version2 = updating || item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
|
|
31011
31430
|
return {
|
|
31012
31431
|
...item,
|
|
31013
31432
|
...state ? { availability: state.status } : {},
|
|
@@ -31029,66 +31448,66 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
31029
31448
|
(item) => item.agentSnapshot?.availability === "notInstalled" || item.error !== null
|
|
31030
31449
|
)?.key ?? items[0]?.key ?? null;
|
|
31031
31450
|
}
|
|
31032
|
-
|
|
31451
|
+
let hostRows = hostRowViews.get(selectedHost.hostId);
|
|
31452
|
+
if (!hostRows) {
|
|
31453
|
+
hostRows = /* @__PURE__ */ new Map();
|
|
31454
|
+
hostRowViews.set(selectedHost.hostId, hostRows);
|
|
31455
|
+
}
|
|
31456
|
+
currentHostRows = hostRows;
|
|
31033
31457
|
const selectItem = (item) => {
|
|
31034
31458
|
selectedItemKey = item.key;
|
|
31035
|
-
for (const [key,
|
|
31036
|
-
|
|
31037
|
-
row.dataset.connectionSelected = String(selected);
|
|
31038
|
-
row.tabIndex = selected ? 0 : -1;
|
|
31459
|
+
for (const [key, view] of currentHostRows) {
|
|
31460
|
+
view.setSelected(key === item.key);
|
|
31039
31461
|
}
|
|
31040
|
-
|
|
31041
|
-
const element = renderConnectionInspector(
|
|
31042
|
-
document2,
|
|
31043
|
-
inspector,
|
|
31044
|
-
item,
|
|
31045
|
-
selectedHost.hostId,
|
|
31046
|
-
messages,
|
|
31047
|
-
getDiagnostics(),
|
|
31048
|
-
existing,
|
|
31049
|
-
runRefresh
|
|
31050
|
-
);
|
|
31051
|
-
launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
|
|
31052
|
-
if (item.version) inspector.append(item.version.element);
|
|
31462
|
+
syncSelectedInspector(selectedHost.hostId, item);
|
|
31053
31463
|
};
|
|
31054
|
-
const
|
|
31055
|
-
|
|
31056
|
-
|
|
31057
|
-
document2,
|
|
31464
|
+
const ensureRowView = (key, groupable) => {
|
|
31465
|
+
let view = hostRows.get(key);
|
|
31466
|
+
if (!view) {
|
|
31467
|
+
view = createConnectionRowView(document2, messages, groupable);
|
|
31468
|
+
hostRows.set(key, view);
|
|
31469
|
+
}
|
|
31470
|
+
return view;
|
|
31471
|
+
};
|
|
31472
|
+
const activeKeys = /* @__PURE__ */ new Set();
|
|
31473
|
+
const nextRowChildren = [];
|
|
31474
|
+
const pinnedItems = items.filter((item) => item.agentSnapshot === void 0);
|
|
31475
|
+
for (const pinnedItem of pinnedItems) {
|
|
31476
|
+
activeKeys.add(pinnedItem.key);
|
|
31477
|
+
const view = ensureRowView(pinnedItem.key, false);
|
|
31478
|
+
view.update(
|
|
31058
31479
|
pinnedItem,
|
|
31059
|
-
messages,
|
|
31060
31480
|
pinnedItem.key === selectedItemKey,
|
|
31061
|
-
() => selectItem(pinnedItem)
|
|
31481
|
+
() => selectItem(pinnedItem),
|
|
31482
|
+
null
|
|
31062
31483
|
);
|
|
31063
|
-
|
|
31064
|
-
rows.append(row);
|
|
31484
|
+
nextRowChildren.push(view.element);
|
|
31065
31485
|
}
|
|
31066
31486
|
const groupableItems = items.filter(
|
|
31067
31487
|
(item) => item.agentSnapshot !== void 0
|
|
31068
31488
|
);
|
|
31069
31489
|
const agentByKey = new Map(groupableItems.map((item) => [item.key, item]));
|
|
31070
|
-
|
|
31071
|
-
const
|
|
31072
|
-
|
|
31073
|
-
|
|
31074
|
-
|
|
31075
|
-
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
|
|
31490
|
+
currentCatalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
|
|
31491
|
+
const notInstalledAgents = /* @__PURE__ */ new Set();
|
|
31492
|
+
for (const item of groupableItems) {
|
|
31493
|
+
const agent = item.agentSnapshot.agent;
|
|
31494
|
+
const stateKey = `${selectedHost.hostId}:${agent}`;
|
|
31495
|
+
if (item.agentSnapshot.availability !== "checking") {
|
|
31496
|
+
knownNotInstalled.set(stateKey, item.agentSnapshot.availability === "notInstalled");
|
|
31497
|
+
}
|
|
31498
|
+
const isNotInstalled = item.agentSnapshot.availability === "checking" ? knownNotInstalled.get(stateKey) ?? false : item.agentSnapshot.availability === "notInstalled";
|
|
31499
|
+
if (isNotInstalled) notInstalledAgents.add(agent);
|
|
31500
|
+
}
|
|
31501
|
+
const preferenceOrder = groupPreference.list(notInstalledAgents, currentCatalog).filter((entry) => agentByKey.has(entry.agent));
|
|
31502
|
+
currentMainEntries = preferenceOrder.filter((entry) => entry.section === "main");
|
|
31503
|
+
currentMoreEntries = preferenceOrder.filter((entry) => entry.section === "more");
|
|
31079
31504
|
const nextInSection = (section, agent) => {
|
|
31080
|
-
const
|
|
31081
|
-
const index =
|
|
31082
|
-
return index >= 0 ?
|
|
31083
|
-
};
|
|
31084
|
-
let draggingAgent = null;
|
|
31085
|
-
let moreZone = null;
|
|
31086
|
-
const clearDropIndicators = () => {
|
|
31087
|
-
for (const row of rowElements.values()) row.dataset.connectionDropIndicator = "";
|
|
31088
|
-
if (moreZone) moreZone.dataset.connectionDragOver = "false";
|
|
31505
|
+
const sectionEntries = section === "main" ? currentMainEntries : currentMoreEntries;
|
|
31506
|
+
const index = sectionEntries.findIndex((entry) => entry.agent === agent);
|
|
31507
|
+
return index >= 0 ? sectionEntries[index + 1]?.agent ?? null : null;
|
|
31089
31508
|
};
|
|
31090
31509
|
const dropTargetSection = (agent, event) => {
|
|
31091
|
-
const row =
|
|
31510
|
+
const row = currentHostRows.get(agent)?.element;
|
|
31092
31511
|
const rect = row && typeof row.getBoundingClientRect === "function" ? row.getBoundingClientRect() : null;
|
|
31093
31512
|
const before = rect ? event.clientY - rect.top < rect.height / 2 : true;
|
|
31094
31513
|
const section = row?.dataset.connectionGroupSection ?? "main";
|
|
@@ -31100,7 +31519,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
31100
31519
|
moveLabel: section === "main" ? messages.connectionGroupMoveToMore : messages.connectionGroupMoveToMain,
|
|
31101
31520
|
dragHandleTitle: messages.connectionGroupDragHandle,
|
|
31102
31521
|
toggleSection() {
|
|
31103
|
-
groupPreference.moveAgent(
|
|
31522
|
+
groupPreference.moveAgent(
|
|
31523
|
+
agent,
|
|
31524
|
+
section === "main" ? "more" : "main",
|
|
31525
|
+
null,
|
|
31526
|
+
currentCatalog
|
|
31527
|
+
);
|
|
31104
31528
|
},
|
|
31105
31529
|
onDragStart(event) {
|
|
31106
31530
|
if (groupDisabled) {
|
|
@@ -31110,127 +31534,107 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
31110
31534
|
draggingAgent = agent;
|
|
31111
31535
|
event.dataTransfer?.setData("text/plain", agent);
|
|
31112
31536
|
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
31113
|
-
const row =
|
|
31537
|
+
const row = currentHostRows.get(agent)?.element;
|
|
31114
31538
|
if (row) row.dataset.connectionDragging = "true";
|
|
31115
31539
|
},
|
|
31116
31540
|
onDragOver(event) {
|
|
31117
31541
|
if (!draggingAgent || draggingAgent === agent) return;
|
|
31118
31542
|
event.preventDefault();
|
|
31119
|
-
const row =
|
|
31543
|
+
const row = currentHostRows.get(agent)?.element;
|
|
31120
31544
|
if (!row) return;
|
|
31121
31545
|
const { before } = dropTargetSection(agent, event);
|
|
31122
31546
|
clearDropIndicators();
|
|
31123
31547
|
row.dataset.connectionDropIndicator = before ? "before" : "after";
|
|
31124
31548
|
},
|
|
31125
31549
|
onDragLeave() {
|
|
31126
|
-
const row =
|
|
31550
|
+
const row = currentHostRows.get(agent)?.element;
|
|
31127
31551
|
if (row) row.dataset.connectionDropIndicator = "";
|
|
31128
31552
|
},
|
|
31129
31553
|
onDrop(event) {
|
|
31130
31554
|
event.preventDefault();
|
|
31131
31555
|
if (!draggingAgent) return;
|
|
31132
31556
|
const { beforeAgent } = dropTargetSection(agent, event);
|
|
31133
|
-
groupPreference.moveAgent(draggingAgent, section, beforeAgent,
|
|
31557
|
+
groupPreference.moveAgent(draggingAgent, section, beforeAgent, currentCatalog);
|
|
31134
31558
|
draggingAgent = null;
|
|
31135
31559
|
clearDropIndicators();
|
|
31136
31560
|
},
|
|
31137
31561
|
onDragEnd() {
|
|
31138
31562
|
draggingAgent = null;
|
|
31139
|
-
const row =
|
|
31563
|
+
const row = currentHostRows.get(agent)?.element;
|
|
31140
31564
|
if (row) row.dataset.connectionDragging = "false";
|
|
31141
31565
|
clearDropIndicators();
|
|
31566
|
+
scheduleRender();
|
|
31142
31567
|
}
|
|
31143
31568
|
});
|
|
31144
|
-
const
|
|
31145
|
-
const item = agentByKey.get(agent);
|
|
31146
|
-
if (!item)
|
|
31147
|
-
|
|
31148
|
-
|
|
31569
|
+
for (const entry of currentMainEntries) {
|
|
31570
|
+
const item = agentByKey.get(entry.agent);
|
|
31571
|
+
if (!item) continue;
|
|
31572
|
+
activeKeys.add(item.key);
|
|
31573
|
+
const view = ensureRowView(item.key, true);
|
|
31574
|
+
view.update(
|
|
31149
31575
|
item,
|
|
31150
|
-
messages,
|
|
31151
31576
|
item.key === selectedItemKey,
|
|
31152
31577
|
() => selectItem(item),
|
|
31153
|
-
createGroupController(agent,
|
|
31578
|
+
createGroupController(entry.agent, "main")
|
|
31154
31579
|
);
|
|
31155
|
-
|
|
31156
|
-
|
|
31157
|
-
};
|
|
31158
|
-
for (const entry of mainEntries) appendGroupRow(entry.agent, "main");
|
|
31580
|
+
nextRowChildren.push(view.element);
|
|
31581
|
+
}
|
|
31159
31582
|
if (groupableItems.length > 0) {
|
|
31160
|
-
|
|
31161
|
-
|
|
31162
|
-
|
|
31163
|
-
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
zone.dataset.connectionDragOver = "true";
|
|
31169
|
-
});
|
|
31170
|
-
zone.addEventListener("dragleave", () => {
|
|
31171
|
-
zone.dataset.connectionDragOver = "false";
|
|
31172
|
-
});
|
|
31173
|
-
zone.addEventListener("drop", (event) => {
|
|
31174
|
-
event.preventDefault();
|
|
31175
|
-
zone.dataset.connectionDragOver = "false";
|
|
31176
|
-
if (!draggingAgent) return;
|
|
31177
|
-
groupPreference.moveAgent(draggingAgent, "more", null, catalog);
|
|
31178
|
-
draggingAgent = null;
|
|
31179
|
-
clearDropIndicators();
|
|
31180
|
-
});
|
|
31181
|
-
if (moreEntries.length === 0) {
|
|
31182
|
-
zone.append(createGroupMoreHint(document2, messages));
|
|
31583
|
+
const dividerText = `${messages.connectionGroupMoreLabel} (${currentMoreEntries.length})`;
|
|
31584
|
+
if (groupDivider.textContent !== dividerText) {
|
|
31585
|
+
groupDivider.textContent = dividerText;
|
|
31586
|
+
}
|
|
31587
|
+
nextRowChildren.push(groupDivider);
|
|
31588
|
+
const nextMoreChildren = [];
|
|
31589
|
+
if (currentMoreEntries.length === 0) {
|
|
31590
|
+
nextMoreChildren.push(moreHint);
|
|
31183
31591
|
} else {
|
|
31184
|
-
for (const entry of
|
|
31592
|
+
for (const entry of currentMoreEntries) {
|
|
31185
31593
|
const item = agentByKey.get(entry.agent);
|
|
31186
31594
|
if (!item) continue;
|
|
31187
|
-
|
|
31188
|
-
|
|
31595
|
+
activeKeys.add(item.key);
|
|
31596
|
+
const view = ensureRowView(item.key, true);
|
|
31597
|
+
view.update(
|
|
31189
31598
|
item,
|
|
31190
|
-
messages,
|
|
31191
31599
|
item.key === selectedItemKey,
|
|
31192
31600
|
() => selectItem(item),
|
|
31193
31601
|
createGroupController(entry.agent, "more")
|
|
31194
31602
|
);
|
|
31195
|
-
|
|
31196
|
-
zone.append(row);
|
|
31603
|
+
nextMoreChildren.push(view.element);
|
|
31197
31604
|
}
|
|
31198
31605
|
}
|
|
31199
|
-
|
|
31200
|
-
|
|
31201
|
-
|
|
31202
|
-
|
|
31203
|
-
|
|
31204
|
-
|
|
31606
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
31607
|
+
reconcileElementChildren(moreZone, nextMoreChildren);
|
|
31608
|
+
}
|
|
31609
|
+
nextRowChildren.push(moreZone);
|
|
31610
|
+
resetButton.disabled = groupDisabled;
|
|
31611
|
+
nextRowChildren.push(resetButton);
|
|
31612
|
+
}
|
|
31613
|
+
for (const key of hostRows.keys()) {
|
|
31614
|
+
if (!activeKeys.has(key)) hostRows.delete(key);
|
|
31615
|
+
}
|
|
31616
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
31617
|
+
reconcileElementChildren(rows, nextRowChildren);
|
|
31205
31618
|
}
|
|
31206
31619
|
const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
|
|
31207
31620
|
if (selectedItem) selectItem(selectedItem);
|
|
31208
|
-
|
|
31621
|
+
updateControls.update(
|
|
31209
31622
|
selectedHost.hostId,
|
|
31210
31623
|
items.flatMap((item) => item.version ? [item.version] : [])
|
|
31211
31624
|
);
|
|
31212
|
-
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
const selectedTab = [...tabs.children].find(
|
|
31226
|
-
(child) => child.getAttribute("aria-selected") === "true"
|
|
31227
|
-
);
|
|
31228
|
-
if (selectedTab) {
|
|
31229
|
-
const left = selectedTab.offsetLeft;
|
|
31230
|
-
const right = left + selectedTab.offsetWidth;
|
|
31231
|
-
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
31232
|
-
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
31233
|
-
tabs.scrollLeft = right - tabs.clientWidth;
|
|
31625
|
+
if (layoutFirstMount || tabsChanged) {
|
|
31626
|
+
hostScroller.update();
|
|
31627
|
+
}
|
|
31628
|
+
if (renderedHostId !== selectedHost.hostId) {
|
|
31629
|
+
renderedHostId = selectedHost.hostId;
|
|
31630
|
+
const selectedTab = hostTabElements.get(selectedHost.hostId);
|
|
31631
|
+
if (selectedTab) {
|
|
31632
|
+
const left = selectedTab.offsetLeft;
|
|
31633
|
+
const right = left + selectedTab.offsetWidth;
|
|
31634
|
+
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
31635
|
+
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
31636
|
+
tabs.scrollLeft = right - tabs.clientWidth;
|
|
31637
|
+
}
|
|
31234
31638
|
}
|
|
31235
31639
|
}
|
|
31236
31640
|
};
|
|
@@ -31251,7 +31655,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
31251
31655
|
refresh.disabled = true;
|
|
31252
31656
|
return () => {
|
|
31253
31657
|
cancelRender();
|
|
31254
|
-
|
|
31658
|
+
hostScroller.dispose();
|
|
31255
31659
|
unsubscribeGroup();
|
|
31256
31660
|
};
|
|
31257
31661
|
}
|
|
@@ -31260,7 +31664,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
31260
31664
|
const unsubscribeInstalls = installs?.subscribe(scheduleRender);
|
|
31261
31665
|
return () => {
|
|
31262
31666
|
cancelRender();
|
|
31263
|
-
|
|
31667
|
+
hostScroller.dispose();
|
|
31264
31668
|
unsubscribeInstalls?.();
|
|
31265
31669
|
unsubscribe();
|
|
31266
31670
|
unsubscribeGroup();
|
|
@@ -33043,9 +33447,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
33043
33447
|
resets: "Resets",
|
|
33044
33448
|
details: "Account limit details",
|
|
33045
33449
|
weekly: "Weekly limit",
|
|
33450
|
+
weeklyShort: "Weekly",
|
|
33046
33451
|
monthly: "Monthly limit",
|
|
33452
|
+
monthlyShort: "Monthly",
|
|
33047
33453
|
fiveHour: "5-hour limit",
|
|
33454
|
+
fiveHourShort: "5-hour",
|
|
33048
33455
|
sevenDay: "7-day limit",
|
|
33456
|
+
sevenDayShort: "7-day",
|
|
33049
33457
|
account: "Account limit"
|
|
33050
33458
|
});
|
|
33051
33459
|
var CHINESE_CREDITS_MESSAGES = Object.freeze({
|
|
@@ -33053,9 +33461,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
33053
33461
|
resets: "\u91CD\u7F6E",
|
|
33054
33462
|
details: "\u8D26\u53F7\u989D\u5EA6\u8BE6\u60C5",
|
|
33055
33463
|
weekly: "\u5468\u989D\u5EA6",
|
|
33464
|
+
weeklyShort: "\u5468\u989D\u5EA6",
|
|
33056
33465
|
monthly: "\u6708\u989D\u5EA6",
|
|
33466
|
+
monthlyShort: "\u6708\u989D\u5EA6",
|
|
33057
33467
|
fiveHour: "5 \u5C0F\u65F6\u989D\u5EA6",
|
|
33468
|
+
fiveHourShort: "5 \u5C0F\u65F6",
|
|
33058
33469
|
sevenDay: "7 \u5929\u989D\u5EA6",
|
|
33470
|
+
sevenDayShort: "7 \u5929",
|
|
33059
33471
|
account: "\u8D26\u53F7\u989D\u5EA6"
|
|
33060
33472
|
});
|
|
33061
33473
|
function formatRendererCreditsReset(value, now = /* @__PURE__ */ new Date(), locale = "en") {
|
|
@@ -34288,6 +34700,25 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34288
34700
|
node.textContent = label;
|
|
34289
34701
|
return node;
|
|
34290
34702
|
}
|
|
34703
|
+
function labeledField(document2, input) {
|
|
34704
|
+
const field2 = document2.createElement("div");
|
|
34705
|
+
field2.className = input.wide ? "settings-mcp-clients-field settings-mcp-clients-field--wide" : "settings-mcp-clients-field";
|
|
34706
|
+
const controlId = input.control.id || preferenceId("mcp-client");
|
|
34707
|
+
input.control.id = controlId;
|
|
34708
|
+
const label = document2.createElement("label");
|
|
34709
|
+
label.htmlFor = controlId;
|
|
34710
|
+
label.textContent = input.label;
|
|
34711
|
+
field2.append(label, input.control);
|
|
34712
|
+
if (input.hint) {
|
|
34713
|
+
const hint = document2.createElement("p");
|
|
34714
|
+
hint.className = "settings-mcp-clients-hint";
|
|
34715
|
+
hint.id = preferenceId("mcp-client-hint");
|
|
34716
|
+
hint.textContent = input.hint;
|
|
34717
|
+
input.control.setAttribute("aria-describedby", hint.id);
|
|
34718
|
+
field2.append(hint);
|
|
34719
|
+
}
|
|
34720
|
+
return field2;
|
|
34721
|
+
}
|
|
34291
34722
|
function createMcpClientsSettingsPage(messages, getClient) {
|
|
34292
34723
|
return Object.freeze({
|
|
34293
34724
|
id: "mcp-clients",
|
|
@@ -34325,10 +34756,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34325
34756
|
status.textContent = message2;
|
|
34326
34757
|
};
|
|
34327
34758
|
const form = document2.createElement("form");
|
|
34328
|
-
form.className = "settings-
|
|
34759
|
+
form.className = "settings-mcp-clients-form";
|
|
34760
|
+
form.setAttribute("aria-label", copy.add);
|
|
34329
34761
|
const nameInput = document2.createElement("input");
|
|
34330
34762
|
nameInput.type = "text";
|
|
34331
34763
|
nameInput.required = true;
|
|
34764
|
+
nameInput.autocomplete = "off";
|
|
34332
34765
|
nameInput.placeholder = copy.name;
|
|
34333
34766
|
nameInput.setAttribute("aria-label", copy.name);
|
|
34334
34767
|
const accessSelect = document2.createElement("select");
|
|
@@ -34339,7 +34772,6 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34339
34772
|
);
|
|
34340
34773
|
const workspaces = document2.createElement("textarea");
|
|
34341
34774
|
workspaces.rows = 3;
|
|
34342
|
-
workspaces.placeholder = copy.workspacesHint;
|
|
34343
34775
|
workspaces.setAttribute("aria-label", copy.workspaces);
|
|
34344
34776
|
const connectionSelect = document2.createElement("select");
|
|
34345
34777
|
connectionSelect.setAttribute("aria-label", copy.connection);
|
|
@@ -34356,25 +34788,46 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34356
34788
|
);
|
|
34357
34789
|
const directUrlInput = document2.createElement("input");
|
|
34358
34790
|
directUrlInput.type = "url";
|
|
34359
|
-
directUrlInput.placeholder = copy.directUrlHint;
|
|
34360
34791
|
directUrlInput.setAttribute("aria-label", copy.directUrl);
|
|
34361
34792
|
const oauthInput = document2.createElement("input");
|
|
34362
34793
|
oauthInput.type = "text";
|
|
34363
|
-
oauthInput.
|
|
34794
|
+
oauthInput.autocomplete = "off";
|
|
34364
34795
|
oauthInput.setAttribute("aria-label", copy.oauthClientId);
|
|
34365
34796
|
const add = document2.createElement("button");
|
|
34366
34797
|
add.type = "submit";
|
|
34367
34798
|
add.className = "settings-command-button";
|
|
34368
34799
|
add.textContent = copy.add;
|
|
34800
|
+
const workspacesField = labeledField(document2, {
|
|
34801
|
+
label: copy.workspaces,
|
|
34802
|
+
control: workspaces,
|
|
34803
|
+
hint: copy.workspacesHint,
|
|
34804
|
+
wide: true
|
|
34805
|
+
});
|
|
34806
|
+
const directUrlField = labeledField(document2, {
|
|
34807
|
+
label: copy.directUrl,
|
|
34808
|
+
control: directUrlInput,
|
|
34809
|
+
hint: copy.directUrlHint,
|
|
34810
|
+
wide: true
|
|
34811
|
+
});
|
|
34812
|
+
const actions = document2.createElement("div");
|
|
34813
|
+
actions.className = "settings-mcp-clients-actions";
|
|
34814
|
+
actions.append(add);
|
|
34815
|
+
const syncOptionalFields = () => {
|
|
34816
|
+
workspacesField.hidden = accessSelect.value !== "selected-workspaces";
|
|
34817
|
+
directUrlField.hidden = connectionSelect.value !== "direct";
|
|
34818
|
+
};
|
|
34819
|
+
accessSelect.addEventListener("change", syncOptionalFields);
|
|
34820
|
+
connectionSelect.addEventListener("change", syncOptionalFields);
|
|
34821
|
+
syncOptionalFields();
|
|
34369
34822
|
form.append(
|
|
34370
|
-
nameInput,
|
|
34371
|
-
accessSelect,
|
|
34372
|
-
|
|
34373
|
-
connectionSelect,
|
|
34374
|
-
grantSelect,
|
|
34375
|
-
|
|
34376
|
-
oauthInput,
|
|
34377
|
-
|
|
34823
|
+
labeledField(document2, { label: copy.name, control: nameInput }),
|
|
34824
|
+
labeledField(document2, { label: copy.access, control: accessSelect }),
|
|
34825
|
+
workspacesField,
|
|
34826
|
+
labeledField(document2, { label: copy.connection, control: connectionSelect }),
|
|
34827
|
+
labeledField(document2, { label: copy.grant, control: grantSelect }),
|
|
34828
|
+
directUrlField,
|
|
34829
|
+
labeledField(document2, { label: copy.oauthClientId, control: oauthInput }),
|
|
34830
|
+
actions
|
|
34378
34831
|
);
|
|
34379
34832
|
const tableWrap = document2.createElement("div");
|
|
34380
34833
|
tableWrap.className = "settings-enrollment-table-wrap";
|
|
@@ -34434,15 +34887,15 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34434
34887
|
grantCell.textContent = grantLabel(view.dispatchGrant, copy);
|
|
34435
34888
|
const urlCell = document2.createElement("td");
|
|
34436
34889
|
urlCell.textContent = view.mcpUrl ?? view.mcpUrlNote ?? "\u2014";
|
|
34437
|
-
const
|
|
34438
|
-
|
|
34890
|
+
const actions2 = document2.createElement("td");
|
|
34891
|
+
actions2.className = "settings-enrollment-actions";
|
|
34439
34892
|
if (view.mcpUrl) {
|
|
34440
34893
|
const copyButton = document2.createElement("button");
|
|
34441
34894
|
copyButton.type = "button";
|
|
34442
34895
|
copyButton.className = "settings-command-button settings-command-button--secondary";
|
|
34443
34896
|
copyButton.textContent = copy.copyUrl;
|
|
34444
34897
|
copyButton.addEventListener("click", () => void copyUrl(view.mcpUrl));
|
|
34445
|
-
|
|
34898
|
+
actions2.append(copyButton);
|
|
34446
34899
|
}
|
|
34447
34900
|
const full = document2.createElement("button");
|
|
34448
34901
|
full.type = "button";
|
|
@@ -34498,8 +34951,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
34498
34951
|
}
|
|
34499
34952
|
);
|
|
34500
34953
|
});
|
|
34501
|
-
|
|
34502
|
-
row.append(nameCell, accessCell, connectionCell, grantCell, urlCell,
|
|
34954
|
+
actions2.append(full, revoke);
|
|
34955
|
+
row.append(nameCell, accessCell, connectionCell, grantCell, urlCell, actions2);
|
|
34503
34956
|
tbody.append(row);
|
|
34504
34957
|
}
|
|
34505
34958
|
};
|
|
@@ -36515,6 +36968,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
36515
36968
|
.settings-connection-inspector {
|
|
36516
36969
|
position: sticky;
|
|
36517
36970
|
top: 18px;
|
|
36971
|
+
overflow-anchor: none;
|
|
36518
36972
|
}
|
|
36519
36973
|
|
|
36520
36974
|
.settings-connection-inspector__header {
|