@codexhost/cli-linux-arm64 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +45 -4
- package/app/console-web.js +1124 -684
- package/app/desktop-controller.mjs +197 -50
- package/app/host-runtime.mjs +36192 -29254
- package/app/plugins/antigravity/assets/icon.svg +1 -1
- package/app/plugins/antigravity/plugin.mjs +8863 -4094
- package/app/plugins/claude-code/plugin.mjs +173 -26
- package/app/plugins/codebuddy/plugin.mjs +71 -6
- package/app/plugins/codex-usage/plugin.mjs +56 -4
- package/app/plugins/copilot/plugin.mjs +48 -4
- package/app/plugins/cursor-cli/plugin.mjs +48 -4
- package/app/plugins/deepseek-harness/plugin.mjs +73 -9
- package/app/plugins/devin/plugin.mjs +47 -4
- package/app/plugins/grok/plugin.mjs +84 -13
- package/app/plugins/hermes/plugin.mjs +47 -4
- package/app/plugins/kimi-code/plugin.mjs +73 -14
- package/app/plugins/kiro-cli/plugin.mjs +48 -4
- package/app/plugins/omp/plugin.mjs +74 -7
- package/app/plugins/opencode/plugin.mjs +74 -13
- package/app/plugins/pi/plugin.mjs +75 -7
- package/app/plugins/qoder/plugin.mjs +85 -5
- package/app/plugins/qoder-cn/plugin.mjs +85 -5
- package/app/plugins/qwen-code/plugin.mjs +48 -4
- package/app/plugins/workbuddy/plugin.mjs +75 -9
- package/app/plugins/zcode/plugin.mjs +56 -4
- package/app/renderer-extension.js +1431 -737
- package/app/web/assets/index-BdmZfTRW.js +201 -0
- package/app/web/assets/index-DJW4bmyx.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 +1130 -686
- package/app/web/index.html +4 -3
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +7 -7
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +27 -27
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- 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 +1144 -731
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BNQIOOHE.css +0 -1
- package/app/web/assets/index-Feo4BkqN.js +0 -199
|
@@ -14912,13 +14912,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14912
14912
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14913
14913
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
14914
14914
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14915
|
+
var usageOutputTimingSchema = external_exports.object({
|
|
14916
|
+
version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
|
|
14917
|
+
requestId: external_exports.string().min(1),
|
|
14918
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
14919
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
14920
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
14921
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
14922
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
14915
14923
|
var usageMeasurementSchema = external_exports.object({
|
|
14924
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
|
|
14916
14925
|
value: finiteNonNegativeNumberSchema,
|
|
14917
14926
|
turnId: external_exports.string().min(1).max(1024),
|
|
14918
14927
|
at: nonNegativeSafeIntegerSchema
|
|
14919
14928
|
}).strict();
|
|
14920
14929
|
var usageMeasurementsSchema = external_exports.object({
|
|
14921
|
-
|
|
14930
|
+
// Older intervals can omit hidden thinking time; do not restore them into averages.
|
|
14931
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
|
|
14932
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
14933
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
14922
14934
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
14923
14935
|
}).strict();
|
|
14924
14936
|
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
@@ -14938,6 +14950,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14938
14950
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14939
14951
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14940
14952
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14953
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14941
14954
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
14942
14955
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14943
14956
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15360,6 +15373,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15360
15373
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15361
15374
|
}).strict();
|
|
15362
15375
|
|
|
15376
|
+
// ../shared-contracts/dist/thread-archive-confirm.js
|
|
15377
|
+
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15378
|
+
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15379
|
+
|
|
15363
15380
|
// ../shared-contracts/dist/client-channel.js
|
|
15364
15381
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15365
15382
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
@@ -15390,6 +15407,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15390
15407
|
cursor: clientChannelCursorSchema,
|
|
15391
15408
|
cwd: external_exports.string().optional()
|
|
15392
15409
|
}),
|
|
15410
|
+
external_exports.object({
|
|
15411
|
+
type: external_exports.literal("harness-inspection-changed"),
|
|
15412
|
+
cursor: clientChannelCursorSchema,
|
|
15413
|
+
harnessId: external_exports.string().min(1)
|
|
15414
|
+
}),
|
|
15393
15415
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
15394
15416
|
external_exports.object({
|
|
15395
15417
|
type: external_exports.literal("preferences-changed"),
|
|
@@ -15461,6 +15483,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15461
15483
|
var clientTurnSchema = external_exports.object({
|
|
15462
15484
|
id: external_exports.string().min(1),
|
|
15463
15485
|
status: external_exports.string().min(1),
|
|
15486
|
+
/** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
|
|
15487
|
+
codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
|
|
15464
15488
|
items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
|
|
15465
15489
|
/** Original file operations, independent of the cumulative Desktop fileChange card.
|
|
15466
15490
|
* Insert before the named non-file Item; null appends at the end of the Turn.
|
|
@@ -15499,7 +15523,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15499
15523
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
15500
15524
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
15501
15525
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
15502
|
-
command: external_exports.object({
|
|
15526
|
+
command: external_exports.object({
|
|
15527
|
+
name: external_exports.string().min(1),
|
|
15528
|
+
turn: clientTurnSchema,
|
|
15529
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
15530
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
15531
|
+
}).optional(),
|
|
15503
15532
|
thread: external_exports.object({
|
|
15504
15533
|
id: external_exports.string().min(1),
|
|
15505
15534
|
cwd: external_exports.string(),
|
|
@@ -15750,7 +15779,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15750
15779
|
quotaUntil: external_exports.string().optional()
|
|
15751
15780
|
}).strict().optional()
|
|
15752
15781
|
}).strict();
|
|
15753
|
-
var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
|
|
15754
15782
|
|
|
15755
15783
|
// ../shared-contracts/dist/delegation-read.js
|
|
15756
15784
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -15951,6 +15979,135 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15951
15979
|
...window2.localizations ? { localizations: window2.localizations } : {}
|
|
15952
15980
|
}, locale).label;
|
|
15953
15981
|
}
|
|
15982
|
+
function periodOrder(periodType) {
|
|
15983
|
+
if (periodType === "five_hour")
|
|
15984
|
+
return 0;
|
|
15985
|
+
if (periodType === "seven_day")
|
|
15986
|
+
return 1;
|
|
15987
|
+
if (periodType === "weekly")
|
|
15988
|
+
return 2;
|
|
15989
|
+
if (periodType === "monthly")
|
|
15990
|
+
return 3;
|
|
15991
|
+
return 4;
|
|
15992
|
+
}
|
|
15993
|
+
function groupAccountCreditsWindows(credits, locale, periodLabel, groupedPeriodLabel = periodLabel) {
|
|
15994
|
+
const entries = [
|
|
15995
|
+
{
|
|
15996
|
+
label: credits.label,
|
|
15997
|
+
periodType: credits.periodType,
|
|
15998
|
+
scope: credits.scope,
|
|
15999
|
+
localizations: credits.localizations,
|
|
16000
|
+
usedPercent: credits.usedPercent,
|
|
16001
|
+
used: credits.used,
|
|
16002
|
+
limit: credits.limit,
|
|
16003
|
+
unit: credits.unit,
|
|
16004
|
+
resetsAt: credits.resetsAt,
|
|
16005
|
+
isPrimary: true
|
|
16006
|
+
},
|
|
16007
|
+
...(credits.productUsage ?? []).map((item) => ({
|
|
16008
|
+
product: item.product,
|
|
16009
|
+
periodType: item.periodType,
|
|
16010
|
+
scope: item.scope,
|
|
16011
|
+
localizations: item.localizations,
|
|
16012
|
+
usedPercent: item.usagePercent,
|
|
16013
|
+
used: item.used,
|
|
16014
|
+
limit: item.limit,
|
|
16015
|
+
unit: item.unit,
|
|
16016
|
+
resetsAt: item.resetsAt,
|
|
16017
|
+
isPrimary: false
|
|
16018
|
+
}))
|
|
16019
|
+
];
|
|
16020
|
+
const scopeCounts = /* @__PURE__ */ new Map();
|
|
16021
|
+
for (const entry of entries) {
|
|
16022
|
+
if (entry.scope)
|
|
16023
|
+
scopeCounts.set(entry.scope.id, (scopeCounts.get(entry.scope.id) ?? 0) + 1);
|
|
16024
|
+
}
|
|
16025
|
+
const sections = /* @__PURE__ */ new Map();
|
|
16026
|
+
for (const entry of entries) {
|
|
16027
|
+
const groupedScope = entry.scope && (scopeCounts.get(entry.scope.id) ?? 0) >= 2 ? entry.scope : void 0;
|
|
16028
|
+
const key = groupedScope ? `scope:${groupedScope.id}` : "default";
|
|
16029
|
+
let section = sections.get(key);
|
|
16030
|
+
if (!section) {
|
|
16031
|
+
section = groupedScope ? {
|
|
16032
|
+
id: groupedScope.id,
|
|
16033
|
+
title: localizeHarnessPresentation(groupedScope, locale).label,
|
|
16034
|
+
windows: []
|
|
16035
|
+
} : { windows: [] };
|
|
16036
|
+
sections.set(key, section);
|
|
16037
|
+
}
|
|
16038
|
+
const inlineScope = !groupedScope && entry.scope && entry.periodType && entry.periodType !== "unknown" ? localizeHarnessPresentation(entry.scope, locale).label : void 0;
|
|
16039
|
+
const label = groupedScope && entry.periodType && entry.periodType !== "unknown" ? groupedPeriodLabel(entry.periodType) : inlineScope && entry.periodType && entry.periodType !== "unknown" ? periodLabel(entry.periodType) : accountCreditsWindowLabel(entry, locale, periodLabel);
|
|
16040
|
+
section.windows.push({
|
|
16041
|
+
order: groupedScope ? periodOrder(entry.periodType) : 0,
|
|
16042
|
+
window: {
|
|
16043
|
+
label,
|
|
16044
|
+
...inlineScope ? { scopeLabel: inlineScope } : {},
|
|
16045
|
+
usedPercent: entry.usedPercent,
|
|
16046
|
+
...entry.used === void 0 ? {} : { used: entry.used },
|
|
16047
|
+
...entry.limit === void 0 ? {} : { limit: entry.limit },
|
|
16048
|
+
...entry.unit === void 0 ? {} : { unit: entry.unit },
|
|
16049
|
+
...entry.resetsAt === void 0 ? {} : { resetsAt: entry.resetsAt },
|
|
16050
|
+
isPrimary: entry.isPrimary
|
|
16051
|
+
}
|
|
16052
|
+
});
|
|
16053
|
+
}
|
|
16054
|
+
return [...sections.values()].map(({ windows, ...section }) => ({
|
|
16055
|
+
...section,
|
|
16056
|
+
windows: (section.title !== void 0 ? [...windows].sort((left, right) => left.order - right.order) : windows).map((item) => item.window)
|
|
16057
|
+
}));
|
|
16058
|
+
}
|
|
16059
|
+
function countdownMinutes(value, nowMs) {
|
|
16060
|
+
const timestamp = typeof value === "number" ? value * 1e3 : Date.parse(value);
|
|
16061
|
+
if (!Number.isFinite(timestamp))
|
|
16062
|
+
return null;
|
|
16063
|
+
return Math.max(0, Math.ceil((timestamp - nowMs) / 6e4));
|
|
16064
|
+
}
|
|
16065
|
+
function isChineseLocale(locale) {
|
|
16066
|
+
return locale === "zh-CN" || locale.startsWith("zh-");
|
|
16067
|
+
}
|
|
16068
|
+
function compactDurationText(minutes) {
|
|
16069
|
+
if (minutes >= 1440) {
|
|
16070
|
+
const days = Math.floor(minutes / 1440);
|
|
16071
|
+
const hours2 = Math.floor(minutes % 1440 / 60);
|
|
16072
|
+
return hours2 > 0 ? `${days}d${hours2}h` : `${days}d`;
|
|
16073
|
+
}
|
|
16074
|
+
const hours = Math.floor(minutes / 60);
|
|
16075
|
+
const mins = minutes % 60;
|
|
16076
|
+
if (hours > 0)
|
|
16077
|
+
return mins > 0 ? `${hours}h${mins}m` : `${hours}h`;
|
|
16078
|
+
return `${mins}m`;
|
|
16079
|
+
}
|
|
16080
|
+
function formatAccountCreditsResetCountdown(value, locale, nowMs = Date.now()) {
|
|
16081
|
+
const minutes = countdownMinutes(value, nowMs);
|
|
16082
|
+
if (minutes === null)
|
|
16083
|
+
return null;
|
|
16084
|
+
const chinese = isChineseLocale(locale);
|
|
16085
|
+
if (minutes === 0)
|
|
16086
|
+
return chinese ? "\u5373\u5C06\u91CD\u7F6E" : "Resets soon";
|
|
16087
|
+
if (minutes >= 1440) {
|
|
16088
|
+
const days = Math.floor(minutes / 1440);
|
|
16089
|
+
const hours2 = Math.floor(minutes % 1440 / 60);
|
|
16090
|
+
if (chinese)
|
|
16091
|
+
return hours2 > 0 ? `${days} \u5929 ${hours2} \u5C0F\u65F6\u540E\u91CD\u7F6E` : `${days} \u5929\u540E\u91CD\u7F6E`;
|
|
16092
|
+
return hours2 > 0 ? `Resets in ${days}d ${hours2}h` : `Resets in ${days}d`;
|
|
16093
|
+
}
|
|
16094
|
+
const hours = Math.floor(minutes / 60);
|
|
16095
|
+
const mins = minutes % 60;
|
|
16096
|
+
if (hours > 0) {
|
|
16097
|
+
if (chinese)
|
|
16098
|
+
return mins > 0 ? `${hours} \u5C0F\u65F6 ${mins} \u5206\u540E\u91CD\u7F6E` : `${hours} \u5C0F\u65F6\u540E\u91CD\u7F6E`;
|
|
16099
|
+
return mins > 0 ? `Resets in ${hours}h ${mins}m` : `Resets in ${hours}h`;
|
|
16100
|
+
}
|
|
16101
|
+
return chinese ? `${mins} \u5206\u949F\u540E\u91CD\u7F6E` : `Resets in ${mins}m`;
|
|
16102
|
+
}
|
|
16103
|
+
function formatAccountCreditsCompactCountdown(value, locale, nowMs = Date.now()) {
|
|
16104
|
+
const minutes = countdownMinutes(value, nowMs);
|
|
16105
|
+
if (minutes === null)
|
|
16106
|
+
return null;
|
|
16107
|
+
if (minutes === 0)
|
|
16108
|
+
return isChineseLocale(locale) ? "\u5373\u5C06\u91CD\u7F6E" : "Resets soon";
|
|
16109
|
+
return compactDurationText(minutes);
|
|
16110
|
+
}
|
|
15954
16111
|
|
|
15955
16112
|
// ../shared-contracts/dist/model-price-overrides.js
|
|
15956
16113
|
var MODEL_PRICE_OVERRIDES_GET_METHOD = "codexhost/usage/model-prices/get";
|
|
@@ -16833,6 +16990,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16833
16990
|
"completed",
|
|
16834
16991
|
"failed",
|
|
16835
16992
|
"interrupted",
|
|
16993
|
+
"needsInput",
|
|
16836
16994
|
"timedOut",
|
|
16837
16995
|
"unreadable",
|
|
16838
16996
|
"notFound"
|
|
@@ -16882,13 +17040,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16882
17040
|
var thread = { ...target, threadId: identity };
|
|
16883
17041
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
16884
17042
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
17043
|
+
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
16885
17044
|
external_exports.strictObject({
|
|
16886
17045
|
kind: external_exports.literal("list"),
|
|
16887
17046
|
...target,
|
|
16888
17047
|
cursor: external_exports.string().nullable(),
|
|
16889
17048
|
archived: external_exports.boolean()
|
|
16890
17049
|
}),
|
|
16891
|
-
external_exports.strictObject({
|
|
17050
|
+
external_exports.strictObject({
|
|
17051
|
+
kind: external_exports.literal("read"),
|
|
17052
|
+
...thread,
|
|
17053
|
+
page: external_exports.strictObject({
|
|
17054
|
+
cursor: external_exports.string().min(1).max(8192).nullable(),
|
|
17055
|
+
epoch: identity.optional(),
|
|
17056
|
+
sortDirection: external_exports.enum(["asc", "desc"]).optional(),
|
|
17057
|
+
limit: external_exports.number().int().min(1).max(20).optional()
|
|
17058
|
+
}).refine((page) => page.cursor === null || page.epoch !== void 0, {
|
|
17059
|
+
message: "A history continuation requires its connection epoch"
|
|
17060
|
+
}).optional()
|
|
17061
|
+
}),
|
|
16892
17062
|
external_exports.strictObject({
|
|
16893
17063
|
kind: external_exports.literal("configure"),
|
|
16894
17064
|
...thread,
|
|
@@ -19091,6 +19261,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19091
19261
|
return fallback;
|
|
19092
19262
|
}
|
|
19093
19263
|
|
|
19264
|
+
// src/settings/harness-version-messages.ts
|
|
19265
|
+
var harnessVersionEnglish = Object.freeze({
|
|
19266
|
+
locale: "en",
|
|
19267
|
+
unknown: "Unknown",
|
|
19268
|
+
trackingBranch: "Tracking branch (new commits)",
|
|
19269
|
+
notes: Object.freeze({
|
|
19270
|
+
"original-installer": "Use the original installer, package manager, or launcher to update this installation."
|
|
19271
|
+
})
|
|
19272
|
+
});
|
|
19273
|
+
var harnessVersionChinese = Object.freeze({
|
|
19274
|
+
locale: "zh-CN",
|
|
19275
|
+
unknown: "\u672A\u77E5",
|
|
19276
|
+
trackingBranch: "\u8DDF\u8E2A\u5206\u652F\uFF08\u6709\u65B0\u63D0\u4EA4\uFF09",
|
|
19277
|
+
notes: Object.freeze({
|
|
19278
|
+
"original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u7A0B\u5E8F\u3001\u5305\u7BA1\u7406\u5668\u6216\u542F\u52A8\u5668\u66F4\u65B0\u6B64\u5B89\u88C5\u3002"
|
|
19279
|
+
})
|
|
19280
|
+
});
|
|
19281
|
+
function harnessVersionLabel(state, messages) {
|
|
19282
|
+
if (!state) return "\u2014";
|
|
19283
|
+
if (state.latestVersionKind === "unknown" || state.latestVersion === "Unknown")
|
|
19284
|
+
return messages.unknown;
|
|
19285
|
+
if (state.latestVersionKind === "tracking-branch" || state.latestVersion === "Tracking branch (new commits)")
|
|
19286
|
+
return messages.trackingBranch;
|
|
19287
|
+
return state.latestVersion;
|
|
19288
|
+
}
|
|
19289
|
+
function harnessVersionNote(state, messages) {
|
|
19290
|
+
if (state?.notice) return localizeHarnessText(state.notice, messages.locale);
|
|
19291
|
+
const code = state?.messageCode;
|
|
19292
|
+
return code && Object.hasOwn(messages.notes, code) ? messages.notes[code] : void 0;
|
|
19293
|
+
}
|
|
19294
|
+
|
|
19094
19295
|
// ../../node_modules/lucide/dist/esm/icons/smartphone.mjs
|
|
19095
19296
|
var Smartphone = [
|
|
19096
19297
|
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }],
|
|
@@ -19564,273 +19765,474 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19564
19765
|
return svg2;
|
|
19565
19766
|
}
|
|
19566
19767
|
|
|
19567
|
-
// src/settings/
|
|
19568
|
-
function
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
19579
|
-
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
19580
|
-
label.append(input);
|
|
19581
|
-
const help = document2.createElement("p");
|
|
19582
|
-
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.";
|
|
19583
|
-
const actions = document2.createElement("div");
|
|
19584
|
-
actions.className = "settings-harness-launch__actions";
|
|
19585
|
-
const save = document2.createElement("button");
|
|
19586
|
-
save.type = "button";
|
|
19587
|
-
save.className = "settings-command-button";
|
|
19588
|
-
save.textContent = messages.launchPathSave;
|
|
19589
|
-
const reset = document2.createElement("button");
|
|
19590
|
-
reset.type = "button";
|
|
19591
|
-
reset.className = "settings-command-button settings-command-button--secondary";
|
|
19592
|
-
reset.textContent = messages.launchPathReset;
|
|
19593
|
-
const status = document2.createElement("p");
|
|
19594
|
-
status.setAttribute("role", "status");
|
|
19595
|
-
status.setAttribute("aria-live", "polite");
|
|
19596
|
-
actions.append(save, reset);
|
|
19597
|
-
section.append(label, help, actions, status);
|
|
19598
|
-
let busy = true;
|
|
19599
|
-
let loaded = false;
|
|
19600
|
-
const controls = () => {
|
|
19601
|
-
input.disabled = busy || !loaded;
|
|
19602
|
-
save.disabled = busy || !loaded || !input.value.trim();
|
|
19603
|
-
reset.disabled = busy || !loaded;
|
|
19604
|
-
};
|
|
19605
|
-
const show = (value) => {
|
|
19606
|
-
input.value = value.path ?? "";
|
|
19607
|
-
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
19608
|
-
};
|
|
19609
|
-
const persist = async (value) => {
|
|
19610
|
-
if (busy || !loaded) return;
|
|
19611
|
-
busy = true;
|
|
19612
|
-
controls();
|
|
19613
|
-
status.textContent = messages.launchPathSaving;
|
|
19614
|
-
try {
|
|
19615
|
-
show(await settings.set(value));
|
|
19616
|
-
} catch {
|
|
19617
|
-
status.textContent = messages.launchPathSaveError;
|
|
19618
|
-
} finally {
|
|
19619
|
-
busy = false;
|
|
19620
|
-
controls();
|
|
19621
|
-
}
|
|
19622
|
-
};
|
|
19623
|
-
input.addEventListener("input", controls);
|
|
19624
|
-
save.addEventListener("click", () => {
|
|
19625
|
-
if (input.value.trim()) void persist(input.value.trim());
|
|
19626
|
-
});
|
|
19627
|
-
reset.addEventListener("click", () => {
|
|
19628
|
-
void persist(null);
|
|
19629
|
-
});
|
|
19630
|
-
controls();
|
|
19631
|
-
status.textContent = messages.launchPathLoading;
|
|
19632
|
-
void settings.get().then((value) => {
|
|
19633
|
-
loaded = true;
|
|
19634
|
-
show(value);
|
|
19635
|
-
}).catch(() => {
|
|
19636
|
-
loaded = true;
|
|
19637
|
-
status.textContent = messages.launchPathLoadError;
|
|
19638
|
-
}).finally(() => {
|
|
19639
|
-
busy = false;
|
|
19640
|
-
controls();
|
|
19641
|
-
});
|
|
19642
|
-
return section;
|
|
19643
|
-
}
|
|
19644
|
-
|
|
19645
|
-
// src/settings/harness-installation-guides.ts
|
|
19646
|
-
function harnessHasInstallCommands(plugin) {
|
|
19647
|
-
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
19768
|
+
// src/settings/connection-row.ts
|
|
19769
|
+
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
19770
|
+
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
19771
|
+
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
19772
|
+
if (availability === "ready") return messages.connectionStatusReady;
|
|
19773
|
+
if (availability === "checking") return messages.connectionStatusChecking;
|
|
19774
|
+
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
19775
|
+
if (availability === "unavailable" || availability === "error") {
|
|
19776
|
+
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
19777
|
+
}
|
|
19778
|
+
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
19648
19779
|
}
|
|
19649
|
-
function
|
|
19650
|
-
|
|
19651
|
-
|
|
19652
|
-
return
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
before: text(guide?.before),
|
|
19657
|
-
after: text(guide?.after)
|
|
19658
|
-
};
|
|
19780
|
+
function connectionStatusTone(availability, hasError = false) {
|
|
19781
|
+
if (availability === "updating") return "checking";
|
|
19782
|
+
if (hasError && availability !== "notInstalled") return "failed";
|
|
19783
|
+
if (availability === "ready") return "ready";
|
|
19784
|
+
if (availability === "checking" || availability === "installing") return "checking";
|
|
19785
|
+
if (availability === "notInstalled") return "setup";
|
|
19786
|
+
return "failed";
|
|
19659
19787
|
}
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
|
|
19670
|
-
panel.append(p);
|
|
19671
|
-
};
|
|
19672
|
-
if (hostId2 !== "local") {
|
|
19673
|
-
paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
|
|
19788
|
+
function createConnectionIdentityIcon(document2, item, size) {
|
|
19789
|
+
const container = document2.createElement("span");
|
|
19790
|
+
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
19791
|
+
container.setAttribute("aria-hidden", "true");
|
|
19792
|
+
if (item.agentSnapshot) {
|
|
19793
|
+
container.append(
|
|
19794
|
+
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
19795
|
+
);
|
|
19796
|
+
} else {
|
|
19797
|
+
container.textContent = "CH";
|
|
19674
19798
|
}
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
install2.disabled = installation.status !== "idle";
|
|
19682
|
-
install2.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
|
|
19683
|
-
install2.addEventListener("click", () => {
|
|
19684
|
-
if (install2.disabled) return;
|
|
19685
|
-
install2.disabled = true;
|
|
19686
|
-
install2.textContent = messages.connectionStatusInstalling;
|
|
19687
|
-
installation.run();
|
|
19688
|
-
});
|
|
19689
|
-
if (guide.commands.length > 1) panel.append(install2);
|
|
19799
|
+
return container;
|
|
19800
|
+
}
|
|
19801
|
+
function sameElementChildren(container, next) {
|
|
19802
|
+
if (container.children.length !== next.length) return false;
|
|
19803
|
+
for (let index = 0; index < next.length; index++) {
|
|
19804
|
+
if (container.children[index] !== next[index]) return false;
|
|
19690
19805
|
}
|
|
19691
|
-
|
|
19692
|
-
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
code.textContent = command;
|
|
19699
|
-
pre.append(code);
|
|
19700
|
-
const button2 = document2.createElement("button");
|
|
19701
|
-
button2.type = "button";
|
|
19702
|
-
button2.className = "settings-command-button settings-command-button--secondary";
|
|
19703
|
-
button2.dataset.connectionAction = "copy-install";
|
|
19704
|
-
const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
|
|
19705
|
-
button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
|
|
19706
|
-
button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
|
|
19707
|
-
button2.addEventListener("click", () => copy(button2, command, copyLabel));
|
|
19708
|
-
const actions = document2.createElement("div");
|
|
19709
|
-
actions.className = "settings-harness-installation-actions";
|
|
19710
|
-
if (install2 && guide.commands.length === 1) actions.append(install2);
|
|
19711
|
-
actions.append(button2);
|
|
19712
|
-
block.append(label, pre, actions);
|
|
19713
|
-
panel.append(block);
|
|
19806
|
+
return true;
|
|
19807
|
+
}
|
|
19808
|
+
function reconcileElementChildren(container, next) {
|
|
19809
|
+
if (sameElementChildren(container, next)) return;
|
|
19810
|
+
if (typeof container.insertBefore !== "function") {
|
|
19811
|
+
container.replaceChildren(...next);
|
|
19812
|
+
return;
|
|
19714
19813
|
}
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
link.href = download2.url;
|
|
19719
|
-
link.target = "_blank";
|
|
19720
|
-
link.rel = "noopener noreferrer";
|
|
19721
|
-
link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
|
|
19722
|
-
link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
|
|
19723
|
-
panel.append(link);
|
|
19814
|
+
const nextSet = new Set(next);
|
|
19815
|
+
for (const child of [...container.children]) {
|
|
19816
|
+
if (!nextSet.has(child)) child.remove();
|
|
19724
19817
|
}
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
panel.append(link);
|
|
19818
|
+
for (let index = 0; index < next.length; index++) {
|
|
19819
|
+
const desired = next[index];
|
|
19820
|
+
if (!desired) continue;
|
|
19821
|
+
const current = container.children[index] ?? null;
|
|
19822
|
+
if (current !== desired) {
|
|
19823
|
+
container.insertBefore(desired, current);
|
|
19824
|
+
}
|
|
19733
19825
|
}
|
|
19734
|
-
return panel;
|
|
19735
|
-
}
|
|
19736
|
-
|
|
19737
|
-
// src/settings/harness-install-store.ts
|
|
19738
|
-
function errorMessage(error51) {
|
|
19739
|
-
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.";
|
|
19740
19826
|
}
|
|
19741
|
-
function
|
|
19742
|
-
|
|
19827
|
+
function identityIconSignature(item) {
|
|
19828
|
+
if (!item.agentSnapshot) return "adapter";
|
|
19829
|
+
const plugin = item.agentSnapshot.plugin;
|
|
19830
|
+
return `${item.agentSnapshot.agent}:${String(plugin?.icon ?? "")}:${String(plugin?.iconStyle ?? "")}`;
|
|
19743
19831
|
}
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
const
|
|
19749
|
-
|
|
19832
|
+
function createConnectionRowView(document2, messages, groupable) {
|
|
19833
|
+
const row = document2.createElement("div");
|
|
19834
|
+
row.className = "settings-connection-row";
|
|
19835
|
+
row.setAttribute("role", "row");
|
|
19836
|
+
const identity3 = document2.createElement("div");
|
|
19837
|
+
identity3.className = "settings-connection-row__identity";
|
|
19838
|
+
identity3.setAttribute("role", "cell");
|
|
19839
|
+
let handle = null;
|
|
19840
|
+
if (groupable) {
|
|
19841
|
+
handle = document2.createElement("span");
|
|
19842
|
+
handle.className = "settings-connection-row__handle";
|
|
19843
|
+
handle.setAttribute("aria-hidden", "true");
|
|
19844
|
+
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
19845
|
+
identity3.append(handle);
|
|
19846
|
+
}
|
|
19847
|
+
let iconElement = null;
|
|
19848
|
+
let renderedIconKey = null;
|
|
19849
|
+
const label = document2.createElement("strong");
|
|
19850
|
+
const status = document2.createElement("span");
|
|
19851
|
+
status.className = "settings-connection-row__status";
|
|
19852
|
+
status.setAttribute("role", "cell");
|
|
19853
|
+
const action = document2.createElement("div");
|
|
19854
|
+
action.className = "settings-connection-row__action";
|
|
19855
|
+
action.setAttribute("role", "cell");
|
|
19856
|
+
row.append(identity3, status, action);
|
|
19857
|
+
let currentItem = null;
|
|
19858
|
+
let currentSelect = () => void 0;
|
|
19859
|
+
let currentGroup = null;
|
|
19860
|
+
let installButton = null;
|
|
19861
|
+
let viewErrorButton = null;
|
|
19862
|
+
let versionAvailableBadge = null;
|
|
19863
|
+
let updateButton = null;
|
|
19864
|
+
let groupToggleButton = null;
|
|
19865
|
+
let groupToggleSection = null;
|
|
19866
|
+
row.addEventListener("click", (event) => {
|
|
19867
|
+
const target2 = event.target;
|
|
19868
|
+
if (target2?.closest?.("a")) return;
|
|
19869
|
+
currentSelect();
|
|
19870
|
+
});
|
|
19871
|
+
row.addEventListener("keydown", (event) => {
|
|
19872
|
+
if (event.target?.closest?.("button, a")) return;
|
|
19873
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
19874
|
+
event.preventDefault();
|
|
19875
|
+
currentSelect();
|
|
19876
|
+
});
|
|
19877
|
+
if (groupable) {
|
|
19878
|
+
row.addEventListener("dragstart", (event) => currentGroup?.onDragStart(event));
|
|
19879
|
+
row.addEventListener("dragover", (event) => currentGroup?.onDragOver(event));
|
|
19880
|
+
row.addEventListener("dragleave", (event) => currentGroup?.onDragLeave(event));
|
|
19881
|
+
row.addEventListener("drop", (event) => currentGroup?.onDrop(event));
|
|
19882
|
+
row.addEventListener("dragend", (event) => currentGroup?.onDragEnd(event));
|
|
19883
|
+
}
|
|
19884
|
+
const setSelected = (selected) => {
|
|
19885
|
+
const nextSelected = String(selected);
|
|
19886
|
+
if (row.dataset.connectionSelected !== nextSelected) {
|
|
19887
|
+
row.dataset.connectionSelected = nextSelected;
|
|
19888
|
+
}
|
|
19889
|
+
const nextTabIndex = selected ? 0 : -1;
|
|
19890
|
+
if (row.tabIndex !== nextTabIndex) {
|
|
19891
|
+
row.tabIndex = nextTabIndex;
|
|
19892
|
+
}
|
|
19893
|
+
};
|
|
19750
19894
|
return {
|
|
19751
|
-
|
|
19752
|
-
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
try {
|
|
19770
|
-
await diagnostics.installation(host, agent, "install");
|
|
19771
|
-
states2.set(id, { status: "checking" });
|
|
19772
|
-
notify2();
|
|
19773
|
-
} catch (error51) {
|
|
19774
|
-
failure = errorMessage(error51);
|
|
19895
|
+
element: row,
|
|
19896
|
+
setSelected,
|
|
19897
|
+
update(item, selected, select, group) {
|
|
19898
|
+
currentItem = item;
|
|
19899
|
+
currentSelect = select;
|
|
19900
|
+
currentGroup = group;
|
|
19901
|
+
if (row.dataset.connectionItem !== item.key) {
|
|
19902
|
+
row.dataset.connectionItem = item.key;
|
|
19903
|
+
}
|
|
19904
|
+
setSelected(selected);
|
|
19905
|
+
const nextIconKey = identityIconSignature(item);
|
|
19906
|
+
if (renderedIconKey !== nextIconKey || !iconElement) {
|
|
19907
|
+
renderedIconKey = nextIconKey;
|
|
19908
|
+
iconElement = createConnectionIdentityIcon(document2, item, 19);
|
|
19909
|
+
reconcileElementChildren(
|
|
19910
|
+
identity3,
|
|
19911
|
+
handle ? [handle, iconElement, label] : [iconElement, label]
|
|
19912
|
+
);
|
|
19775
19913
|
}
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
|
|
19780
|
-
|
|
19781
|
-
|
|
19914
|
+
if (handle && group && handle.title !== group.dragHandleTitle) {
|
|
19915
|
+
handle.title = group.dragHandleTitle;
|
|
19916
|
+
}
|
|
19917
|
+
if (label.textContent !== item.name) {
|
|
19918
|
+
label.textContent = item.name;
|
|
19919
|
+
}
|
|
19920
|
+
const tone = connectionStatusTone(item.availability, item.error !== null);
|
|
19921
|
+
if (status.dataset.connectionTone !== tone) {
|
|
19922
|
+
status.dataset.connectionTone = tone;
|
|
19923
|
+
}
|
|
19924
|
+
const statusText = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
19925
|
+
if (status.textContent !== statusText) {
|
|
19926
|
+
status.textContent = statusText;
|
|
19927
|
+
}
|
|
19928
|
+
const nextActions = [];
|
|
19929
|
+
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
19930
|
+
if (!installButton) {
|
|
19931
|
+
const button2 = document2.createElement("button");
|
|
19932
|
+
button2.type = "button";
|
|
19933
|
+
button2.className = "settings-connection-install-link";
|
|
19934
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
19935
|
+
button2.addEventListener("click", (event) => {
|
|
19936
|
+
event.stopPropagation();
|
|
19937
|
+
currentSelect();
|
|
19938
|
+
currentItem?.install?.();
|
|
19939
|
+
});
|
|
19940
|
+
installButton = button2;
|
|
19941
|
+
}
|
|
19942
|
+
installButton.disabled = item.availability === "installing" || item.availability === "checking";
|
|
19943
|
+
const installLabel = messages.connectionInstall;
|
|
19944
|
+
const ariaLabel = `${installLabel}: ${item.name}`;
|
|
19945
|
+
if (installButton.getAttribute("aria-label") !== ariaLabel) {
|
|
19946
|
+
installButton.setAttribute("aria-label", ariaLabel);
|
|
19947
|
+
}
|
|
19948
|
+
if (installButton.title !== installLabel) {
|
|
19949
|
+
installButton.title = installLabel;
|
|
19950
|
+
}
|
|
19951
|
+
nextActions.push(installButton);
|
|
19952
|
+
} else if (item.error) {
|
|
19953
|
+
if (!viewErrorButton) {
|
|
19954
|
+
const button2 = document2.createElement("button");
|
|
19955
|
+
button2.type = "button";
|
|
19956
|
+
button2.className = "settings-connection-view-error";
|
|
19957
|
+
button2.textContent = messages.connectionViewError;
|
|
19958
|
+
button2.addEventListener("click", (event) => {
|
|
19959
|
+
event.stopPropagation();
|
|
19960
|
+
currentSelect();
|
|
19961
|
+
});
|
|
19962
|
+
viewErrorButton = button2;
|
|
19963
|
+
}
|
|
19964
|
+
nextActions.push(viewErrorButton);
|
|
19965
|
+
}
|
|
19966
|
+
const version2 = item.version;
|
|
19967
|
+
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
19968
|
+
if (!versionAvailableBadge) {
|
|
19969
|
+
const badge = document2.createElement("span");
|
|
19970
|
+
badge.className = "settings-connection-version-available";
|
|
19971
|
+
badge.textContent = messages.harnessVersionAvailable;
|
|
19972
|
+
versionAvailableBadge = badge;
|
|
19973
|
+
}
|
|
19974
|
+
const badgeTitle = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
19975
|
+
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
19976
|
+
if (versionAvailableBadge.title !== badgeTitle) {
|
|
19977
|
+
versionAvailableBadge.title = badgeTitle;
|
|
19978
|
+
}
|
|
19979
|
+
nextActions.push(versionAvailableBadge);
|
|
19980
|
+
}
|
|
19981
|
+
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
19982
|
+
if (!updateButton) {
|
|
19983
|
+
const button2 = document2.createElement("button");
|
|
19984
|
+
button2.type = "button";
|
|
19985
|
+
button2.className = "settings-connection-install-link";
|
|
19986
|
+
button2.dataset.connectionAction = "update";
|
|
19987
|
+
button2.append(createRendererSettingsIcon("download", 17));
|
|
19988
|
+
button2.addEventListener("click", (event) => {
|
|
19989
|
+
event.stopPropagation();
|
|
19990
|
+
if (button2.disabled) return;
|
|
19991
|
+
void currentItem?.version?.update();
|
|
19992
|
+
currentSelect();
|
|
19993
|
+
});
|
|
19994
|
+
updateButton = button2;
|
|
19995
|
+
}
|
|
19996
|
+
updateButton.disabled = version2.updating;
|
|
19997
|
+
if (updateButton.title !== messages.harnessVersionUpdate) {
|
|
19998
|
+
updateButton.title = messages.harnessVersionUpdate;
|
|
19999
|
+
}
|
|
20000
|
+
const updateAriaLabel = `${messages.harnessVersionUpdate}: ${item.name}`;
|
|
20001
|
+
if (updateButton.getAttribute("aria-label") !== updateAriaLabel) {
|
|
20002
|
+
updateButton.setAttribute("aria-label", updateAriaLabel);
|
|
20003
|
+
}
|
|
20004
|
+
nextActions.push(updateButton);
|
|
20005
|
+
}
|
|
20006
|
+
if (group) {
|
|
20007
|
+
if (!groupToggleButton) {
|
|
20008
|
+
const button2 = document2.createElement("button");
|
|
20009
|
+
button2.type = "button";
|
|
20010
|
+
button2.className = "settings-connection-row__group-toggle";
|
|
20011
|
+
button2.addEventListener("click", (event) => {
|
|
20012
|
+
event.stopPropagation();
|
|
20013
|
+
currentGroup?.toggleSection();
|
|
20014
|
+
});
|
|
20015
|
+
groupToggleButton = button2;
|
|
20016
|
+
}
|
|
20017
|
+
groupToggleButton.disabled = group.disabled;
|
|
20018
|
+
if (groupToggleButton.title !== group.moveLabel) {
|
|
20019
|
+
groupToggleButton.title = group.moveLabel;
|
|
20020
|
+
}
|
|
20021
|
+
if (groupToggleButton.getAttribute("aria-label") !== group.moveLabel) {
|
|
20022
|
+
groupToggleButton.setAttribute("aria-label", group.moveLabel);
|
|
20023
|
+
}
|
|
20024
|
+
if (groupToggleSection !== group.section) {
|
|
20025
|
+
groupToggleSection = group.section;
|
|
20026
|
+
groupToggleButton.replaceChildren(
|
|
20027
|
+
createRendererSettingsIcon(
|
|
20028
|
+
group.section === "main" ? "chevron-down" : "chevron-up",
|
|
20029
|
+
15
|
|
20030
|
+
)
|
|
20031
|
+
);
|
|
20032
|
+
}
|
|
20033
|
+
nextActions.push(groupToggleButton);
|
|
20034
|
+
}
|
|
20035
|
+
reconcileElementChildren(action, nextActions);
|
|
20036
|
+
if (group) {
|
|
20037
|
+
row.draggable = !group.disabled;
|
|
20038
|
+
if (row.dataset.connectionGroupSection !== group.section) {
|
|
20039
|
+
row.dataset.connectionGroupSection = group.section;
|
|
19782
20040
|
}
|
|
19783
|
-
} catch (error51) {
|
|
19784
|
-
failure ??= errorMessage(error51);
|
|
19785
20041
|
}
|
|
19786
|
-
if (failure) states2.set(id, { status: "error", error: failure });
|
|
19787
|
-
else states2.delete(id);
|
|
19788
|
-
notify2();
|
|
19789
20042
|
}
|
|
19790
20043
|
};
|
|
19791
20044
|
}
|
|
19792
|
-
|
|
19793
|
-
|
|
20045
|
+
|
|
20046
|
+
// src/settings/connection-updates.ts
|
|
20047
|
+
var sharedBatchStores = /* @__PURE__ */ new WeakMap();
|
|
20048
|
+
function getBatchStore(diagnostics) {
|
|
20049
|
+
if (!diagnostics) {
|
|
20050
|
+
return { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
20051
|
+
}
|
|
20052
|
+
let store = sharedBatchStores.get(diagnostics);
|
|
19794
20053
|
if (!store) {
|
|
19795
|
-
store =
|
|
19796
|
-
|
|
20054
|
+
store = { batches: /* @__PURE__ */ new Map(), listeners: /* @__PURE__ */ new Set() };
|
|
20055
|
+
sharedBatchStores.set(diagnostics, store);
|
|
19797
20056
|
}
|
|
19798
20057
|
return store;
|
|
19799
20058
|
}
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
|
|
19813
|
-
|
|
19814
|
-
|
|
19815
|
-
|
|
19816
|
-
|
|
19817
|
-
|
|
19818
|
-
|
|
19819
|
-
|
|
19820
|
-
|
|
19821
|
-
|
|
19822
|
-
|
|
19823
|
-
|
|
19824
|
-
|
|
19825
|
-
|
|
19826
|
-
|
|
19827
|
-
|
|
19828
|
-
|
|
19829
|
-
|
|
20059
|
+
function createConnectionUpdates(document2, messages, signal, onChange, diagnostics = null) {
|
|
20060
|
+
const store = getBatchStore(diagnostics);
|
|
20061
|
+
const notify2 = () => {
|
|
20062
|
+
for (const listener of [...store.listeners]) listener();
|
|
20063
|
+
};
|
|
20064
|
+
if (!signal.aborted) {
|
|
20065
|
+
const listener = () => {
|
|
20066
|
+
if (!signal.aborted) onChange();
|
|
20067
|
+
};
|
|
20068
|
+
store.listeners.add(listener);
|
|
20069
|
+
signal.addEventListener(
|
|
20070
|
+
"abort",
|
|
20071
|
+
() => {
|
|
20072
|
+
store.listeners.delete(listener);
|
|
20073
|
+
},
|
|
20074
|
+
{ once: true }
|
|
20075
|
+
);
|
|
20076
|
+
}
|
|
20077
|
+
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
20078
|
+
const start = async (hostId2, panels) => {
|
|
20079
|
+
if (signal.aborted || store.batches.get(hostId2)?.running) return;
|
|
20080
|
+
const targets = eligible(panels);
|
|
20081
|
+
if (!targets.length) return;
|
|
20082
|
+
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
20083
|
+
store.batches.set(hostId2, batch);
|
|
20084
|
+
notify2();
|
|
20085
|
+
await Promise.all(
|
|
20086
|
+
targets.map(async (panel) => {
|
|
20087
|
+
try {
|
|
20088
|
+
if (await panel.update()) batch.succeeded++;
|
|
20089
|
+
else batch.failed++;
|
|
20090
|
+
} catch {
|
|
20091
|
+
batch.failed++;
|
|
20092
|
+
}
|
|
20093
|
+
notify2();
|
|
20094
|
+
})
|
|
20095
|
+
);
|
|
20096
|
+
batch.running = false;
|
|
20097
|
+
notify2();
|
|
20098
|
+
};
|
|
20099
|
+
return {
|
|
20100
|
+
createControls(hostId2, panels) {
|
|
20101
|
+
let currentHostId = hostId2;
|
|
20102
|
+
let currentPanels = panels;
|
|
20103
|
+
let renderedLabel = null;
|
|
20104
|
+
const button2 = document2.createElement("button");
|
|
20105
|
+
button2.type = "button";
|
|
20106
|
+
button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
|
|
20107
|
+
button2.dataset.connectionAction = "update-all";
|
|
20108
|
+
button2.title = messages.harnessUpdateAllDescription;
|
|
20109
|
+
button2.addEventListener("click", () => {
|
|
20110
|
+
if (!button2.disabled) void start(currentHostId, currentPanels);
|
|
20111
|
+
});
|
|
20112
|
+
const result = document2.createElement("p");
|
|
20113
|
+
result.className = "settings-connection-update-result";
|
|
20114
|
+
result.setAttribute("role", "status");
|
|
20115
|
+
const update = (nextHostId, nextPanels) => {
|
|
20116
|
+
currentHostId = nextHostId;
|
|
20117
|
+
currentPanels = nextPanels;
|
|
20118
|
+
const batch = store.batches.get(nextHostId);
|
|
20119
|
+
const count3 = eligible(nextPanels).length;
|
|
20120
|
+
button2.disabled = signal.aborted || Boolean(batch?.running) || !count3;
|
|
20121
|
+
const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count3 ? `${messages.harnessUpdateAll} (${count3})` : messages.harnessUpdateAll;
|
|
20122
|
+
if (renderedLabel !== label) {
|
|
20123
|
+
renderedLabel = label;
|
|
20124
|
+
button2.replaceChildren(createRendererSettingsIcon("download", 15), label);
|
|
20125
|
+
}
|
|
20126
|
+
const hidden = !batch || batch.running;
|
|
20127
|
+
result.hidden = hidden;
|
|
20128
|
+
const resultText = batch && !batch.running ? messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed)) : "";
|
|
20129
|
+
if (result.textContent !== resultText) {
|
|
20130
|
+
result.textContent = resultText;
|
|
20131
|
+
}
|
|
20132
|
+
};
|
|
20133
|
+
update(hostId2, panels);
|
|
20134
|
+
return { button: button2, result, update };
|
|
20135
|
+
}
|
|
20136
|
+
};
|
|
19830
20137
|
}
|
|
19831
20138
|
|
|
19832
20139
|
// src/settings/harness-version-panel.ts
|
|
19833
|
-
function
|
|
20140
|
+
function isUnsupportedInstallationError(error51) {
|
|
20141
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
20142
|
+
}
|
|
20143
|
+
function createHarnessVersionSession(client, options) {
|
|
20144
|
+
let state;
|
|
20145
|
+
let statusKind = "checking";
|
|
20146
|
+
let checkPromise = null;
|
|
20147
|
+
let updatePromise = null;
|
|
20148
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
20149
|
+
const signal = options?.signal;
|
|
20150
|
+
const notify2 = (pageChange) => {
|
|
20151
|
+
if (signal?.aborted) return;
|
|
20152
|
+
for (const listener of [...listeners]) listener(pageChange);
|
|
20153
|
+
};
|
|
20154
|
+
const check2 = () => {
|
|
20155
|
+
if (signal?.aborted || updatePromise) return Promise.resolve();
|
|
20156
|
+
if (checkPromise) return checkPromise;
|
|
20157
|
+
statusKind = "checking";
|
|
20158
|
+
notify2(false);
|
|
20159
|
+
checkPromise = (async () => {
|
|
20160
|
+
try {
|
|
20161
|
+
const result = await client.run("check");
|
|
20162
|
+
if (signal?.aborted || updatePromise) return;
|
|
20163
|
+
state = result;
|
|
20164
|
+
statusKind = "idle";
|
|
20165
|
+
} catch (error51) {
|
|
20166
|
+
if (signal?.aborted || updatePromise) return;
|
|
20167
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
20168
|
+
if (state) state = { ...state, canUpdate: false };
|
|
20169
|
+
} finally {
|
|
20170
|
+
checkPromise = null;
|
|
20171
|
+
if (!signal?.aborted && !updatePromise) {
|
|
20172
|
+
notify2(true);
|
|
20173
|
+
}
|
|
20174
|
+
}
|
|
20175
|
+
})();
|
|
20176
|
+
return checkPromise;
|
|
20177
|
+
};
|
|
20178
|
+
const update = () => {
|
|
20179
|
+
if (updatePromise) return updatePromise;
|
|
20180
|
+
updatePromise = (async () => {
|
|
20181
|
+
if (signal?.aborted) return false;
|
|
20182
|
+
if (checkPromise) await checkPromise;
|
|
20183
|
+
if (signal?.aborted || statusKind === "unsupported" || !state?.canUpdate || !state.updateAvailable) {
|
|
20184
|
+
return false;
|
|
20185
|
+
}
|
|
20186
|
+
statusKind = "updating";
|
|
20187
|
+
notify2(true);
|
|
20188
|
+
try {
|
|
20189
|
+
const result = await client.run("update");
|
|
20190
|
+
if (signal?.aborted) return false;
|
|
20191
|
+
state = result;
|
|
20192
|
+
statusKind = !result.canUpdate ? "updated" : result.updateAvailable ? "failed" : "updated";
|
|
20193
|
+
return result.canUpdate && !result.updateAvailable;
|
|
20194
|
+
} catch (error51) {
|
|
20195
|
+
if (signal?.aborted) return false;
|
|
20196
|
+
statusKind = isUnsupportedInstallationError(error51) ? "unsupported" : "failed";
|
|
20197
|
+
if (state) state = { ...state, canUpdate: false };
|
|
20198
|
+
return false;
|
|
20199
|
+
} finally {
|
|
20200
|
+
updatePromise = null;
|
|
20201
|
+
if (!signal?.aborted) {
|
|
20202
|
+
notify2(true);
|
|
20203
|
+
}
|
|
20204
|
+
}
|
|
20205
|
+
})();
|
|
20206
|
+
return updatePromise;
|
|
20207
|
+
};
|
|
20208
|
+
return {
|
|
20209
|
+
get state() {
|
|
20210
|
+
return state;
|
|
20211
|
+
},
|
|
20212
|
+
get statusKind() {
|
|
20213
|
+
return statusKind;
|
|
20214
|
+
},
|
|
20215
|
+
get updating() {
|
|
20216
|
+
return statusKind === "updating";
|
|
20217
|
+
},
|
|
20218
|
+
prepareMount() {
|
|
20219
|
+
if (updatePromise || checkPromise) return false;
|
|
20220
|
+
statusKind = "checking";
|
|
20221
|
+
return true;
|
|
20222
|
+
},
|
|
20223
|
+
check: check2,
|
|
20224
|
+
update,
|
|
20225
|
+
subscribe(listener) {
|
|
20226
|
+
listeners.add(listener);
|
|
20227
|
+
return () => {
|
|
20228
|
+
listeners.delete(listener);
|
|
20229
|
+
};
|
|
20230
|
+
}
|
|
20231
|
+
};
|
|
20232
|
+
}
|
|
20233
|
+
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0, sharedSession) {
|
|
20234
|
+
const session = sharedSession ?? createHarnessVersionSession(client, { signal });
|
|
20235
|
+
const shouldScheduleCheck = session.prepareMount();
|
|
19834
20236
|
const panel = document2.createElement("section");
|
|
19835
20237
|
panel.className = "settings-harness-version";
|
|
19836
20238
|
panel.dataset.harnessVersion = agent;
|
|
@@ -19854,15 +20256,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19854
20256
|
note.textContent = messages.harnessVersionNote;
|
|
19855
20257
|
actions.append(update);
|
|
19856
20258
|
panel.append(heading, versions, status, actions, note);
|
|
19857
|
-
let state;
|
|
19858
|
-
let busy = false;
|
|
19859
|
-
let updating = false;
|
|
19860
|
-
let unsupported = false;
|
|
19861
|
-
let updatePromise = null;
|
|
19862
20259
|
const render = () => {
|
|
20260
|
+
const state = session.state;
|
|
20261
|
+
const statusKind = session.statusKind;
|
|
20262
|
+
const busy = statusKind === "checking" || statusKind === "updating";
|
|
19863
20263
|
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
19864
20264
|
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
19865
20265
|
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
20266
|
+
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 : "";
|
|
19866
20267
|
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
19867
20268
|
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
19868
20269
|
actions.replaceChildren(update);
|
|
@@ -19881,99 +20282,92 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19881
20282
|
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
19882
20283
|
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
19883
20284
|
};
|
|
19884
|
-
|
|
19885
|
-
if (
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
onChange();
|
|
19890
|
-
status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
|
|
20285
|
+
update.addEventListener("click", () => {
|
|
20286
|
+
if (!signal.aborted) void session.update();
|
|
20287
|
+
});
|
|
20288
|
+
const unsubscribe = session.subscribe((pageChange) => {
|
|
20289
|
+
if (signal.aborted) return;
|
|
19891
20290
|
render();
|
|
19892
|
-
|
|
19893
|
-
|
|
19894
|
-
if (signal.aborted) return false;
|
|
19895
|
-
state = result;
|
|
19896
|
-
status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
|
|
19897
|
-
return result.canUpdate && !result.updateAvailable;
|
|
19898
|
-
} catch (error51) {
|
|
19899
|
-
if (signal.aborted) return false;
|
|
19900
|
-
unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
19901
|
-
status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
|
|
19902
|
-
if (state) state = { ...state, canUpdate: false };
|
|
19903
|
-
return false;
|
|
19904
|
-
} finally {
|
|
19905
|
-
busy = false;
|
|
19906
|
-
updating = false;
|
|
19907
|
-
if (!signal.aborted) {
|
|
19908
|
-
render();
|
|
19909
|
-
onChange();
|
|
19910
|
-
}
|
|
19911
|
-
}
|
|
19912
|
-
};
|
|
19913
|
-
const updateVersion = () => {
|
|
19914
|
-
updatePromise ??= run("update").finally(() => {
|
|
19915
|
-
updatePromise = null;
|
|
19916
|
-
});
|
|
19917
|
-
return updatePromise;
|
|
19918
|
-
};
|
|
19919
|
-
update.addEventListener("click", () => void updateVersion());
|
|
20291
|
+
if (pageChange) onChange();
|
|
20292
|
+
});
|
|
19920
20293
|
const owner = document2.defaultView;
|
|
19921
20294
|
let checkFrame = null;
|
|
19922
20295
|
let checkTimer = null;
|
|
19923
20296
|
signal.addEventListener(
|
|
19924
20297
|
"abort",
|
|
19925
20298
|
() => {
|
|
20299
|
+
unsubscribe();
|
|
19926
20300
|
if (checkFrame !== null) owner?.cancelAnimationFrame(checkFrame);
|
|
19927
20301
|
if (checkTimer !== null) owner?.clearTimeout(checkTimer);
|
|
19928
20302
|
render();
|
|
19929
20303
|
},
|
|
19930
20304
|
{ once: true }
|
|
19931
20305
|
);
|
|
19932
|
-
status.textContent = messages.harnessVersionChecking;
|
|
19933
20306
|
render();
|
|
19934
|
-
if (!signal.aborted
|
|
19935
|
-
|
|
19936
|
-
checkFrame =
|
|
19937
|
-
|
|
19938
|
-
|
|
19939
|
-
checkTimer =
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
20307
|
+
if (shouldScheduleCheck && !signal.aborted) {
|
|
20308
|
+
if (owner?.requestAnimationFrame) {
|
|
20309
|
+
checkFrame = owner.requestAnimationFrame(() => {
|
|
20310
|
+
checkFrame = null;
|
|
20311
|
+
if (signal.aborted) return;
|
|
20312
|
+
checkTimer = owner.setTimeout(() => {
|
|
20313
|
+
checkTimer = null;
|
|
20314
|
+
if (!signal.aborted) void session.check();
|
|
20315
|
+
}, 0);
|
|
20316
|
+
});
|
|
20317
|
+
} else {
|
|
20318
|
+
void session.check();
|
|
20319
|
+
}
|
|
19945
20320
|
}
|
|
19946
20321
|
return {
|
|
19947
20322
|
element: panel,
|
|
19948
20323
|
get state() {
|
|
19949
|
-
return state;
|
|
20324
|
+
return session.state;
|
|
19950
20325
|
},
|
|
19951
20326
|
get updating() {
|
|
19952
|
-
return updating;
|
|
20327
|
+
return session.updating;
|
|
19953
20328
|
},
|
|
19954
|
-
update:
|
|
20329
|
+
update: () => signal.aborted ? Promise.resolve(false) : session.update()
|
|
19955
20330
|
};
|
|
19956
20331
|
}
|
|
19957
20332
|
|
|
19958
20333
|
// src/settings/connection-versions.ts
|
|
20334
|
+
var sessionStores = /* @__PURE__ */ new WeakMap();
|
|
20335
|
+
function getSessionStore(diagnostics) {
|
|
20336
|
+
let store = sessionStores.get(diagnostics);
|
|
20337
|
+
if (!store) {
|
|
20338
|
+
store = /* @__PURE__ */ new Map();
|
|
20339
|
+
sessionStores.set(diagnostics, store);
|
|
20340
|
+
}
|
|
20341
|
+
return store;
|
|
20342
|
+
}
|
|
19959
20343
|
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
19960
20344
|
const panels = /* @__PURE__ */ new Map();
|
|
19961
20345
|
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
20346
|
+
const sessions = diagnostics ? getSessionStore(diagnostics) : null;
|
|
20347
|
+
const sessionKey = (hostId2, agent) => JSON.stringify([hostId2, agent]);
|
|
19962
20348
|
return {
|
|
20349
|
+
isUpdating(hostId2, agent) {
|
|
20350
|
+
return Boolean(sessions?.get(sessionKey(hostId2, agent))?.updating);
|
|
20351
|
+
},
|
|
19963
20352
|
get(hostId2, agent) {
|
|
19964
20353
|
if (!installation || signal.aborted) return void 0;
|
|
19965
|
-
const key =
|
|
20354
|
+
const key = sessionKey(hostId2, agent);
|
|
19966
20355
|
let panel = panels.get(key);
|
|
19967
20356
|
if (!panel) {
|
|
20357
|
+
const run = (action) => installation(hostId2, agent, action);
|
|
20358
|
+
let session = sessions?.get(key);
|
|
20359
|
+
if (!session) {
|
|
20360
|
+
session = createHarnessVersionSession({ run });
|
|
20361
|
+
sessions?.set(key, session);
|
|
20362
|
+
}
|
|
19968
20363
|
panel = createHarnessVersionPanel(
|
|
19969
20364
|
document2,
|
|
19970
20365
|
messages,
|
|
19971
20366
|
signal,
|
|
19972
20367
|
agent,
|
|
19973
|
-
{
|
|
19974
|
-
|
|
19975
|
-
|
|
19976
|
-
onChange
|
|
20368
|
+
{ run },
|
|
20369
|
+
onChange,
|
|
20370
|
+
session
|
|
19977
20371
|
);
|
|
19978
20372
|
panels.set(key, panel);
|
|
19979
20373
|
}
|
|
@@ -19982,79 +20376,242 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19982
20376
|
};
|
|
19983
20377
|
}
|
|
19984
20378
|
|
|
19985
|
-
// src/settings/
|
|
19986
|
-
function
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20379
|
+
// src/settings/harness-install-store.ts
|
|
20380
|
+
function errorMessage(error51) {
|
|
20381
|
+
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.";
|
|
20382
|
+
}
|
|
20383
|
+
function unknownInstallOutcome(message2) {
|
|
20384
|
+
return /outcome is unknown|do not retry automatically|did not answer in time/i.test(message2);
|
|
20385
|
+
}
|
|
20386
|
+
var stores = /* @__PURE__ */ new WeakMap();
|
|
20387
|
+
function createStore(diagnostics) {
|
|
20388
|
+
const states2 = /* @__PURE__ */ new Map();
|
|
20389
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
20390
|
+
const key = (host, agent) => JSON.stringify([host, agent]);
|
|
20391
|
+
const notify2 = () => listeners.forEach((listener) => listener());
|
|
20392
|
+
return {
|
|
20393
|
+
get: (host, agent) => states2.get(key(host, agent)),
|
|
20394
|
+
clearErrors() {
|
|
20395
|
+
for (const [id, state] of states2) if (state.status === "error") states2.delete(id);
|
|
20396
|
+
notify2();
|
|
20397
|
+
},
|
|
20398
|
+
subscribe(listener) {
|
|
20399
|
+
listeners.add(listener);
|
|
20400
|
+
return () => {
|
|
20401
|
+
listeners.delete(listener);
|
|
20402
|
+
};
|
|
20403
|
+
},
|
|
20404
|
+
async install(host, agent) {
|
|
20405
|
+
const id = key(host, agent);
|
|
20406
|
+
const previous = states2.get(id);
|
|
20407
|
+
if (!diagnostics.installation || previous && previous.status !== "error") return;
|
|
20408
|
+
states2.set(id, { status: "installing" });
|
|
20409
|
+
notify2();
|
|
20410
|
+
let failure;
|
|
20411
|
+
try {
|
|
20412
|
+
await diagnostics.installation(host, agent, "install");
|
|
20413
|
+
states2.set(id, { status: "checking" });
|
|
20414
|
+
notify2();
|
|
20415
|
+
} catch (error51) {
|
|
20416
|
+
failure = errorMessage(error51);
|
|
20417
|
+
}
|
|
20418
|
+
try {
|
|
20419
|
+
await diagnostics.refresh(host);
|
|
20420
|
+
const refreshed = diagnostics.snapshot().hosts.find((candidate) => candidate.hostId === host)?.agents.find((candidate) => candidate.agent === agent);
|
|
20421
|
+
if (refreshed?.availability === "ready") failure = void 0;
|
|
20422
|
+
else if (failure && unknownInstallOutcome(failure) && refreshed && refreshed.availability !== "notInstalled") {
|
|
20423
|
+
failure = void 0;
|
|
20003
20424
|
}
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20425
|
+
} catch (error51) {
|
|
20426
|
+
failure ??= errorMessage(error51);
|
|
20427
|
+
}
|
|
20428
|
+
if (failure) states2.set(id, { status: "error", error: failure });
|
|
20429
|
+
else states2.delete(id);
|
|
20430
|
+
notify2();
|
|
20431
|
+
}
|
|
20432
|
+
};
|
|
20433
|
+
}
|
|
20434
|
+
function harnessInstallStore(diagnostics) {
|
|
20435
|
+
let store = stores.get(diagnostics);
|
|
20436
|
+
if (!store) {
|
|
20437
|
+
store = createStore(diagnostics);
|
|
20438
|
+
stores.set(diagnostics, store);
|
|
20439
|
+
}
|
|
20440
|
+
return store;
|
|
20441
|
+
}
|
|
20442
|
+
|
|
20443
|
+
// src/settings/harness-installation-guides.ts
|
|
20444
|
+
function harnessHasInstallCommands(plugin) {
|
|
20445
|
+
return (plugin?.installation?.commands.length ?? 0) > 0;
|
|
20446
|
+
}
|
|
20447
|
+
function harnessInstallationGuide(plugin, locale) {
|
|
20448
|
+
const guide = plugin?.installation;
|
|
20449
|
+
const text = (value) => value?.[locale] ?? value?.en;
|
|
20450
|
+
return {
|
|
20451
|
+
url: plugin?.links?.installation ?? plugin?.links?.documentation ?? plugin?.links?.website,
|
|
20452
|
+
commands: guide?.commands ?? [],
|
|
20453
|
+
downloads: guide?.downloads ?? [],
|
|
20454
|
+
before: text(guide?.before),
|
|
20455
|
+
after: text(guide?.after)
|
|
20456
|
+
};
|
|
20457
|
+
}
|
|
20458
|
+
|
|
20459
|
+
// src/settings/harness-installation-panel.ts
|
|
20460
|
+
function createHarnessInstallationPanel(document2, plugin, hostId2, messages, copy, installation) {
|
|
20461
|
+
const zh = messages.locale === "zh-CN";
|
|
20462
|
+
const guide = harnessInstallationGuide(plugin, messages.locale);
|
|
20463
|
+
const panel = document2.createElement("div");
|
|
20464
|
+
panel.className = "settings-harness-installation";
|
|
20465
|
+
const paragraph = (text) => {
|
|
20466
|
+
const p = document2.createElement("p");
|
|
20467
|
+
p.textContent = text;
|
|
20468
|
+
panel.append(p);
|
|
20469
|
+
};
|
|
20470
|
+
if (hostId2 !== "local") {
|
|
20471
|
+
paragraph(zh ? "\u8BF7\u5728\u8FDC\u7A0B Host \u4E0A\u5B89\u88C5\u3002" : "Install on the remote Host.");
|
|
20472
|
+
}
|
|
20473
|
+
if (guide.before) paragraph(guide.before);
|
|
20474
|
+
const install2 = installation && guide.commands.length > 0 ? document2.createElement("button") : null;
|
|
20475
|
+
if (install2 && installation) {
|
|
20476
|
+
install2.type = "button";
|
|
20477
|
+
install2.className = "settings-command-button";
|
|
20478
|
+
install2.dataset.connectionAction = "install";
|
|
20479
|
+
install2.disabled = installation.status !== "idle";
|
|
20480
|
+
install2.textContent = installation.status === "installing" ? messages.connectionStatusInstalling : installation.status === "checking" ? messages.connectionStatusChecking : zh ? "\u4E00\u952E\u5B89\u88C5" : "Install automatically";
|
|
20481
|
+
install2.addEventListener("click", () => {
|
|
20482
|
+
if (install2.disabled) return;
|
|
20483
|
+
install2.disabled = true;
|
|
20484
|
+
install2.textContent = messages.connectionStatusInstalling;
|
|
20485
|
+
installation.run();
|
|
20486
|
+
});
|
|
20487
|
+
if (guide.commands.length > 1) panel.append(install2);
|
|
20488
|
+
}
|
|
20489
|
+
for (const { terminal, command } of guide.commands) {
|
|
20490
|
+
const block = document2.createElement("div");
|
|
20491
|
+
block.className = "settings-harness-installation-command";
|
|
20492
|
+
const label = document2.createElement("strong");
|
|
20493
|
+
label.textContent = terminal;
|
|
20494
|
+
const pre = document2.createElement("pre");
|
|
20495
|
+
const code = document2.createElement("code");
|
|
20496
|
+
code.textContent = command;
|
|
20497
|
+
pre.append(code);
|
|
20498
|
+
const button2 = document2.createElement("button");
|
|
20499
|
+
button2.type = "button";
|
|
20500
|
+
button2.className = "settings-command-button settings-command-button--secondary";
|
|
20501
|
+
button2.dataset.connectionAction = "copy-install";
|
|
20502
|
+
const copyLabel = zh ? "\u590D\u5236\u547D\u4EE4" : "Copy command";
|
|
20503
|
+
button2.setAttribute("aria-label", `${copyLabel}: ${terminal}`);
|
|
20504
|
+
button2.append(createRendererSettingsIcon("copy", 16), copyLabel);
|
|
20505
|
+
button2.addEventListener("click", () => copy(button2, command, copyLabel));
|
|
20506
|
+
const actions = document2.createElement("div");
|
|
20507
|
+
actions.className = "settings-harness-installation-actions";
|
|
20508
|
+
if (install2 && guide.commands.length === 1) actions.append(install2);
|
|
20509
|
+
actions.append(button2);
|
|
20510
|
+
block.append(label, pre, actions);
|
|
20511
|
+
panel.append(block);
|
|
20512
|
+
}
|
|
20513
|
+
for (const download2 of guide.downloads ?? []) {
|
|
20514
|
+
const link = document2.createElement("a");
|
|
20515
|
+
link.className = "settings-command-button settings-command-button--secondary";
|
|
20516
|
+
link.href = download2.url;
|
|
20517
|
+
link.target = "_blank";
|
|
20518
|
+
link.rel = "noopener noreferrer";
|
|
20519
|
+
link.textContent = zh ? "\u4E0B\u8F7D" : "Download";
|
|
20520
|
+
link.setAttribute("aria-label", `${link.textContent} ${download2.label}`);
|
|
20521
|
+
panel.append(link);
|
|
20522
|
+
}
|
|
20523
|
+
if (guide.after) paragraph(guide.after);
|
|
20524
|
+
if (!plugin?.installation && guide.url) {
|
|
20525
|
+
const link = document2.createElement("a");
|
|
20526
|
+
link.href = guide.url;
|
|
20527
|
+
link.target = "_blank";
|
|
20528
|
+
link.rel = "noopener noreferrer";
|
|
20529
|
+
link.textContent = zh ? "\u5B89\u88C5\u8BF4\u660E" : "Installation instructions";
|
|
20530
|
+
panel.append(link);
|
|
20531
|
+
}
|
|
20532
|
+
return panel;
|
|
20533
|
+
}
|
|
20534
|
+
|
|
20535
|
+
// src/settings/harness-launch-controls.ts
|
|
20536
|
+
function createHarnessLaunchControls(document2, messages, agent, settings) {
|
|
20537
|
+
const section = document2.createElement("section");
|
|
20538
|
+
section.className = "settings-harness-launch";
|
|
20539
|
+
section.dataset.harnessLaunch = agent;
|
|
20540
|
+
const label = document2.createElement("label");
|
|
20541
|
+
label.textContent = messages.launchPathLabel;
|
|
20542
|
+
const input = document2.createElement("input");
|
|
20543
|
+
input.type = "text";
|
|
20544
|
+
input.autocomplete = "off";
|
|
20545
|
+
input.spellcheck = false;
|
|
20546
|
+
input.placeholder = messages.locale === "zh-CN" ? "\u5E94\u7528\u5B89\u88C5\u76EE\u5F55\u7684\u7EDD\u5BF9\u8DEF\u5F84" : "Absolute installation directory";
|
|
20547
|
+
input.setAttribute("aria-label", messages.launchPathLabel);
|
|
20548
|
+
label.append(input);
|
|
20549
|
+
const help = document2.createElement("p");
|
|
20550
|
+
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.";
|
|
20551
|
+
const actions = document2.createElement("div");
|
|
20552
|
+
actions.className = "settings-harness-launch__actions";
|
|
20553
|
+
const save = document2.createElement("button");
|
|
20554
|
+
save.type = "button";
|
|
20555
|
+
save.className = "settings-command-button";
|
|
20556
|
+
save.textContent = messages.launchPathSave;
|
|
20557
|
+
const reset = document2.createElement("button");
|
|
20558
|
+
reset.type = "button";
|
|
20559
|
+
reset.className = "settings-command-button settings-command-button--secondary";
|
|
20560
|
+
reset.textContent = messages.launchPathReset;
|
|
20561
|
+
const status = document2.createElement("p");
|
|
20562
|
+
status.setAttribute("role", "status");
|
|
20563
|
+
status.setAttribute("aria-live", "polite");
|
|
20564
|
+
actions.append(save, reset);
|
|
20565
|
+
section.append(label, help, actions, status);
|
|
20566
|
+
let busy = true;
|
|
20567
|
+
let loaded = false;
|
|
20568
|
+
const controls = () => {
|
|
20569
|
+
input.disabled = busy || !loaded;
|
|
20570
|
+
save.disabled = busy || !loaded || !input.value.trim();
|
|
20571
|
+
reset.disabled = busy || !loaded;
|
|
20009
20572
|
};
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
result.className = "settings-connection-update-result";
|
|
20027
|
-
result.setAttribute("role", "status");
|
|
20028
|
-
result.hidden = !batch || batch.running;
|
|
20029
|
-
if (batch && !batch.running) {
|
|
20030
|
-
result.textContent = messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed));
|
|
20031
|
-
}
|
|
20032
|
-
return { button: button2, result };
|
|
20573
|
+
const show = (value) => {
|
|
20574
|
+
input.value = value.path ?? "";
|
|
20575
|
+
status.textContent = value.restartRequired ? messages.launchPathRestart : value.path ? messages.launchPathSaved : messages.launchPathAutomatic;
|
|
20576
|
+
};
|
|
20577
|
+
const persist = async (value) => {
|
|
20578
|
+
if (busy || !loaded) return;
|
|
20579
|
+
busy = true;
|
|
20580
|
+
controls();
|
|
20581
|
+
status.textContent = messages.launchPathSaving;
|
|
20582
|
+
try {
|
|
20583
|
+
show(await settings.set(value));
|
|
20584
|
+
} catch {
|
|
20585
|
+
status.textContent = messages.launchPathSaveError;
|
|
20586
|
+
} finally {
|
|
20587
|
+
busy = false;
|
|
20588
|
+
controls();
|
|
20033
20589
|
}
|
|
20034
20590
|
};
|
|
20591
|
+
input.addEventListener("input", controls);
|
|
20592
|
+
save.addEventListener("click", () => {
|
|
20593
|
+
if (input.value.trim()) void persist(input.value.trim());
|
|
20594
|
+
});
|
|
20595
|
+
reset.addEventListener("click", () => {
|
|
20596
|
+
void persist(null);
|
|
20597
|
+
});
|
|
20598
|
+
controls();
|
|
20599
|
+
status.textContent = messages.launchPathLoading;
|
|
20600
|
+
void settings.get().then((value) => {
|
|
20601
|
+
loaded = true;
|
|
20602
|
+
show(value);
|
|
20603
|
+
}).catch(() => {
|
|
20604
|
+
loaded = true;
|
|
20605
|
+
status.textContent = messages.launchPathLoadError;
|
|
20606
|
+
}).finally(() => {
|
|
20607
|
+
busy = false;
|
|
20608
|
+
controls();
|
|
20609
|
+
});
|
|
20610
|
+
return section;
|
|
20035
20611
|
}
|
|
20036
20612
|
|
|
20037
20613
|
// src/settings/connections-page.ts
|
|
20038
20614
|
var CODEXHOST_GITHUB_ISSUES_NEW_URL = "https://github.com/BytePioneer-AI/codex-host/issues/new";
|
|
20039
|
-
function connectionStatusLabel(availability, messages, hasError = false) {
|
|
20040
|
-
if (availability === "updating") return messages.connectionStatusUpdating;
|
|
20041
|
-
if (hasError && availability !== "notInstalled") return messages.connectionStatusError;
|
|
20042
|
-
if (availability === "ready") return messages.connectionStatusReady;
|
|
20043
|
-
if (availability === "checking") return messages.connectionStatusChecking;
|
|
20044
|
-
if (availability === "notInstalled") return messages.connectionStatusNotInstalled;
|
|
20045
|
-
if (availability === "unavailable" || availability === "error") {
|
|
20046
|
-
return availability === "error" ? messages.connectionStatusError : messages.connectionStatusUnavailable;
|
|
20047
|
-
}
|
|
20048
|
-
return availability === "installing" ? messages.connectionStatusInstalling : messages.connectionStatusUnsupported;
|
|
20049
|
-
}
|
|
20050
|
-
function connectionStatusTone(availability, hasError = false) {
|
|
20051
|
-
if (availability === "updating") return "checking";
|
|
20052
|
-
if (hasError && availability !== "notInstalled") return "failed";
|
|
20053
|
-
if (availability === "ready") return "ready";
|
|
20054
|
-
if (availability === "checking" || availability === "installing") return "checking";
|
|
20055
|
-
if (availability === "notInstalled") return "setup";
|
|
20056
|
-
return "failed";
|
|
20057
|
-
}
|
|
20058
20615
|
function diagnosticText(hostId2, item) {
|
|
20059
20616
|
const error51 = item.error;
|
|
20060
20617
|
return [
|
|
@@ -20150,148 +20707,21 @@ ${error51.stderrTail}`] : []
|
|
|
20150
20707
|
tabs.addEventListener("wheel", onWheel, { passive: false });
|
|
20151
20708
|
const ownerWindow = document2.defaultView;
|
|
20152
20709
|
ownerWindow?.addEventListener("resize", updateButtons);
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
|
|
20157
|
-
|
|
20158
|
-
|
|
20159
|
-
|
|
20160
|
-
|
|
20710
|
+
const refreshLayout = () => {
|
|
20711
|
+
ownerWindow?.setTimeout(updateButtons, 0);
|
|
20712
|
+
updateButtons();
|
|
20713
|
+
};
|
|
20714
|
+
refreshLayout();
|
|
20715
|
+
return {
|
|
20716
|
+
update: refreshLayout,
|
|
20717
|
+
dispose() {
|
|
20718
|
+
left.removeEventListener("click", onLeft);
|
|
20719
|
+
right.removeEventListener("click", onRight);
|
|
20720
|
+
tabs.removeEventListener("scroll", updateButtons);
|
|
20721
|
+
tabs.removeEventListener("wheel", onWheel);
|
|
20722
|
+
ownerWindow?.removeEventListener("resize", updateButtons);
|
|
20723
|
+
}
|
|
20161
20724
|
};
|
|
20162
|
-
}
|
|
20163
|
-
function createConnectionIdentityIcon(document2, item, size) {
|
|
20164
|
-
const container = document2.createElement("span");
|
|
20165
|
-
container.className = item.agentSnapshot ? "settings-connection-row__mark settings-connection-row__mark--logo" : "settings-connection-row__mark";
|
|
20166
|
-
container.setAttribute("aria-hidden", "true");
|
|
20167
|
-
if (item.agentSnapshot) {
|
|
20168
|
-
container.append(
|
|
20169
|
-
createRendererAgentIcon(item.agentSnapshot.agent, size, document2, item.agentSnapshot.plugin)
|
|
20170
|
-
);
|
|
20171
|
-
} else {
|
|
20172
|
-
container.textContent = "CH";
|
|
20173
|
-
}
|
|
20174
|
-
return container;
|
|
20175
|
-
}
|
|
20176
|
-
function createConnectionRow(document2, item, messages, selected, select, group = null) {
|
|
20177
|
-
const row = document2.createElement("div");
|
|
20178
|
-
row.className = "settings-connection-row";
|
|
20179
|
-
row.dataset.connectionItem = item.key;
|
|
20180
|
-
row.dataset.connectionSelected = String(selected);
|
|
20181
|
-
row.tabIndex = selected ? 0 : -1;
|
|
20182
|
-
row.setAttribute("role", "row");
|
|
20183
|
-
const identity3 = document2.createElement("div");
|
|
20184
|
-
identity3.className = "settings-connection-row__identity";
|
|
20185
|
-
identity3.setAttribute("role", "cell");
|
|
20186
|
-
if (group) {
|
|
20187
|
-
const handle = document2.createElement("span");
|
|
20188
|
-
handle.className = "settings-connection-row__handle";
|
|
20189
|
-
handle.setAttribute("aria-hidden", "true");
|
|
20190
|
-
handle.title = group.dragHandleTitle;
|
|
20191
|
-
handle.append(createRendererSettingsIcon("grip-vertical", 15));
|
|
20192
|
-
identity3.append(handle);
|
|
20193
|
-
}
|
|
20194
|
-
const label = document2.createElement("strong");
|
|
20195
|
-
label.textContent = item.name;
|
|
20196
|
-
identity3.append(createConnectionIdentityIcon(document2, item, 19), label);
|
|
20197
|
-
const status = document2.createElement("span");
|
|
20198
|
-
status.className = "settings-connection-row__status";
|
|
20199
|
-
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
20200
|
-
status.setAttribute("role", "cell");
|
|
20201
|
-
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
20202
|
-
const version2 = item.version;
|
|
20203
|
-
const action = document2.createElement("div");
|
|
20204
|
-
action.className = "settings-connection-row__action";
|
|
20205
|
-
action.setAttribute("role", "cell");
|
|
20206
|
-
if (item.agentSnapshot?.availability === "notInstalled" && item.install) {
|
|
20207
|
-
const install2 = document2.createElement("button");
|
|
20208
|
-
install2.type = "button";
|
|
20209
|
-
install2.className = "settings-connection-install-link";
|
|
20210
|
-
install2.addEventListener("click", (event) => {
|
|
20211
|
-
event.stopPropagation();
|
|
20212
|
-
select();
|
|
20213
|
-
item.install?.();
|
|
20214
|
-
});
|
|
20215
|
-
install2.disabled = item.availability === "installing" || item.availability === "checking";
|
|
20216
|
-
const installLabel = messages.connectionInstall;
|
|
20217
|
-
install2.setAttribute("aria-label", `${installLabel}: ${item.name}`);
|
|
20218
|
-
install2.title = installLabel;
|
|
20219
|
-
install2.append(createRendererSettingsIcon("download", 17));
|
|
20220
|
-
action.append(install2);
|
|
20221
|
-
} else if (item.error) {
|
|
20222
|
-
const viewError = document2.createElement("button");
|
|
20223
|
-
viewError.type = "button";
|
|
20224
|
-
viewError.className = "settings-connection-view-error";
|
|
20225
|
-
viewError.textContent = messages.connectionViewError;
|
|
20226
|
-
viewError.addEventListener("click", (event) => {
|
|
20227
|
-
event.stopPropagation();
|
|
20228
|
-
select();
|
|
20229
|
-
});
|
|
20230
|
-
action.append(viewError);
|
|
20231
|
-
}
|
|
20232
|
-
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
20233
|
-
const available = document2.createElement("span");
|
|
20234
|
-
available.className = "settings-connection-version-available";
|
|
20235
|
-
available.textContent = messages.harnessVersionAvailable;
|
|
20236
|
-
available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
20237
|
-
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
20238
|
-
action.append(available);
|
|
20239
|
-
}
|
|
20240
|
-
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
20241
|
-
const update = document2.createElement("button");
|
|
20242
|
-
update.type = "button";
|
|
20243
|
-
update.className = "settings-connection-install-link";
|
|
20244
|
-
update.dataset.connectionAction = "update";
|
|
20245
|
-
update.disabled = version2.updating;
|
|
20246
|
-
update.title = messages.harnessVersionUpdate;
|
|
20247
|
-
update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
|
|
20248
|
-
update.append(createRendererSettingsIcon("download", 17));
|
|
20249
|
-
update.addEventListener("click", (event) => {
|
|
20250
|
-
event.stopPropagation();
|
|
20251
|
-
if (update.disabled) return;
|
|
20252
|
-
void version2.update();
|
|
20253
|
-
select();
|
|
20254
|
-
});
|
|
20255
|
-
action.append(update);
|
|
20256
|
-
}
|
|
20257
|
-
if (group) {
|
|
20258
|
-
const toggle = document2.createElement("button");
|
|
20259
|
-
toggle.type = "button";
|
|
20260
|
-
toggle.disabled = group.disabled;
|
|
20261
|
-
toggle.className = "settings-connection-row__group-toggle";
|
|
20262
|
-
toggle.title = group.moveLabel;
|
|
20263
|
-
toggle.setAttribute("aria-label", group.moveLabel);
|
|
20264
|
-
toggle.append(
|
|
20265
|
-
createRendererSettingsIcon(group.section === "main" ? "chevron-down" : "chevron-up", 15)
|
|
20266
|
-
);
|
|
20267
|
-
toggle.addEventListener("click", (event) => {
|
|
20268
|
-
event.stopPropagation();
|
|
20269
|
-
group.toggleSection();
|
|
20270
|
-
});
|
|
20271
|
-
action.append(toggle);
|
|
20272
|
-
}
|
|
20273
|
-
row.addEventListener("click", (event) => {
|
|
20274
|
-
const target2 = event.target;
|
|
20275
|
-
if (target2?.closest?.("a")) return;
|
|
20276
|
-
select();
|
|
20277
|
-
});
|
|
20278
|
-
row.addEventListener("keydown", (event) => {
|
|
20279
|
-
if (event.target?.closest?.("button, a")) return;
|
|
20280
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
20281
|
-
event.preventDefault();
|
|
20282
|
-
select();
|
|
20283
|
-
});
|
|
20284
|
-
if (group) {
|
|
20285
|
-
row.draggable = !group.disabled;
|
|
20286
|
-
row.dataset.connectionGroupSection = group.section;
|
|
20287
|
-
row.addEventListener("dragstart", group.onDragStart);
|
|
20288
|
-
row.addEventListener("dragover", group.onDragOver);
|
|
20289
|
-
row.addEventListener("dragleave", group.onDragLeave);
|
|
20290
|
-
row.addEventListener("drop", group.onDrop);
|
|
20291
|
-
row.addEventListener("dragend", group.onDragEnd);
|
|
20292
|
-
}
|
|
20293
|
-
row.append(identity3, status, action);
|
|
20294
|
-
return row;
|
|
20295
20725
|
}
|
|
20296
20726
|
function createInspectorHeader(document2, item, messages) {
|
|
20297
20727
|
const header = document2.createElement("header");
|
|
@@ -20321,6 +20751,29 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20321
20751
|
header.append(identity3, status);
|
|
20322
20752
|
return header;
|
|
20323
20753
|
}
|
|
20754
|
+
function inspectorRenderSignature(hostId2, item, messages, diagnostics) {
|
|
20755
|
+
const plugin = item.agentSnapshot?.plugin;
|
|
20756
|
+
const notice = plugin?.notice ? plugin.notice[messages.locale] ?? plugin.notice.en : "";
|
|
20757
|
+
const websiteUrl = plugin?.links?.website ?? plugin?.links?.documentation ?? "";
|
|
20758
|
+
const hasLaunchControls = hostId2 === "local" && Boolean(item.agentSnapshot?.agent) && Boolean(plugin?.launchCommand) && Boolean(diagnostics?.getLaunchSettings && diagnostics?.setLaunchSettings);
|
|
20759
|
+
return JSON.stringify([
|
|
20760
|
+
hostId2,
|
|
20761
|
+
item.key,
|
|
20762
|
+
item.name,
|
|
20763
|
+
item.availability,
|
|
20764
|
+
item.agentSnapshot?.availability ?? null,
|
|
20765
|
+
String(plugin?.icon ?? ""),
|
|
20766
|
+
String(plugin?.iconStyle ?? ""),
|
|
20767
|
+
websiteUrl,
|
|
20768
|
+
notice,
|
|
20769
|
+
item.installError ?? "",
|
|
20770
|
+
Boolean(item.install),
|
|
20771
|
+
plugin?.installation ?? null,
|
|
20772
|
+
Boolean(item.openWebUi),
|
|
20773
|
+
hasLaunchControls,
|
|
20774
|
+
item.error ? diagnosticText(hostId2, item) : ""
|
|
20775
|
+
]);
|
|
20776
|
+
}
|
|
20324
20777
|
function renderConnectionInspector(document2, inspector, item, hostId2, messages, diagnostics, existingLaunchControls, refresh) {
|
|
20325
20778
|
inspector.replaceChildren(createInspectorHeader(document2, item, messages));
|
|
20326
20779
|
const body = document2.createElement("div");
|
|
@@ -20486,11 +20939,10 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20486
20939
|
function requestConnectionsPageFocus(agentKey) {
|
|
20487
20940
|
pendingFocusAgent = agentKey;
|
|
20488
20941
|
}
|
|
20489
|
-
function createGroupDivider(document2
|
|
20942
|
+
function createGroupDivider(document2) {
|
|
20490
20943
|
const divider = document2.createElement("div");
|
|
20491
20944
|
divider.className = "settings-connection-group-divider";
|
|
20492
20945
|
divider.setAttribute("role", "presentation");
|
|
20493
|
-
divider.textContent = `${messages.connectionGroupMoreLabel} (${count3})`;
|
|
20494
20946
|
return divider;
|
|
20495
20947
|
}
|
|
20496
20948
|
function createGroupMoreHint(document2, messages) {
|
|
@@ -20543,11 +20995,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20543
20995
|
context2.content.append(header, syncMessage, content);
|
|
20544
20996
|
let pending2 = false;
|
|
20545
20997
|
let selectedHostId = null;
|
|
20998
|
+
let renderedHostId = null;
|
|
20546
20999
|
let selectedItemKey = null;
|
|
20547
21000
|
let launchControls = null;
|
|
21001
|
+
let renderedInspector = null;
|
|
20548
21002
|
const hostNames = /* @__PURE__ */ new Map();
|
|
21003
|
+
const knownNotInstalled = /* @__PURE__ */ new Map();
|
|
20549
21004
|
let latestSnapshot = null;
|
|
20550
|
-
let disposeHostScroller = () => void 0;
|
|
20551
21005
|
let disposed = false;
|
|
20552
21006
|
let renderQueued = false;
|
|
20553
21007
|
let renderFrame = null;
|
|
@@ -20581,7 +21035,99 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20581
21035
|
scheduleRender
|
|
20582
21036
|
);
|
|
20583
21037
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
20584
|
-
const updates = createConnectionUpdates(
|
|
21038
|
+
const updates = createConnectionUpdates(
|
|
21039
|
+
document2,
|
|
21040
|
+
messages,
|
|
21041
|
+
context2.signal,
|
|
21042
|
+
scheduleRender,
|
|
21043
|
+
diagnostics
|
|
21044
|
+
);
|
|
21045
|
+
const panelId = "codexhost-settings-connection-host-panel";
|
|
21046
|
+
const empty = document2.createElement("div");
|
|
21047
|
+
empty.className = "settings-empty";
|
|
21048
|
+
empty.textContent = messages.connectionNoRuntime;
|
|
21049
|
+
const layout = document2.createElement("div");
|
|
21050
|
+
layout.className = "settings-connections-layout";
|
|
21051
|
+
const list = document2.createElement("section");
|
|
21052
|
+
list.className = "settings-connection-list";
|
|
21053
|
+
const hostStrip = document2.createElement("div");
|
|
21054
|
+
hostStrip.className = "settings-connection-host-strip";
|
|
21055
|
+
const scrollLeft = createHostScrollButton(document2, "left", messages);
|
|
21056
|
+
const tabs = document2.createElement("div");
|
|
21057
|
+
tabs.className = "settings-connection-host-tabs";
|
|
21058
|
+
tabs.setAttribute("role", "tablist");
|
|
21059
|
+
tabs.setAttribute("aria-label", messages.connectionHosts);
|
|
21060
|
+
const scrollRight = createHostScrollButton(document2, "right", messages);
|
|
21061
|
+
hostStrip.append(scrollLeft, tabs, scrollRight);
|
|
21062
|
+
const updateControls = updates.createControls("local", []);
|
|
21063
|
+
const hostHeader = document2.createElement("div");
|
|
21064
|
+
hostHeader.className = "settings-connection-host-header";
|
|
21065
|
+
hostHeader.append(hostStrip, updateControls.button);
|
|
21066
|
+
const tableHeader = document2.createElement("div");
|
|
21067
|
+
tableHeader.className = "settings-connection-table-header";
|
|
21068
|
+
tableHeader.setAttribute("role", "row");
|
|
21069
|
+
const componentHeading = document2.createElement("span");
|
|
21070
|
+
componentHeading.textContent = messages.connectionComponent;
|
|
21071
|
+
componentHeading.setAttribute("role", "columnheader");
|
|
21072
|
+
const statusHeading = document2.createElement("span");
|
|
21073
|
+
statusHeading.textContent = messages.connectionStatus;
|
|
21074
|
+
statusHeading.setAttribute("role", "columnheader");
|
|
21075
|
+
const actionHeading = document2.createElement("span");
|
|
21076
|
+
actionHeading.setAttribute("aria-hidden", "true");
|
|
21077
|
+
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
21078
|
+
const rows = document2.createElement("div");
|
|
21079
|
+
rows.className = "settings-connection-rows";
|
|
21080
|
+
rows.id = panelId;
|
|
21081
|
+
rows.setAttribute("role", "rowgroup");
|
|
21082
|
+
list.append(hostHeader, updateControls.result, tableHeader, rows);
|
|
21083
|
+
const inspector = document2.createElement("aside");
|
|
21084
|
+
inspector.className = "settings-connection-inspector";
|
|
21085
|
+
inspector.setAttribute("aria-live", "polite");
|
|
21086
|
+
layout.append(list, inspector);
|
|
21087
|
+
const hostScroller = configureHostScroller(
|
|
21088
|
+
document2,
|
|
21089
|
+
hostStrip,
|
|
21090
|
+
tabs,
|
|
21091
|
+
scrollLeft,
|
|
21092
|
+
scrollRight
|
|
21093
|
+
);
|
|
21094
|
+
const hostTabElements = /* @__PURE__ */ new Map();
|
|
21095
|
+
const hostRowViews = /* @__PURE__ */ new Map();
|
|
21096
|
+
const groupDivider = createGroupDivider(document2);
|
|
21097
|
+
const moreHint = createGroupMoreHint(document2, messages);
|
|
21098
|
+
const moreZone = document2.createElement("div");
|
|
21099
|
+
moreZone.className = "settings-connection-group-more";
|
|
21100
|
+
moreZone.setAttribute("role", "presentation");
|
|
21101
|
+
const resetButton = createGroupResetButton(document2, messages, () => {
|
|
21102
|
+
groupPreference.resetToDefault();
|
|
21103
|
+
});
|
|
21104
|
+
let draggingAgent = null;
|
|
21105
|
+
let currentCatalog = [];
|
|
21106
|
+
let currentMainEntries = [];
|
|
21107
|
+
let currentMoreEntries = [];
|
|
21108
|
+
let currentHostRows = /* @__PURE__ */ new Map();
|
|
21109
|
+
const clearDropIndicators = () => {
|
|
21110
|
+
for (const view of currentHostRows.values()) {
|
|
21111
|
+
view.element.dataset.connectionDropIndicator = "";
|
|
21112
|
+
}
|
|
21113
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
21114
|
+
};
|
|
21115
|
+
moreZone.addEventListener("dragover", (event) => {
|
|
21116
|
+
if (!draggingAgent) return;
|
|
21117
|
+
event.preventDefault();
|
|
21118
|
+
moreZone.dataset.connectionDragOver = "true";
|
|
21119
|
+
});
|
|
21120
|
+
moreZone.addEventListener("dragleave", () => {
|
|
21121
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
21122
|
+
});
|
|
21123
|
+
moreZone.addEventListener("drop", (event) => {
|
|
21124
|
+
event.preventDefault();
|
|
21125
|
+
moreZone.dataset.connectionDragOver = "false";
|
|
21126
|
+
if (!draggingAgent) return;
|
|
21127
|
+
groupPreference.moveAgent(draggingAgent, "more", null, currentCatalog);
|
|
21128
|
+
draggingAgent = null;
|
|
21129
|
+
clearDropIndicators();
|
|
21130
|
+
});
|
|
20585
21131
|
const runRefresh = () => {
|
|
20586
21132
|
if (pending2 || !diagnostics) return;
|
|
20587
21133
|
pending2 = true;
|
|
@@ -20594,6 +21140,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20594
21140
|
success() {
|
|
20595
21141
|
installs?.clearErrors();
|
|
20596
21142
|
pending2 = false;
|
|
21143
|
+
renderedInspector = null;
|
|
20597
21144
|
refresh.disabled = false;
|
|
20598
21145
|
refresh.replaceChildren(
|
|
20599
21146
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -20603,6 +21150,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20603
21150
|
},
|
|
20604
21151
|
failure(error51) {
|
|
20605
21152
|
pending2 = false;
|
|
21153
|
+
renderedInspector = null;
|
|
20606
21154
|
refresh.disabled = false;
|
|
20607
21155
|
refresh.replaceChildren(
|
|
20608
21156
|
createRendererSettingsIcon("diagnose", 16),
|
|
@@ -20628,97 +21176,111 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20628
21176
|
}
|
|
20629
21177
|
});
|
|
20630
21178
|
};
|
|
21179
|
+
const syncSelectedInspector = (hostId2, item) => {
|
|
21180
|
+
const currentDiagnostics = getDiagnostics();
|
|
21181
|
+
const signature = inspectorRenderSignature(hostId2, item, messages, currentDiagnostics);
|
|
21182
|
+
const versionElement = item.version?.element ?? null;
|
|
21183
|
+
if (renderedInspector?.signature === signature && renderedInspector.versionElement === versionElement) {
|
|
21184
|
+
return;
|
|
21185
|
+
}
|
|
21186
|
+
const existing = launchControls?.hostId === hostId2 && launchControls.itemKey === item.key ? launchControls.element : null;
|
|
21187
|
+
const element = renderConnectionInspector(
|
|
21188
|
+
document2,
|
|
21189
|
+
inspector,
|
|
21190
|
+
item,
|
|
21191
|
+
hostId2,
|
|
21192
|
+
messages,
|
|
21193
|
+
currentDiagnostics,
|
|
21194
|
+
existing,
|
|
21195
|
+
runRefresh
|
|
21196
|
+
);
|
|
21197
|
+
launchControls = { hostId: hostId2, itemKey: item.key, element };
|
|
21198
|
+
if (versionElement) inspector.append(versionElement);
|
|
21199
|
+
renderedInspector = { signature, versionElement };
|
|
21200
|
+
};
|
|
20631
21201
|
const render = (snapshot) => {
|
|
20632
21202
|
const syncStatus = groupPreference.syncStatus();
|
|
20633
21203
|
const groupDisabled = syncStatus === "loading" || syncStatus === "saving";
|
|
20634
21204
|
syncMessage.hidden = syncStatus === "ready";
|
|
20635
21205
|
syncMessage.textContent = syncStatus === "error" ? messages.connectionGroupSyncFailed : syncStatus === "saving" ? messages.connectionGroupSaving : messages.connectionGroupLoading;
|
|
20636
21206
|
latestSnapshot = snapshot;
|
|
20637
|
-
disposeHostScroller();
|
|
20638
|
-
disposeHostScroller = () => void 0;
|
|
20639
21207
|
if (!snapshot) {
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
empty
|
|
20643
|
-
content.replaceChildren(empty);
|
|
21208
|
+
renderedHostId = null;
|
|
21209
|
+
renderedInspector = null;
|
|
21210
|
+
reconcileElementChildren(content, [empty]);
|
|
20644
21211
|
return;
|
|
20645
21212
|
}
|
|
20646
21213
|
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];
|
|
20647
21214
|
if (!selectedHost) return;
|
|
20648
21215
|
selectedHostId = selectedHost.hostId;
|
|
20649
|
-
const
|
|
20650
|
-
|
|
20651
|
-
|
|
20652
|
-
|
|
20653
|
-
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20667
|
-
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
21216
|
+
const layoutFirstMount = content.children[0] !== layout;
|
|
21217
|
+
reconcileElementChildren(content, [layout]);
|
|
21218
|
+
let tabsChanged = tabs.children.length !== snapshot.hosts.length;
|
|
21219
|
+
const nextTabs = snapshot.hosts.map((host) => {
|
|
21220
|
+
let tab = hostTabElements.get(host.hostId);
|
|
21221
|
+
if (!tab) {
|
|
21222
|
+
tab = document2.createElement("button");
|
|
21223
|
+
tab.type = "button";
|
|
21224
|
+
tab.className = "settings-connection-host-tab";
|
|
21225
|
+
tab.dataset.connectionHostTab = host.hostId;
|
|
21226
|
+
tab.setAttribute("role", "tab");
|
|
21227
|
+
tab.setAttribute("aria-controls", panelId);
|
|
21228
|
+
tab.addEventListener("click", () => {
|
|
21229
|
+
selectedHostId = host.hostId;
|
|
21230
|
+
render(latestSnapshot);
|
|
21231
|
+
});
|
|
21232
|
+
tab.addEventListener("keydown", (event) => {
|
|
21233
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
21234
|
+
event.preventDefault();
|
|
21235
|
+
const hosts = latestSnapshot?.hosts ?? [];
|
|
21236
|
+
const index = hosts.findIndex((candidate) => candidate.hostId === host.hostId);
|
|
21237
|
+
if (index < 0) return;
|
|
21238
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
21239
|
+
const next = hosts[(index + direction + hosts.length) % hosts.length];
|
|
21240
|
+
if (!next) return;
|
|
21241
|
+
selectedHostId = next.hostId;
|
|
21242
|
+
render(latestSnapshot);
|
|
21243
|
+
hostTabElements.get(next.hostId)?.focus();
|
|
21244
|
+
});
|
|
21245
|
+
hostTabElements.set(host.hostId, tab);
|
|
21246
|
+
tabsChanged = true;
|
|
21247
|
+
}
|
|
21248
|
+
const isSelected = host.hostId === selectedHost.hostId;
|
|
21249
|
+
const activeValue = String(host.active);
|
|
21250
|
+
if (tab.dataset.connectionHostActive !== activeValue) {
|
|
21251
|
+
tab.dataset.connectionHostActive = activeValue;
|
|
21252
|
+
}
|
|
21253
|
+
const selectedValue = String(isSelected);
|
|
21254
|
+
if (tab.getAttribute("aria-selected") !== selectedValue) {
|
|
21255
|
+
tab.setAttribute("aria-selected", selectedValue);
|
|
21256
|
+
}
|
|
21257
|
+
const nextTabIndex = isSelected ? 0 : -1;
|
|
21258
|
+
if (tab.tabIndex !== nextTabIndex) {
|
|
21259
|
+
tab.tabIndex = nextTabIndex;
|
|
21260
|
+
}
|
|
20672
21261
|
const hostName = hostNames.get(host.hostId) || connectionHostName(host.hostId, messages);
|
|
20673
|
-
tab.textContent
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20677
|
-
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
20683
|
-
const next = snapshot.hosts[(index + direction + snapshot.hosts.length) % snapshot.hosts.length];
|
|
20684
|
-
if (!next) return;
|
|
20685
|
-
selectedHostId = next.hostId;
|
|
20686
|
-
render(latestSnapshot);
|
|
20687
|
-
const nextTab = [
|
|
20688
|
-
...content.querySelectorAll("[data-connection-host-tab]")
|
|
20689
|
-
].find((candidate) => candidate.dataset.connectionHostTab === next.hostId);
|
|
20690
|
-
nextTab?.focus();
|
|
20691
|
-
});
|
|
20692
|
-
tabs.append(tab);
|
|
21262
|
+
if (tab.textContent !== hostName) {
|
|
21263
|
+
tab.textContent = hostName;
|
|
21264
|
+
tabsChanged = true;
|
|
21265
|
+
}
|
|
21266
|
+
const tabTitle = host.active ? `${hostName} \xB7 ${messages.connectionActiveHost}` : hostName;
|
|
21267
|
+
if (tab.title !== tabTitle) {
|
|
21268
|
+
tab.title = tabTitle;
|
|
21269
|
+
}
|
|
21270
|
+
return tab;
|
|
20693
21271
|
});
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
const componentHeading = document2.createElement("span");
|
|
20699
|
-
componentHeading.textContent = messages.connectionComponent;
|
|
20700
|
-
componentHeading.setAttribute("role", "columnheader");
|
|
20701
|
-
const statusHeading = document2.createElement("span");
|
|
20702
|
-
statusHeading.textContent = messages.connectionStatus;
|
|
20703
|
-
statusHeading.setAttribute("role", "columnheader");
|
|
20704
|
-
const actionHeading = document2.createElement("span");
|
|
20705
|
-
actionHeading.setAttribute("aria-hidden", "true");
|
|
20706
|
-
tableHeader.append(componentHeading, statusHeading, actionHeading);
|
|
20707
|
-
const rows = document2.createElement("div");
|
|
20708
|
-
rows.className = "settings-connection-rows";
|
|
20709
|
-
rows.id = panelId;
|
|
20710
|
-
rows.dataset.connectionHost = selectedHost.hostId;
|
|
20711
|
-
rows.setAttribute("role", "rowgroup");
|
|
20712
|
-
const inspector = document2.createElement("aside");
|
|
20713
|
-
inspector.className = "settings-connection-inspector";
|
|
20714
|
-
inspector.setAttribute("aria-live", "polite");
|
|
21272
|
+
reconcileElementChildren(tabs, nextTabs);
|
|
21273
|
+
if (rows.dataset.connectionHost !== selectedHost.hostId) {
|
|
21274
|
+
rows.dataset.connectionHost = selectedHost.hostId;
|
|
21275
|
+
}
|
|
20715
21276
|
const items = connectionItems(snapshot, selectedHost, messages, diagnostics).map(
|
|
20716
21277
|
(item) => {
|
|
20717
21278
|
const agent = item.agentSnapshot?.agent;
|
|
20718
21279
|
if (!agent) return item;
|
|
20719
21280
|
const state = installs?.get(selectedHost.hostId, agent);
|
|
20720
21281
|
const availability = state?.status ?? item.availability;
|
|
20721
|
-
const
|
|
21282
|
+
const updating = versions.isUpdating(selectedHost.hostId, agent);
|
|
21283
|
+
const version2 = updating || item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
|
|
20722
21284
|
return {
|
|
20723
21285
|
...item,
|
|
20724
21286
|
...state ? { availability: state.status } : {},
|
|
@@ -20740,66 +21302,66 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20740
21302
|
(item) => item.agentSnapshot?.availability === "notInstalled" || item.error !== null
|
|
20741
21303
|
)?.key ?? items[0]?.key ?? null;
|
|
20742
21304
|
}
|
|
20743
|
-
|
|
21305
|
+
let hostRows = hostRowViews.get(selectedHost.hostId);
|
|
21306
|
+
if (!hostRows) {
|
|
21307
|
+
hostRows = /* @__PURE__ */ new Map();
|
|
21308
|
+
hostRowViews.set(selectedHost.hostId, hostRows);
|
|
21309
|
+
}
|
|
21310
|
+
currentHostRows = hostRows;
|
|
20744
21311
|
const selectItem = (item) => {
|
|
20745
21312
|
selectedItemKey = item.key;
|
|
20746
|
-
for (const [key,
|
|
20747
|
-
|
|
20748
|
-
row.dataset.connectionSelected = String(selected);
|
|
20749
|
-
row.tabIndex = selected ? 0 : -1;
|
|
21313
|
+
for (const [key, view] of currentHostRows) {
|
|
21314
|
+
view.setSelected(key === item.key);
|
|
20750
21315
|
}
|
|
20751
|
-
|
|
20752
|
-
const element = renderConnectionInspector(
|
|
20753
|
-
document2,
|
|
20754
|
-
inspector,
|
|
20755
|
-
item,
|
|
20756
|
-
selectedHost.hostId,
|
|
20757
|
-
messages,
|
|
20758
|
-
getDiagnostics(),
|
|
20759
|
-
existing,
|
|
20760
|
-
runRefresh
|
|
20761
|
-
);
|
|
20762
|
-
launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
|
|
20763
|
-
if (item.version) inspector.append(item.version.element);
|
|
21316
|
+
syncSelectedInspector(selectedHost.hostId, item);
|
|
20764
21317
|
};
|
|
20765
|
-
const
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
document2,
|
|
21318
|
+
const ensureRowView = (key, groupable) => {
|
|
21319
|
+
let view = hostRows.get(key);
|
|
21320
|
+
if (!view) {
|
|
21321
|
+
view = createConnectionRowView(document2, messages, groupable);
|
|
21322
|
+
hostRows.set(key, view);
|
|
21323
|
+
}
|
|
21324
|
+
return view;
|
|
21325
|
+
};
|
|
21326
|
+
const activeKeys = /* @__PURE__ */ new Set();
|
|
21327
|
+
const nextRowChildren = [];
|
|
21328
|
+
const pinnedItems = items.filter((item) => item.agentSnapshot === void 0);
|
|
21329
|
+
for (const pinnedItem of pinnedItems) {
|
|
21330
|
+
activeKeys.add(pinnedItem.key);
|
|
21331
|
+
const view = ensureRowView(pinnedItem.key, false);
|
|
21332
|
+
view.update(
|
|
20769
21333
|
pinnedItem,
|
|
20770
|
-
messages,
|
|
20771
21334
|
pinnedItem.key === selectedItemKey,
|
|
20772
|
-
() => selectItem(pinnedItem)
|
|
21335
|
+
() => selectItem(pinnedItem),
|
|
21336
|
+
null
|
|
20773
21337
|
);
|
|
20774
|
-
|
|
20775
|
-
rows.append(row);
|
|
21338
|
+
nextRowChildren.push(view.element);
|
|
20776
21339
|
}
|
|
20777
21340
|
const groupableItems = items.filter(
|
|
20778
21341
|
(item) => item.agentSnapshot !== void 0
|
|
20779
21342
|
);
|
|
20780
21343
|
const agentByKey = new Map(groupableItems.map((item) => [item.key, item]));
|
|
20781
|
-
|
|
20782
|
-
const
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
21344
|
+
currentCatalog = groupableItems.map((item) => ({ id: item.key, name: item.name }));
|
|
21345
|
+
const notInstalledAgents = /* @__PURE__ */ new Set();
|
|
21346
|
+
for (const item of groupableItems) {
|
|
21347
|
+
const agent = item.agentSnapshot.agent;
|
|
21348
|
+
const stateKey = `${selectedHost.hostId}:${agent}`;
|
|
21349
|
+
if (item.agentSnapshot.availability !== "checking") {
|
|
21350
|
+
knownNotInstalled.set(stateKey, item.agentSnapshot.availability === "notInstalled");
|
|
21351
|
+
}
|
|
21352
|
+
const isNotInstalled = item.agentSnapshot.availability === "checking" ? knownNotInstalled.get(stateKey) ?? false : item.agentSnapshot.availability === "notInstalled";
|
|
21353
|
+
if (isNotInstalled) notInstalledAgents.add(agent);
|
|
21354
|
+
}
|
|
21355
|
+
const preferenceOrder = groupPreference.list(notInstalledAgents, currentCatalog).filter((entry) => agentByKey.has(entry.agent));
|
|
21356
|
+
currentMainEntries = preferenceOrder.filter((entry) => entry.section === "main");
|
|
21357
|
+
currentMoreEntries = preferenceOrder.filter((entry) => entry.section === "more");
|
|
20790
21358
|
const nextInSection = (section, agent) => {
|
|
20791
|
-
const
|
|
20792
|
-
const index =
|
|
20793
|
-
return index >= 0 ?
|
|
20794
|
-
};
|
|
20795
|
-
let draggingAgent = null;
|
|
20796
|
-
let moreZone = null;
|
|
20797
|
-
const clearDropIndicators = () => {
|
|
20798
|
-
for (const row of rowElements.values()) row.dataset.connectionDropIndicator = "";
|
|
20799
|
-
if (moreZone) moreZone.dataset.connectionDragOver = "false";
|
|
21359
|
+
const sectionEntries = section === "main" ? currentMainEntries : currentMoreEntries;
|
|
21360
|
+
const index = sectionEntries.findIndex((entry) => entry.agent === agent);
|
|
21361
|
+
return index >= 0 ? sectionEntries[index + 1]?.agent ?? null : null;
|
|
20800
21362
|
};
|
|
20801
21363
|
const dropTargetSection = (agent, event) => {
|
|
20802
|
-
const row =
|
|
21364
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20803
21365
|
const rect = row && typeof row.getBoundingClientRect === "function" ? row.getBoundingClientRect() : null;
|
|
20804
21366
|
const before = rect ? event.clientY - rect.top < rect.height / 2 : true;
|
|
20805
21367
|
const section = row?.dataset.connectionGroupSection ?? "main";
|
|
@@ -20811,7 +21373,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20811
21373
|
moveLabel: section === "main" ? messages.connectionGroupMoveToMore : messages.connectionGroupMoveToMain,
|
|
20812
21374
|
dragHandleTitle: messages.connectionGroupDragHandle,
|
|
20813
21375
|
toggleSection() {
|
|
20814
|
-
groupPreference.moveAgent(
|
|
21376
|
+
groupPreference.moveAgent(
|
|
21377
|
+
agent,
|
|
21378
|
+
section === "main" ? "more" : "main",
|
|
21379
|
+
null,
|
|
21380
|
+
currentCatalog
|
|
21381
|
+
);
|
|
20815
21382
|
},
|
|
20816
21383
|
onDragStart(event) {
|
|
20817
21384
|
if (groupDisabled) {
|
|
@@ -20821,127 +21388,107 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20821
21388
|
draggingAgent = agent;
|
|
20822
21389
|
event.dataTransfer?.setData("text/plain", agent);
|
|
20823
21390
|
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
20824
|
-
const row =
|
|
21391
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20825
21392
|
if (row) row.dataset.connectionDragging = "true";
|
|
20826
21393
|
},
|
|
20827
21394
|
onDragOver(event) {
|
|
20828
21395
|
if (!draggingAgent || draggingAgent === agent) return;
|
|
20829
21396
|
event.preventDefault();
|
|
20830
|
-
const row =
|
|
21397
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20831
21398
|
if (!row) return;
|
|
20832
21399
|
const { before } = dropTargetSection(agent, event);
|
|
20833
21400
|
clearDropIndicators();
|
|
20834
21401
|
row.dataset.connectionDropIndicator = before ? "before" : "after";
|
|
20835
21402
|
},
|
|
20836
21403
|
onDragLeave() {
|
|
20837
|
-
const row =
|
|
21404
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20838
21405
|
if (row) row.dataset.connectionDropIndicator = "";
|
|
20839
21406
|
},
|
|
20840
21407
|
onDrop(event) {
|
|
20841
21408
|
event.preventDefault();
|
|
20842
21409
|
if (!draggingAgent) return;
|
|
20843
21410
|
const { beforeAgent } = dropTargetSection(agent, event);
|
|
20844
|
-
groupPreference.moveAgent(draggingAgent, section, beforeAgent,
|
|
21411
|
+
groupPreference.moveAgent(draggingAgent, section, beforeAgent, currentCatalog);
|
|
20845
21412
|
draggingAgent = null;
|
|
20846
21413
|
clearDropIndicators();
|
|
20847
21414
|
},
|
|
20848
21415
|
onDragEnd() {
|
|
20849
21416
|
draggingAgent = null;
|
|
20850
|
-
const row =
|
|
21417
|
+
const row = currentHostRows.get(agent)?.element;
|
|
20851
21418
|
if (row) row.dataset.connectionDragging = "false";
|
|
20852
21419
|
clearDropIndicators();
|
|
21420
|
+
scheduleRender();
|
|
20853
21421
|
}
|
|
20854
21422
|
});
|
|
20855
|
-
const
|
|
20856
|
-
const item = agentByKey.get(agent);
|
|
20857
|
-
if (!item)
|
|
20858
|
-
|
|
20859
|
-
|
|
21423
|
+
for (const entry of currentMainEntries) {
|
|
21424
|
+
const item = agentByKey.get(entry.agent);
|
|
21425
|
+
if (!item) continue;
|
|
21426
|
+
activeKeys.add(item.key);
|
|
21427
|
+
const view = ensureRowView(item.key, true);
|
|
21428
|
+
view.update(
|
|
20860
21429
|
item,
|
|
20861
|
-
messages,
|
|
20862
21430
|
item.key === selectedItemKey,
|
|
20863
21431
|
() => selectItem(item),
|
|
20864
|
-
createGroupController(agent,
|
|
21432
|
+
createGroupController(entry.agent, "main")
|
|
20865
21433
|
);
|
|
20866
|
-
|
|
20867
|
-
|
|
20868
|
-
};
|
|
20869
|
-
for (const entry of mainEntries) appendGroupRow(entry.agent, "main");
|
|
21434
|
+
nextRowChildren.push(view.element);
|
|
21435
|
+
}
|
|
20870
21436
|
if (groupableItems.length > 0) {
|
|
20871
|
-
|
|
20872
|
-
|
|
20873
|
-
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20879
|
-
zone.dataset.connectionDragOver = "true";
|
|
20880
|
-
});
|
|
20881
|
-
zone.addEventListener("dragleave", () => {
|
|
20882
|
-
zone.dataset.connectionDragOver = "false";
|
|
20883
|
-
});
|
|
20884
|
-
zone.addEventListener("drop", (event) => {
|
|
20885
|
-
event.preventDefault();
|
|
20886
|
-
zone.dataset.connectionDragOver = "false";
|
|
20887
|
-
if (!draggingAgent) return;
|
|
20888
|
-
groupPreference.moveAgent(draggingAgent, "more", null, catalog);
|
|
20889
|
-
draggingAgent = null;
|
|
20890
|
-
clearDropIndicators();
|
|
20891
|
-
});
|
|
20892
|
-
if (moreEntries.length === 0) {
|
|
20893
|
-
zone.append(createGroupMoreHint(document2, messages));
|
|
21437
|
+
const dividerText = `${messages.connectionGroupMoreLabel} (${currentMoreEntries.length})`;
|
|
21438
|
+
if (groupDivider.textContent !== dividerText) {
|
|
21439
|
+
groupDivider.textContent = dividerText;
|
|
21440
|
+
}
|
|
21441
|
+
nextRowChildren.push(groupDivider);
|
|
21442
|
+
const nextMoreChildren = [];
|
|
21443
|
+
if (currentMoreEntries.length === 0) {
|
|
21444
|
+
nextMoreChildren.push(moreHint);
|
|
20894
21445
|
} else {
|
|
20895
|
-
for (const entry of
|
|
21446
|
+
for (const entry of currentMoreEntries) {
|
|
20896
21447
|
const item = agentByKey.get(entry.agent);
|
|
20897
21448
|
if (!item) continue;
|
|
20898
|
-
|
|
20899
|
-
|
|
21449
|
+
activeKeys.add(item.key);
|
|
21450
|
+
const view = ensureRowView(item.key, true);
|
|
21451
|
+
view.update(
|
|
20900
21452
|
item,
|
|
20901
|
-
messages,
|
|
20902
21453
|
item.key === selectedItemKey,
|
|
20903
21454
|
() => selectItem(item),
|
|
20904
21455
|
createGroupController(entry.agent, "more")
|
|
20905
21456
|
);
|
|
20906
|
-
|
|
20907
|
-
zone.append(row);
|
|
21457
|
+
nextMoreChildren.push(view.element);
|
|
20908
21458
|
}
|
|
20909
21459
|
}
|
|
20910
|
-
|
|
20911
|
-
|
|
20912
|
-
|
|
20913
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
21460
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
21461
|
+
reconcileElementChildren(moreZone, nextMoreChildren);
|
|
21462
|
+
}
|
|
21463
|
+
nextRowChildren.push(moreZone);
|
|
21464
|
+
resetButton.disabled = groupDisabled;
|
|
21465
|
+
nextRowChildren.push(resetButton);
|
|
21466
|
+
}
|
|
21467
|
+
for (const key of hostRows.keys()) {
|
|
21468
|
+
if (!activeKeys.has(key)) hostRows.delete(key);
|
|
21469
|
+
}
|
|
21470
|
+
if (!draggingAgent || renderedHostId !== selectedHost.hostId) {
|
|
21471
|
+
reconcileElementChildren(rows, nextRowChildren);
|
|
20916
21472
|
}
|
|
20917
21473
|
const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
|
|
20918
21474
|
if (selectedItem) selectItem(selectedItem);
|
|
20919
|
-
|
|
21475
|
+
updateControls.update(
|
|
20920
21476
|
selectedHost.hostId,
|
|
20921
21477
|
items.flatMap((item) => item.version ? [item.version] : [])
|
|
20922
21478
|
);
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
const selectedTab = [...tabs.children].find(
|
|
20937
|
-
(child) => child.getAttribute("aria-selected") === "true"
|
|
20938
|
-
);
|
|
20939
|
-
if (selectedTab) {
|
|
20940
|
-
const left = selectedTab.offsetLeft;
|
|
20941
|
-
const right = left + selectedTab.offsetWidth;
|
|
20942
|
-
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
20943
|
-
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
20944
|
-
tabs.scrollLeft = right - tabs.clientWidth;
|
|
21479
|
+
if (layoutFirstMount || tabsChanged) {
|
|
21480
|
+
hostScroller.update();
|
|
21481
|
+
}
|
|
21482
|
+
if (renderedHostId !== selectedHost.hostId) {
|
|
21483
|
+
renderedHostId = selectedHost.hostId;
|
|
21484
|
+
const selectedTab = hostTabElements.get(selectedHost.hostId);
|
|
21485
|
+
if (selectedTab) {
|
|
21486
|
+
const left = selectedTab.offsetLeft;
|
|
21487
|
+
const right = left + selectedTab.offsetWidth;
|
|
21488
|
+
if (left < tabs.scrollLeft) tabs.scrollLeft = left;
|
|
21489
|
+
else if (right > tabs.scrollLeft + tabs.clientWidth) {
|
|
21490
|
+
tabs.scrollLeft = right - tabs.clientWidth;
|
|
21491
|
+
}
|
|
20945
21492
|
}
|
|
20946
21493
|
}
|
|
20947
21494
|
};
|
|
@@ -20962,7 +21509,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20962
21509
|
refresh.disabled = true;
|
|
20963
21510
|
return () => {
|
|
20964
21511
|
cancelRender();
|
|
20965
|
-
|
|
21512
|
+
hostScroller.dispose();
|
|
20966
21513
|
unsubscribeGroup();
|
|
20967
21514
|
};
|
|
20968
21515
|
}
|
|
@@ -20971,7 +21518,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20971
21518
|
const unsubscribeInstalls = installs?.subscribe(scheduleRender);
|
|
20972
21519
|
return () => {
|
|
20973
21520
|
cancelRender();
|
|
20974
|
-
|
|
21521
|
+
hostScroller.dispose();
|
|
20975
21522
|
unsubscribeInstalls?.();
|
|
20976
21523
|
unsubscribe();
|
|
20977
21524
|
unsubscribeGroup();
|
|
@@ -22378,6 +22925,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22378
22925
|
latestCacheHit: "Latest cache hit (CH)",
|
|
22379
22926
|
sessionCacheHit: "Average cache hit",
|
|
22380
22927
|
outputSpeed: "Output speed (TPS)",
|
|
22928
|
+
averageOutputSpeed: "Average output speed (TPS)",
|
|
22381
22929
|
apiOutputSpeed: "API average speed",
|
|
22382
22930
|
apiOutputSpeedDescription: "Output tokens / native API time, including first-token wait; not generation TPS.",
|
|
22383
22931
|
timeToFirstOutput: "Time to first token (TTFT)",
|
|
@@ -22403,6 +22951,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22403
22951
|
latestCacheHit: "\u6700\u8FD1\u7F13\u5B58\u547D\u4E2D\uFF08CH\uFF09",
|
|
22404
22952
|
sessionCacheHit: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
|
|
22405
22953
|
outputSpeed: "\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
22954
|
+
averageOutputSpeed: "\u5E73\u5747\u8F93\u51FA\u901F\u5EA6\uFF08TPS\uFF09",
|
|
22406
22955
|
apiOutputSpeed: "API \u5E73\u5747\u901F\u5EA6",
|
|
22407
22956
|
apiOutputSpeedDescription: "\u8F93\u51FA Token \xF7 \u539F\u751F API \u8017\u65F6\uFF0C\u542B\u9996\u5B57\u7B49\u5F85\uFF1B\u4E0D\u662F\u751F\u6210 TPS\u3002",
|
|
22408
22957
|
timeToFirstOutput: "\u9996 token\uFF08TTFT\uFF09",
|
|
@@ -22500,7 +23049,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22500
23049
|
return svg2;
|
|
22501
23050
|
}
|
|
22502
23051
|
function rendererUsageHasDisplayData(usage) {
|
|
22503
|
-
return usage?.cacheHitRatePercent !== void 0 || usage?.sessionCacheHitRatePercent !== void 0 || usage?.outputTokensPerSecond !== void 0 || usage?.apiOutputTokensPerSecond !== void 0 || usage?.timeToFirstOutputMs !== void 0 || usage?.totalCostUsd !== void 0 || usage?.totalCredits !== void 0 || usage?.contextUsagePercent !== void 0 || usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0 || usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0;
|
|
23052
|
+
return usage?.cacheHitRatePercent !== void 0 || usage?.sessionCacheHitRatePercent !== void 0 || usage?.sessionOutputTokensPerSecond !== void 0 || usage?.outputTokensPerSecond !== void 0 || usage?.apiOutputTokensPerSecond !== void 0 || usage?.timeToFirstOutputMs !== void 0 || usage?.totalCostUsd !== void 0 || usage?.totalCredits !== void 0 || usage?.contextUsagePercent !== void 0 || usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0 || usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0;
|
|
22504
23053
|
}
|
|
22505
23054
|
function applyRendererPopoverChrome(popover) {
|
|
22506
23055
|
popover.style.border = "1px solid light-dark(rgba(15, 23, 42, 0.10), color-mix(in srgb, CanvasText 16%, transparent))";
|
|
@@ -22613,6 +23162,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22613
23162
|
formatRendererCacheHitRate(usage.sessionCacheHitRatePercent)
|
|
22614
23163
|
]);
|
|
22615
23164
|
}
|
|
23165
|
+
if (usage?.sessionOutputTokensPerSecond !== void 0) {
|
|
23166
|
+
session.push([
|
|
23167
|
+
messages.averageOutputSpeed,
|
|
23168
|
+
formatRendererTokenRate(usage.sessionOutputTokensPerSecond, locale)
|
|
23169
|
+
]);
|
|
23170
|
+
}
|
|
22616
23171
|
if (usage?.cacheHitRatePercent !== void 0) {
|
|
22617
23172
|
session.push([messages.latestCacheHit, formatRendererCacheHitRate(usage.cacheHitRatePercent)]);
|
|
22618
23173
|
}
|
|
@@ -24439,9 +24994,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24439
24994
|
resets: "Resets",
|
|
24440
24995
|
details: "Account limit details",
|
|
24441
24996
|
weekly: "Weekly limit",
|
|
24997
|
+
weeklyShort: "Weekly",
|
|
24442
24998
|
monthly: "Monthly limit",
|
|
24999
|
+
monthlyShort: "Monthly",
|
|
24443
25000
|
fiveHour: "5-hour limit",
|
|
25001
|
+
fiveHourShort: "5-hour",
|
|
24444
25002
|
sevenDay: "7-day limit",
|
|
25003
|
+
sevenDayShort: "7-day",
|
|
24445
25004
|
account: "Account limit"
|
|
24446
25005
|
});
|
|
24447
25006
|
var CHINESE_CREDITS_MESSAGES = Object.freeze({
|
|
@@ -24449,9 +25008,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24449
25008
|
resets: "\u91CD\u7F6E",
|
|
24450
25009
|
details: "\u8D26\u53F7\u989D\u5EA6\u8BE6\u60C5",
|
|
24451
25010
|
weekly: "\u5468\u989D\u5EA6",
|
|
25011
|
+
weeklyShort: "\u5468\u989D\u5EA6",
|
|
24452
25012
|
monthly: "\u6708\u989D\u5EA6",
|
|
25013
|
+
monthlyShort: "\u6708\u989D\u5EA6",
|
|
24453
25014
|
fiveHour: "5 \u5C0F\u65F6\u989D\u5EA6",
|
|
25015
|
+
fiveHourShort: "5 \u5C0F\u65F6",
|
|
24454
25016
|
sevenDay: "7 \u5929\u989D\u5EA6",
|
|
25017
|
+
sevenDayShort: "7 \u5929",
|
|
24455
25018
|
account: "\u8D26\u53F7\u989D\u5EA6"
|
|
24456
25019
|
});
|
|
24457
25020
|
function rendererCreditsMessages(locale) {
|
|
@@ -24483,6 +25046,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24483
25046
|
if (periodType === "seven_day") return messages.sevenDay;
|
|
24484
25047
|
return messages.account;
|
|
24485
25048
|
}
|
|
25049
|
+
function compactPeriodLabel(periodType, locale) {
|
|
25050
|
+
const messages = rendererCreditsMessages(locale);
|
|
25051
|
+
if (periodType === "weekly") return messages.weeklyShort;
|
|
25052
|
+
if (periodType === "monthly") return messages.monthlyShort;
|
|
25053
|
+
if (periodType === "five_hour") return messages.fiveHourShort;
|
|
25054
|
+
if (periodType === "seven_day") return messages.sevenDayShort;
|
|
25055
|
+
return messages.account;
|
|
25056
|
+
}
|
|
24486
25057
|
function productLabel(product, locale = "en") {
|
|
24487
25058
|
return accountCreditsWindowLabel(product, locale, (period) => creditsPeriodLabel(period, locale));
|
|
24488
25059
|
}
|
|
@@ -24494,10 +25065,10 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24494
25065
|
function remainingPercent(usedPercent) {
|
|
24495
25066
|
return Math.min(100, Math.max(0, 100 - usedPercent));
|
|
24496
25067
|
}
|
|
24497
|
-
function renderCreditsBar(usagePercent, color) {
|
|
25068
|
+
function renderCreditsBar(usagePercent, color, height = "6px") {
|
|
24498
25069
|
const track = document.createElement("div");
|
|
24499
25070
|
track.dataset.codexhostCreditsBar = "";
|
|
24500
|
-
track.style.height =
|
|
25071
|
+
track.style.height = height;
|
|
24501
25072
|
track.style.borderRadius = "9999px";
|
|
24502
25073
|
track.style.background = "color-mix(in srgb, currentColor 16%, transparent)";
|
|
24503
25074
|
track.style.overflow = "hidden";
|
|
@@ -24514,6 +25085,34 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24514
25085
|
const formatted = formatRendererCreditsReset(resetsAt, /* @__PURE__ */ new Date(), locale);
|
|
24515
25086
|
return locale === "zh-CN" ? `${formatted} ${messages.resets}` : `${messages.resets} ${formatted}`;
|
|
24516
25087
|
}
|
|
25088
|
+
function renderResetLine(resetsAt, fontSize, locale, messages) {
|
|
25089
|
+
const exact = resetLabel(resetsAt, locale, messages);
|
|
25090
|
+
const reset = document.createElement("div");
|
|
25091
|
+
reset.dataset.codexhostResetAt = resetsAt;
|
|
25092
|
+
reset.dataset.codexhostResetLocale = locale;
|
|
25093
|
+
reset.textContent = formatAccountCreditsResetCountdown(resetsAt, locale) ?? exact;
|
|
25094
|
+
reset.title = exact;
|
|
25095
|
+
reset.style.fontSize = fontSize;
|
|
25096
|
+
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
25097
|
+
return reset;
|
|
25098
|
+
}
|
|
25099
|
+
function refreshResetLines(popover) {
|
|
25100
|
+
if (typeof popover.querySelectorAll !== "function") return;
|
|
25101
|
+
const nowMs = Date.now();
|
|
25102
|
+
for (const element of popover.querySelectorAll("[data-codexhost-reset-at]")) {
|
|
25103
|
+
const resetsAt = element.dataset.codexhostResetAt;
|
|
25104
|
+
if (!resetsAt) continue;
|
|
25105
|
+
const locale = element.dataset.codexhostResetLocale === "zh-CN" ? "zh-CN" : "en";
|
|
25106
|
+
const exact = resetLabel(resetsAt, locale, rendererCreditsMessages(locale));
|
|
25107
|
+
if (element.dataset.codexhostResetCompact === "1") {
|
|
25108
|
+
const compact = formatAccountCreditsCompactCountdown(resetsAt, locale, nowMs);
|
|
25109
|
+
element.textContent = `\xB7 ${compact ?? exact}`;
|
|
25110
|
+
} else {
|
|
25111
|
+
element.textContent = formatAccountCreditsResetCountdown(resetsAt, locale, nowMs) ?? exact;
|
|
25112
|
+
}
|
|
25113
|
+
element.title = exact;
|
|
25114
|
+
}
|
|
25115
|
+
}
|
|
24517
25116
|
function renderCreditsHeader(credits, locale, messages) {
|
|
24518
25117
|
const wrapper = document.createElement("div");
|
|
24519
25118
|
wrapper.style.marginBottom = "11px";
|
|
@@ -24530,11 +25129,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24530
25129
|
label.style.fontWeight = "600";
|
|
24531
25130
|
left.append(label);
|
|
24532
25131
|
if (credits.resetsAt) {
|
|
24533
|
-
|
|
24534
|
-
reset.textContent = resetLabel(credits.resetsAt, locale, messages);
|
|
24535
|
-
reset.style.fontSize = "11px";
|
|
24536
|
-
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
24537
|
-
left.append(reset);
|
|
25132
|
+
left.append(renderResetLine(credits.resetsAt, "11px", locale, messages));
|
|
24538
25133
|
}
|
|
24539
25134
|
const color = toneColor(rendererCreditsTone(credits.usedPercent));
|
|
24540
25135
|
const remaining = remainingPercent(credits.usedPercent);
|
|
@@ -24563,7 +25158,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24563
25158
|
const color = toneColor(rendererCreditsTone(usagePercent));
|
|
24564
25159
|
const remaining = remainingPercent(usagePercent);
|
|
24565
25160
|
const tile = document.createElement("div");
|
|
24566
|
-
tile.style.marginBottom = "
|
|
25161
|
+
tile.style.marginBottom = "9px";
|
|
24567
25162
|
const top = document.createElement("div");
|
|
24568
25163
|
top.style.display = "flex";
|
|
24569
25164
|
top.style.alignItems = "flex-start";
|
|
@@ -24576,40 +25171,137 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24576
25171
|
name.style.fontSize = "12px";
|
|
24577
25172
|
left.append(name);
|
|
24578
25173
|
if (resetsAt) {
|
|
24579
|
-
|
|
24580
|
-
reset.textContent = resetLabel(resetsAt, locale, messages);
|
|
24581
|
-
reset.style.fontSize = "10.5px";
|
|
24582
|
-
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
24583
|
-
left.append(reset);
|
|
25174
|
+
left.append(renderResetLine(resetsAt, "10.5px", locale, messages));
|
|
24584
25175
|
}
|
|
24585
25176
|
const percent2 = document.createElement("span");
|
|
24586
25177
|
percent2.textContent = `${messages.remaining} ${formatRendererCreditsPercent(remaining)}`;
|
|
24587
25178
|
percent2.style.fontSize = "12px";
|
|
24588
25179
|
percent2.style.fontVariantNumeric = "tabular-nums";
|
|
25180
|
+
percent2.style.whiteSpace = "nowrap";
|
|
24589
25181
|
percent2.style.color = color;
|
|
24590
25182
|
top.append(left, percent2);
|
|
24591
25183
|
tile.append(top, renderCreditsBar(remaining, color));
|
|
24592
25184
|
return tile;
|
|
24593
25185
|
}
|
|
25186
|
+
function renderCompactCreditsRow(label, usagePercent, locale, messages, resetsAt, hero = false) {
|
|
25187
|
+
const color = toneColor(rendererCreditsTone(usagePercent));
|
|
25188
|
+
const remaining = remainingPercent(usagePercent);
|
|
25189
|
+
const row = document.createElement("div");
|
|
25190
|
+
row.style.marginBottom = "8px";
|
|
25191
|
+
const top = document.createElement("div");
|
|
25192
|
+
top.style.display = "flex";
|
|
25193
|
+
top.style.alignItems = "baseline";
|
|
25194
|
+
top.style.justifyContent = "space-between";
|
|
25195
|
+
top.style.gap = "8px";
|
|
25196
|
+
top.style.marginBottom = "4px";
|
|
25197
|
+
const left = document.createElement("span");
|
|
25198
|
+
left.style.display = "inline-flex";
|
|
25199
|
+
left.style.alignItems = "baseline";
|
|
25200
|
+
left.style.gap = "6px";
|
|
25201
|
+
left.style.minWidth = "0";
|
|
25202
|
+
const name = document.createElement("span");
|
|
25203
|
+
name.textContent = label;
|
|
25204
|
+
name.style.fontSize = "12px";
|
|
25205
|
+
name.style.color = "color-mix(in srgb, currentColor 82%, transparent)";
|
|
25206
|
+
left.append(name);
|
|
25207
|
+
if (resetsAt) {
|
|
25208
|
+
const exact = resetLabel(resetsAt, locale, messages);
|
|
25209
|
+
if (usagePercent > 0) {
|
|
25210
|
+
const countdown = document.createElement("span");
|
|
25211
|
+
countdown.dataset.codexhostResetAt = resetsAt;
|
|
25212
|
+
countdown.dataset.codexhostResetLocale = locale;
|
|
25213
|
+
countdown.dataset.codexhostResetCompact = "1";
|
|
25214
|
+
const compact = formatAccountCreditsCompactCountdown(resetsAt, locale);
|
|
25215
|
+
countdown.textContent = `\xB7 ${compact ?? exact}`;
|
|
25216
|
+
countdown.title = exact;
|
|
25217
|
+
countdown.style.fontSize = "11px";
|
|
25218
|
+
countdown.style.color = "color-mix(in srgb, currentColor 52%, transparent)";
|
|
25219
|
+
countdown.style.whiteSpace = "nowrap";
|
|
25220
|
+
left.append(countdown);
|
|
25221
|
+
} else {
|
|
25222
|
+
left.title = exact;
|
|
25223
|
+
}
|
|
25224
|
+
}
|
|
25225
|
+
const percent2 = document.createElement("span");
|
|
25226
|
+
percent2.textContent = formatRendererCreditsPercent(remaining);
|
|
25227
|
+
percent2.style.fontSize = hero ? "22px" : "13px";
|
|
25228
|
+
percent2.style.fontWeight = hero ? "700" : "600";
|
|
25229
|
+
if (hero) {
|
|
25230
|
+
percent2.style.lineHeight = "1";
|
|
25231
|
+
percent2.style.marginTop = "-6px";
|
|
25232
|
+
}
|
|
25233
|
+
percent2.style.fontVariantNumeric = "tabular-nums";
|
|
25234
|
+
percent2.style.whiteSpace = "nowrap";
|
|
25235
|
+
percent2.style.color = color;
|
|
25236
|
+
top.append(left, percent2);
|
|
25237
|
+
row.append(top, renderCreditsBar(remaining, color, "4px"));
|
|
25238
|
+
return row;
|
|
25239
|
+
}
|
|
24594
25240
|
function renderDetails2(popover, credits, locale) {
|
|
24595
25241
|
const messages = rendererCreditsMessages(locale);
|
|
24596
25242
|
const glowColor = toneColor(rendererCreditsTone(credits.usedPercent));
|
|
24597
25243
|
popover.style.backgroundImage = `radial-gradient(160px 100px at 18% -10%, color-mix(in srgb, ${glowColor} 20%, transparent), transparent 70%)`;
|
|
24598
25244
|
popover.setAttribute("aria-label", messages.details);
|
|
24599
25245
|
popover.replaceChildren();
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
locale,
|
|
24606
|
-
messages,
|
|
24607
|
-
product.resetsAt
|
|
24608
|
-
)
|
|
25246
|
+
const sections = groupAccountCreditsWindows(
|
|
25247
|
+
credits,
|
|
25248
|
+
locale,
|
|
25249
|
+
(period) => creditsPeriodLabel(period, locale),
|
|
25250
|
+
(period) => compactPeriodLabel(period, locale)
|
|
24609
25251
|
);
|
|
24610
|
-
const
|
|
24611
|
-
if (
|
|
24612
|
-
|
|
25252
|
+
const firstScopedIndex = sections.findIndex((section) => section.title !== void 0);
|
|
25253
|
+
if (firstScopedIndex === -1) {
|
|
25254
|
+
popover.append(renderCreditsHeader(credits, locale, messages));
|
|
25255
|
+
const tiles = (credits.productUsage ?? []).map(
|
|
25256
|
+
(product) => renderCreditsTile(
|
|
25257
|
+
productLabel(product, locale),
|
|
25258
|
+
product.usagePercent,
|
|
25259
|
+
locale,
|
|
25260
|
+
messages,
|
|
25261
|
+
product.resetsAt
|
|
25262
|
+
)
|
|
25263
|
+
);
|
|
25264
|
+
const lastTile = tiles.at(-1);
|
|
25265
|
+
if (lastTile) lastTile.style.marginBottom = "0";
|
|
25266
|
+
popover.append(...tiles);
|
|
25267
|
+
return;
|
|
25268
|
+
}
|
|
25269
|
+
sections.forEach((section, sectionIndex) => {
|
|
25270
|
+
const group = document.createElement("div");
|
|
25271
|
+
if (sectionIndex > 0) {
|
|
25272
|
+
group.style.marginTop = "11px";
|
|
25273
|
+
group.style.paddingTop = "10px";
|
|
25274
|
+
group.style.borderTop = "1px solid color-mix(in srgb, currentColor 12%, transparent)";
|
|
25275
|
+
}
|
|
25276
|
+
if (section.title) {
|
|
25277
|
+
const heading = document.createElement("div");
|
|
25278
|
+
heading.textContent = section.title;
|
|
25279
|
+
heading.style.marginBottom = "7px";
|
|
25280
|
+
heading.style.fontSize = "12px";
|
|
25281
|
+
heading.style.fontWeight = "600";
|
|
25282
|
+
group.append(heading);
|
|
25283
|
+
}
|
|
25284
|
+
const tiles = section.windows.map(
|
|
25285
|
+
(window2, windowIndex) => section.title ? renderCompactCreditsRow(
|
|
25286
|
+
window2.label,
|
|
25287
|
+
window2.usedPercent,
|
|
25288
|
+
locale,
|
|
25289
|
+
messages,
|
|
25290
|
+
window2.resetsAt,
|
|
25291
|
+
sectionIndex === firstScopedIndex && windowIndex === 0
|
|
25292
|
+
) : renderCreditsTile(
|
|
25293
|
+
window2.scopeLabel ? `${window2.scopeLabel} \xB7 ${window2.label}` : window2.label,
|
|
25294
|
+
window2.usedPercent,
|
|
25295
|
+
locale,
|
|
25296
|
+
messages,
|
|
25297
|
+
window2.resetsAt
|
|
25298
|
+
)
|
|
25299
|
+
);
|
|
25300
|
+
const lastTile = tiles.at(-1);
|
|
25301
|
+
if (lastTile) lastTile.style.marginBottom = "0";
|
|
25302
|
+
group.append(...tiles);
|
|
25303
|
+
popover.append(group);
|
|
25304
|
+
});
|
|
24613
25305
|
}
|
|
24614
25306
|
function popoverIsOpen2(popover) {
|
|
24615
25307
|
try {
|
|
@@ -24636,6 +25328,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24636
25328
|
control.trigger.setAttribute("aria-expanded", "false");
|
|
24637
25329
|
}
|
|
24638
25330
|
function openPopover2(control) {
|
|
25331
|
+
refreshResetLines(control.popover);
|
|
24639
25332
|
positionPopover2(control);
|
|
24640
25333
|
control.popover.hidden = false;
|
|
24641
25334
|
if (typeof control.popover.showPopover === "function" && !popoverIsOpen2(control.popover)) {
|
|
@@ -37784,6 +38477,7 @@ ${detail}` : ""}`
|
|
|
37784
38477
|
.settings-connection-inspector {
|
|
37785
38478
|
position: sticky;
|
|
37786
38479
|
top: 18px;
|
|
38480
|
+
overflow-anchor: none;
|
|
37787
38481
|
}
|
|
37788
38482
|
|
|
37789
38483
|
.settings-connection-inspector__header {
|