@liberseek/boft-cli-linux-x64 0.8.3 → 0.8.4
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 +58 -5
- package/app/console-web.js +436 -67
- package/app/desktop-controller.mjs +72 -9
- package/app/host-runtime.mjs +772 -218
- package/app/plugins/antigravity/plugin.mjs +91 -13
- package/app/plugins/claude-code/plugin.mjs +404 -26
- package/app/plugins/codebuddy/plugin.mjs +117 -22
- package/app/plugins/codex-usage/plugin.mjs +176 -74
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34601 -0
- package/app/plugins/cursor-cli/plugin.mjs +20794 -44912
- package/app/plugins/deepseek-harness/plugin.mjs +83 -11
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +214 -24
- package/app/plugins/hermes/plugin.mjs +80 -9
- package/app/plugins/kimi-code/plugin.mjs +76 -7
- package/app/plugins/kiro-cli/plugin.mjs +76 -7
- package/app/plugins/muse/plugin.mjs +73 -5
- package/app/plugins/omp/plugin.mjs +2155 -2000
- package/app/plugins/opencode/plugin.mjs +85 -11
- package/app/plugins/pi/plugin.mjs +2515 -2298
- package/app/plugins/qoder/plugin.mjs +83 -11
- package/app/plugins/qoder-cn/plugin.mjs +83 -11
- package/app/plugins/workbuddy/plugin.mjs +378 -46
- package/app/plugins/zcode/plugin.mjs +84 -11
- package/app/renderer-extension.js +833 -162
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/package.json +1 -1
|
@@ -178,9 +178,10 @@
|
|
|
178
178
|
clearPendingSubmission(composer) {
|
|
179
179
|
this.#pendingSubmissions.delete(this.#state(composer));
|
|
180
180
|
}
|
|
181
|
+
/** Only a draft's submission creates a Thread, so only it sets the next new-Thread Agent. */
|
|
181
182
|
recordSubmission(composer) {
|
|
182
183
|
const state = this.#state(composer);
|
|
183
|
-
this.#lastSubmittedAgent = state.agent;
|
|
184
|
+
if (state.phase === "draft") this.#lastSubmittedAgent = state.agent;
|
|
184
185
|
return state;
|
|
185
186
|
}
|
|
186
187
|
transfer(source, replacement, target = null) {
|
|
@@ -14930,10 +14931,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14930
14931
|
var project = external_exports.string().min(1).max(4096);
|
|
14931
14932
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
14932
14933
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
14934
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
14935
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
14936
|
+
try {
|
|
14937
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
14938
|
+
return true;
|
|
14939
|
+
} catch {
|
|
14940
|
+
return false;
|
|
14941
|
+
}
|
|
14942
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
14933
14943
|
harness: harness.optional(),
|
|
14934
14944
|
model: model.nullable().optional(),
|
|
14935
14945
|
project: project.nullable().optional(),
|
|
14936
|
-
/** One
|
|
14946
|
+
/** One date in the query timezone inside the range. */
|
|
14937
14947
|
date: localDate.optional()
|
|
14938
14948
|
});
|
|
14939
14949
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -14969,7 +14979,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14969
14979
|
});
|
|
14970
14980
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
14971
14981
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
14972
|
-
/** First
|
|
14982
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
14973
14983
|
from: localDate.nullable(),
|
|
14974
14984
|
to: localDate,
|
|
14975
14985
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -15009,7 +15019,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15009
15019
|
totals: usageStatisticsTotalsSchema,
|
|
15010
15020
|
/** Each date and Harness of the range: every filter except the day. */
|
|
15011
15021
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
15012
|
-
/**
|
|
15022
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
15013
15023
|
hourly: external_exports.array(external_exports.strictObject({
|
|
15014
15024
|
weekday: external_exports.number().int().min(0).max(6),
|
|
15015
15025
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -15152,6 +15162,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15152
15162
|
"codexhost/harness/display-settings/set",
|
|
15153
15163
|
"codexhost/harness/inspect",
|
|
15154
15164
|
"codexhost/harness/installation",
|
|
15165
|
+
"codexhost/harness/installation/start",
|
|
15166
|
+
"codexhost/harness/installation/status",
|
|
15155
15167
|
"codexhost/harness/launch-settings/get",
|
|
15156
15168
|
"codexhost/harness/launch-settings/set",
|
|
15157
15169
|
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
@@ -15232,7 +15244,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15232
15244
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15233
15245
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15234
15246
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15247
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
15248
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15249
|
+
kind: external_exports.literal("countdown"),
|
|
15250
|
+
id: external_exports.string().min(1).max(64),
|
|
15251
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15252
|
+
label: indicatorTextSchema(256).optional(),
|
|
15253
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
15254
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
15255
|
+
message: "Composer indicator IDs must be unique"
|
|
15256
|
+
});
|
|
15235
15257
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
15258
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
15236
15259
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15237
15260
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15238
15261
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15666,7 +15689,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15666
15689
|
}).strict().optional(),
|
|
15667
15690
|
input: external_exports.object({
|
|
15668
15691
|
image: external_exports.boolean()
|
|
15669
|
-
}).strict().optional()
|
|
15692
|
+
}).strict().optional(),
|
|
15693
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15694
|
+
steer: external_exports.boolean().optional()
|
|
15670
15695
|
}).strict();
|
|
15671
15696
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15672
15697
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15714,7 +15739,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15714
15739
|
var harnessInspectParamsSchema = external_exports.object({
|
|
15715
15740
|
harnessId: harnessIdSchema,
|
|
15716
15741
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15717
|
-
refresh: external_exports.boolean().optional()
|
|
15742
|
+
refresh: external_exports.boolean().optional(),
|
|
15743
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15744
|
+
purpose: external_exports.literal("availability").optional()
|
|
15718
15745
|
}).strict();
|
|
15719
15746
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15720
15747
|
harnessId: harnessIdSchema
|
|
@@ -15799,6 +15826,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15799
15826
|
seen.add(thread.threadId);
|
|
15800
15827
|
}
|
|
15801
15828
|
});
|
|
15829
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15830
|
+
threadId: hostThreadIdSchema,
|
|
15831
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15832
|
+
text: external_exports.string().optional()
|
|
15833
|
+
}).strict();
|
|
15834
|
+
var THREAD_STEER_DELIVERY_PARAM = "codexhostSteerDelivery";
|
|
15835
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15836
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15837
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15838
|
+
}).strict();
|
|
15802
15839
|
|
|
15803
15840
|
// ../shared-contracts/dist/harness-route.js
|
|
15804
15841
|
var HARNESS_PLUGIN_ROUTE_PREFIX = "codexhost/plugin-v1@";
|
|
@@ -15848,7 +15885,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15848
15885
|
}).strict();
|
|
15849
15886
|
|
|
15850
15887
|
// ../shared-contracts/dist/harness-installation.js
|
|
15851
|
-
var
|
|
15888
|
+
var HARNESS_INSTALLATION_START_METHOD = "codexhost/harness/installation/start";
|
|
15889
|
+
var HARNESS_INSTALLATION_STATUS_METHOD = "codexhost/harness/installation/status";
|
|
15852
15890
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
15853
15891
|
harnessId: harnessIdSchema,
|
|
15854
15892
|
action: external_exports.enum(["check", "update", "install"])
|
|
@@ -15858,6 +15896,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15858
15896
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15859
15897
|
updateAvailable: external_exports.boolean(),
|
|
15860
15898
|
canUpdate: external_exports.boolean(),
|
|
15899
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
15900
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
15901
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
15902
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
15861
15903
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15862
15904
|
message: external_exports.string().max(2048).optional(),
|
|
15863
15905
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
@@ -15865,6 +15907,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15865
15907
|
notice: harnessLocalizedTextSchema.optional(),
|
|
15866
15908
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15867
15909
|
}).strict();
|
|
15910
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
15911
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
15912
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
15913
|
+
external_exports.object({
|
|
15914
|
+
taskId: external_exports.string().uuid(),
|
|
15915
|
+
status: external_exports.literal("succeeded"),
|
|
15916
|
+
result: harnessInstallationStateSchema
|
|
15917
|
+
}).strict(),
|
|
15918
|
+
external_exports.object({
|
|
15919
|
+
taskId: external_exports.string().uuid(),
|
|
15920
|
+
status: external_exports.literal("failed"),
|
|
15921
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
15922
|
+
}).strict()
|
|
15923
|
+
]);
|
|
15868
15924
|
|
|
15869
15925
|
// ../shared-contracts/dist/codex-accounts.js
|
|
15870
15926
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -16288,9 +16344,63 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16288
16344
|
// ../shared-contracts/dist/index.js
|
|
16289
16345
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
16290
16346
|
|
|
16291
|
-
// src/codex-
|
|
16347
|
+
// src/codex-native-services.ts
|
|
16348
|
+
async function loadCodexNativeServices(ownerWindow, matchesServices, importModule = (url2) => import(url2)) {
|
|
16349
|
+
if (!ownerWindow.document || !ownerWindow.location) return null;
|
|
16350
|
+
const page = new URL(ownerWindow.location.href);
|
|
16351
|
+
const urls = /* @__PURE__ */ new Set();
|
|
16352
|
+
for (const link of ownerWindow.document.querySelectorAll('link[rel="modulepreload"][href]')) {
|
|
16353
|
+
const url2 = new URL(link.getAttribute("href") ?? "", page);
|
|
16354
|
+
if (url2.protocol === page.protocol && url2.host === page.host && url2.pathname.endsWith(".js") && !url2.search && !url2.hash)
|
|
16355
|
+
urls.add(url2.href);
|
|
16356
|
+
}
|
|
16357
|
+
const candidates = [...urls].sort(
|
|
16358
|
+
(a, b) => Number(b.includes("/app-shared-")) - Number(a.includes("/app-shared-"))
|
|
16359
|
+
);
|
|
16360
|
+
for (const url2 of candidates) {
|
|
16361
|
+
let module;
|
|
16362
|
+
try {
|
|
16363
|
+
module = await importModule(url2);
|
|
16364
|
+
} catch {
|
|
16365
|
+
continue;
|
|
16366
|
+
}
|
|
16367
|
+
const matches = new Set(Object.values(module).filter(matchesServices));
|
|
16368
|
+
if (matches.size > 1) throw new Error("Codex native services are unavailable in this window");
|
|
16369
|
+
if (matches.size === 1) return [...matches][0] ?? null;
|
|
16370
|
+
}
|
|
16371
|
+
return null;
|
|
16372
|
+
}
|
|
16373
|
+
|
|
16374
|
+
// src/codex-ssh-services.ts
|
|
16292
16375
|
var record2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16376
|
+
function isSshServices(value) {
|
|
16377
|
+
if (!record2(value) || !Object.hasOwn(value, "sshConnections") || !Object.hasOwn(value, "remoteConnections"))
|
|
16378
|
+
return false;
|
|
16379
|
+
const ssh = value.sshConnections;
|
|
16380
|
+
const remote = value.remoteConnections;
|
|
16381
|
+
return ssh != null && remote != null && typeof ssh.refresh === "function" && typeof ssh.save === "function" && typeof remote.getState === "function" && typeof remote.setAutoConnect === "function";
|
|
16382
|
+
}
|
|
16383
|
+
async function loadCodexSshServices(ownerWindow, importModule) {
|
|
16384
|
+
return loadCodexNativeServices(ownerWindow, isSshServices, importModule);
|
|
16385
|
+
}
|
|
16386
|
+
|
|
16387
|
+
// src/codex-ssh-adapter.ts
|
|
16388
|
+
var record3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16293
16389
|
function createCodexSshClient(ownerWindow) {
|
|
16390
|
+
let nativeServices;
|
|
16391
|
+
function services() {
|
|
16392
|
+
nativeServices ??= loadCodexSshServices(ownerWindow).then(
|
|
16393
|
+
(value) => {
|
|
16394
|
+
if (!value) nativeServices = void 0;
|
|
16395
|
+
return value;
|
|
16396
|
+
},
|
|
16397
|
+
(error51) => {
|
|
16398
|
+
nativeServices = void 0;
|
|
16399
|
+
throw error51;
|
|
16400
|
+
}
|
|
16401
|
+
);
|
|
16402
|
+
return nativeServices;
|
|
16403
|
+
}
|
|
16294
16404
|
function request(operation, params, signal) {
|
|
16295
16405
|
const bridge = ownerWindow.electronBridge;
|
|
16296
16406
|
if (!bridge?.sendMessageFromView)
|
|
@@ -16298,7 +16408,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16298
16408
|
if (signal?.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
16299
16409
|
return new Promise((resolve, reject) => {
|
|
16300
16410
|
const requestId = ownerWindow.crypto.randomUUID();
|
|
16411
|
+
let settled = false;
|
|
16301
16412
|
const finish = (error51, value) => {
|
|
16413
|
+
if (settled) return;
|
|
16414
|
+
settled = true;
|
|
16302
16415
|
ownerWindow.clearTimeout(timer);
|
|
16303
16416
|
ownerWindow.removeEventListener("message", receive);
|
|
16304
16417
|
signal?.removeEventListener("abort", abort);
|
|
@@ -16308,10 +16421,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16308
16421
|
const abort = () => finish(new DOMException("Aborted", "AbortError"));
|
|
16309
16422
|
const receive = (event) => {
|
|
16310
16423
|
const message2 = event.data;
|
|
16311
|
-
if (!
|
|
16424
|
+
if (!record3(message2) || message2.type !== "fetch-response" || message2.requestId !== requestId)
|
|
16312
16425
|
return;
|
|
16313
16426
|
if (message2.responseType !== "success" || typeof message2.status !== "number" || message2.status < 200 || message2.status >= 300 || typeof message2.bodyJsonString !== "string") {
|
|
16314
|
-
|
|
16427
|
+
const detail = typeof message2.error === "string" ? `: ${message2.error}` : "";
|
|
16428
|
+
finish(
|
|
16429
|
+
new Error(`Codex SSH request failed; check the native Connections settings${detail}`)
|
|
16430
|
+
);
|
|
16315
16431
|
return;
|
|
16316
16432
|
}
|
|
16317
16433
|
try {
|
|
@@ -16326,30 +16442,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16326
16442
|
);
|
|
16327
16443
|
ownerWindow.addEventListener("message", receive);
|
|
16328
16444
|
signal?.addEventListener("abort", abort, { once: true });
|
|
16329
|
-
|
|
16330
|
-
|
|
16331
|
-
|
|
16445
|
+
void (async () => {
|
|
16446
|
+
const native = await services();
|
|
16447
|
+
if (settled) return;
|
|
16448
|
+
if (native) {
|
|
16449
|
+
let result;
|
|
16450
|
+
switch (operation) {
|
|
16451
|
+
case "refresh-remote-connections":
|
|
16452
|
+
result = await native.sshConnections.refresh();
|
|
16453
|
+
break;
|
|
16454
|
+
case "save-codex-managed-remote-ssh-connections":
|
|
16455
|
+
result = await native.sshConnections.save(params);
|
|
16456
|
+
break;
|
|
16457
|
+
case "set-remote-connection-auto-connect":
|
|
16458
|
+
result = await native.remoteConnections.setAutoConnect(params);
|
|
16459
|
+
break;
|
|
16460
|
+
case "app-server-connection-state":
|
|
16461
|
+
result = await native.remoteConnections.getState(String(params.hostId));
|
|
16462
|
+
break;
|
|
16463
|
+
}
|
|
16464
|
+
finish(null, result);
|
|
16465
|
+
} else {
|
|
16466
|
+
await bridge.sendMessageFromView({
|
|
16332
16467
|
type: "fetch",
|
|
16333
16468
|
requestId,
|
|
16334
16469
|
method: "POST",
|
|
16335
16470
|
url: `vscode://codex/${operation}`,
|
|
16336
16471
|
body: JSON.stringify(params),
|
|
16337
16472
|
reportUploadProgress: false
|
|
16338
|
-
})
|
|
16339
|
-
|
|
16340
|
-
}
|
|
16341
|
-
finish(error51);
|
|
16342
|
-
}
|
|
16473
|
+
});
|
|
16474
|
+
}
|
|
16475
|
+
})().catch((error51) => finish(error51));
|
|
16343
16476
|
});
|
|
16344
16477
|
}
|
|
16345
16478
|
async function list(signal) {
|
|
16346
16479
|
const result = await request("refresh-remote-connections", {}, signal);
|
|
16347
|
-
if (!
|
|
16480
|
+
if (!record3(result) || !Array.isArray(result.remoteConnections))
|
|
16348
16481
|
throw new Error("Invalid Codex SSH connection list");
|
|
16349
16482
|
return result.remoteConnections.filter(
|
|
16350
|
-
(item) => !(
|
|
16483
|
+
(item) => !(record3(item) && ["wsl", "remote-control"].includes(String(item.source)))
|
|
16351
16484
|
).map((item) => {
|
|
16352
|
-
if (!
|
|
16485
|
+
if (!record3(item) || typeof item.hostId !== "string" || typeof item.displayName !== "string" || !["codex-managed", "discovered"].includes(String(item.source)) || typeof item.sshHost !== "string" || typeof item.autoConnect !== "boolean" || !(item.sshAlias == null || typeof item.sshAlias === "string") || !(item.identity == null || typeof item.identity === "string") || !(item.sshPort == null || Number.isInteger(item.sshPort) && Number(item.sshPort) > 0 && Number(item.sshPort) <= 65535)) {
|
|
16353
16486
|
throw new Error(
|
|
16354
16487
|
"This Codex version uses an unsupported SSH configuration; open native settings"
|
|
16355
16488
|
);
|
|
@@ -16421,11 +16554,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16421
16554
|
},
|
|
16422
16555
|
async state(hostId2, signal) {
|
|
16423
16556
|
const result = await request("app-server-connection-state", { hostId: hostId2 }, signal);
|
|
16424
|
-
if (!
|
|
16557
|
+
if (!record3(result) || typeof result.state !== "string")
|
|
16425
16558
|
throw new Error("Invalid Codex connection state");
|
|
16426
16559
|
return {
|
|
16427
16560
|
state: result.state,
|
|
16428
|
-
error: typeof result.error === "string" ? result.error :
|
|
16561
|
+
error: typeof result.error === "string" ? result.error : record3(result.error) && typeof result.error.message === "string" ? result.error.message : null
|
|
16429
16562
|
};
|
|
16430
16563
|
}
|
|
16431
16564
|
};
|
|
@@ -17906,7 +18039,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17906
18039
|
}
|
|
17907
18040
|
|
|
17908
18041
|
// src/settings/harness-version-panel.ts
|
|
17909
|
-
function createHarnessVersionPanel(document2, messages, signal, agent, client) {
|
|
18042
|
+
function createHarnessVersionPanel(document2, messages, signal, agent, client, onChange = () => void 0) {
|
|
17910
18043
|
const panel = document2.createElement("section");
|
|
17911
18044
|
panel.className = "settings-harness-version";
|
|
17912
18045
|
panel.dataset.harnessVersion = agent;
|
|
@@ -17932,37 +18065,67 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17932
18065
|
panel.append(heading, versions, status, actions, note);
|
|
17933
18066
|
let state;
|
|
17934
18067
|
let busy = false;
|
|
18068
|
+
let updating = false;
|
|
17935
18069
|
let unsupported = false;
|
|
18070
|
+
let updatePromise = null;
|
|
17936
18071
|
const render = () => {
|
|
18072
|
+
heading.textContent = state?.versionKind === "application" ? messages.harnessVersionApplicationTitle : messages.harnessVersionTitle;
|
|
17937
18073
|
current.textContent = `${messages.harnessVersionCurrent}: ${state?.currentVersion ?? "\u2014"}`;
|
|
17938
18074
|
latest.textContent = `${messages.harnessVersionLatest}: ${harnessVersionLabel(state, messages.harnessVersion)}`;
|
|
17939
18075
|
update.disabled = busy || signal.aborted || !state?.canUpdate || !state.updateAvailable;
|
|
18076
|
+
const manualUrl = !state?.canUpdate && state?.updateAvailable ? state.manualUpdateUrl : void 0;
|
|
18077
|
+
actions.replaceChildren(update);
|
|
18078
|
+
update.hidden = !busy && !signal.aborted && Boolean(manualUrl);
|
|
18079
|
+
if (update.hidden && manualUrl) {
|
|
18080
|
+
const download2 = document2.createElement("a");
|
|
18081
|
+
download2.className = "settings-command-button settings-command-button--secondary";
|
|
18082
|
+
download2.dataset.harnessVersionAction = "download-update";
|
|
18083
|
+
download2.textContent = messages.harnessVersionDownloadUpdate;
|
|
18084
|
+
download2.href = manualUrl;
|
|
18085
|
+
download2.target = "_blank";
|
|
18086
|
+
download2.rel = "noopener noreferrer";
|
|
18087
|
+
actions.append(download2);
|
|
18088
|
+
}
|
|
17940
18089
|
update.textContent = state?.canUpdate && state.latestVersion !== "Unknown" && !state.updateAvailable ? messages.harnessVersionUpToDate : messages.harnessVersionUpdate;
|
|
17941
18090
|
const detail = harnessVersionNote(state, messages.harnessVersion);
|
|
17942
|
-
note.textContent = detail ? `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
18091
|
+
note.textContent = detail ? !state?.canUpdate ? detail : `${detail} ${messages.harnessVersionNote}` : messages.harnessVersionNote;
|
|
17943
18092
|
};
|
|
17944
18093
|
const run = async (action) => {
|
|
17945
|
-
if (busy || unsupported || signal.aborted) return;
|
|
17946
|
-
if (action === "update" && (!state?.canUpdate || !state.updateAvailable)) return;
|
|
18094
|
+
if (busy || unsupported || signal.aborted) return false;
|
|
18095
|
+
if (action === "update" && (!state?.canUpdate || !state.updateAvailable)) return false;
|
|
17947
18096
|
busy = true;
|
|
18097
|
+
updating = action === "update";
|
|
18098
|
+
onChange();
|
|
17948
18099
|
status.textContent = action === "check" ? messages.harnessVersionChecking : messages.harnessVersionUpdating;
|
|
17949
18100
|
render();
|
|
17950
18101
|
try {
|
|
17951
18102
|
const result = await client.run(action);
|
|
17952
|
-
if (signal.aborted) return;
|
|
18103
|
+
if (signal.aborted) return false;
|
|
17953
18104
|
state = result;
|
|
17954
18105
|
status.textContent = !result.canUpdate ? messages.harnessVersionManual : action === "update" ? result.updateAvailable ? messages.harnessVersionFailed : messages.harnessVersionUpdated : "";
|
|
18106
|
+
return result.canUpdate && !result.updateAvailable;
|
|
17955
18107
|
} catch (error51) {
|
|
17956
|
-
if (signal.aborted) return;
|
|
18108
|
+
if (signal.aborted) return false;
|
|
17957
18109
|
unsupported = typeof error51 === "object" && error51 !== null && "code" in error51 && (error51.code === -32601 || error51.code === -32078);
|
|
17958
18110
|
status.textContent = unsupported ? messages.harnessVersionUnsupported : messages.harnessVersionFailed;
|
|
17959
18111
|
if (state) state = { ...state, canUpdate: false };
|
|
18112
|
+
return false;
|
|
17960
18113
|
} finally {
|
|
17961
18114
|
busy = false;
|
|
17962
|
-
|
|
18115
|
+
updating = false;
|
|
18116
|
+
if (!signal.aborted) {
|
|
18117
|
+
render();
|
|
18118
|
+
onChange();
|
|
18119
|
+
}
|
|
17963
18120
|
}
|
|
17964
18121
|
};
|
|
17965
|
-
|
|
18122
|
+
const updateVersion = () => {
|
|
18123
|
+
updatePromise ??= run("update").finally(() => {
|
|
18124
|
+
updatePromise = null;
|
|
18125
|
+
});
|
|
18126
|
+
return updatePromise;
|
|
18127
|
+
};
|
|
18128
|
+
update.addEventListener("click", () => void updateVersion());
|
|
17966
18129
|
const owner = document2.defaultView;
|
|
17967
18130
|
let checkFrame = null;
|
|
17968
18131
|
let checkTimer = null;
|
|
@@ -17989,7 +18152,95 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17989
18152
|
} else {
|
|
17990
18153
|
void run("check");
|
|
17991
18154
|
}
|
|
17992
|
-
return
|
|
18155
|
+
return {
|
|
18156
|
+
element: panel,
|
|
18157
|
+
get state() {
|
|
18158
|
+
return state;
|
|
18159
|
+
},
|
|
18160
|
+
get updating() {
|
|
18161
|
+
return updating;
|
|
18162
|
+
},
|
|
18163
|
+
update: updateVersion
|
|
18164
|
+
};
|
|
18165
|
+
}
|
|
18166
|
+
|
|
18167
|
+
// src/settings/connection-versions.ts
|
|
18168
|
+
function createConnectionVersions(document2, messages, signal, diagnostics, onChange) {
|
|
18169
|
+
const panels = /* @__PURE__ */ new Map();
|
|
18170
|
+
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
18171
|
+
return {
|
|
18172
|
+
get(hostId2, agent) {
|
|
18173
|
+
if (!installation || signal.aborted) return void 0;
|
|
18174
|
+
const key = JSON.stringify([hostId2, agent]);
|
|
18175
|
+
let panel = panels.get(key);
|
|
18176
|
+
if (!panel) {
|
|
18177
|
+
panel = createHarnessVersionPanel(
|
|
18178
|
+
document2,
|
|
18179
|
+
messages,
|
|
18180
|
+
signal,
|
|
18181
|
+
agent,
|
|
18182
|
+
{
|
|
18183
|
+
run: (action) => installation(hostId2, agent, action)
|
|
18184
|
+
},
|
|
18185
|
+
onChange
|
|
18186
|
+
);
|
|
18187
|
+
panels.set(key, panel);
|
|
18188
|
+
}
|
|
18189
|
+
return panel;
|
|
18190
|
+
}
|
|
18191
|
+
};
|
|
18192
|
+
}
|
|
18193
|
+
|
|
18194
|
+
// src/settings/connection-updates.ts
|
|
18195
|
+
function createConnectionUpdates(document2, messages, signal, onChange) {
|
|
18196
|
+
const batches = /* @__PURE__ */ new Map();
|
|
18197
|
+
const eligible = (panels) => panels.filter((panel) => panel.state?.updateAvailable && panel.state.canUpdate);
|
|
18198
|
+
const start = async (hostId2, panels) => {
|
|
18199
|
+
if (signal.aborted || batches.get(hostId2)?.running) return;
|
|
18200
|
+
const targets = eligible(panels);
|
|
18201
|
+
if (!targets.length) return;
|
|
18202
|
+
const batch = { running: true, total: targets.length, succeeded: 0, failed: 0 };
|
|
18203
|
+
batches.set(hostId2, batch);
|
|
18204
|
+
onChange();
|
|
18205
|
+
await Promise.all(
|
|
18206
|
+
targets.map(async (panel) => {
|
|
18207
|
+
try {
|
|
18208
|
+
if (await panel.update()) batch.succeeded++;
|
|
18209
|
+
else batch.failed++;
|
|
18210
|
+
} catch {
|
|
18211
|
+
batch.failed++;
|
|
18212
|
+
}
|
|
18213
|
+
if (!signal.aborted) onChange();
|
|
18214
|
+
})
|
|
18215
|
+
);
|
|
18216
|
+
batch.running = false;
|
|
18217
|
+
if (!signal.aborted) onChange();
|
|
18218
|
+
};
|
|
18219
|
+
return {
|
|
18220
|
+
createControls(hostId2, panels) {
|
|
18221
|
+
const batch = batches.get(hostId2);
|
|
18222
|
+
const count3 = eligible(panels).length;
|
|
18223
|
+
const button2 = document2.createElement("button");
|
|
18224
|
+
button2.type = "button";
|
|
18225
|
+
button2.className = "settings-command-button settings-command-button--secondary settings-connection-update-all";
|
|
18226
|
+
button2.dataset.connectionAction = "update-all";
|
|
18227
|
+
button2.disabled = signal.aborted || Boolean(batch?.running) || !count3;
|
|
18228
|
+
button2.title = messages.harnessUpdateAllDescription;
|
|
18229
|
+
const label = batch?.running ? `${messages.harnessUpdateAllProgress} ${batch.succeeded + batch.failed}/${batch.total}` : count3 ? `${messages.harnessUpdateAll} (${count3})` : messages.harnessUpdateAll;
|
|
18230
|
+
button2.append(createRendererSettingsIcon("download", 15), label);
|
|
18231
|
+
button2.addEventListener("click", () => {
|
|
18232
|
+
if (!button2.disabled) void start(hostId2, panels);
|
|
18233
|
+
});
|
|
18234
|
+
const result = document2.createElement("p");
|
|
18235
|
+
result.className = "settings-connection-update-result";
|
|
18236
|
+
result.setAttribute("role", "status");
|
|
18237
|
+
result.hidden = !batch || batch.running;
|
|
18238
|
+
if (batch && !batch.running) {
|
|
18239
|
+
result.textContent = messages.harnessUpdateAllResult.replace("{succeeded}", String(batch.succeeded)).replace("{failed}", String(batch.failed));
|
|
18240
|
+
}
|
|
18241
|
+
return { button: button2, result };
|
|
18242
|
+
}
|
|
18243
|
+
};
|
|
17993
18244
|
}
|
|
17994
18245
|
|
|
17995
18246
|
// src/settings/selection-scroll.ts
|
|
@@ -18259,6 +18510,7 @@ ${error51.stderrTail}`] : []
|
|
|
18259
18510
|
status.dataset.connectionTone = connectionStatusTone(item.availability, item.error !== null);
|
|
18260
18511
|
status.setAttribute("role", "cell");
|
|
18261
18512
|
status.textContent = item.error?.code === "authenticationRequired" ? messages.connectionLoginRequired : item.error?.code === "configurationRequired" ? messages.connectionConfigurationRequired : connectionStatusLabel(item.availability, messages, item.error !== null);
|
|
18513
|
+
const version2 = item.version;
|
|
18262
18514
|
const action = document2.createElement("div");
|
|
18263
18515
|
action.className = "settings-connection-row__action";
|
|
18264
18516
|
action.setAttribute("role", "cell");
|
|
@@ -18274,6 +18526,31 @@ ${error51.stderrTail}`] : []
|
|
|
18274
18526
|
action.append(viewError);
|
|
18275
18527
|
}
|
|
18276
18528
|
if (longContext) action.append(longContext);
|
|
18529
|
+
if (version2?.state?.updateAvailable && !version2.updating) {
|
|
18530
|
+
const available = document2.createElement("span");
|
|
18531
|
+
available.className = "settings-connection-version-available";
|
|
18532
|
+
available.textContent = messages.harnessVersionAvailable;
|
|
18533
|
+
available.title = `${messages.harnessVersionCurrent}: ${version2.state.currentVersion ?? "\u2014"}
|
|
18534
|
+
${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages.harnessVersion)}`;
|
|
18535
|
+
action.append(available);
|
|
18536
|
+
}
|
|
18537
|
+
if (version2?.state?.updateAvailable && version2.state.canUpdate) {
|
|
18538
|
+
const update = document2.createElement("button");
|
|
18539
|
+
update.type = "button";
|
|
18540
|
+
update.className = "settings-connection-install-link";
|
|
18541
|
+
update.dataset.connectionAction = "update";
|
|
18542
|
+
update.disabled = version2.updating;
|
|
18543
|
+
update.title = messages.harnessVersionUpdate;
|
|
18544
|
+
update.setAttribute("aria-label", `${messages.harnessVersionUpdate}: ${item.name}`);
|
|
18545
|
+
update.append(createRendererSettingsIcon("download", 17));
|
|
18546
|
+
update.addEventListener("click", (event) => {
|
|
18547
|
+
event.stopPropagation();
|
|
18548
|
+
if (update.disabled) return;
|
|
18549
|
+
void version2.update();
|
|
18550
|
+
select();
|
|
18551
|
+
});
|
|
18552
|
+
action.append(update);
|
|
18553
|
+
}
|
|
18277
18554
|
if (group) {
|
|
18278
18555
|
const toggle = document2.createElement("button");
|
|
18279
18556
|
toggle.type = "button";
|
|
@@ -18594,9 +18871,7 @@ ${error51.stderrTail}`] : []
|
|
|
18594
18871
|
let selectedHostId = null;
|
|
18595
18872
|
let selectedItemKey = null;
|
|
18596
18873
|
let launchControls = null;
|
|
18597
|
-
const versionPanels = /* @__PURE__ */ new Map();
|
|
18598
18874
|
const longContextControls = /* @__PURE__ */ new Map();
|
|
18599
|
-
const updatingVersions = /* @__PURE__ */ new Set();
|
|
18600
18875
|
const hostNames = /* @__PURE__ */ new Map();
|
|
18601
18876
|
let latestSnapshot = null;
|
|
18602
18877
|
let disposeHostScroller = () => void 0;
|
|
@@ -18643,7 +18918,15 @@ ${error51.stderrTail}`] : []
|
|
|
18643
18918
|
return element;
|
|
18644
18919
|
};
|
|
18645
18920
|
const diagnostics = getDiagnostics();
|
|
18921
|
+
const versions = createConnectionVersions(
|
|
18922
|
+
document2,
|
|
18923
|
+
messages,
|
|
18924
|
+
context.signal,
|
|
18925
|
+
diagnostics,
|
|
18926
|
+
scheduleRender
|
|
18927
|
+
);
|
|
18646
18928
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
18929
|
+
const updates = createConnectionUpdates(document2, messages, context.signal, scheduleRender);
|
|
18647
18930
|
const runRefresh = () => {
|
|
18648
18931
|
if (pending || !diagnostics) return;
|
|
18649
18932
|
pending = true;
|
|
@@ -18779,10 +19062,13 @@ ${error51.stderrTail}`] : []
|
|
|
18779
19062
|
const agent = item.agentSnapshot?.agent;
|
|
18780
19063
|
if (!agent) return item;
|
|
18781
19064
|
const state = installs?.get(selectedHost.hostId, agent);
|
|
19065
|
+
const availability = state?.status ?? item.availability;
|
|
19066
|
+
const version2 = item.agentSnapshot?.availability !== "notInstalled" && availability !== "installing" && availability !== "checking" ? versions.get(selectedHost.hostId, agent) : void 0;
|
|
18782
19067
|
return {
|
|
18783
19068
|
...item,
|
|
18784
19069
|
...state ? { availability: state.status } : {},
|
|
18785
|
-
...
|
|
19070
|
+
...version2 ? { version: version2 } : {},
|
|
19071
|
+
...version2?.updating ? { availability: "updating" } : {},
|
|
18786
19072
|
...state?.error ? { installError: state.error } : {},
|
|
18787
19073
|
...diagnostics?.installation && harnessHasInstallCommands(item.agentSnapshot?.plugin) ? {
|
|
18788
19074
|
install: () => {
|
|
@@ -18819,30 +19105,7 @@ ${error51.stderrTail}`] : []
|
|
|
18819
19105
|
openExternalUrl
|
|
18820
19106
|
);
|
|
18821
19107
|
launchControls = { hostId: selectedHost.hostId, itemKey: item.key, element };
|
|
18822
|
-
|
|
18823
|
-
const installation = diagnostics?.installation?.bind(diagnostics);
|
|
18824
|
-
if (agent && item.agentSnapshot?.availability !== "notInstalled" && item.availability !== "installing" && item.availability !== "checking" && installation) {
|
|
18825
|
-
const key = JSON.stringify([selectedHost.hostId, agent]);
|
|
18826
|
-
let panel = versionPanels.get(key);
|
|
18827
|
-
if (!panel) {
|
|
18828
|
-
const hostId2 = selectedHost.hostId;
|
|
18829
|
-
panel = createHarnessVersionPanel(document2, messages, context.signal, agent, {
|
|
18830
|
-
async run(action) {
|
|
18831
|
-
if (action !== "update") return installation(hostId2, agent, action);
|
|
18832
|
-
updatingVersions.add(key);
|
|
18833
|
-
if (diagnostics) render(diagnostics.snapshot());
|
|
18834
|
-
try {
|
|
18835
|
-
return await installation(hostId2, agent, action);
|
|
18836
|
-
} finally {
|
|
18837
|
-
updatingVersions.delete(key);
|
|
18838
|
-
if (!context.signal.aborted && diagnostics) render(diagnostics.snapshot());
|
|
18839
|
-
}
|
|
18840
|
-
}
|
|
18841
|
-
});
|
|
18842
|
-
versionPanels.set(key, panel);
|
|
18843
|
-
}
|
|
18844
|
-
inspector.append(panel);
|
|
18845
|
-
}
|
|
19108
|
+
if (item.version) inspector.append(item.version.element);
|
|
18846
19109
|
};
|
|
18847
19110
|
for (const pinnedItem of items.filter((item) => !item.agentSnapshot)) {
|
|
18848
19111
|
const row = createConnectionRow(
|
|
@@ -19037,7 +19300,14 @@ ${error51.stderrTail}`] : []
|
|
|
19037
19300
|
}
|
|
19038
19301
|
const selectedItem = items.find((item) => item.key === selectedItemKey) ?? items[0];
|
|
19039
19302
|
if (selectedItem) selectItem(selectedItem);
|
|
19040
|
-
|
|
19303
|
+
const updateControls = updates.createControls(
|
|
19304
|
+
selectedHost.hostId,
|
|
19305
|
+
items.flatMap((item) => item.version ? [item.version] : [])
|
|
19306
|
+
);
|
|
19307
|
+
const hostHeader = document2.createElement("div");
|
|
19308
|
+
hostHeader.className = "settings-connection-host-header";
|
|
19309
|
+
hostHeader.append(hostStrip, updateControls.button);
|
|
19310
|
+
list.append(hostHeader, updateControls.result, tableHeader, rows);
|
|
19041
19311
|
layout.append(list, inspector);
|
|
19042
19312
|
content.replaceChildren(layout);
|
|
19043
19313
|
disposeHostScroller = configureHostScroller(
|
|
@@ -19364,10 +19634,17 @@ ${error51.stderrTail}`] : []
|
|
|
19364
19634
|
connectionInstallRunning: "Installing on the selected Host. You can leave this page; login or setup may still be required afterward.",
|
|
19365
19635
|
harnessVersion: harnessVersionEnglish,
|
|
19366
19636
|
harnessVersionTitle: "Harness CLI version",
|
|
19637
|
+
harnessVersionApplicationTitle: "Application version",
|
|
19367
19638
|
harnessVersionCurrent: "Current version",
|
|
19368
19639
|
harnessVersionLatest: "Latest version",
|
|
19369
19640
|
harnessVersionChecking: "Checking versions\u2026",
|
|
19641
|
+
harnessVersionAvailable: "Update available",
|
|
19370
19642
|
harnessVersionUpdate: "Update",
|
|
19643
|
+
harnessVersionDownloadUpdate: "Download update",
|
|
19644
|
+
harnessUpdateAll: "Update all",
|
|
19645
|
+
harnessUpdateAllProgress: "Updating",
|
|
19646
|
+
harnessUpdateAllDescription: "Update all eligible Harnesses on the selected Host.",
|
|
19647
|
+
harnessUpdateAllResult: "Updated {succeeded}; failed {failed}.",
|
|
19371
19648
|
harnessVersionUpdating: "Updating\u2026",
|
|
19372
19649
|
harnessVersionUpToDate: "Up to date",
|
|
19373
19650
|
harnessVersionUpdated: "Update verified. New sessions will use the new version.",
|
|
@@ -19672,10 +19949,17 @@ ${error51.stderrTail}`] : []
|
|
|
19672
19949
|
connectionInstallRunning: "\u6B63\u5728\u6240\u9009 Host \u4E0A\u5B89\u88C5\uFF0C\u79BB\u5F00\u9875\u9762\u4E0D\u4F1A\u4E2D\u65AD\u3002\u5B89\u88C5\u540E\u53EF\u80FD\u4ECD\u9700\u767B\u5F55\u6216\u914D\u7F6E\u3002",
|
|
19673
19950
|
harnessVersion: harnessVersionChinese,
|
|
19674
19951
|
harnessVersionTitle: "Harness CLI \u7248\u672C",
|
|
19952
|
+
harnessVersionApplicationTitle: "\u5E94\u7528\u7248\u672C",
|
|
19675
19953
|
harnessVersionCurrent: "\u5F53\u524D\u7248\u672C",
|
|
19676
19954
|
harnessVersionLatest: "\u6700\u65B0\u7248\u672C",
|
|
19677
19955
|
harnessVersionChecking: "\u6B63\u5728\u68C0\u67E5\u7248\u672C\u2026",
|
|
19956
|
+
harnessVersionAvailable: "\u6709\u66F4\u65B0",
|
|
19678
19957
|
harnessVersionUpdate: "\u66F4\u65B0",
|
|
19958
|
+
harnessVersionDownloadUpdate: "\u4E0B\u8F7D\u66F4\u65B0",
|
|
19959
|
+
harnessUpdateAll: "\u5168\u90E8\u66F4\u65B0",
|
|
19960
|
+
harnessUpdateAllProgress: "\u66F4\u65B0\u4E2D",
|
|
19961
|
+
harnessUpdateAllDescription: "\u66F4\u65B0\u5F53\u524D Host \u4E0A\u652F\u6301\u81EA\u52A8\u66F4\u65B0\u4E14\u6709\u65B0\u7248\u672C\u7684 Harness\u3002",
|
|
19962
|
+
harnessUpdateAllResult: "\u5DF2\u66F4\u65B0 {succeeded} \u9879\uFF0C{failed} \u9879\u5931\u8D25\u3002",
|
|
19679
19963
|
harnessVersionUpdating: "\u6B63\u5728\u66F4\u65B0\u2026",
|
|
19680
19964
|
harnessVersionUpToDate: "\u5DF2\u662F\u6700\u65B0",
|
|
19681
19965
|
harnessVersionUpdated: "\u5DF2\u786E\u8BA4\u66F4\u65B0\u6210\u529F\uFF0C\u65B0\u4F1A\u8BDD\u5C06\u4F7F\u7528\u65B0\u7248\u672C\u3002",
|
|
@@ -23077,7 +23361,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23077
23361
|
})
|
|
23078
23362
|
);
|
|
23079
23363
|
}
|
|
23080
|
-
if (label) label.textContent =
|
|
23364
|
+
if (label) label.textContent = `${Math.round(remaining)}%`;
|
|
23081
23365
|
control.root.style.display = "inline-flex";
|
|
23082
23366
|
control.trigger.setAttribute("aria-label", title);
|
|
23083
23367
|
control.trigger.title = title;
|
|
@@ -23085,6 +23369,148 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23085
23369
|
return true;
|
|
23086
23370
|
}
|
|
23087
23371
|
|
|
23372
|
+
// src/renderer-composer-indicators.ts
|
|
23373
|
+
var SHOW_WITHIN_SECONDS = 50 * 60;
|
|
23374
|
+
function mountRendererComposerIndicators(composer) {
|
|
23375
|
+
const doc = composer.ownerDocument;
|
|
23376
|
+
ensureRendererTriggerChipStyle(doc);
|
|
23377
|
+
const root = doc.createElement("div");
|
|
23378
|
+
root.setAttribute("data-codexhost-composer-indicators", "true");
|
|
23379
|
+
applyRendererTriggerChipSqueezeRoot(root, "128px", "0");
|
|
23380
|
+
Object.assign(root.style, { alignItems: "center", gap: "2px", flexShrink: "100000" });
|
|
23381
|
+
let indicators = [];
|
|
23382
|
+
let locale = "en";
|
|
23383
|
+
let timer;
|
|
23384
|
+
let anchor = null;
|
|
23385
|
+
let contentKey = "";
|
|
23386
|
+
let tip = null;
|
|
23387
|
+
const hideTip = () => {
|
|
23388
|
+
tip?.remove();
|
|
23389
|
+
tip = null;
|
|
23390
|
+
};
|
|
23391
|
+
const showTip = (chip, textContent) => {
|
|
23392
|
+
hideTip();
|
|
23393
|
+
const el = doc.createElement("div");
|
|
23394
|
+
el.setAttribute("role", "tooltip");
|
|
23395
|
+
el.textContent = textContent;
|
|
23396
|
+
Object.assign(el.style, {
|
|
23397
|
+
position: "fixed",
|
|
23398
|
+
zIndex: "2147483647",
|
|
23399
|
+
pointerEvents: "none",
|
|
23400
|
+
padding: "4px 8px",
|
|
23401
|
+
borderRadius: "8px",
|
|
23402
|
+
fontSize: "12px",
|
|
23403
|
+
whiteSpace: "nowrap",
|
|
23404
|
+
background: "rgba(30, 30, 30, 0.92)",
|
|
23405
|
+
color: "#fff",
|
|
23406
|
+
visibility: "hidden"
|
|
23407
|
+
});
|
|
23408
|
+
(doc.body ?? doc.documentElement).append(el);
|
|
23409
|
+
const rect = chip.getBoundingClientRect();
|
|
23410
|
+
const width = el.offsetWidth;
|
|
23411
|
+
const left = Math.max(
|
|
23412
|
+
4,
|
|
23413
|
+
Math.min(rect.left + rect.width / 2 - width / 2, window.innerWidth - width - 4)
|
|
23414
|
+
);
|
|
23415
|
+
el.style.left = `${left}px`;
|
|
23416
|
+
el.style.top = `${Math.max(4, rect.top - el.offsetHeight - 6)}px`;
|
|
23417
|
+
el.style.visibility = "visible";
|
|
23418
|
+
tip = el;
|
|
23419
|
+
};
|
|
23420
|
+
const refresh = () => {
|
|
23421
|
+
const now = Date.now() / 1e3;
|
|
23422
|
+
const active = indicators.filter(
|
|
23423
|
+
(indicator) => indicator.expiresAtUnix > now && indicator.expiresAtUnix - now <= SHOW_WITHIN_SECONDS
|
|
23424
|
+
);
|
|
23425
|
+
const nextKey = JSON.stringify([
|
|
23426
|
+
locale,
|
|
23427
|
+
active.map((indicator) => [indicator, Math.ceil((indicator.expiresAtUnix - now) / 60)])
|
|
23428
|
+
]);
|
|
23429
|
+
if (nextKey !== contentKey) {
|
|
23430
|
+
contentKey = nextKey;
|
|
23431
|
+
hideTip();
|
|
23432
|
+
root.replaceChildren();
|
|
23433
|
+
for (const indicator of active) {
|
|
23434
|
+
const minutes = Math.ceil((indicator.expiresAtUnix - now) / 60);
|
|
23435
|
+
const remaining = locale === "zh-CN" ? `\u5269\u4F59 ${minutes} \u5206\u949F` : `${minutes}m remaining`;
|
|
23436
|
+
const label = indicator.label ? localizeHarnessText(indicator.label, locale) : "";
|
|
23437
|
+
const tooltip = indicator.tooltip ? localizeHarnessText(indicator.tooltip, locale) : "";
|
|
23438
|
+
const chip = doc.createElement("span");
|
|
23439
|
+
chip.className = TRIGGER_CHIP_CLASS;
|
|
23440
|
+
chip.setAttribute("data-indicator-id", indicator.id);
|
|
23441
|
+
const summary = [label, tooltip, remaining].filter(Boolean).join(" \xB7 ");
|
|
23442
|
+
chip.setAttribute("aria-label", summary);
|
|
23443
|
+
chip.addEventListener("mouseenter", () => showTip(chip, summary));
|
|
23444
|
+
chip.addEventListener("mouseleave", hideTip);
|
|
23445
|
+
Object.assign(chip.style, {
|
|
23446
|
+
height: "28px",
|
|
23447
|
+
padding: "0 6px",
|
|
23448
|
+
gap: "4px",
|
|
23449
|
+
fontSize: "12px",
|
|
23450
|
+
cursor: "default",
|
|
23451
|
+
flexShrink: "0"
|
|
23452
|
+
});
|
|
23453
|
+
const icon2 = doc.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
23454
|
+
icon2.setAttribute("viewBox", "0 0 24 24");
|
|
23455
|
+
icon2.setAttribute("width", "14");
|
|
23456
|
+
icon2.setAttribute("height", "14");
|
|
23457
|
+
icon2.setAttribute("fill", "none");
|
|
23458
|
+
icon2.setAttribute("stroke", "currentColor");
|
|
23459
|
+
icon2.setAttribute("stroke-width", "1.5");
|
|
23460
|
+
icon2.setAttribute("aria-hidden", "true");
|
|
23461
|
+
const path = doc.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
23462
|
+
path.setAttribute("d", "M12 8v4l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0");
|
|
23463
|
+
icon2.append(path);
|
|
23464
|
+
const text = doc.createElement("span");
|
|
23465
|
+
text.textContent = `${minutes}m`;
|
|
23466
|
+
chip.append(icon2, text);
|
|
23467
|
+
root.append(chip);
|
|
23468
|
+
}
|
|
23469
|
+
}
|
|
23470
|
+
const visible = active.length > 0 && anchor !== null;
|
|
23471
|
+
if (root.hidden === visible) root.hidden = !visible;
|
|
23472
|
+
const display = visible ? "inline-flex" : "none";
|
|
23473
|
+
if (root.style.display !== display) root.style.display = display;
|
|
23474
|
+
const visibility = root.scrollWidth > root.clientWidth ? "hidden" : "visible";
|
|
23475
|
+
if (root.style.visibility !== visibility) root.style.visibility = visibility;
|
|
23476
|
+
const pending = indicators.some(({ expiresAtUnix }) => expiresAtUnix > now);
|
|
23477
|
+
if (!pending && timer !== void 0) {
|
|
23478
|
+
clearInterval(timer);
|
|
23479
|
+
timer = void 0;
|
|
23480
|
+
}
|
|
23481
|
+
};
|
|
23482
|
+
const observer = new ResizeObserver(refresh);
|
|
23483
|
+
observer.observe(root);
|
|
23484
|
+
refresh();
|
|
23485
|
+
return {
|
|
23486
|
+
root,
|
|
23487
|
+
place(next) {
|
|
23488
|
+
anchor = next;
|
|
23489
|
+
if (!next?.parentElement) {
|
|
23490
|
+
anchor = null;
|
|
23491
|
+
root.remove();
|
|
23492
|
+
} else if (next.nextElementSibling !== root) {
|
|
23493
|
+
next.parentElement.insertBefore(root, next.nextSibling);
|
|
23494
|
+
}
|
|
23495
|
+
refresh();
|
|
23496
|
+
},
|
|
23497
|
+
render(next, nextLocale) {
|
|
23498
|
+
indicators = next;
|
|
23499
|
+
locale = nextLocale;
|
|
23500
|
+
refresh();
|
|
23501
|
+
if (timer === void 0 && indicators.some(({ expiresAtUnix }) => expiresAtUnix > Date.now() / 1e3)) {
|
|
23502
|
+
timer = setInterval(refresh, 6e4);
|
|
23503
|
+
}
|
|
23504
|
+
},
|
|
23505
|
+
dispose() {
|
|
23506
|
+
observer.disconnect();
|
|
23507
|
+
hideTip();
|
|
23508
|
+
if (timer !== void 0) clearInterval(timer);
|
|
23509
|
+
root.remove();
|
|
23510
|
+
}
|
|
23511
|
+
};
|
|
23512
|
+
}
|
|
23513
|
+
|
|
23088
23514
|
// src/renderer-harness-command-control.ts
|
|
23089
23515
|
var CONTROL_ATTRIBUTE2 = "data-codexhost-harness-command-control";
|
|
23090
23516
|
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
@@ -23225,7 +23651,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23225
23651
|
"[data-codexhost-harness-command-control]"
|
|
23226
23652
|
].join(", ");
|
|
23227
23653
|
function isOwnedRendererControl(element) {
|
|
23228
|
-
return element.hasAttribute(CONTROL_ATTRIBUTE) || element.hasAttribute("data-codexhost-model-control") || element.hasAttribute("data-codexhost-permission-mode-control") || element.hasAttribute("data-codexhost-usage-control") || element.hasAttribute("data-codexhost-credits-control") || element.hasAttribute("data-codexhost-harness-command-control");
|
|
23654
|
+
return element.hasAttribute(CONTROL_ATTRIBUTE) || element.hasAttribute("data-codexhost-model-control") || element.hasAttribute("data-codexhost-permission-mode-control") || element.hasAttribute("data-codexhost-usage-control") || element.hasAttribute("data-codexhost-credits-control") || element.hasAttribute("data-codexhost-composer-indicators") || element.hasAttribute("data-codexhost-harness-command-control");
|
|
23229
23655
|
}
|
|
23230
23656
|
function isInsideOwnedRendererControl(element) {
|
|
23231
23657
|
return typeof element.closest === "function" ? Boolean(element.closest(OWNED_RENDERER_CONTROL_SELECTOR)) : isOwnedRendererControl(element);
|
|
@@ -23553,6 +23979,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23553
23979
|
refreshTrailingClusterPlacement(control);
|
|
23554
23980
|
refreshUsagePlacement(control);
|
|
23555
23981
|
refreshCreditsPlacement(control);
|
|
23982
|
+
control.composerIndicators?.place(
|
|
23983
|
+
control.nativePermissionModeControlVerified ? control.nativePermissionModeControl?.element ?? null : null
|
|
23984
|
+
);
|
|
23556
23985
|
setNativeControlHidden(control.nativeModelControl, hideModel);
|
|
23557
23986
|
syncLeftoverNativeModelControls(control, hideModel);
|
|
23558
23987
|
setNativeControlHidden(control.nativeContextUsageControl, false);
|
|
@@ -23579,6 +24008,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23579
24008
|
onSelectPermissionMode
|
|
23580
24009
|
);
|
|
23581
24010
|
const credits = mountRendererCreditsControl(composerId);
|
|
24011
|
+
const composerIndicators = mountRendererComposerIndicators(composer);
|
|
23582
24012
|
const toolbar = sendButton.parentElement;
|
|
23583
24013
|
const harnessCommands = mountRendererHarnessCommandControl(
|
|
23584
24014
|
toolbar ?? composer,
|
|
@@ -23624,6 +24054,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23624
24054
|
nativeContextUsageControl,
|
|
23625
24055
|
nativePermissionModeControlVerified,
|
|
23626
24056
|
credits,
|
|
24057
|
+
composerIndicators,
|
|
23627
24058
|
usage: null,
|
|
23628
24059
|
harnessCommands,
|
|
23629
24060
|
sendButton,
|
|
@@ -23691,6 +24122,10 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23691
24122
|
locale
|
|
23692
24123
|
);
|
|
23693
24124
|
const selectedCodexAccount = state.agent === "codex" && !ownershipError ? currentCodexAccount : void 0;
|
|
24125
|
+
control.composerIndicators?.render(
|
|
24126
|
+
permissionModeVisible ? usage?.composerIndicators ?? [] : [],
|
|
24127
|
+
locale
|
|
24128
|
+
);
|
|
23694
24129
|
if (control.usage) {
|
|
23695
24130
|
renderRendererUsageControl(
|
|
23696
24131
|
control.usage,
|
|
@@ -23722,6 +24157,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23722
24157
|
restoreNativeControl(control.nativePermissionModeControl);
|
|
23723
24158
|
for (const state of control.leftoverNativeModelControls) restoreNativeControl(state);
|
|
23724
24159
|
control.leftoverNativeModelControls = [];
|
|
24160
|
+
control.composerIndicators?.dispose();
|
|
23725
24161
|
control.credits.dispose();
|
|
23726
24162
|
control.usage?.dispose();
|
|
23727
24163
|
control.usage = null;
|
|
@@ -24276,6 +24712,26 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24276
24712
|
};
|
|
24277
24713
|
}
|
|
24278
24714
|
|
|
24715
|
+
// src/renderer-installation-client.ts
|
|
24716
|
+
async function runRendererInstallation(send, input) {
|
|
24717
|
+
const params = harnessInstallationParamsSchema.parse(input);
|
|
24718
|
+
const options = { priority: "background", timeoutMs: 15e3 };
|
|
24719
|
+
let task = harnessInstallationTaskSchema.parse(
|
|
24720
|
+
await send(HARNESS_INSTALLATION_START_METHOD, params, options)
|
|
24721
|
+
);
|
|
24722
|
+
const taskId = task.taskId;
|
|
24723
|
+
while (task.status === "running") {
|
|
24724
|
+
await new Promise((resolve) => globalThis.setTimeout(resolve, 500));
|
|
24725
|
+
task = harnessInstallationTaskSchema.parse(
|
|
24726
|
+
await send(HARNESS_INSTALLATION_STATUS_METHOD, { taskId }, options)
|
|
24727
|
+
);
|
|
24728
|
+
if (task.taskId !== taskId) throw new Error("Harness installation task identity changed");
|
|
24729
|
+
}
|
|
24730
|
+
if (task.status === "failed")
|
|
24731
|
+
throw Object.assign(new Error(task.error.message), { code: task.error.code });
|
|
24732
|
+
return task.result;
|
|
24733
|
+
}
|
|
24734
|
+
|
|
24279
24735
|
// src/renderer-request-sender.ts
|
|
24280
24736
|
var RendererMethodUnavailableError = class extends Error {
|
|
24281
24737
|
constructor(method, cause) {
|
|
@@ -24466,7 +24922,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24466
24922
|
};
|
|
24467
24923
|
const inspectHarness = async (input, options) => {
|
|
24468
24924
|
const params = harnessInspectParamsSchema.parse(input);
|
|
24469
|
-
|
|
24925
|
+
let result;
|
|
24926
|
+
try {
|
|
24927
|
+
result = await manager.sendRequest(HARNESS_INSPECT_METHOD, params, options);
|
|
24928
|
+
} catch (error51) {
|
|
24929
|
+
if (!params.purpose || !isInvalidParams(error51)) throw error51;
|
|
24930
|
+
const full = { ...params };
|
|
24931
|
+
delete full.purpose;
|
|
24932
|
+
result = await manager.sendRequest(HARNESS_INSPECT_METHOD, full, options);
|
|
24933
|
+
}
|
|
24470
24934
|
return harnessInspectionSchema.parse(result);
|
|
24471
24935
|
};
|
|
24472
24936
|
const inspectHarnessCommands = async (input) => {
|
|
@@ -24506,13 +24970,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24506
24970
|
};
|
|
24507
24971
|
return Object.freeze({
|
|
24508
24972
|
async installation(input) {
|
|
24509
|
-
return
|
|
24510
|
-
await manager.sendRequest(
|
|
24511
|
-
HARNESS_INSTALLATION_METHOD,
|
|
24512
|
-
harnessInstallationParamsSchema.parse(input),
|
|
24513
|
-
{ priority: "interactive" }
|
|
24514
|
-
)
|
|
24515
|
-
);
|
|
24973
|
+
return runRendererInstallation(manager.sendRequest, input);
|
|
24516
24974
|
},
|
|
24517
24975
|
async getHarnessDisplaySettings() {
|
|
24518
24976
|
return harnessDisplaySettingsSchema.parse(
|
|
@@ -24757,6 +25215,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24757
25215
|
}
|
|
24758
25216
|
});
|
|
24759
25217
|
}
|
|
25218
|
+
function isInvalidParams(error51) {
|
|
25219
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === -32602;
|
|
25220
|
+
}
|
|
24760
25221
|
|
|
24761
25222
|
// src/renderer-external-queue.ts
|
|
24762
25223
|
function isRecord6(value) {
|
|
@@ -24792,6 +25253,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24792
25253
|
}
|
|
24793
25254
|
|
|
24794
25255
|
// src/renderer-external-steering.ts
|
|
25256
|
+
var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
|
|
24795
25257
|
var THREAD_OWNERSHIP_LIST_METHOD2 = "codexhost/thread/ownership/list";
|
|
24796
25258
|
function isRecord7(value) {
|
|
24797
25259
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -24875,6 +25337,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24875
25337
|
const originalSteer = manager.steerTurn;
|
|
24876
25338
|
const originalSend = manager.sendRequest;
|
|
24877
25339
|
const routes = /* @__PURE__ */ new Map();
|
|
25340
|
+
const activeTurnSteers = /* @__PURE__ */ new Map();
|
|
24878
25341
|
const pending = /* @__PURE__ */ new Map();
|
|
24879
25342
|
let disposed = false;
|
|
24880
25343
|
const send = function(method, params, options) {
|
|
@@ -24890,6 +25353,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24890
25353
|
return originalSend.call(manager, method, input, options);
|
|
24891
25354
|
});
|
|
24892
25355
|
}
|
|
25356
|
+
if (method === "turn/steer" && isRecord7(params) && typeof params.threadId === "string" && activeTurnSteers.has(params.threadId)) {
|
|
25357
|
+
params = { ...params, [THREAD_STEER_DELIVERY_PARAM]: "activeTurn" };
|
|
25358
|
+
}
|
|
24893
25359
|
return originalSend.call(manager, method, params, options);
|
|
24894
25360
|
}
|
|
24895
25361
|
if (disposed) return Promise.reject(new Error("External steering binding was disposed"));
|
|
@@ -24904,7 +25370,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24904
25370
|
input: params.input,
|
|
24905
25371
|
additionalContext: params.additionalContext,
|
|
24906
25372
|
responsesapiClientMetadata: params.responsesapiClientMetadata,
|
|
24907
|
-
...params[THREAD_REFERENCE_SOURCE_HOST_PARAM] !== void 0 ? { [THREAD_REFERENCE_SOURCE_HOST_PARAM]: params[THREAD_REFERENCE_SOURCE_HOST_PARAM] } : {}
|
|
25373
|
+
...params[THREAD_REFERENCE_SOURCE_HOST_PARAM] !== void 0 ? { [THREAD_REFERENCE_SOURCE_HOST_PARAM]: params[THREAD_REFERENCE_SOURCE_HOST_PARAM] } : {},
|
|
25374
|
+
[THREAD_STEER_DELIVERY_PARAM]: "newTurn"
|
|
24908
25375
|
},
|
|
24909
25376
|
options
|
|
24910
25377
|
)
|
|
@@ -24926,6 +25393,34 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24926
25393
|
};
|
|
24927
25394
|
});
|
|
24928
25395
|
};
|
|
25396
|
+
const inspectDelivery = async (threadId, text) => {
|
|
25397
|
+
try {
|
|
25398
|
+
const response = await originalSend.call(manager, THREAD_STEERING_INSPECT_METHOD, {
|
|
25399
|
+
threadId,
|
|
25400
|
+
...text !== void 0 ? { text } : {}
|
|
25401
|
+
});
|
|
25402
|
+
return threadSteeringInspectResultSchema.parse(response).delivery;
|
|
25403
|
+
} catch (error51) {
|
|
25404
|
+
if (!isUnsupportedMethod(error51, THREAD_STEERING_INSPECT_METHOD)) throw error51;
|
|
25405
|
+
}
|
|
25406
|
+
let ownershipResponse;
|
|
25407
|
+
try {
|
|
25408
|
+
ownershipResponse = await originalSend.call(manager, THREAD_OWNERSHIP_LIST_METHOD2, {
|
|
25409
|
+
threadIds: [threadId]
|
|
25410
|
+
});
|
|
25411
|
+
} catch (error51) {
|
|
25412
|
+
if (!isUnsupportedMethod(error51, THREAD_OWNERSHIP_LIST_METHOD2)) throw error51;
|
|
25413
|
+
await verifyNativeCodexThread(
|
|
25414
|
+
(method, params) => originalSend.call(manager, method, params),
|
|
25415
|
+
threadId
|
|
25416
|
+
);
|
|
25417
|
+
return "official";
|
|
25418
|
+
}
|
|
25419
|
+
const ownership = threadOwnershipListResultSchema.parse(ownershipResponse);
|
|
25420
|
+
const owner = ownership.threads.find((thread) => thread.threadId === threadId)?.owner;
|
|
25421
|
+
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
25422
|
+
return owner === "codex" ? "official" : "newTurn";
|
|
25423
|
+
};
|
|
24929
25424
|
const steer = async function(...args) {
|
|
24930
25425
|
const [
|
|
24931
25426
|
threadId,
|
|
@@ -24948,25 +25443,20 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24948
25443
|
expectedTurnId = host.getActiveTurnId(threadId);
|
|
24949
25444
|
} catch {
|
|
24950
25445
|
}
|
|
24951
|
-
|
|
24952
|
-
|
|
24953
|
-
ownershipResponse = await originalSend.call(manager, THREAD_OWNERSHIP_LIST_METHOD2, {
|
|
24954
|
-
threadIds: [threadId]
|
|
24955
|
-
});
|
|
24956
|
-
} catch (error51) {
|
|
24957
|
-
if (!isUnsupportedMethod(error51, THREAD_OWNERSHIP_LIST_METHOD2)) throw error51;
|
|
24958
|
-
await verifyNativeCodexThread(
|
|
24959
|
-
(method, params) => originalSend.call(manager, method, params),
|
|
24960
|
-
threadId
|
|
24961
|
-
);
|
|
24962
|
-
if (disposed) throw new Error("External steering binding was disposed");
|
|
24963
|
-
return originalSteer.apply(manager, args);
|
|
24964
|
-
}
|
|
24965
|
-
const ownership = threadOwnershipListResultSchema.parse(ownershipResponse);
|
|
24966
|
-
const owner = ownership.threads.find((thread) => thread.threadId === threadId)?.owner;
|
|
24967
|
-
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
25446
|
+
const text = Array.isArray(input) ? input.filter((item) => isRecord7(item) && typeof item.text === "string").map((item) => item.text).join("\n") : void 0;
|
|
25447
|
+
const delivery = await inspectDelivery(threadId, text);
|
|
24968
25448
|
if (disposed) throw new Error("External steering binding was disposed");
|
|
24969
|
-
if (
|
|
25449
|
+
if (delivery === "official") return originalSteer.apply(manager, args);
|
|
25450
|
+
if (delivery === "activeTurn") {
|
|
25451
|
+
activeTurnSteers.set(threadId, (activeTurnSteers.get(threadId) ?? 0) + 1);
|
|
25452
|
+
try {
|
|
25453
|
+
return await originalSteer.apply(manager, args);
|
|
25454
|
+
} finally {
|
|
25455
|
+
const remaining = (activeTurnSteers.get(threadId) ?? 1) - 1;
|
|
25456
|
+
if (remaining > 0) activeTurnSteers.set(threadId, remaining);
|
|
25457
|
+
else activeTurnSteers.delete(threadId);
|
|
25458
|
+
}
|
|
25459
|
+
}
|
|
24970
25460
|
if (!host) throw new Error("Desktop turn submission binding is unavailable");
|
|
24971
25461
|
const currentRole = manager.getStreamRole?.(threadId);
|
|
24972
25462
|
if (isRecord7(currentRole) && currentRole.role === "follower")
|
|
@@ -25211,9 +25701,9 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25211
25701
|
}
|
|
25212
25702
|
|
|
25213
25703
|
// src/renderer-thread-reference-capability.ts
|
|
25214
|
-
var
|
|
25704
|
+
var record4 = (value) => typeof value === "object" && value !== null;
|
|
25215
25705
|
function restoreThreadReferenceCapability(client, manager, isCurrent) {
|
|
25216
|
-
if (!
|
|
25706
|
+
if (!record4(manager) || !record4(manager.storage)) return client;
|
|
25217
25707
|
const storage = manager.storage;
|
|
25218
25708
|
const read = storage.readValue;
|
|
25219
25709
|
const write = storage.writeValue;
|
|
@@ -25248,14 +25738,14 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25248
25738
|
}
|
|
25249
25739
|
|
|
25250
25740
|
// src/renderer-thread-reference-context.ts
|
|
25251
|
-
var
|
|
25741
|
+
var record5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25252
25742
|
function createThreadReferenceContext(manager, hostId2, isCurrent) {
|
|
25253
25743
|
const prepared = /* @__PURE__ */ new WeakMap();
|
|
25254
25744
|
return (params) => {
|
|
25255
|
-
if (hostId2 === "local" || !
|
|
25745
|
+
if (hostId2 === "local" || !record5(manager) || typeof manager.getConversation !== "function" || !record5(params) || typeof params.threadId !== "string")
|
|
25256
25746
|
return params;
|
|
25257
25747
|
const conversation = manager.getConversation.call(manager, params.threadId);
|
|
25258
|
-
if (!
|
|
25748
|
+
if (!record5(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
|
|
25259
25749
|
return params;
|
|
25260
25750
|
if (!isCurrent()) throw new Error("Thread reference connection is no longer available");
|
|
25261
25751
|
const cached2 = prepared.get(params);
|
|
@@ -27511,6 +28001,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27511
28001
|
var GET_LOCALE_OVERRIDE_URL = "vscode://codex/get-setting";
|
|
27512
28002
|
var GET_LOCALE_INFO_URL = "vscode://codex/locale-info";
|
|
27513
28003
|
var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
|
|
28004
|
+
function isNativeLocaleServices(value) {
|
|
28005
|
+
if (!isRecord16(value) || !Object.hasOwn(value, "appInfo")) return false;
|
|
28006
|
+
const appInfo = value.appInfo;
|
|
28007
|
+
return appInfo != null && typeof appInfo.getLocaleInfo === "function";
|
|
28008
|
+
}
|
|
27514
28009
|
function isRecord16(value) {
|
|
27515
28010
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27516
28011
|
}
|
|
@@ -27556,7 +28051,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27556
28051
|
}
|
|
27557
28052
|
function sendFixedLocaleRequest(request, ownerWindow, signal, timeoutMs) {
|
|
27558
28053
|
const bridge = ownerWindow.electronBridge;
|
|
27559
|
-
if (typeof bridge?.sendMessageFromView !== "function") {
|
|
28054
|
+
if (request.kind !== "locale-info" && typeof bridge?.sendMessageFromView !== "function") {
|
|
27560
28055
|
return Promise.reject(new Error("Codex locale bridge is unavailable"));
|
|
27561
28056
|
}
|
|
27562
28057
|
if (signal?.aborted) return Promise.reject(abortError2());
|
|
@@ -27604,13 +28099,21 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27604
28099
|
...request.body === void 0 ? {} : { body: request.body },
|
|
27605
28100
|
reportUploadProgress: false
|
|
27606
28101
|
};
|
|
27607
|
-
|
|
27608
|
-
|
|
27609
|
-
|
|
27610
|
-
|
|
27611
|
-
|
|
27612
|
-
|
|
27613
|
-
|
|
28102
|
+
void (async () => {
|
|
28103
|
+
if (request.kind === "locale-info") {
|
|
28104
|
+
const native = await loadCodexNativeServices(ownerWindow, isNativeLocaleServices);
|
|
28105
|
+
if (settled) return;
|
|
28106
|
+
if (native) {
|
|
28107
|
+
const response = await native.appInfo.getLocaleInfo();
|
|
28108
|
+
settle(() => resolve(response));
|
|
28109
|
+
return;
|
|
28110
|
+
}
|
|
28111
|
+
}
|
|
28112
|
+
if (typeof bridge?.sendMessageFromView !== "function") {
|
|
28113
|
+
throw new Error("Codex locale bridge is unavailable");
|
|
28114
|
+
}
|
|
28115
|
+
await bridge.sendMessageFromView(message2);
|
|
28116
|
+
})().catch((error51) => settle(() => reject(error51)));
|
|
27614
28117
|
});
|
|
27615
28118
|
}
|
|
27616
28119
|
async function readLocaleOverride(ownerWindow, signal, timeoutMs) {
|
|
@@ -27720,6 +28223,34 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27720
28223
|
return names.size === 1 ? names.values().next().value ?? model2 : model2;
|
|
27721
28224
|
}
|
|
27722
28225
|
|
|
28226
|
+
// src/console/usage/usage-hosts.ts
|
|
28227
|
+
var LOCAL_USAGE_HOST_ID = "local";
|
|
28228
|
+
function usageHostOptions(hosts, localLabel, selected) {
|
|
28229
|
+
const options = [{ key: LOCAL_USAGE_HOST_ID, label: localLabel }];
|
|
28230
|
+
const seen = /* @__PURE__ */ new Set([LOCAL_USAGE_HOST_ID]);
|
|
28231
|
+
const add = (hostId2, label) => {
|
|
28232
|
+
if (hostId2.length === 0 || seen.has(hostId2)) return;
|
|
28233
|
+
seen.add(hostId2);
|
|
28234
|
+
options.push({ key: hostId2, label: label !== void 0 && label.length > 0 ? label : hostId2 });
|
|
28235
|
+
};
|
|
28236
|
+
for (const host of hosts ?? []) add(host.hostId, host.label);
|
|
28237
|
+
if (!seen.has(selected)) add(selected, void 0);
|
|
28238
|
+
return options;
|
|
28239
|
+
}
|
|
28240
|
+
function createLatestKeyGuard() {
|
|
28241
|
+
let generation = 0;
|
|
28242
|
+
let key;
|
|
28243
|
+
return {
|
|
28244
|
+
begin(next) {
|
|
28245
|
+
generation += 1;
|
|
28246
|
+
key = next;
|
|
28247
|
+
const mine = generation;
|
|
28248
|
+
const selected = next;
|
|
28249
|
+
return () => generation === mine && Object.is(key, selected);
|
|
28250
|
+
}
|
|
28251
|
+
};
|
|
28252
|
+
}
|
|
28253
|
+
|
|
27723
28254
|
// src/console/usage/format.ts
|
|
27724
28255
|
var MEASURES = ["cost", "tokens"];
|
|
27725
28256
|
function fill(template, values) {
|
|
@@ -29006,6 +29537,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29006
29537
|
const range = text("range");
|
|
29007
29538
|
const measure = text("measure");
|
|
29008
29539
|
const granularity = text("granularity");
|
|
29540
|
+
const hostId2 = text("hostId");
|
|
29009
29541
|
const harness2 = text("harness");
|
|
29010
29542
|
const model2 = text("model");
|
|
29011
29543
|
const project3 = text("project");
|
|
@@ -29014,6 +29546,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29014
29546
|
...range && USAGE_STATISTICS_RANGES.includes(range) ? { range } : {},
|
|
29015
29547
|
...measure && MEASURES.includes(measure) ? { measure } : {},
|
|
29016
29548
|
...granularity === "day" || granularity === "week" || granularity === "month" ? { granularity } : {},
|
|
29549
|
+
...hostId2 !== void 0 && hostId2.length > 0 ? { hostId: hostId2 } : {},
|
|
29017
29550
|
...harness2 !== void 0 ? { harness: harness2 } : {},
|
|
29018
29551
|
...model2 !== void 0 ? { model: model2 } : {},
|
|
29019
29552
|
...project3 !== void 0 ? { project: project3 } : {},
|
|
@@ -29052,7 +29585,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29052
29585
|
day.setDate(day.getDate() - (day.getDay() + 6) % 7);
|
|
29053
29586
|
return isoDate(day);
|
|
29054
29587
|
}
|
|
29055
|
-
function createUsageStatisticsPage(consoleMessages2, request, pageLocale) {
|
|
29588
|
+
function createUsageStatisticsPage(consoleMessages2, request, pageLocale, usageHosts) {
|
|
29056
29589
|
const messages = consoleMessages2.usageStatistics;
|
|
29057
29590
|
return Object.freeze({
|
|
29058
29591
|
id: "usage-statistics",
|
|
@@ -29061,10 +29594,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29061
29594
|
mount(context) {
|
|
29062
29595
|
const document2 = context.content.ownerDocument;
|
|
29063
29596
|
const locale = pageLocale ?? (document2.documentElement.lang || "en");
|
|
29597
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
29064
29598
|
const count3 = (value) => count2(value, locale);
|
|
29065
29599
|
const tokenCount2 = (totals2, value) => tokenCount(totals2, value, locale);
|
|
29066
29600
|
const saved = readView();
|
|
29067
29601
|
const view = {
|
|
29602
|
+
hostId: saved.hostId ?? LOCAL_USAGE_HOST_ID,
|
|
29068
29603
|
range: saved.range ?? "30d",
|
|
29069
29604
|
measure: saved.measure ?? "cost",
|
|
29070
29605
|
granularity: saved.granularity ?? null,
|
|
@@ -29095,7 +29630,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29095
29630
|
let projectLabel = /* @__PURE__ */ new Map();
|
|
29096
29631
|
const projectName = (key) => key === UNKNOWN ? messages.unknownProject : projectLabel.get(key) ?? baseName(key);
|
|
29097
29632
|
const measureLabel = (measure) => measure === "cost" ? messages.cost : messages.tokens;
|
|
29098
|
-
const dateFormat = (options) => new Intl.DateTimeFormat(locale, options);
|
|
29633
|
+
const dateFormat = (options) => new Intl.DateTimeFormat(locale, { ...options, timeZone });
|
|
29099
29634
|
const shortDate = dateFormat({ month: "short", day: "numeric" });
|
|
29100
29635
|
const longDate = dateFormat({
|
|
29101
29636
|
year: "numeric",
|
|
@@ -29114,10 +29649,51 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29114
29649
|
const prices = createModelPricesDialog(
|
|
29115
29650
|
document2,
|
|
29116
29651
|
consoleMessages2,
|
|
29117
|
-
request,
|
|
29652
|
+
(method, params2) => request(method, params2, view.hostId),
|
|
29118
29653
|
context.signal,
|
|
29119
29654
|
load
|
|
29120
29655
|
);
|
|
29656
|
+
let offeredHosts = usageHosts ? [] : void 0;
|
|
29657
|
+
const hostCombo = new ComboBox(document2, {
|
|
29658
|
+
label: messages.host,
|
|
29659
|
+
searchLabel: messages.search,
|
|
29660
|
+
emptyLabel: messages.noMatches,
|
|
29661
|
+
signal: context.signal,
|
|
29662
|
+
searchable: false,
|
|
29663
|
+
display: (option) => `${messages.host} \xB7 ${option.label}`,
|
|
29664
|
+
onChange: (key) => {
|
|
29665
|
+
if (key === view.hostId) return;
|
|
29666
|
+
view.hostId = key;
|
|
29667
|
+
view.harness = "";
|
|
29668
|
+
view.model = "";
|
|
29669
|
+
view.project = "";
|
|
29670
|
+
date5 = null;
|
|
29671
|
+
unpricedOnly = false;
|
|
29672
|
+
result = null;
|
|
29673
|
+
error51 = null;
|
|
29674
|
+
loadedAt = 0;
|
|
29675
|
+
names.clear();
|
|
29676
|
+
save();
|
|
29677
|
+
hostOptions();
|
|
29678
|
+
render();
|
|
29679
|
+
void refreshHarnessNames();
|
|
29680
|
+
load();
|
|
29681
|
+
}
|
|
29682
|
+
});
|
|
29683
|
+
const hostOptions = () => {
|
|
29684
|
+
const options = usageHostOptions(offeredHosts, messages.localHost, view.hostId);
|
|
29685
|
+
hostCombo.element.hidden = options.length < 2;
|
|
29686
|
+
hostCombo.update(options, view.hostId === LOCAL_USAGE_HOST_ID ? "" : view.hostId);
|
|
29687
|
+
};
|
|
29688
|
+
const offerHosts = () => {
|
|
29689
|
+
if (!usageHosts) return;
|
|
29690
|
+
void usageHosts().then((hosts) => {
|
|
29691
|
+
if (context.signal.aborted) return;
|
|
29692
|
+
offeredHosts = hosts;
|
|
29693
|
+
hostOptions();
|
|
29694
|
+
}).catch(() => void 0);
|
|
29695
|
+
};
|
|
29696
|
+
hostOptions();
|
|
29121
29697
|
const updated = h(document2, "span", { className: "console-muted console-usage-updated" });
|
|
29122
29698
|
const refresh = h(
|
|
29123
29699
|
document2,
|
|
@@ -29130,7 +29706,10 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29130
29706
|
},
|
|
29131
29707
|
createRendererSettingsIcon("refresh", 16)
|
|
29132
29708
|
);
|
|
29133
|
-
refresh.addEventListener("click", () =>
|
|
29709
|
+
refresh.addEventListener("click", () => {
|
|
29710
|
+
offerHosts();
|
|
29711
|
+
load();
|
|
29712
|
+
});
|
|
29134
29713
|
const auto = new ComboBox(document2, {
|
|
29135
29714
|
label: messages.autoRefresh,
|
|
29136
29715
|
searchLabel: messages.search,
|
|
@@ -29169,6 +29748,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29169
29748
|
document2,
|
|
29170
29749
|
"div",
|
|
29171
29750
|
{ className: "console-usage-toolbar" },
|
|
29751
|
+
hostCombo.element,
|
|
29172
29752
|
updated,
|
|
29173
29753
|
refresh,
|
|
29174
29754
|
auto.element,
|
|
@@ -29807,7 +30387,6 @@ ${detail}` : ""}`
|
|
|
29807
30387
|
}
|
|
29808
30388
|
function hourlyPanel(data) {
|
|
29809
30389
|
const singleDay = data.filters.date !== null || data.range === "today";
|
|
29810
|
-
const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
29811
30390
|
return panel(
|
|
29812
30391
|
singleDay ? messages.hourlyDay : messages.hourly,
|
|
29813
30392
|
hourlyChart(document2, {
|
|
@@ -29822,7 +30401,7 @@ ${detail}` : ""}`
|
|
|
29822
30401
|
weekStartsOnMonday: !locale.startsWith("en"),
|
|
29823
30402
|
labels: { cost: messages.cost, tokens: messages.tokens }
|
|
29824
30403
|
}),
|
|
29825
|
-
h(document2, "span", { className: "console-muted console-usage-zone" },
|
|
30404
|
+
h(document2, "span", { className: "console-muted console-usage-zone" }, timeZone)
|
|
29826
30405
|
);
|
|
29827
30406
|
}
|
|
29828
30407
|
function sessionsPanel(title, rows, tableKey) {
|
|
@@ -29969,6 +30548,7 @@ ${detail}` : ""}`
|
|
|
29969
30548
|
const project3 = filterValue(view.project);
|
|
29970
30549
|
return {
|
|
29971
30550
|
range: view.range,
|
|
30551
|
+
timeZone,
|
|
29972
30552
|
...view.harness ? { harness: view.harness } : {},
|
|
29973
30553
|
...model2 !== void 0 ? { model: model2 } : {},
|
|
29974
30554
|
...project3 !== void 0 ? { project: project3 } : {},
|
|
@@ -29981,10 +30561,26 @@ ${detail}` : ""}`
|
|
|
29981
30561
|
if (result && !result.reading.complete) poll = window.setTimeout(load, POLL_MS);
|
|
29982
30562
|
else if (view.autoRefreshMs > 0) poll = window.setTimeout(load, view.autoRefreshMs);
|
|
29983
30563
|
}
|
|
30564
|
+
const harnessNamesRead = createLatestKeyGuard();
|
|
30565
|
+
async function refreshHarnessNames() {
|
|
30566
|
+
const hostId2 = view.hostId;
|
|
30567
|
+
const isCurrent = harnessNamesRead.begin(hostId2);
|
|
30568
|
+
names.clear();
|
|
30569
|
+
try {
|
|
30570
|
+
const value = await request(HARNESS_PLUGIN_LIST_METHOD2, {}, hostId2);
|
|
30571
|
+
if (!isCurrent()) return;
|
|
30572
|
+
for (const plugin of harnessPluginListResultSchema.parse(value).plugins) {
|
|
30573
|
+
names.set(plugin.id, plugin.name);
|
|
30574
|
+
}
|
|
30575
|
+
} catch {
|
|
30576
|
+
if (!isCurrent()) return;
|
|
30577
|
+
}
|
|
30578
|
+
if (!context.signal.aborted) render();
|
|
30579
|
+
}
|
|
29984
30580
|
function load() {
|
|
29985
30581
|
window.clearTimeout(poll);
|
|
29986
30582
|
const requested = params();
|
|
29987
|
-
void context.runLatest(() => request(USAGE_STATISTICS_METHOD, requested), {
|
|
30583
|
+
void context.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
|
|
29988
30584
|
success(value) {
|
|
29989
30585
|
const parsed = usageStatisticsResultSchema.safeParse(value);
|
|
29990
30586
|
if (parsed.success) {
|
|
@@ -30009,12 +30605,8 @@ ${detail}` : ""}`
|
|
|
30009
30605
|
}
|
|
30010
30606
|
context.content.replaceChildren(header, prices.element, filters, notices, body);
|
|
30011
30607
|
render();
|
|
30012
|
-
|
|
30013
|
-
|
|
30014
|
-
names.set(plugin.id, plugin.name);
|
|
30015
|
-
}
|
|
30016
|
-
if (!context.signal.aborted) render();
|
|
30017
|
-
}).catch(() => void 0);
|
|
30608
|
+
offerHosts();
|
|
30609
|
+
void refreshHarnessNames();
|
|
30018
30610
|
load();
|
|
30019
30611
|
return () => {
|
|
30020
30612
|
window.clearTimeout(poll);
|
|
@@ -30107,6 +30699,8 @@ ${detail}` : ""}`
|
|
|
30107
30699
|
harness: "Harness",
|
|
30108
30700
|
model: "Model",
|
|
30109
30701
|
project: "Project",
|
|
30702
|
+
host: "Machine",
|
|
30703
|
+
localHost: "This machine",
|
|
30110
30704
|
filterModel: "Filter by model",
|
|
30111
30705
|
filterProject: "Filter by project",
|
|
30112
30706
|
unknownModel: "Unknown model",
|
|
@@ -30290,6 +30884,8 @@ ${detail}` : ""}`
|
|
|
30290
30884
|
harness: "Harness",
|
|
30291
30885
|
model: "\u6A21\u578B",
|
|
30292
30886
|
project: "\u9879\u76EE",
|
|
30887
|
+
host: "\u673A\u5668",
|
|
30888
|
+
localHost: "\u672C\u673A",
|
|
30293
30889
|
filterModel: "\u6309\u6A21\u578B\u7B5B\u9009",
|
|
30294
30890
|
filterProject: "\u6309\u9879\u76EE\u7B5B\u9009",
|
|
30295
30891
|
unknownModel: "\u672A\u77E5\u6A21\u578B",
|
|
@@ -32906,7 +33502,7 @@ ${detail}` : ""}`
|
|
|
32906
33502
|
}
|
|
32907
33503
|
function defaultImportName(source, existing) {
|
|
32908
33504
|
const base = source.provider === "openai-codex" ? "codex" : "grok";
|
|
32909
|
-
const used = new Set(existing.map((
|
|
33505
|
+
const used = new Set(existing.map((record6) => record6.name));
|
|
32910
33506
|
const valid = (name) => credentialImportNameSchema.safeParse(name).success;
|
|
32911
33507
|
if (!used.has(base)) return base;
|
|
32912
33508
|
const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
|
|
@@ -32929,7 +33525,7 @@ ${detail}` : ""}`
|
|
|
32929
33525
|
const shown = (text) => accountDisplayText(text, hideEmails);
|
|
32930
33526
|
const targetButtons = /* @__PURE__ */ new Map();
|
|
32931
33527
|
const importedRecords = () => snapshot.targets.find((target) => target.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
|
|
32932
|
-
const sourceOf = (
|
|
33528
|
+
const sourceOf = (record6) => snapshot.sources.find((source) => source.id === record6.source.id);
|
|
32933
33529
|
const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
|
|
32934
33530
|
const compatibleSources = () => {
|
|
32935
33531
|
const target = piTarget();
|
|
@@ -32967,7 +33563,7 @@ ${detail}` : ""}`
|
|
|
32967
33563
|
sectionImport.addEventListener("click", () => {
|
|
32968
33564
|
const sources = compatibleSources();
|
|
32969
33565
|
const free = sources.find(
|
|
32970
|
-
(source2) => !importedRecords().some((
|
|
33566
|
+
(source2) => !importedRecords().some((record6) => record6.source.id === source2.id)
|
|
32971
33567
|
);
|
|
32972
33568
|
const source = free ?? sources[0];
|
|
32973
33569
|
if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
|
|
@@ -33017,30 +33613,30 @@ ${detail}` : ""}`
|
|
|
33017
33613
|
mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
|
|
33018
33614
|
return mark;
|
|
33019
33615
|
};
|
|
33020
|
-
const renderRow = (
|
|
33616
|
+
const renderRow = (record6) => {
|
|
33021
33617
|
const row = document2.createElement("div");
|
|
33022
33618
|
row.className = "settings-pi-accounts__row";
|
|
33023
33619
|
row.tabIndex = -1;
|
|
33024
|
-
row.dataset.importName =
|
|
33025
|
-
row.setAttribute("aria-label", shown(
|
|
33026
|
-
const agent =
|
|
33620
|
+
row.dataset.importName = record6.name;
|
|
33621
|
+
row.setAttribute("aria-label", shown(record6.source.label));
|
|
33622
|
+
const agent = record6.source.harnessId;
|
|
33027
33623
|
const mark = createMark(agent);
|
|
33028
33624
|
const identity = document2.createElement("div");
|
|
33029
33625
|
identity.className = "settings-pi-accounts__identity";
|
|
33030
33626
|
const label = document2.createElement("strong");
|
|
33031
33627
|
label.className = "settings-account-email";
|
|
33032
|
-
label.textContent = shown(
|
|
33628
|
+
label.textContent = shown(record6.source.label);
|
|
33033
33629
|
label.title = label.textContent;
|
|
33034
33630
|
label.translate = false;
|
|
33035
33631
|
const meta3 = document2.createElement("div");
|
|
33036
33632
|
meta3.className = "settings-account-metadata";
|
|
33037
|
-
const source = sourceOf(
|
|
33633
|
+
const source = sourceOf(record6);
|
|
33038
33634
|
const parts = [
|
|
33039
33635
|
metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
|
|
33040
|
-
metaPart(`${
|
|
33636
|
+
metaPart(`${record6.name}/\u2026`, void 0, true),
|
|
33041
33637
|
metaPart(messages.copied)
|
|
33042
33638
|
];
|
|
33043
|
-
const time3 = formatImportedAt(
|
|
33639
|
+
const time3 = formatImportedAt(record6.importedAt);
|
|
33044
33640
|
if (time3) parts.push(metaPart(time3));
|
|
33045
33641
|
parts.forEach((part, index) => {
|
|
33046
33642
|
if (index > 0) {
|
|
@@ -33057,23 +33653,23 @@ ${detail}` : ""}`
|
|
|
33057
33653
|
reimport.type = "button";
|
|
33058
33654
|
reimport.className = "settings-account-action";
|
|
33059
33655
|
reimport.textContent = messages.rowReimport;
|
|
33060
|
-
reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(
|
|
33656
|
+
reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record6.source.label)}`);
|
|
33061
33657
|
reimport.disabled = busy || !source;
|
|
33062
33658
|
reimport.title = messages.reimport;
|
|
33063
33659
|
reimport.addEventListener("click", () => {
|
|
33064
|
-
if (source) openDialog("reimport", { source, record:
|
|
33660
|
+
if (source) openDialog("reimport", { source, record: record6 }, `row:${record6.name}`);
|
|
33065
33661
|
});
|
|
33066
33662
|
const remove = document2.createElement("button");
|
|
33067
33663
|
remove.type = "button";
|
|
33068
33664
|
remove.className = "settings-account-action settings-pi-accounts__remove";
|
|
33069
33665
|
remove.textContent = messages.rowRemove;
|
|
33070
|
-
remove.setAttribute("aria-label", `${messages.remove}: ${shown(
|
|
33666
|
+
remove.setAttribute("aria-label", `${messages.remove}: ${shown(record6.source.label)}`);
|
|
33071
33667
|
remove.disabled = busy;
|
|
33072
|
-
remove.addEventListener("click", () => openDialog("remove", { record:
|
|
33668
|
+
remove.addEventListener("click", () => openDialog("remove", { record: record6 }, `row:${record6.name}`));
|
|
33073
33669
|
if (source) actions.append(reimport);
|
|
33074
33670
|
actions.append(remove);
|
|
33075
33671
|
row.append(mark, identity, actions);
|
|
33076
|
-
rows.set(
|
|
33672
|
+
rows.set(record6.name, row);
|
|
33077
33673
|
return row;
|
|
33078
33674
|
};
|
|
33079
33675
|
const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
|
|
@@ -33226,7 +33822,7 @@ ${detail}` : ""}`
|
|
|
33226
33822
|
const label = document2.createElement("strong");
|
|
33227
33823
|
label.textContent = shown(choice.label);
|
|
33228
33824
|
label.translate = false;
|
|
33229
|
-
const existing = importedRecords().find((
|
|
33825
|
+
const existing = importedRecords().find((record6) => record6.source.id === choice.id);
|
|
33230
33826
|
const agent = choice.harnessId;
|
|
33231
33827
|
const detail = document2.createElement("span");
|
|
33232
33828
|
detail.textContent = [
|
|
@@ -33267,7 +33863,7 @@ ${detail}` : ""}`
|
|
|
33267
33863
|
const name = request.action === "list" ? void 0 : request.name;
|
|
33268
33864
|
state = {
|
|
33269
33865
|
source: state.source,
|
|
33270
|
-
record: importedRecords().find((
|
|
33866
|
+
record: importedRecords().find((record6) => record6.name === name) ?? state.record
|
|
33271
33867
|
};
|
|
33272
33868
|
show(next);
|
|
33273
33869
|
} else {
|
|
@@ -33281,12 +33877,12 @@ ${detail}` : ""}`
|
|
|
33281
33877
|
sourceRadios = [];
|
|
33282
33878
|
body.replaceChildren();
|
|
33283
33879
|
controls.replaceChildren();
|
|
33284
|
-
const { source, record:
|
|
33880
|
+
const { source, record: record6 } = state;
|
|
33285
33881
|
const close = () => modal.close();
|
|
33286
33882
|
if (mode === "add" || mode === "reimport") {
|
|
33287
33883
|
title.textContent = mode === "add" ? messages.add : messages.reimport;
|
|
33288
33884
|
modal.setAttribute("aria-label", title.textContent);
|
|
33289
|
-
const active = source ??
|
|
33885
|
+
const active = source ?? record6?.source;
|
|
33290
33886
|
const choices = mode === "add" && state.choose ? compatibleSources() : [];
|
|
33291
33887
|
if (choices.length > 1) body.append(sourcePicker(choices));
|
|
33292
33888
|
else if (active) body.append(line(messages.source, shown(active.label)));
|
|
@@ -33295,8 +33891,8 @@ ${detail}` : ""}`
|
|
|
33295
33891
|
input.maxLength = 48;
|
|
33296
33892
|
input.autocomplete = "off";
|
|
33297
33893
|
input.spellcheck = false;
|
|
33298
|
-
input.value =
|
|
33299
|
-
input.readOnly = Boolean(
|
|
33894
|
+
input.value = record6?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
|
|
33895
|
+
input.readOnly = Boolean(record6);
|
|
33300
33896
|
input.addEventListener("input", () => {
|
|
33301
33897
|
nameEdited = true;
|
|
33302
33898
|
});
|
|
@@ -33330,7 +33926,7 @@ ${detail}` : ""}`
|
|
|
33330
33926
|
{
|
|
33331
33927
|
action: mode === "reimport" ? "reimport" : "import",
|
|
33332
33928
|
sourceId: source2.id,
|
|
33333
|
-
name:
|
|
33929
|
+
name: record6?.name ?? input.value,
|
|
33334
33930
|
confirmed: true
|
|
33335
33931
|
},
|
|
33336
33932
|
"done"
|
|
@@ -33340,16 +33936,16 @@ ${detail}` : ""}`
|
|
|
33340
33936
|
)
|
|
33341
33937
|
);
|
|
33342
33938
|
(mode === "add" ? input : controls.children[0]).focus();
|
|
33343
|
-
} else if (mode === "remove" &&
|
|
33939
|
+
} else if (mode === "remove" && record6) {
|
|
33344
33940
|
title.textContent = messages.remove;
|
|
33345
33941
|
modal.setAttribute("aria-label", title.textContent);
|
|
33346
|
-
body.append(note(messages.removeWarning.replace("{name}",
|
|
33942
|
+
body.append(note(messages.removeWarning.replace("{name}", record6.name)));
|
|
33347
33943
|
const cancel = command(messages.cancel, close);
|
|
33348
33944
|
controls.append(
|
|
33349
33945
|
cancel,
|
|
33350
33946
|
command(
|
|
33351
33947
|
messages.remove,
|
|
33352
|
-
() => submit({ action: "remove", name:
|
|
33948
|
+
() => submit({ action: "remove", name: record6.name, confirmed: true }, null),
|
|
33353
33949
|
"danger"
|
|
33354
33950
|
)
|
|
33355
33951
|
);
|
|
@@ -33357,7 +33953,7 @@ ${detail}` : ""}`
|
|
|
33357
33953
|
} else {
|
|
33358
33954
|
title.textContent = messages.doneTitle;
|
|
33359
33955
|
modal.setAttribute("aria-label", title.textContent);
|
|
33360
|
-
const name =
|
|
33956
|
+
const name = record6?.name;
|
|
33361
33957
|
if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
|
|
33362
33958
|
body.append(note(messages.done));
|
|
33363
33959
|
const done = command(messages.close, close, "primary");
|
|
@@ -33404,21 +34000,21 @@ ${detail}` : ""}`
|
|
|
33404
34000
|
(candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
|
|
33405
34001
|
);
|
|
33406
34002
|
if (!source || !target) return null;
|
|
33407
|
-
const
|
|
34003
|
+
const record6 = target.imports.find((candidate) => candidate.source.id === source.id);
|
|
33408
34004
|
const key = `${harnessId}:${accountLabel}:import`;
|
|
33409
34005
|
const button2 = document2.createElement("button");
|
|
33410
34006
|
button2.type = "button";
|
|
33411
34007
|
button2.className = "settings-account-pi-import";
|
|
33412
34008
|
button2.dataset.accountFocus = key;
|
|
33413
34009
|
button2.disabled = busy;
|
|
33414
|
-
const hint =
|
|
34010
|
+
const hint = record6 ? messages.importedHint.replace("{name}", record6.name) : messages.add;
|
|
33415
34011
|
button2.title = hint;
|
|
33416
34012
|
button2.setAttribute("aria-label", hint);
|
|
33417
34013
|
button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
|
|
33418
|
-
if (
|
|
34014
|
+
if (record6) {
|
|
33419
34015
|
button2.dataset.state = "imported";
|
|
33420
34016
|
const name = document2.createElement("code");
|
|
33421
|
-
name.textContent = `${
|
|
34017
|
+
name.textContent = `${record6.name}/\u2026`;
|
|
33422
34018
|
name.translate = false;
|
|
33423
34019
|
button2.append(name, createRendererSettingsIcon("check", 12));
|
|
33424
34020
|
} else {
|
|
@@ -33426,7 +34022,7 @@ ${detail}` : ""}`
|
|
|
33426
34022
|
button2.append(messages.add);
|
|
33427
34023
|
}
|
|
33428
34024
|
button2.addEventListener("click", () => {
|
|
33429
|
-
if (!
|
|
34025
|
+
if (!record6) {
|
|
33430
34026
|
openDialog("add", { source }, key);
|
|
33431
34027
|
return;
|
|
33432
34028
|
}
|
|
@@ -33435,7 +34031,7 @@ ${detail}` : ""}`
|
|
|
33435
34031
|
renderSection();
|
|
33436
34032
|
sectionToggle.setAttribute("aria-expanded", "true");
|
|
33437
34033
|
}
|
|
33438
|
-
const row = rows.get(
|
|
34034
|
+
const row = rows.get(record6.name);
|
|
33439
34035
|
row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
33440
34036
|
row?.focus();
|
|
33441
34037
|
});
|
|
@@ -35207,7 +35803,7 @@ ${detail}` : ""}`
|
|
|
35207
35803
|
}
|
|
35208
35804
|
});
|
|
35209
35805
|
}
|
|
35210
|
-
function createDefaultRendererSettingsPages(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread = () => Promise.reject(new Error("Imported Thread navigation is unavailable")), getLoadedSessionsClient = () => null, getRemoteConnections = () => null, requestUsageStatistics = () => Promise.reject(new Error("Local Host connection is unavailable"))) {
|
|
35806
|
+
function createDefaultRendererSettingsPages(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread = () => Promise.reject(new Error("Imported Thread navigation is unavailable")), getLoadedSessionsClient = () => null, getRemoteConnections = () => null, requestUsageStatistics = () => Promise.reject(new Error("Local Host connection is unavailable")), usageStatisticsHosts) {
|
|
35211
35807
|
return Object.freeze([
|
|
35212
35808
|
createConnectionsSettingsPage(messages, getDiagnostics, void 0, getRemoteConnections, () => {
|
|
35213
35809
|
const client = getUpdateClient();
|
|
@@ -35224,7 +35820,8 @@ ${detail}` : ""}`
|
|
|
35224
35820
|
createUsageStatisticsPage(
|
|
35225
35821
|
consoleMessages(messages.locale),
|
|
35226
35822
|
requestUsageStatistics,
|
|
35227
|
-
messages.locale
|
|
35823
|
+
messages.locale,
|
|
35824
|
+
usageStatisticsHosts
|
|
35228
35825
|
),
|
|
35229
35826
|
createAppearanceSettingsPage(messages, getLoadedSessionsClient),
|
|
35230
35827
|
createPluginsSettingsPage(messages, getDiagnostics),
|
|
@@ -35232,7 +35829,7 @@ ${detail}` : ""}`
|
|
|
35232
35829
|
aboutPage(messages, getUpdateClient)
|
|
35233
35830
|
]);
|
|
35234
35831
|
}
|
|
35235
|
-
function createDefaultRendererSettingsRegistry(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread, requestUsageStatistics) {
|
|
35832
|
+
function createDefaultRendererSettingsRegistry(messages = DEFAULT_RENDERER_SETTINGS_MESSAGES, getUpdateClient = () => null, getDiagnostics = () => null, getAccountClient = () => null, getSessionImportClient = () => null, openImportedThread, requestUsageStatistics, usageStatisticsHosts) {
|
|
35236
35833
|
return createRendererSettingsPageRegistry(
|
|
35237
35834
|
createDefaultRendererSettingsPages(
|
|
35238
35835
|
messages,
|
|
@@ -35243,7 +35840,8 @@ ${detail}` : ""}`
|
|
|
35243
35840
|
openImportedThread,
|
|
35244
35841
|
void 0,
|
|
35245
35842
|
void 0,
|
|
35246
|
-
requestUsageStatistics
|
|
35843
|
+
requestUsageStatistics,
|
|
35844
|
+
usageStatisticsHosts
|
|
35247
35845
|
)
|
|
35248
35846
|
);
|
|
35249
35847
|
}
|
|
@@ -36038,6 +36636,20 @@ ${detail}` : ""}`
|
|
|
36038
36636
|
gap: 16px;
|
|
36039
36637
|
}
|
|
36040
36638
|
|
|
36639
|
+
.settings-connections-content {
|
|
36640
|
+
container: settings-connections / inline-size;
|
|
36641
|
+
}
|
|
36642
|
+
|
|
36643
|
+
@container settings-connections (max-width: 780px) {
|
|
36644
|
+
.settings-connections-layout {
|
|
36645
|
+
grid-template-columns: minmax(0, 1fr);
|
|
36646
|
+
}
|
|
36647
|
+
|
|
36648
|
+
.settings-connection-inspector {
|
|
36649
|
+
position: static;
|
|
36650
|
+
}
|
|
36651
|
+
}
|
|
36652
|
+
|
|
36041
36653
|
.settings-connection-list {
|
|
36042
36654
|
overflow: hidden;
|
|
36043
36655
|
background: var(--settings-surface);
|
|
@@ -36045,14 +36657,36 @@ ${detail}` : ""}`
|
|
|
36045
36657
|
border-radius: 10px;
|
|
36046
36658
|
}
|
|
36047
36659
|
|
|
36660
|
+
.settings-connection-host-header {
|
|
36661
|
+
display: flex;
|
|
36662
|
+
align-items: center;
|
|
36663
|
+
min-width: 0;
|
|
36664
|
+
border-bottom: 1px solid var(--settings-divider);
|
|
36665
|
+
}
|
|
36666
|
+
|
|
36667
|
+
.settings-connection-update-all {
|
|
36668
|
+
flex: none;
|
|
36669
|
+
margin-right: 10px;
|
|
36670
|
+
white-space: nowrap;
|
|
36671
|
+
}
|
|
36672
|
+
|
|
36673
|
+
.settings-connection-update-result {
|
|
36674
|
+
margin: 0;
|
|
36675
|
+
padding: 7px 10px;
|
|
36676
|
+
color: var(--settings-muted);
|
|
36677
|
+
font-size: 11px;
|
|
36678
|
+
line-height: 18px;
|
|
36679
|
+
border-bottom: 1px solid var(--settings-divider);
|
|
36680
|
+
}
|
|
36681
|
+
|
|
36048
36682
|
.settings-connection-host-strip {
|
|
36049
36683
|
display: grid;
|
|
36684
|
+
flex: 1;
|
|
36050
36685
|
grid-template-columns: 28px minmax(0, 1fr) 28px;
|
|
36051
36686
|
align-items: center;
|
|
36052
36687
|
min-width: 0;
|
|
36053
36688
|
gap: 6px;
|
|
36054
36689
|
padding: 10px 12px;
|
|
36055
|
-
border-bottom: 1px solid var(--settings-divider);
|
|
36056
36690
|
}
|
|
36057
36691
|
|
|
36058
36692
|
.settings-connection-host-scroll {
|
|
@@ -36312,6 +36946,14 @@ ${detail}` : ""}`
|
|
|
36312
36946
|
line-height: 18px;
|
|
36313
36947
|
}
|
|
36314
36948
|
|
|
36949
|
+
.settings-connection-version-available {
|
|
36950
|
+
flex: none;
|
|
36951
|
+
color: var(--settings-muted);
|
|
36952
|
+
font-size: 10px;
|
|
36953
|
+
line-height: 16px;
|
|
36954
|
+
white-space: nowrap;
|
|
36955
|
+
}
|
|
36956
|
+
|
|
36315
36957
|
.settings-connection-row__status::before {
|
|
36316
36958
|
width: 6px;
|
|
36317
36959
|
height: 6px;
|
|
@@ -36348,6 +36990,7 @@ ${detail}` : ""}`
|
|
|
36348
36990
|
justify-content: flex-end;
|
|
36349
36991
|
min-width: 0;
|
|
36350
36992
|
gap: 4px;
|
|
36993
|
+
white-space: nowrap;
|
|
36351
36994
|
}
|
|
36352
36995
|
|
|
36353
36996
|
.settings-connection-row__handle {
|
|
@@ -40967,7 +41610,8 @@ ${usage_default}`;
|
|
|
40967
41610
|
},
|
|
40968
41611
|
options.getLoadedSessionsClient ?? (() => null),
|
|
40969
41612
|
options.getRemoteConnections ?? (() => null),
|
|
40970
|
-
options.requestUsageStatistics
|
|
41613
|
+
options.requestUsageStatistics,
|
|
41614
|
+
options.usageStatisticsHosts
|
|
40971
41615
|
);
|
|
40972
41616
|
const nextShell = installRendererSettingsShell(definitions, messages, ownerWindow.document, {
|
|
40973
41617
|
onOpenChange(open) {
|
|
@@ -41116,6 +41760,30 @@ ${usage_default}`;
|
|
|
41116
41760
|
};
|
|
41117
41761
|
}
|
|
41118
41762
|
|
|
41763
|
+
// src/renderer-usage-statistics-source.ts
|
|
41764
|
+
function createRendererUsageStatisticsSource(options) {
|
|
41765
|
+
return {
|
|
41766
|
+
async request(method, params, hostId2) {
|
|
41767
|
+
const route = options.routing()?.forHost(hostId2);
|
|
41768
|
+
if (options.disposed() || !route) {
|
|
41769
|
+
throw new Error(`Host connection is unavailable (${hostId2})`);
|
|
41770
|
+
}
|
|
41771
|
+
return route.manager.sendRequest(method, params);
|
|
41772
|
+
},
|
|
41773
|
+
async hosts() {
|
|
41774
|
+
const connections = await options.listConnections().catch(() => []);
|
|
41775
|
+
const names = new Map(
|
|
41776
|
+
connections.map((connection) => [connection.hostId, connection.displayName])
|
|
41777
|
+
);
|
|
41778
|
+
const known = options.routing()?.knownHostIds?.() ?? [];
|
|
41779
|
+
return [.../* @__PURE__ */ new Set([...known, ...names.keys()])].map((hostId2) => {
|
|
41780
|
+
const label = names.get(hostId2);
|
|
41781
|
+
return label === void 0 ? { hostId: hostId2 } : { hostId: hostId2, label };
|
|
41782
|
+
});
|
|
41783
|
+
}
|
|
41784
|
+
};
|
|
41785
|
+
}
|
|
41786
|
+
|
|
41119
41787
|
// src/renderer-native-composer-controller.ts
|
|
41120
41788
|
var MAX_ELEMENT_DEPTH = 4;
|
|
41121
41789
|
var MAX_FIBER_DEPTH = 40;
|
|
@@ -42071,17 +42739,19 @@ ${usage_default}`;
|
|
|
42071
42739
|
});
|
|
42072
42740
|
let connectionDiagnostics = null;
|
|
42073
42741
|
const remoteConnections = createRemoteConnectionsControl(window, modelClientForHost);
|
|
42742
|
+
const usageStatistics = createRendererUsageStatisticsSource({
|
|
42743
|
+
routing: () => window.__codexhostHostRoutingV1,
|
|
42744
|
+
listConnections: () => remoteConnections.ssh.list(),
|
|
42745
|
+
disposed: () => disposed
|
|
42746
|
+
});
|
|
42074
42747
|
const settingsLifecycle = installRendererSettingsLifecycle(window, {
|
|
42075
42748
|
getRemoteConnections: () => remoteConnections,
|
|
42076
42749
|
getUpdateClient: () => modelControl,
|
|
42077
42750
|
getAccountClient: () => modelControl,
|
|
42078
42751
|
getConnectionDiagnostics: () => connectionDiagnostics,
|
|
42079
42752
|
getLoadedSessionsClient: () => modelClientForHost("local"),
|
|
42080
|
-
|
|
42081
|
-
|
|
42082
|
-
if (disposed || !route) throw new Error("Local Host connection is unavailable");
|
|
42083
|
-
return route.manager.sendRequest(method, params);
|
|
42084
|
-
},
|
|
42753
|
+
requestUsageStatistics: usageStatistics.request,
|
|
42754
|
+
usageStatisticsHosts: usageStatistics.hosts,
|
|
42085
42755
|
getSessionImportClient: () => {
|
|
42086
42756
|
const hostId2 = activeModelHostId() ?? "local";
|
|
42087
42757
|
const client = modelClientForHost(hostId2);
|
|
@@ -42180,9 +42850,10 @@ ${usage_default}`;
|
|
|
42180
42850
|
};
|
|
42181
42851
|
const notifySubmission = (composer, trigger) => {
|
|
42182
42852
|
const state = controller.recordSubmission(composer);
|
|
42853
|
+
const createsThread = state.phase === "draft";
|
|
42183
42854
|
const preferenceStorage = rendererNewThreadPreferenceStorage(activeModelHostId(composer));
|
|
42184
|
-
writeNewThreadAgentPreference(state.agent, preferenceStorage);
|
|
42185
|
-
if (state.agent !== "codex") {
|
|
42855
|
+
if (createsThread) writeNewThreadAgentPreference(state.agent, preferenceStorage);
|
|
42856
|
+
if (createsThread && state.agent !== "codex") {
|
|
42186
42857
|
const model2 = controller.modelForAgent(composer, state.agent);
|
|
42187
42858
|
if (model2) {
|
|
42188
42859
|
writeNewThreadExternalConfigurationPreference(
|
|
@@ -43316,7 +43987,7 @@ ${usage_default}`;
|
|
|
43316
43987
|
let webUiAvailable = false;
|
|
43317
43988
|
try {
|
|
43318
43989
|
const inspection = await client.inspectHarness(
|
|
43319
|
-
{ harnessId: harnessIdSchema.parse(agent), refresh },
|
|
43990
|
+
{ harnessId: harnessIdSchema.parse(agent), refresh, purpose: "availability" },
|
|
43320
43991
|
{ priority: "background" }
|
|
43321
43992
|
);
|
|
43322
43993
|
status = inspection.status === "ready" ? "ready" : inspection.status;
|