@liberseek/boft-cli-linux-x64 0.8.5 → 0.8.6
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 +2 -2
- package/THIRD_PARTY_NOTICES.txt +6 -2
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +70 -20
- package/app/console-web.js +61 -18
- package/app/desktop-controller.mjs +1142 -69
- package/app/host-runtime.mjs +3804 -1949
- package/app/plugins/antigravity/plugin.mjs +77 -9
- package/app/plugins/claude-code/plugin.mjs +27 -6
- package/app/plugins/codebuddy/plugin.mjs +25 -0
- package/app/plugins/codex-usage/plugin.mjs +15 -0
- package/app/plugins/copilot/plugin.mjs +15 -0
- package/app/plugins/cursor-cli/plugin.mjs +43 -8
- package/app/plugins/deepseek-harness/plugin.mjs +472 -44
- package/app/plugins/devin/assets/icon.svg +1 -0
- package/app/plugins/devin/manifest.json +30 -0
- package/app/plugins/devin/plugin.mjs +23425 -0
- package/app/plugins/enabled.json +2 -0
- package/app/plugins/grok/plugin.mjs +470 -387
- package/app/plugins/hermes/plugin.mjs +468 -196
- package/app/plugins/kimi-code/plugin.mjs +65 -3
- package/app/plugins/kiro-cli/plugin.mjs +15 -0
- package/app/plugins/muse/plugin.mjs +15 -0
- package/app/plugins/omp/plugin.mjs +15 -0
- package/app/plugins/opencode/plugin.mjs +15 -0
- package/app/plugins/pi/plugin.mjs +1595 -411
- package/app/plugins/qoder/plugin.mjs +9539 -8654
- package/app/plugins/qoder-cn/plugin.mjs +9539 -8654
- package/app/plugins/qwen-code/assets/icon.svg +1 -0
- package/app/plugins/qwen-code/manifest.json +29 -0
- package/app/plugins/qwen-code/plugin.mjs +29366 -0
- package/app/plugins/workbuddy/plugin.mjs +25 -0
- package/app/plugins/zcode/plugin.mjs +157 -9
- package/app/renderer-extension.js +727 -274
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
- package/package.json +2 -2
|
@@ -15327,49 +15327,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15327
15327
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15328
15328
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15329
15329
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15330
|
-
}).strict().superRefine((usage,
|
|
15330
|
+
}).strict().superRefine((usage, context2) => {
|
|
15331
15331
|
if (Object.keys(usage).length === 0) {
|
|
15332
|
-
|
|
15332
|
+
context2.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
15333
15333
|
}
|
|
15334
15334
|
const hasContextUsed = usage.contextUsedTokens !== void 0;
|
|
15335
15335
|
const hasContextWindow = usage.contextWindowTokens !== void 0;
|
|
15336
15336
|
if (hasContextUsed !== hasContextWindow) {
|
|
15337
|
-
|
|
15337
|
+
context2.addIssue({
|
|
15338
15338
|
code: "custom",
|
|
15339
15339
|
message: "Thread Usage context fields must be provided together",
|
|
15340
15340
|
path: [hasContextUsed ? "contextWindowTokens" : "contextUsedTokens"]
|
|
15341
15341
|
});
|
|
15342
15342
|
}
|
|
15343
15343
|
if (usage.contextWindowTokens === 0) {
|
|
15344
|
-
|
|
15344
|
+
context2.addIssue({
|
|
15345
15345
|
code: "custom",
|
|
15346
15346
|
message: "Thread Usage contextWindowTokens must be greater than zero",
|
|
15347
15347
|
path: ["contextWindowTokens"]
|
|
15348
15348
|
});
|
|
15349
15349
|
}
|
|
15350
15350
|
if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
|
|
15351
|
-
|
|
15351
|
+
context2.addIssue({
|
|
15352
15352
|
code: "custom",
|
|
15353
15353
|
message: "Thread Usage costSource must be provided with totalCostUsd",
|
|
15354
15354
|
path: ["costSource"]
|
|
15355
15355
|
});
|
|
15356
15356
|
}
|
|
15357
15357
|
if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
|
|
15358
|
-
|
|
15358
|
+
context2.addIssue({
|
|
15359
15359
|
code: "custom",
|
|
15360
15360
|
message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
|
|
15361
15361
|
path: ["unpricedModels"]
|
|
15362
15362
|
});
|
|
15363
15363
|
}
|
|
15364
15364
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
15365
|
-
|
|
15365
|
+
context2.addIssue({
|
|
15366
15366
|
code: "custom",
|
|
15367
15367
|
message: "Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent",
|
|
15368
15368
|
path: ["planFiveHourResetsAtUnix"]
|
|
15369
15369
|
});
|
|
15370
15370
|
}
|
|
15371
15371
|
if (usage.planSevenDayResetsAtUnix !== void 0 && usage.planSevenDayUsedPercent === void 0) {
|
|
15372
|
-
|
|
15372
|
+
context2.addIssue({
|
|
15373
15373
|
code: "custom",
|
|
15374
15374
|
message: "Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent",
|
|
15375
15375
|
path: ["planSevenDayResetsAtUnix"]
|
|
@@ -15422,15 +15422,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15422
15422
|
periodType: accountCreditsPeriodSchema,
|
|
15423
15423
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
15424
15424
|
resetCredits: accountResetCreditsSchema.optional()
|
|
15425
|
-
}).strict().superRefine((credits,
|
|
15425
|
+
}).strict().superRefine((credits, context2) => {
|
|
15426
15426
|
if (credits.usedPercent === void 0 && credits.remaining === void 0) {
|
|
15427
|
-
|
|
15427
|
+
context2.addIssue({
|
|
15428
15428
|
code: "custom",
|
|
15429
15429
|
message: "Account credits must include usedPercent or remaining"
|
|
15430
15430
|
});
|
|
15431
15431
|
}
|
|
15432
15432
|
if (credits.remaining !== void 0 && !credits.unit) {
|
|
15433
|
-
|
|
15433
|
+
context2.addIssue({
|
|
15434
15434
|
code: "custom",
|
|
15435
15435
|
message: "Account remaining credits require a unit",
|
|
15436
15436
|
path: ["unit"]
|
|
@@ -15492,10 +15492,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15492
15492
|
|
|
15493
15493
|
// ../shared-contracts/dist/json-value.js
|
|
15494
15494
|
function rejectExplicitUndefined(keys) {
|
|
15495
|
-
return (value,
|
|
15495
|
+
return (value, context2) => {
|
|
15496
15496
|
for (const key of keys) {
|
|
15497
15497
|
if (Object.hasOwn(value, key) && value[key] === void 0) {
|
|
15498
|
-
|
|
15498
|
+
context2.addIssue({
|
|
15499
15499
|
code: "custom",
|
|
15500
15500
|
path: [key],
|
|
15501
15501
|
message: "Explicit undefined is not valid JSON"
|
|
@@ -15579,11 +15579,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15579
15579
|
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15580
15580
|
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15581
15581
|
defaultModeId: harnessPermissionModeIdSchema
|
|
15582
|
-
}).strict().superRefine((catalog,
|
|
15582
|
+
}).strict().superRefine((catalog, context2) => {
|
|
15583
15583
|
const ids = /* @__PURE__ */ new Set();
|
|
15584
15584
|
for (const [index, mode] of catalog.modes.entries()) {
|
|
15585
15585
|
if (ids.has(mode.id)) {
|
|
15586
|
-
|
|
15586
|
+
context2.addIssue({
|
|
15587
15587
|
code: "custom",
|
|
15588
15588
|
message: "Permission Mode IDs must be unique",
|
|
15589
15589
|
path: ["modes", index, "id"]
|
|
@@ -15592,7 +15592,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15592
15592
|
ids.add(mode.id);
|
|
15593
15593
|
}
|
|
15594
15594
|
if (!ids.has(catalog.defaultModeId)) {
|
|
15595
|
-
|
|
15595
|
+
context2.addIssue({
|
|
15596
15596
|
code: "custom",
|
|
15597
15597
|
message: "Default Permission Mode must exist in the catalog",
|
|
15598
15598
|
path: ["defaultModeId"]
|
|
@@ -15635,11 +15635,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15635
15635
|
return void 0;
|
|
15636
15636
|
return catalog?.models.find((model2) => model2.ref.id === ref.id || model2.fastModel?.id === ref.id);
|
|
15637
15637
|
}
|
|
15638
|
-
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options,
|
|
15638
|
+
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context2) => {
|
|
15639
15639
|
const ids = /* @__PURE__ */ new Set();
|
|
15640
15640
|
for (const [index, option] of options.entries()) {
|
|
15641
15641
|
if (ids.has(option.id)) {
|
|
15642
|
-
|
|
15642
|
+
context2.addIssue({
|
|
15643
15643
|
code: "custom",
|
|
15644
15644
|
message: "Thinking option IDs must be unique",
|
|
15645
15645
|
path: [index, "id"]
|
|
@@ -15653,12 +15653,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15653
15653
|
defaultModel: harnessModelRefSchema.optional(),
|
|
15654
15654
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15655
15655
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15656
|
-
}).strict().superRefine((catalog,
|
|
15656
|
+
}).strict().superRefine((catalog, context2) => {
|
|
15657
15657
|
const refs = /* @__PURE__ */ new Set();
|
|
15658
15658
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
15659
15659
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15660
15660
|
if (refs.has(model2.ref.id)) {
|
|
15661
|
-
|
|
15661
|
+
context2.addIssue({
|
|
15662
15662
|
code: "custom",
|
|
15663
15663
|
message: "Model Catalog refs must be unique",
|
|
15664
15664
|
path: ["models", index, "ref", "id"]
|
|
@@ -15667,7 +15667,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15667
15667
|
refs.add(model2.ref.id);
|
|
15668
15668
|
if (model2.fastModel) {
|
|
15669
15669
|
if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
|
|
15670
|
-
|
|
15670
|
+
context2.addIssue({
|
|
15671
15671
|
code: "custom",
|
|
15672
15672
|
message: "Fast Model refs must be distinct and unique",
|
|
15673
15673
|
path: ["models", index, "fastModel"]
|
|
@@ -15678,7 +15678,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15678
15678
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15679
15679
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
15680
15680
|
if (supportedThinkingIds.has(optionId)) {
|
|
15681
|
-
|
|
15681
|
+
context2.addIssue({
|
|
15682
15682
|
code: "custom",
|
|
15683
15683
|
message: "Supported Thinking option IDs must be unique per Model",
|
|
15684
15684
|
path: ["models", index, "supportedThinkingOptionIds", optionIndex]
|
|
@@ -15686,7 +15686,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15686
15686
|
}
|
|
15687
15687
|
supportedThinkingIds.add(optionId);
|
|
15688
15688
|
if (!thinkingIds.has(optionId)) {
|
|
15689
|
-
|
|
15689
|
+
context2.addIssue({
|
|
15690
15690
|
code: "custom",
|
|
15691
15691
|
message: "Supported Thinking option must exist in the catalog",
|
|
15692
15692
|
path: ["models", index, "supportedThinkingOptionIds", optionIndex]
|
|
@@ -15695,14 +15695,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15695
15695
|
}
|
|
15696
15696
|
}
|
|
15697
15697
|
if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
|
|
15698
|
-
|
|
15698
|
+
context2.addIssue({
|
|
15699
15699
|
code: "custom",
|
|
15700
15700
|
message: "Default Model must exist in the Model Catalog",
|
|
15701
15701
|
path: ["defaultModel", "id"]
|
|
15702
15702
|
});
|
|
15703
15703
|
}
|
|
15704
15704
|
if (catalog.defaultThinkingOptionId && !thinkingIds.has(catalog.defaultThinkingOptionId)) {
|
|
15705
|
-
|
|
15705
|
+
context2.addIssue({
|
|
15706
15706
|
code: "custom",
|
|
15707
15707
|
message: "Default Thinking option must exist in the catalog",
|
|
15708
15708
|
path: ["defaultThinkingOptionId"]
|
|
@@ -15748,9 +15748,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15748
15748
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15749
15749
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15750
15750
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15751
|
-
}).strict().superRefine((state,
|
|
15751
|
+
}).strict().superRefine((state, context2) => {
|
|
15752
15752
|
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
|
|
15753
|
-
|
|
15753
|
+
context2.addIssue({
|
|
15754
15754
|
code: "custom",
|
|
15755
15755
|
message: "Effective Thinking option must be currently available",
|
|
15756
15756
|
path: ["effectiveThinkingOptionId"]
|
|
@@ -15767,10 +15767,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15767
15767
|
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15768
15768
|
capabilities: harnessSessionCapabilitiesSchema,
|
|
15769
15769
|
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15770
|
-
}).strict().superRefine((inspection,
|
|
15770
|
+
}).strict().superRefine((inspection, context2) => {
|
|
15771
15771
|
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15772
15772
|
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15773
|
-
|
|
15773
|
+
context2.addIssue({
|
|
15774
15774
|
code: "custom",
|
|
15775
15775
|
message: "Permission Mode catalog and capability must agree",
|
|
15776
15776
|
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
@@ -15834,11 +15834,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15834
15834
|
]);
|
|
15835
15835
|
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15836
15836
|
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15837
|
-
}).strict().superRefine(({ threadIds },
|
|
15837
|
+
}).strict().superRefine(({ threadIds }, context2) => {
|
|
15838
15838
|
const seen = /* @__PURE__ */ new Set();
|
|
15839
15839
|
for (const [index, threadId] of threadIds.entries()) {
|
|
15840
15840
|
if (seen.has(threadId)) {
|
|
15841
|
-
|
|
15841
|
+
context2.addIssue({
|
|
15842
15842
|
code: "custom",
|
|
15843
15843
|
message: "Thread ownership-list IDs must be unique",
|
|
15844
15844
|
path: ["threadIds", index]
|
|
@@ -15862,11 +15862,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15862
15862
|
]);
|
|
15863
15863
|
var threadOwnershipListResultSchema = external_exports.object({
|
|
15864
15864
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15865
|
-
}).strict().superRefine(({ threads },
|
|
15865
|
+
}).strict().superRefine(({ threads }, context2) => {
|
|
15866
15866
|
const seen = /* @__PURE__ */ new Set();
|
|
15867
15867
|
for (const [index, thread] of threads.entries()) {
|
|
15868
15868
|
if (seen.has(thread.threadId)) {
|
|
15869
|
-
|
|
15869
|
+
context2.addIssue({
|
|
15870
15870
|
code: "custom",
|
|
15871
15871
|
message: "Thread ownership-list results must be unique",
|
|
15872
15872
|
path: ["threads", index, "threadId"]
|
|
@@ -15881,6 +15881,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15881
15881
|
text: external_exports.string().optional()
|
|
15882
15882
|
}).strict();
|
|
15883
15883
|
var THREAD_STEER_DELIVERY_PARAM = "codexhostSteerDelivery";
|
|
15884
|
+
var THREAD_STEERING_CONTEXT_PARAM = "codexhost_external_steering";
|
|
15885
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15886
|
+
kind: external_exports.literal("application"),
|
|
15887
|
+
value: external_exports.string().transform((text, context2) => {
|
|
15888
|
+
try {
|
|
15889
|
+
return JSON.parse(text);
|
|
15890
|
+
} catch {
|
|
15891
|
+
context2.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15892
|
+
return external_exports.NEVER;
|
|
15893
|
+
}
|
|
15894
|
+
}).pipe(external_exports.object({
|
|
15895
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15896
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15897
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15898
|
+
}).strict())
|
|
15899
|
+
}).strict().transform((context2) => context2.value);
|
|
15884
15900
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15885
15901
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15886
15902
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -16131,11 +16147,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16131
16147
|
* Omitted by Adapters; set by the Host on inspection results.
|
|
16132
16148
|
*/
|
|
16133
16149
|
source: external_exports.enum(["live", "static"]).optional()
|
|
16134
|
-
}).strict().superRefine((catalog,
|
|
16150
|
+
}).strict().superRefine((catalog, context2) => {
|
|
16135
16151
|
const ids = /* @__PURE__ */ new Set();
|
|
16136
16152
|
for (const [index, command] of catalog.commands.entries()) {
|
|
16137
16153
|
if (ids.has(command.id)) {
|
|
16138
|
-
|
|
16154
|
+
context2.addIssue({
|
|
16139
16155
|
code: "custom",
|
|
16140
16156
|
message: "Harness command IDs must be unique",
|
|
16141
16157
|
path: ["commands", index, "id"]
|
|
@@ -16258,9 +16274,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16258
16274
|
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
16259
16275
|
totalBytes: external_exports.number().int().positive().optional(),
|
|
16260
16276
|
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable()
|
|
16261
|
-
}).superRefine((status,
|
|
16277
|
+
}).superRefine((status, context2) => {
|
|
16262
16278
|
if (status.downloadedBytes !== void 0 && status.totalBytes !== void 0 && status.downloadedBytes > status.totalBytes) {
|
|
16263
|
-
|
|
16279
|
+
context2.addIssue({
|
|
16264
16280
|
code: "custom",
|
|
16265
16281
|
path: ["downloadedBytes"],
|
|
16266
16282
|
message: "downloadedBytes must not exceed totalBytes"
|
|
@@ -16311,6 +16327,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16311
16327
|
return `${HARNESS_COMMAND_MENTION_PATH_PREFIX}${encodeURIComponent(name).replace(/[()]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)}`;
|
|
16312
16328
|
}
|
|
16313
16329
|
|
|
16330
|
+
// ../shared-contracts/dist/desktop-attachments.js
|
|
16331
|
+
var ATTACHED_FILES_HEADING = /^\s*# Files mentioned by the user:[ \t]*(?:\r?\n|$)/u;
|
|
16332
|
+
var REQUEST_HEADING = /(?:^|\n)## My request:[ \t]*(?:\r?\n|$)/u;
|
|
16333
|
+
var IMAGE_ATTACHMENT_PATTERN = /(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu;
|
|
16334
|
+
var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
|
|
16335
|
+
function desktopImageAttachmentPaths(text) {
|
|
16336
|
+
const end = text.search(REQUEST_HEADING);
|
|
16337
|
+
const context2 = end < 0 ? text : text.slice(0, end);
|
|
16338
|
+
if (!ATTACHED_FILES_HEADING.test(context2))
|
|
16339
|
+
return [];
|
|
16340
|
+
return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
|
|
16341
|
+
}
|
|
16342
|
+
|
|
16314
16343
|
// ../shared-contracts/dist/remote-runtime.js
|
|
16315
16344
|
var RUNTIME_STATUS_METHOD = "codexhost/runtime/status";
|
|
16316
16345
|
var REMOTE_UPDATE_METHOD = "codexhost/remote/update";
|
|
@@ -16397,6 +16426,39 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16397
16426
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
16398
16427
|
|
|
16399
16428
|
// src/codex-native-services.ts
|
|
16429
|
+
var MAX_RUNTIME_MODULES = 32768;
|
|
16430
|
+
var MAX_RUNTIME_EXPORTS = 131072;
|
|
16431
|
+
var RUNTIME_SCAN_SLICE = 2048;
|
|
16432
|
+
var COMPILED_EXPORT_GETTER = /^(?:\(\)=>|function\(\)\{return )[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[(?:[A-Za-z_$][\w$]*|"[^"\\]*"|'[^'\\]*')\])*\}?$/;
|
|
16433
|
+
var objectLike = (value) => (typeof value === "object" || typeof value === "function") && value !== null;
|
|
16434
|
+
function instantiatedModules(namespace) {
|
|
16435
|
+
const runtime = namespace.__webpack_require__;
|
|
16436
|
+
if (typeof runtime !== "function") return null;
|
|
16437
|
+
const cache = Object.getOwnPropertyDescriptor(runtime, "c")?.value;
|
|
16438
|
+
return objectLike(cache) ? cache : null;
|
|
16439
|
+
}
|
|
16440
|
+
function compiledExportValues(module) {
|
|
16441
|
+
if (!objectLike(module) || Object.hasOwn(module, "error")) return [];
|
|
16442
|
+
const exports = Object.getOwnPropertyDescriptor(module, "exports")?.value;
|
|
16443
|
+
if (typeof exports !== "object" || exports === null) return [];
|
|
16444
|
+
const prototype = Object.getPrototypeOf(exports);
|
|
16445
|
+
if (prototype !== Object.prototype && prototype !== null) return [];
|
|
16446
|
+
const values = [];
|
|
16447
|
+
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(exports))) {
|
|
16448
|
+
if (!descriptor.enumerable || descriptor.configurable) continue;
|
|
16449
|
+
if ("value" in descriptor) {
|
|
16450
|
+
values.push(descriptor.value);
|
|
16451
|
+
continue;
|
|
16452
|
+
}
|
|
16453
|
+
if (!descriptor.get) continue;
|
|
16454
|
+
try {
|
|
16455
|
+
if (COMPILED_EXPORT_GETTER.test(Function.prototype.toString.call(descriptor.get)))
|
|
16456
|
+
values.push(descriptor.get.call(exports));
|
|
16457
|
+
} catch {
|
|
16458
|
+
}
|
|
16459
|
+
}
|
|
16460
|
+
return values;
|
|
16461
|
+
}
|
|
16400
16462
|
async function loadCodexNativeServices(ownerWindow, matchesServices, importModule = (url2) => import(url2)) {
|
|
16401
16463
|
if (!ownerWindow.document || !ownerWindow.location) return null;
|
|
16402
16464
|
const page = new URL(ownerWindow.location.href);
|
|
@@ -16426,6 +16488,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16426
16488
|
(a, b) => Number(b.includes("/app-shared-")) - Number(a.includes("/app-shared-"))
|
|
16427
16489
|
);
|
|
16428
16490
|
const matches = /* @__PURE__ */ new Set();
|
|
16491
|
+
const addMatch = (value) => {
|
|
16492
|
+
if (matchesServices(value)) matches.add(value);
|
|
16493
|
+
if (matches.size > 1) throw new Error("Codex native services are unavailable in this window");
|
|
16494
|
+
};
|
|
16495
|
+
const runtimes = /* @__PURE__ */ new Set();
|
|
16429
16496
|
for (const url2 of candidates) {
|
|
16430
16497
|
let module;
|
|
16431
16498
|
try {
|
|
@@ -16433,8 +16500,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16433
16500
|
} catch {
|
|
16434
16501
|
continue;
|
|
16435
16502
|
}
|
|
16436
|
-
|
|
16437
|
-
|
|
16503
|
+
Object.values(module).forEach(addMatch);
|
|
16504
|
+
const runtime = instantiatedModules(module);
|
|
16505
|
+
if (runtime) runtimes.add(runtime);
|
|
16506
|
+
}
|
|
16507
|
+
let scannedExports = 0;
|
|
16508
|
+
for (const runtime of runtimes) {
|
|
16509
|
+
const modules = Object.values(runtime);
|
|
16510
|
+
if (modules.length > MAX_RUNTIME_MODULES)
|
|
16511
|
+
throw new Error("Codex native services are unavailable in this window");
|
|
16512
|
+
for (const [index, module] of modules.entries()) {
|
|
16513
|
+
if (index > 0 && index % RUNTIME_SCAN_SLICE === 0)
|
|
16514
|
+
await new Promise((resolve) => setTimeout(resolve));
|
|
16515
|
+
const values = compiledExportValues(module);
|
|
16516
|
+
scannedExports += values.length;
|
|
16517
|
+
if (scannedExports > MAX_RUNTIME_EXPORTS)
|
|
16518
|
+
throw new Error("Codex native services are unavailable in this window");
|
|
16519
|
+
values.forEach(addMatch);
|
|
16520
|
+
}
|
|
16438
16521
|
}
|
|
16439
16522
|
if (catalog !== void 0 && Reflect.get(ownerWindow, "__codexhostLoadedModulesV1") !== catalog)
|
|
16440
16523
|
throw new Error("Codex loaded module catalog changed during discovery. Try again once ready.");
|
|
@@ -17116,7 +17199,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17116
17199
|
};
|
|
17117
17200
|
function isUnsupportedMethod(error51, method) {
|
|
17118
17201
|
if (typeof error51 !== "object" || error51 === null) return false;
|
|
17119
|
-
const code = "code" in error51 ? error51.code : void 0;
|
|
17202
|
+
const code = "code" in error51 ? error51.code : "jsonRpcCode" in error51 ? error51.jsonRpcCode : void 0;
|
|
17120
17203
|
const message2 = "message" in error51 ? error51.message : void 0;
|
|
17121
17204
|
return code === -32601 || code === -32600 && typeof message2 === "string" && message2.startsWith(`Invalid request: unknown variant \`${method}\``);
|
|
17122
17205
|
}
|
|
@@ -17144,7 +17227,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17144
17227
|
let disposed = false;
|
|
17145
17228
|
let inFlight = false;
|
|
17146
17229
|
let revision = 0;
|
|
17147
|
-
let
|
|
17230
|
+
let context2 = null;
|
|
17148
17231
|
let card = null;
|
|
17149
17232
|
let cardKey = null;
|
|
17150
17233
|
const unsupported = /* @__PURE__ */ new WeakSet();
|
|
@@ -17162,12 +17245,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17162
17245
|
const refresh = async () => {
|
|
17163
17246
|
if (disposed) return;
|
|
17164
17247
|
const next = readContext();
|
|
17165
|
-
if (!same(
|
|
17248
|
+
if (!same(context2, next)) {
|
|
17166
17249
|
clear();
|
|
17167
|
-
|
|
17250
|
+
context2 = next;
|
|
17168
17251
|
revision++;
|
|
17169
17252
|
}
|
|
17170
|
-
const current =
|
|
17253
|
+
const current = context2;
|
|
17171
17254
|
if (!current || inFlight || unsupported.has(current.route)) return;
|
|
17172
17255
|
const startedRevision = revision;
|
|
17173
17256
|
inFlight = true;
|
|
@@ -17212,7 +17295,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17212
17295
|
);
|
|
17213
17296
|
threadQuestionRespondResultSchema.parse(raw2);
|
|
17214
17297
|
drafts.delete(key);
|
|
17215
|
-
if (same(current,
|
|
17298
|
+
if (same(current, context2)) {
|
|
17216
17299
|
revision++;
|
|
17217
17300
|
if (cardKey === key) clear(false);
|
|
17218
17301
|
}
|
|
@@ -17222,7 +17305,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17222
17305
|
current.composer.before(card.root);
|
|
17223
17306
|
} catch (error51) {
|
|
17224
17307
|
if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
|
|
17225
|
-
if (revision === startedRevision && same(current,
|
|
17308
|
+
if (revision === startedRevision && same(current, context2)) clear();
|
|
17226
17309
|
} finally {
|
|
17227
17310
|
inFlight = false;
|
|
17228
17311
|
}
|
|
@@ -17234,7 +17317,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17234
17317
|
return {
|
|
17235
17318
|
refresh,
|
|
17236
17319
|
refreshContext() {
|
|
17237
|
-
if (!same(
|
|
17320
|
+
if (!same(context2, readContext()) || card && !card.root.isConnected) void refresh();
|
|
17238
17321
|
},
|
|
17239
17322
|
dispose() {
|
|
17240
17323
|
disposed = true;
|
|
@@ -17391,11 +17474,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17391
17474
|
for (const row of rows) {
|
|
17392
17475
|
if (row.length !== 24 || row[7] !== null || row[10] !== true || !updates.has(row[13]))
|
|
17393
17476
|
continue;
|
|
17394
|
-
const
|
|
17477
|
+
const context2 = row[12];
|
|
17395
17478
|
const result = row[23];
|
|
17396
|
-
if (
|
|
17479
|
+
if (context2 && context2 === row[21] && typeof context2.usesAccountPreferences === "boolean" && result?.usesAccountPreferences === context2.usesAccountPreferences && typeof row[14] === "function" && row[14] === row[20] && result.setModelAndReasoningEffort === row[14]) {
|
|
17397
17480
|
update ??= row[13];
|
|
17398
|
-
modes.add(
|
|
17481
|
+
modes.add(context2.usesAccountPreferences);
|
|
17399
17482
|
const settings = result.modelSettings;
|
|
17400
17483
|
const group = groups.get(row);
|
|
17401
17484
|
const candidate = group?.[group.indexOf(row) - 1];
|
|
@@ -17419,12 +17502,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17419
17502
|
if (!entry)
|
|
17420
17503
|
return;
|
|
17421
17504
|
entry.update((current) => {
|
|
17505
|
+
const { original } = entry;
|
|
17506
|
+
if (!original)
|
|
17507
|
+
return current;
|
|
17422
17508
|
const settings = current.modelSettings;
|
|
17423
17509
|
return settings?.model === entry.model && current.modelSettingsPersistAsDefault === false ? {
|
|
17424
17510
|
...current,
|
|
17425
|
-
modelSettings:
|
|
17426
|
-
modelSettingsPersistAsDefault:
|
|
17427
|
-
isManuallyChanged:
|
|
17511
|
+
modelSettings: original.modelSettings,
|
|
17512
|
+
modelSettingsPersistAsDefault: original.modelSettingsPersistAsDefault,
|
|
17513
|
+
isManuallyChanged: original.isManuallyChanged
|
|
17428
17514
|
} : current;
|
|
17429
17515
|
});
|
|
17430
17516
|
captured.delete(key);
|
|
@@ -17433,15 +17519,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17433
17519
|
has(key) {
|
|
17434
17520
|
return captured.has(key);
|
|
17435
17521
|
},
|
|
17522
|
+
/** The carrier last written to this draft, or null while it keeps its native setting. */
|
|
17523
|
+
model(key) {
|
|
17524
|
+
return captured.get(key)?.model ?? null;
|
|
17525
|
+
},
|
|
17436
17526
|
apply(key, binding, model2) {
|
|
17437
17527
|
if (model2 === null) {
|
|
17438
17528
|
restore(key);
|
|
17439
17529
|
return;
|
|
17440
17530
|
}
|
|
17441
17531
|
const { update, usesAccountPreferences } = binding;
|
|
17532
|
+
const previous = captured.get(key);
|
|
17533
|
+
const entry = { update, model: model2 };
|
|
17442
17534
|
update((current) => {
|
|
17443
|
-
|
|
17444
|
-
captured.set(key, { update, original: previous?.original ?? current, model: model2 });
|
|
17535
|
+
entry.original ??= previous?.original ?? current;
|
|
17445
17536
|
const settings = current.modelSettings;
|
|
17446
17537
|
if (settings?.model === model2 && settings.usesAccountPreferences === usesAccountPreferences && current.modelSettingsPersistAsDefault === false)
|
|
17447
17538
|
return current;
|
|
@@ -17458,6 +17549,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17458
17549
|
}
|
|
17459
17550
|
};
|
|
17460
17551
|
});
|
|
17552
|
+
captured.set(key, entry);
|
|
17461
17553
|
},
|
|
17462
17554
|
dispose() {
|
|
17463
17555
|
for (const key of captured.keys())
|
|
@@ -17532,14 +17624,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17532
17624
|
|
|
17533
17625
|
// ../desktop-control/dist/renderer-host-discovery.js
|
|
17534
17626
|
function requestManagerFromHookState(value, hostId2) {
|
|
17535
|
-
const
|
|
17627
|
+
const record12 = (candidate) => typeof candidate === "object" && candidate !== null;
|
|
17536
17628
|
const manager = (candidate) => {
|
|
17537
|
-
if (!
|
|
17629
|
+
if (!record12(candidate) || !record12(candidate.requestClient) || !record12(candidate.prewarmedThreadManager))
|
|
17538
17630
|
return null;
|
|
17539
17631
|
const bridge = candidate.requestClient;
|
|
17540
17632
|
return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
|
|
17541
17633
|
};
|
|
17542
|
-
if (!
|
|
17634
|
+
if (!record12(value))
|
|
17543
17635
|
return null;
|
|
17544
17636
|
const direct = manager(value) ?? manager(value.manager);
|
|
17545
17637
|
if (direct)
|
|
@@ -17602,18 +17694,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17602
17694
|
|
|
17603
17695
|
// ../desktop-control/dist/renderer-host-rpc-discovery.js
|
|
17604
17696
|
function findRendererHostRpcFamily(store) {
|
|
17605
|
-
const
|
|
17697
|
+
const record12 = (value) => typeof value === "object" && value !== null;
|
|
17606
17698
|
const families = /* @__PURE__ */ new Set();
|
|
17607
17699
|
for (const [definition, members] of store.familyBindings) {
|
|
17608
|
-
if (!
|
|
17700
|
+
if (!record12(definition) || definition.kind !== "signal-family")
|
|
17609
17701
|
continue;
|
|
17610
|
-
if (!
|
|
17702
|
+
if (!record12(members) || typeof members.get !== "function")
|
|
17611
17703
|
continue;
|
|
17612
17704
|
for (const [hostId2, member] of members) {
|
|
17613
|
-
if (typeof hostId2 !== "string" ||
|
|
17705
|
+
if (typeof hostId2 !== "string" || !/^(?:local$|durable$|remote[-:])/u.test(hostId2))
|
|
17706
|
+
continue;
|
|
17707
|
+
if (!record12(member))
|
|
17614
17708
|
continue;
|
|
17615
17709
|
const signal = member.value;
|
|
17616
|
-
if (!
|
|
17710
|
+
if (!record12(signal) || typeof signal.get !== "function")
|
|
17617
17711
|
continue;
|
|
17618
17712
|
let value;
|
|
17619
17713
|
try {
|
|
@@ -17621,7 +17715,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17621
17715
|
} catch {
|
|
17622
17716
|
continue;
|
|
17623
17717
|
}
|
|
17624
|
-
if (
|
|
17718
|
+
if (record12(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record12(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
|
|
17625
17719
|
families.add(members);
|
|
17626
17720
|
break;
|
|
17627
17721
|
}
|
|
@@ -17632,9 +17726,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17632
17726
|
return { store, family: families.values().next().value };
|
|
17633
17727
|
}
|
|
17634
17728
|
function resolveRendererHostRpc(discovery, hostId2) {
|
|
17635
|
-
const
|
|
17729
|
+
const record12 = (value2) => typeof value2 === "object" && value2 !== null;
|
|
17636
17730
|
const signal = discovery.family.get(hostId2)?.value;
|
|
17637
|
-
if (!
|
|
17731
|
+
if (!record12(signal) || typeof signal.get !== "function")
|
|
17638
17732
|
return null;
|
|
17639
17733
|
let value;
|
|
17640
17734
|
try {
|
|
@@ -17642,10 +17736,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17642
17736
|
} catch {
|
|
17643
17737
|
return null;
|
|
17644
17738
|
}
|
|
17645
|
-
if (!
|
|
17739
|
+
if (!record12(value) || value.status !== "ready" || !record12(value.client) || value.client.hostId !== hostId2)
|
|
17646
17740
|
return null;
|
|
17647
17741
|
const rpc = value.client.rpc;
|
|
17648
|
-
return typeof rpc === "function" ||
|
|
17742
|
+
return typeof rpc === "function" || record12(rpc) ? rpc : null;
|
|
17649
17743
|
}
|
|
17650
17744
|
|
|
17651
17745
|
// ../desktop-control/dist/renderer-schedule-workspace-rpc.js
|
|
@@ -18850,6 +18944,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18850
18944
|
loaded = true;
|
|
18851
18945
|
show(value);
|
|
18852
18946
|
}).catch(() => {
|
|
18947
|
+
loaded = true;
|
|
18853
18948
|
status.textContent = messages.launchPathLoadError;
|
|
18854
18949
|
}).finally(() => {
|
|
18855
18950
|
busy = false;
|
|
@@ -20007,8 +20102,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20007
20102
|
id: "connections",
|
|
20008
20103
|
label: messages.pageLabels.connections,
|
|
20009
20104
|
icon: "connections",
|
|
20010
|
-
mount(
|
|
20011
|
-
const document2 =
|
|
20105
|
+
mount(context2) {
|
|
20106
|
+
const document2 = context2.content.ownerDocument;
|
|
20012
20107
|
const header = document2.createElement("div");
|
|
20013
20108
|
header.className = "settings-connection-page-header";
|
|
20014
20109
|
const headingCopy = document2.createElement("div");
|
|
@@ -20030,7 +20125,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20030
20125
|
const syncMessage = document2.createElement("p");
|
|
20031
20126
|
syncMessage.className = "settings-page-description";
|
|
20032
20127
|
syncMessage.setAttribute("role", "status");
|
|
20033
|
-
|
|
20128
|
+
context2.content.append(header, syncMessage, content);
|
|
20034
20129
|
let pending = false;
|
|
20035
20130
|
let selectedHostId = null;
|
|
20036
20131
|
let selectedItemKey = null;
|
|
@@ -20043,12 +20138,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20043
20138
|
let renderQueued = false;
|
|
20044
20139
|
let renderFrame = null;
|
|
20045
20140
|
const scheduleRender = () => {
|
|
20046
|
-
if (disposed ||
|
|
20141
|
+
if (disposed || context2.signal.aborted || renderQueued) return;
|
|
20047
20142
|
renderQueued = true;
|
|
20048
20143
|
const flush = () => {
|
|
20049
20144
|
renderFrame = null;
|
|
20050
20145
|
renderQueued = false;
|
|
20051
|
-
if (!disposed && !
|
|
20146
|
+
if (!disposed && !context2.signal.aborted) {
|
|
20052
20147
|
render(diagnostics?.snapshot() ?? latestSnapshot);
|
|
20053
20148
|
}
|
|
20054
20149
|
};
|
|
@@ -20085,12 +20180,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20085
20180
|
const versions = createConnectionVersions(
|
|
20086
20181
|
document2,
|
|
20087
20182
|
messages,
|
|
20088
|
-
|
|
20183
|
+
context2.signal,
|
|
20089
20184
|
diagnostics,
|
|
20090
20185
|
scheduleRender
|
|
20091
20186
|
);
|
|
20092
20187
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
20093
|
-
const updates = createConnectionUpdates(document2, messages,
|
|
20188
|
+
const updates = createConnectionUpdates(document2, messages, context2.signal, scheduleRender);
|
|
20094
20189
|
const runRefresh = () => {
|
|
20095
20190
|
if (pending || !diagnostics) return;
|
|
20096
20191
|
pending = true;
|
|
@@ -20099,7 +20194,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20099
20194
|
createRendererSettingsIcon("diagnose", 16),
|
|
20100
20195
|
messages.connectionRefreshing
|
|
20101
20196
|
);
|
|
20102
|
-
void
|
|
20197
|
+
void context2.runLatest(() => diagnostics.refresh(), {
|
|
20103
20198
|
success() {
|
|
20104
20199
|
installs?.clearErrors();
|
|
20105
20200
|
pending = false;
|
|
@@ -20494,9 +20589,9 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20494
20589
|
}
|
|
20495
20590
|
};
|
|
20496
20591
|
render(diagnostics?.snapshot() ?? null);
|
|
20497
|
-
void getRemoteConnections()?.ssh.list(
|
|
20592
|
+
void getRemoteConnections()?.ssh.list(context2.signal).then(
|
|
20498
20593
|
(connections) => {
|
|
20499
|
-
if (
|
|
20594
|
+
if (context2.signal.aborted) return;
|
|
20500
20595
|
for (const connection of connections) {
|
|
20501
20596
|
hostNames.set(connection.hostId, connection.displayName.trim());
|
|
20502
20597
|
}
|
|
@@ -20781,7 +20876,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
20781
20876
|
launchPathAutomatic: "No saved override. Uses environment configuration, then automatic discovery.",
|
|
20782
20877
|
launchPathSaving: "Saving\u2026",
|
|
20783
20878
|
launchPathLoading: "Loading launch settings\u2026",
|
|
20784
|
-
launchPathLoadError: "Could not load launch settings.
|
|
20879
|
+
launchPathLoadError: "Could not load launch settings. Save an installation directory or reset to automatic discovery to replace them.",
|
|
20785
20880
|
launchPathSaveError: "Could not save. Enter an existing absolute installation folder on this Host and check configuration permissions.",
|
|
20786
20881
|
connectionOfficialWebsite: "Visit official website",
|
|
20787
20882
|
connectionOpenInstallation: "Open official installation page",
|
|
@@ -21096,7 +21191,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21096
21191
|
launchPathAutomatic: "\u672A\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u8DEF\u5F84\uFF0C\u4F7F\u7528\u73AF\u5883\u53D8\u91CF\u914D\u7F6E\u6216\u81EA\u52A8\u53D1\u73B0\u3002",
|
|
21097
21192
|
launchPathSaving: "\u6B63\u5728\u4FDD\u5B58\u2026",
|
|
21098
21193
|
launchPathLoading: "\u6B63\u5728\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\u2026",
|
|
21099
|
-
launchPathLoadError: "\u65E0\u6CD5\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\
|
|
21194
|
+
launchPathLoadError: "\u65E0\u6CD5\u8BFB\u53D6\u542F\u52A8\u8BBE\u7F6E\u3002\u4FDD\u5B58\u5B89\u88C5\u76EE\u5F55\u6216\u6062\u590D\u81EA\u52A8\u53D1\u73B0\u5373\u53EF\u66FF\u6362\u3002",
|
|
21100
21195
|
launchPathSaveError: "\u4FDD\u5B58\u5931\u8D25\u3002\u8BF7\u586B\u5199\u6B64 Host \u4E0A\u5B9E\u9645\u5B58\u5728\u7684\u5B89\u88C5\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5E76\u786E\u8BA4\u914D\u7F6E\u76EE\u5F55\u53EF\u5199\u3002",
|
|
21101
21196
|
connectionOfficialWebsite: "\u8BBF\u95EE\u5B98\u7F51",
|
|
21102
21197
|
connectionOpenInstallation: "\u524D\u5F80\u5B98\u65B9\u5B89\u88C5\u9875\u9762",
|
|
@@ -25005,7 +25100,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25005
25100
|
let fiber = fiberName ? Object.getOwnPropertyDescriptor(element, fiberName)?.value : null;
|
|
25006
25101
|
for (let depth = 0; fiber && depth < 60; depth += 1) {
|
|
25007
25102
|
const props = fiber.memoizedProps;
|
|
25008
|
-
if (isRecord(props) && typeof props.onSelectModel === "function" && typeof props.onSelectReasoningEffort === "function" && "
|
|
25103
|
+
if (isRecord(props) && typeof props.onSelectModel === "function" && "reasoningEffort" in props && (typeof props.onSelectReasoningEffort === "function" && isRecord(props.fallbackPowerSelection) || element.getAttribute("data-composer-navigation-target") === "reasoning" && typeof props.onCommitPower === "function" && Array.isArray(props.powerSelections))) {
|
|
25009
25104
|
return true;
|
|
25010
25105
|
}
|
|
25011
25106
|
const parent = fiber.return;
|
|
@@ -25099,8 +25194,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25099
25194
|
}
|
|
25100
25195
|
}
|
|
25101
25196
|
function usagePlacementAnchor(control) {
|
|
25102
|
-
const
|
|
25103
|
-
const contextWrapper =
|
|
25197
|
+
const context2 = control.nativeContextUsageControl?.element;
|
|
25198
|
+
const contextWrapper = context2?.parentElement;
|
|
25104
25199
|
if (contextWrapper?.parentElement) return contextWrapper;
|
|
25105
25200
|
const modelRoot = control.modelPicker?.root;
|
|
25106
25201
|
return modelRoot?.parentElement ? modelRoot : null;
|
|
@@ -25342,7 +25437,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25342
25437
|
const modelReady = selectedModel !== void 0 && selectedCatalogModel !== void 0;
|
|
25343
25438
|
const modelBlocked = state.agent !== "codex" && (modelView.status === "selecting" || !modelReady || !thinkingReady);
|
|
25344
25439
|
const permissionModeBlocked = state.agent !== "codex" && !isPermissionModeControlReady(permissionModeView);
|
|
25345
|
-
const submissionBlocked = switching || ownershipError || modelBlocked || permissionModeBlocked;
|
|
25440
|
+
const submissionBlocked = switching || ownershipError || state.agent !== "codex" && adapterState !== "ready" || modelBlocked || permissionModeBlocked;
|
|
25346
25441
|
if (submissionBlocked && control.sendDisabledBeforeSwitch === null) {
|
|
25347
25442
|
control.sendDisabledBeforeSwitch = control.sendButton.disabled;
|
|
25348
25443
|
control.sendButton.disabled = true;
|
|
@@ -26481,9 +26576,31 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26481
26576
|
};
|
|
26482
26577
|
}
|
|
26483
26578
|
|
|
26579
|
+
// src/renderer-steering-delivery.ts
|
|
26580
|
+
async function inspectRendererSteeringDelivery(send, threadId, text) {
|
|
26581
|
+
const inspect = "codexhost/thread/steering/inspect";
|
|
26582
|
+
try {
|
|
26583
|
+
const response2 = await send(inspect, { threadId, ...text !== void 0 ? { text } : {} });
|
|
26584
|
+
return threadSteeringInspectResultSchema.parse(response2).delivery;
|
|
26585
|
+
} catch (error51) {
|
|
26586
|
+
if (!isUnsupportedMethod(error51, inspect)) throw error51;
|
|
26587
|
+
}
|
|
26588
|
+
const ownership = "codexhost/thread/ownership/list";
|
|
26589
|
+
let response;
|
|
26590
|
+
try {
|
|
26591
|
+
response = await send(ownership, { threadIds: [threadId] });
|
|
26592
|
+
} catch (error51) {
|
|
26593
|
+
if (!isUnsupportedMethod(error51, ownership)) throw error51;
|
|
26594
|
+
await verifyNativeCodexThread(send, threadId);
|
|
26595
|
+
return "official";
|
|
26596
|
+
}
|
|
26597
|
+
const result = threadOwnershipListResultSchema.parse(response);
|
|
26598
|
+
const owner = result.threads.find((thread) => thread.threadId === threadId)?.owner;
|
|
26599
|
+
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
26600
|
+
return owner === "codex" ? "official" : "newTurn";
|
|
26601
|
+
}
|
|
26602
|
+
|
|
26484
26603
|
// src/renderer-external-steering.ts
|
|
26485
|
-
var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
|
|
26486
|
-
var THREAD_OWNERSHIP_LIST_METHOD2 = "codexhost/thread/ownership/list";
|
|
26487
26604
|
function isRecord7(value) {
|
|
26488
26605
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26489
26606
|
}
|
|
@@ -26622,34 +26739,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26622
26739
|
};
|
|
26623
26740
|
});
|
|
26624
26741
|
};
|
|
26625
|
-
const inspectDelivery =
|
|
26626
|
-
|
|
26627
|
-
|
|
26628
|
-
|
|
26629
|
-
|
|
26630
|
-
});
|
|
26631
|
-
return threadSteeringInspectResultSchema.parse(response).delivery;
|
|
26632
|
-
} catch (error51) {
|
|
26633
|
-
if (!isUnsupportedMethod(error51, THREAD_STEERING_INSPECT_METHOD)) throw error51;
|
|
26634
|
-
}
|
|
26635
|
-
let ownershipResponse;
|
|
26636
|
-
try {
|
|
26637
|
-
ownershipResponse = await originalSend.call(manager, THREAD_OWNERSHIP_LIST_METHOD2, {
|
|
26638
|
-
threadIds: [threadId]
|
|
26639
|
-
});
|
|
26640
|
-
} catch (error51) {
|
|
26641
|
-
if (!isUnsupportedMethod(error51, THREAD_OWNERSHIP_LIST_METHOD2)) throw error51;
|
|
26642
|
-
await verifyNativeCodexThread(
|
|
26643
|
-
(method, params) => originalSend.call(manager, method, params),
|
|
26644
|
-
threadId
|
|
26645
|
-
);
|
|
26646
|
-
return "official";
|
|
26647
|
-
}
|
|
26648
|
-
const ownership = threadOwnershipListResultSchema.parse(ownershipResponse);
|
|
26649
|
-
const owner = ownership.threads.find((thread) => thread.threadId === threadId)?.owner;
|
|
26650
|
-
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
26651
|
-
return owner === "codex" ? "official" : "newTurn";
|
|
26652
|
-
};
|
|
26742
|
+
const inspectDelivery = (threadId, text) => inspectRendererSteeringDelivery(
|
|
26743
|
+
(method, params) => originalSend.call(manager, method, params),
|
|
26744
|
+
threadId,
|
|
26745
|
+
text
|
|
26746
|
+
);
|
|
26653
26747
|
const steer = async function(...args) {
|
|
26654
26748
|
const [
|
|
26655
26749
|
threadId,
|
|
@@ -26660,7 +26754,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26660
26754
|
clientUserMessageId,
|
|
26661
26755
|
additionalContext,
|
|
26662
26756
|
toolOutput,
|
|
26663
|
-
onMessageAdded
|
|
26757
|
+
onMessageAdded,
|
|
26758
|
+
beforeSendRequest,
|
|
26759
|
+
assertRequestCurrent
|
|
26664
26760
|
] = args;
|
|
26665
26761
|
if (typeof threadId !== "string") return originalSteer.apply(manager, args);
|
|
26666
26762
|
const role = manager.getStreamRole?.(threadId);
|
|
@@ -26690,10 +26786,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26690
26786
|
const currentRole = manager.getStreamRole?.(threadId);
|
|
26691
26787
|
if (isRecord7(currentRole) && currentRole.role === "follower")
|
|
26692
26788
|
return originalSteer.apply(manager, args);
|
|
26693
|
-
if (!Array.isArray(input) || input.length === 0 || input.some(
|
|
26694
|
-
(
|
|
26695
|
-
|
|
26696
|
-
|
|
26789
|
+
if (!Array.isArray(input) || input.length === 0 || input.some((item) => {
|
|
26790
|
+
if (!isRecord7(item)) return true;
|
|
26791
|
+
if (item.type === "text") return typeof item.text !== "string";
|
|
26792
|
+
if (item.type === "localImage") return typeof item.path !== "string" || !item.path;
|
|
26793
|
+
if (item.type === "image") return typeof item.url !== "string" || !item.url;
|
|
26794
|
+
return true;
|
|
26795
|
+
}) || !input.some(
|
|
26796
|
+
(item) => isRecord7(item) && (item.type !== "text" || typeof item.text === "string" && item.text.trim())
|
|
26797
|
+
)) {
|
|
26798
|
+
throw new Error("External steering requires non-empty text or image input");
|
|
26697
26799
|
}
|
|
26698
26800
|
if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
|
|
26699
26801
|
if (!isRecord7(restoreMessage) || !isRecord7(restoreMessage.context)) {
|
|
@@ -26713,7 +26815,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26713
26815
|
if (expectedTurnId == null && host.hasPendingTurnStart(threadId)) {
|
|
26714
26816
|
throw new Error("Previous Turn submission has not been confirmed yet");
|
|
26715
26817
|
}
|
|
26716
|
-
const
|
|
26818
|
+
const context2 = restoreMessage.context;
|
|
26717
26819
|
const routeKey = `${threadId}\0${messageId}`;
|
|
26718
26820
|
if (typeof expectedTurnId === "string") routes.set(routeKey, { threadId, expectedTurnId });
|
|
26719
26821
|
const promise2 = Promise.resolve().then(async () => {
|
|
@@ -26733,13 +26835,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26733
26835
|
serviceTier,
|
|
26734
26836
|
model: null,
|
|
26735
26837
|
effort: null,
|
|
26736
|
-
collaborationMode:
|
|
26838
|
+
collaborationMode: context2.collaborationMode ?? null
|
|
26737
26839
|
},
|
|
26738
26840
|
context: {
|
|
26739
26841
|
attachments: attachments ?? [],
|
|
26740
|
-
commentAttachments:
|
|
26741
|
-
mcpAppModelContextAttachments:
|
|
26742
|
-
useAppServerPermissionDefault: true
|
|
26842
|
+
commentAttachments: context2.commentAttachments ?? [],
|
|
26843
|
+
mcpAppModelContextAttachments: context2.mcpAppModelContextAttachments,
|
|
26844
|
+
useAppServerPermissionDefault: true,
|
|
26845
|
+
beforeSendRequest,
|
|
26846
|
+
assertRequestCurrent
|
|
26743
26847
|
}
|
|
26744
26848
|
},
|
|
26745
26849
|
onMessageAdded
|
|
@@ -26814,16 +26918,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26814
26918
|
for (let index = 0; index < decoded.length; index += 1) bytes[index] = decoded.charCodeAt(index);
|
|
26815
26919
|
return { contents: new Blob([bytes], { type: mimeType }), extension };
|
|
26816
26920
|
}
|
|
26817
|
-
function nativeImagePaths(text) {
|
|
26818
|
-
const context = text.split("## My request:")[0] ?? "";
|
|
26819
|
-
const start = context.indexOf("# Files mentioned by the user:");
|
|
26820
|
-
if (start < 0) return [];
|
|
26821
|
-
return [
|
|
26822
|
-
...context.slice(start).matchAll(
|
|
26823
|
-
/(?:^|\n)## [^\r\n]+: ((?:\/|[A-Za-z]:[\\/]|\\\\)[^\r\n]+)\r?\nImage attachment: true(?=\r?\n|$)/gu
|
|
26824
|
-
)
|
|
26825
|
-
].map((match) => match[1]).filter(filePath);
|
|
26826
|
-
}
|
|
26827
26921
|
function createRemoteAttachmentSender(target, hostId2, isCurrent) {
|
|
26828
26922
|
const prepared = /* @__PURE__ */ new WeakMap();
|
|
26829
26923
|
return (params, send) => {
|
|
@@ -26848,7 +26942,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26848
26942
|
if (cached2) return cached2.then(dispatch);
|
|
26849
26943
|
const input = params.input;
|
|
26850
26944
|
const text = input.filter((item) => isRecord8(item) && item.type === "text").map((item) => isRecord8(item) && typeof item.text === "string" ? item.text : "").join("\n");
|
|
26851
|
-
const existingPaths =
|
|
26945
|
+
const existingPaths = desktopImageAttachmentPaths(text);
|
|
26852
26946
|
const prepare = async () => {
|
|
26853
26947
|
if (existingPaths.length === images.length) return params;
|
|
26854
26948
|
if (images.length > 20) throw new Error("Too many remote image attachments (maximum 20)");
|
|
@@ -28302,9 +28396,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28302
28396
|
const connected = !disposed && (client !== null || localClient !== null || (window.__codexhostHostRoutingV1?.knownHostIds?.() ?? []).some(
|
|
28303
28397
|
(hostId2) => window.__codexhostHostRoutingV1?.forHost(hostId2) != null
|
|
28304
28398
|
));
|
|
28399
|
+
const manager = route?.manager;
|
|
28400
|
+
const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
|
|
28401
|
+
const steeringReady = !needsRpcSteering || window.__codexhostRpcSteeringV1 !== void 0;
|
|
28305
28402
|
updateStatus(
|
|
28306
28403
|
connected ? "ready" : "installing",
|
|
28307
|
-
connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
|
|
28404
|
+
connected && !steeringReady ? "native-steering-policy-unavailable" : connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
|
|
28308
28405
|
connected ? "request-bridge" : null
|
|
28309
28406
|
);
|
|
28310
28407
|
return route;
|
|
@@ -28439,8 +28536,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28439
28536
|
const draftKey = target[1];
|
|
28440
28537
|
if (!binding || !route.policy.scopedCreation)
|
|
28441
28538
|
return agent === "codex" && !draftModels.has(draftKey);
|
|
28442
|
-
draftModels.
|
|
28443
|
-
|
|
28539
|
+
const previous = draftModels.model(draftKey);
|
|
28540
|
+
const policyChanged = route.policy.select(carrier ?? null, draftKey, binding.creationModes);
|
|
28541
|
+
try {
|
|
28542
|
+
draftModels.apply(draftKey, binding, carrier ?? null);
|
|
28543
|
+
} catch (error51) {
|
|
28544
|
+
try {
|
|
28545
|
+
route.policy.select(previous, draftKey, binding.creationModes);
|
|
28546
|
+
} catch {
|
|
28547
|
+
}
|
|
28548
|
+
throw error51;
|
|
28549
|
+
}
|
|
28550
|
+
if (policyChanged) {
|
|
28444
28551
|
modelUpdates += 1;
|
|
28445
28552
|
liveStatus.modelUpdates = modelUpdates;
|
|
28446
28553
|
}
|
|
@@ -29373,7 +29480,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29373
29480
|
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
29374
29481
|
};
|
|
29375
29482
|
}
|
|
29376
|
-
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices,
|
|
29483
|
+
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke2) {
|
|
29377
29484
|
if (signal?.aborted) return Promise.reject(abortError2());
|
|
29378
29485
|
return new Promise((resolve, reject) => {
|
|
29379
29486
|
let settled = false;
|
|
@@ -29400,7 +29507,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29400
29507
|
const native = await loadCodexNativeServices(ownerWindow, matchesServices);
|
|
29401
29508
|
if (settled) return;
|
|
29402
29509
|
if (!native) throw new Error("Codex native locale services are unavailable");
|
|
29403
|
-
nativeRequest =
|
|
29510
|
+
nativeRequest = invoke2(native);
|
|
29404
29511
|
const response = await nativeRequest;
|
|
29405
29512
|
settle(() => resolve(response));
|
|
29406
29513
|
})().catch((error51) => settle(() => reject(error51)));
|
|
@@ -30877,8 +30984,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
30877
30984
|
id: "usage-statistics",
|
|
30878
30985
|
label: messages.label,
|
|
30879
30986
|
icon: "dashboard",
|
|
30880
|
-
mount(
|
|
30881
|
-
const document2 =
|
|
30987
|
+
mount(context2) {
|
|
30988
|
+
const document2 = context2.content.ownerDocument;
|
|
30882
30989
|
const locale = pageLocale ?? (document2.documentElement.lang || "en");
|
|
30883
30990
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
30884
30991
|
const count3 = (value) => count2(value, locale);
|
|
@@ -30936,7 +31043,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
30936
31043
|
document2,
|
|
30937
31044
|
consoleMessages2,
|
|
30938
31045
|
(method, params2) => request(method, params2, view.hostId),
|
|
30939
|
-
|
|
31046
|
+
context2.signal,
|
|
30940
31047
|
load
|
|
30941
31048
|
);
|
|
30942
31049
|
let offeredHosts = usageHosts ? [] : void 0;
|
|
@@ -30944,7 +31051,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
30944
31051
|
label: messages.host,
|
|
30945
31052
|
searchLabel: messages.search,
|
|
30946
31053
|
emptyLabel: messages.noMatches,
|
|
30947
|
-
signal:
|
|
31054
|
+
signal: context2.signal,
|
|
30948
31055
|
searchable: false,
|
|
30949
31056
|
display: (option) => `${messages.host} \xB7 ${option.label}`,
|
|
30950
31057
|
onChange: (key) => {
|
|
@@ -30974,7 +31081,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
30974
31081
|
const offerHosts = () => {
|
|
30975
31082
|
if (!usageHosts) return;
|
|
30976
31083
|
void usageHosts().then((hosts) => {
|
|
30977
|
-
if (
|
|
31084
|
+
if (context2.signal.aborted) return;
|
|
30978
31085
|
offeredHosts = hosts;
|
|
30979
31086
|
hostOptions();
|
|
30980
31087
|
}).catch(() => void 0);
|
|
@@ -31000,7 +31107,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
31000
31107
|
label: messages.autoRefresh,
|
|
31001
31108
|
searchLabel: messages.search,
|
|
31002
31109
|
emptyLabel: messages.noMatches,
|
|
31003
|
-
signal:
|
|
31110
|
+
signal: context2.signal,
|
|
31004
31111
|
searchable: false,
|
|
31005
31112
|
display: (option) => `${messages.autoRefresh} \xB7 ${option.label}`,
|
|
31006
31113
|
onChange: (key) => {
|
|
@@ -31045,7 +31152,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
31045
31152
|
label: messages.filterModel,
|
|
31046
31153
|
searchLabel: messages.search,
|
|
31047
31154
|
emptyLabel: messages.noMatches,
|
|
31048
|
-
signal:
|
|
31155
|
+
signal: context2.signal,
|
|
31049
31156
|
onChange: (key) => {
|
|
31050
31157
|
view.model = key;
|
|
31051
31158
|
changed();
|
|
@@ -31055,7 +31162,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
31055
31162
|
label: messages.filterProject,
|
|
31056
31163
|
searchLabel: messages.search,
|
|
31057
31164
|
emptyLabel: messages.noMatches,
|
|
31058
|
-
signal:
|
|
31165
|
+
signal: context2.signal,
|
|
31059
31166
|
onChange: (key) => {
|
|
31060
31167
|
view.project = key;
|
|
31061
31168
|
changed();
|
|
@@ -31843,7 +31950,7 @@ ${detail}` : ""}`
|
|
|
31843
31950
|
}
|
|
31844
31951
|
function schedule() {
|
|
31845
31952
|
window.clearTimeout(poll);
|
|
31846
|
-
if (
|
|
31953
|
+
if (context2.signal.aborted) return;
|
|
31847
31954
|
if (result && !result.reading.complete) poll = window.setTimeout(load, POLL_MS);
|
|
31848
31955
|
else if (view.autoRefreshMs > 0) poll = window.setTimeout(load, view.autoRefreshMs);
|
|
31849
31956
|
}
|
|
@@ -31861,12 +31968,12 @@ ${detail}` : ""}`
|
|
|
31861
31968
|
} catch {
|
|
31862
31969
|
if (!isCurrent()) return;
|
|
31863
31970
|
}
|
|
31864
|
-
if (!
|
|
31971
|
+
if (!context2.signal.aborted) render();
|
|
31865
31972
|
}
|
|
31866
31973
|
function load() {
|
|
31867
31974
|
window.clearTimeout(poll);
|
|
31868
31975
|
const requested = params();
|
|
31869
|
-
void
|
|
31976
|
+
void context2.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
|
|
31870
31977
|
success(value) {
|
|
31871
31978
|
const parsed = usageStatisticsResultSchema.safeParse(value);
|
|
31872
31979
|
if (parsed.success) {
|
|
@@ -31889,7 +31996,7 @@ ${detail}` : ""}`
|
|
|
31889
31996
|
}
|
|
31890
31997
|
});
|
|
31891
31998
|
}
|
|
31892
|
-
|
|
31999
|
+
context2.content.replaceChildren(header, prices.element, filters, notices, body);
|
|
31893
32000
|
render();
|
|
31894
32001
|
offerHosts();
|
|
31895
32002
|
void refreshHarnessNames();
|
|
@@ -32297,7 +32404,7 @@ ${detail}` : ""}`
|
|
|
32297
32404
|
"codexhost was not detected over SSH. Install it on the remote computer or add it to the login shell PATH, then retry": "\u901A\u8FC7 SSH \u672A\u68C0\u6D4B\u5230 codexhost\u3002\u8BF7\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u5B89\u88C5\uFF0C\u6216\u5C06\u5DF2\u5B89\u88C5\u7684 codexhost \u52A0\u5165\u767B\u5F55 shell \u7684 PATH \u540E\u91CD\u8BD5",
|
|
32298
32405
|
"The active codexhost does not match the global npm installation. Uninstall only the remote service, or remove the package manually on the remote computer": "\u5F53\u524D codexhost \u4E0E npm \u5168\u5C40\u5B89\u88C5\u4F4D\u7F6E\u4E0D\u5339\u914D\u3002\u8BF7\u9009\u62E9\u4EC5\u5378\u8F7D\u8FDC\u7A0B\u670D\u52A1\uFF0C\u6216\u5728\u8FDC\u7A0B\u7535\u8111\u4E0A\u624B\u52A8\u5378\u8F7D\u8F6F\u4EF6\u5305",
|
|
32299
32406
|
"The remote service was uninstalled, but removing the codexhost package failed. Check npm permissions on the remote computer and retry": "\u8FDC\u7A0B\u670D\u52A1\u5DF2\u5378\u8F7D\uFF0C\u4F46 codexhost \u8F6F\u4EF6\u5305\u5378\u8F7D\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u7535\u8111\u4E0A\u7684 npm \u6743\u9650\u540E\u91CD\u8BD5",
|
|
32300
|
-
"Remote Node.js is unsupported. Select Node.js 22.19 or later
|
|
32407
|
+
"Remote Node.js is unsupported. Select Node.js 22.19 or later, except 23.x": "\u8FDC\u7A0B Node.js \u7248\u672C\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u9009\u62E9 Node.js 22.19 \u53CA\u4EE5\u4E0A\u7248\u672C\uFF0C\u4F46\u4E0D\u5305\u62EC 23.x",
|
|
32301
32408
|
"npm installation failed. Check network access and global installation permissions": "npm \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u548C\u5168\u5C40\u5B89\u88C5\u6743\u9650",
|
|
32302
32409
|
"Remote service configuration failed. Check Codex CLI and the remote desktop login": "\u8FDC\u7A0B\u670D\u52A1\u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 Codex CLI \u4EE5\u53CA\u8FDC\u7A0B\u7535\u8111\u7684\u684C\u9762\u767B\u5F55\u72B6\u6001",
|
|
32303
32410
|
"Remote service could not stop. Check the remote service before retrying": "\u8FDC\u7A0B\u670D\u52A1\u65E0\u6CD5\u505C\u6B62\uFF0C\u8BF7\u68C0\u67E5\u8FDC\u7A0B\u670D\u52A1\u540E\u91CD\u8BD5",
|
|
@@ -33731,6 +33838,30 @@ ${detail}` : ""}`
|
|
|
33731
33838
|
};
|
|
33732
33839
|
}
|
|
33733
33840
|
|
|
33841
|
+
// src/settings/session-import-sources.ts
|
|
33842
|
+
async function loadSessionImportSources(client, diagnostics, signal, refresh) {
|
|
33843
|
+
const { harnesses } = await client.listSessionImportSources();
|
|
33844
|
+
signal.throwIfAborted();
|
|
33845
|
+
if (!diagnostics || harnesses.length === 0) return harnesses;
|
|
33846
|
+
const hostId2 = client.hostId ?? "local";
|
|
33847
|
+
const readHost = () => diagnostics.snapshot().hosts.find((host2) => host2.hostId === hostId2);
|
|
33848
|
+
let host = readHost();
|
|
33849
|
+
const incomplete = () => !host || Boolean(host.directoryError) || harnesses.some(({ harnessId }) => {
|
|
33850
|
+
const status = host?.agents.find(({ agent }) => agent === harnessId)?.availability;
|
|
33851
|
+
return status === void 0 || status === "checking";
|
|
33852
|
+
});
|
|
33853
|
+
if (refresh || incomplete()) {
|
|
33854
|
+
await diagnostics.refresh(hostId2);
|
|
33855
|
+
signal.throwIfAborted();
|
|
33856
|
+
host = readHost();
|
|
33857
|
+
}
|
|
33858
|
+
if (incomplete()) throw new Error("Harness installation diagnostics are incomplete");
|
|
33859
|
+
const missing = new Set(
|
|
33860
|
+
host?.agents.filter(({ availability }) => availability === "notInstalled").map(({ agent }) => agent)
|
|
33861
|
+
);
|
|
33862
|
+
return harnesses.filter(({ harnessId }) => !missing.has(harnessId));
|
|
33863
|
+
}
|
|
33864
|
+
|
|
33734
33865
|
// src/settings/session-import-page.ts
|
|
33735
33866
|
function shortSessionId(value) {
|
|
33736
33867
|
return value.length <= 18 ? value : `${value.slice(0, 10)}\u2026${value.slice(-6)}`;
|
|
@@ -33756,8 +33887,8 @@ ${detail}` : ""}`
|
|
|
33756
33887
|
id: "session-import",
|
|
33757
33888
|
label: messages.pageLabels["session-import"],
|
|
33758
33889
|
icon: "session-import",
|
|
33759
|
-
mount(
|
|
33760
|
-
const document2 =
|
|
33890
|
+
mount(context2) {
|
|
33891
|
+
const document2 = context2.content.ownerDocument;
|
|
33761
33892
|
const header = document2.createElement("div");
|
|
33762
33893
|
header.className = "settings-connection-page-header";
|
|
33763
33894
|
const headingCopy = document2.createElement("div");
|
|
@@ -33808,7 +33939,7 @@ ${detail}` : ""}`
|
|
|
33808
33939
|
...getDiagnostics()?.snapshot().hosts.map(({ hostId: hostId2 }) => hostId2) ?? [],
|
|
33809
33940
|
...current ? [current] : []
|
|
33810
33941
|
])
|
|
33811
|
-
];
|
|
33942
|
+
].filter((hostId2) => hostId2 !== "durable");
|
|
33812
33943
|
displayedHostId = current;
|
|
33813
33944
|
const scrollLeft = hostOptions.scrollLeft;
|
|
33814
33945
|
hostOptions.replaceChildren();
|
|
@@ -33877,7 +34008,7 @@ ${detail}` : ""}`
|
|
|
33877
34008
|
const content = document2.createElement("section");
|
|
33878
34009
|
content.className = "settings-session-import-content";
|
|
33879
34010
|
const listControls = createSessionImportListControls(document2, messages, () => load());
|
|
33880
|
-
|
|
34011
|
+
context2.content.append(
|
|
33881
34012
|
header,
|
|
33882
34013
|
hostLabel,
|
|
33883
34014
|
harness2,
|
|
@@ -34008,7 +34139,7 @@ ${detail}` : ""}`
|
|
|
34008
34139
|
retry.addEventListener("click", () => {
|
|
34009
34140
|
if (retry.disabled) return;
|
|
34010
34141
|
setRetrying(true);
|
|
34011
|
-
void
|
|
34142
|
+
void context2.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
|
|
34012
34143
|
success() {
|
|
34013
34144
|
setRetrying(false);
|
|
34014
34145
|
},
|
|
@@ -34069,16 +34200,16 @@ ${detail}` : ""}`
|
|
|
34069
34200
|
const actionArea = document2.createElement("div");
|
|
34070
34201
|
actionArea.className = "settings-session-import-row__action";
|
|
34071
34202
|
if (candidate.running === true) {
|
|
34072
|
-
const
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
|
|
34203
|
+
const running2 = document2.createElement("span");
|
|
34204
|
+
running2.className = "settings-session-import-running";
|
|
34205
|
+
running2.textContent = messages.sessionImportRunning;
|
|
34206
|
+
running2.title = messages.sessionImportRunningHint;
|
|
34207
|
+
running2.setAttribute("aria-hidden", "true");
|
|
34077
34208
|
actionArea.append(
|
|
34078
|
-
|
|
34209
|
+
running2,
|
|
34079
34210
|
createAccessibleText(
|
|
34080
34211
|
document2,
|
|
34081
|
-
`${
|
|
34212
|
+
`${running2.textContent}: ${messages.sessionImportRunningHint}`
|
|
34082
34213
|
)
|
|
34083
34214
|
);
|
|
34084
34215
|
}
|
|
@@ -34099,7 +34230,7 @@ ${detail}` : ""}`
|
|
|
34099
34230
|
refresh.disabled = true;
|
|
34100
34231
|
updateImportActions();
|
|
34101
34232
|
let committedThreadId = null;
|
|
34102
|
-
void
|
|
34233
|
+
void context2.runLatest(
|
|
34103
34234
|
async (signal) => {
|
|
34104
34235
|
importStatus.replaceChildren();
|
|
34105
34236
|
const result = await client.importHarnessSession({
|
|
@@ -34143,10 +34274,14 @@ ${detail}` : ""}`
|
|
|
34143
34274
|
content.append(list);
|
|
34144
34275
|
updateImportActions();
|
|
34145
34276
|
};
|
|
34146
|
-
const load = () => {
|
|
34147
|
-
if (importingId !== null ||
|
|
34277
|
+
const load = (refreshDiagnostics = false) => {
|
|
34278
|
+
if (importingId !== null || context2.signal.aborted) return;
|
|
34148
34279
|
loadedClient = null;
|
|
34149
|
-
|
|
34280
|
+
let client = getClient(selectedHostId);
|
|
34281
|
+
if (client?.hostId === "durable") {
|
|
34282
|
+
selectedHostId = "local";
|
|
34283
|
+
client = getClient(selectedHostId);
|
|
34284
|
+
}
|
|
34150
34285
|
renderHosts(client);
|
|
34151
34286
|
listControls.setBusy(client !== null);
|
|
34152
34287
|
refresh.disabled = client !== null;
|
|
@@ -34156,14 +34291,14 @@ ${detail}` : ""}`
|
|
|
34156
34291
|
else renderUnavailable();
|
|
34157
34292
|
const requestedHarness = selectedHarness;
|
|
34158
34293
|
const pageParams = listControls.params();
|
|
34159
|
-
void
|
|
34294
|
+
void context2.runLatest(
|
|
34160
34295
|
async (signal) => {
|
|
34161
34296
|
if (!client) throw new RendererSessionImportUnavailableError();
|
|
34162
|
-
const
|
|
34163
|
-
|
|
34164
|
-
|
|
34165
|
-
|
|
34166
|
-
|
|
34297
|
+
const harnesses = await loadSessionImportSources(
|
|
34298
|
+
client,
|
|
34299
|
+
getDiagnostics(),
|
|
34300
|
+
signal,
|
|
34301
|
+
refreshDiagnostics
|
|
34167
34302
|
);
|
|
34168
34303
|
const selected = harnesses.find(({ harnessId }) => harnessId === requestedHarness)?.harnessId ?? harnesses[0]?.harnessId ?? null;
|
|
34169
34304
|
if (signal.aborted) throw new Error("Session import selection changed");
|
|
@@ -34214,7 +34349,7 @@ ${detail}` : ""}`
|
|
|
34214
34349
|
load();
|
|
34215
34350
|
hostButtons.find((button2) => button2.dataset.sessionImportHost === hostId2)?.focus();
|
|
34216
34351
|
};
|
|
34217
|
-
refresh.addEventListener("click", load);
|
|
34352
|
+
refresh.addEventListener("click", () => load(true));
|
|
34218
34353
|
load();
|
|
34219
34354
|
return void 0;
|
|
34220
34355
|
}
|
|
@@ -34264,8 +34399,8 @@ ${detail}` : ""}`
|
|
|
34264
34399
|
id: "plugins",
|
|
34265
34400
|
label: messages.pageLabels.plugins,
|
|
34266
34401
|
icon: "plugins",
|
|
34267
|
-
mount(
|
|
34268
|
-
const document2 =
|
|
34402
|
+
mount(context2) {
|
|
34403
|
+
const document2 = context2.content.ownerDocument;
|
|
34269
34404
|
const header = document2.createElement("div");
|
|
34270
34405
|
header.className = "settings-connection-page-header";
|
|
34271
34406
|
const headingCopy = document2.createElement("div");
|
|
@@ -34284,7 +34419,7 @@ ${detail}` : ""}`
|
|
|
34284
34419
|
header.append(headingCopy, refresh);
|
|
34285
34420
|
const content = document2.createElement("div");
|
|
34286
34421
|
content.className = "settings-plugins-content";
|
|
34287
|
-
|
|
34422
|
+
context2.content.append(header, content);
|
|
34288
34423
|
let pending = false;
|
|
34289
34424
|
let unsubscribe = () => void 0;
|
|
34290
34425
|
const render = () => {
|
|
@@ -34329,7 +34464,7 @@ ${detail}` : ""}`
|
|
|
34329
34464
|
createRendererSettingsIcon("diagnose", 16),
|
|
34330
34465
|
messages.pluginsRefreshing
|
|
34331
34466
|
);
|
|
34332
|
-
void
|
|
34467
|
+
void context2.runLatest(() => diagnostics2.refresh(), {
|
|
34333
34468
|
success() {
|
|
34334
34469
|
pending = false;
|
|
34335
34470
|
refresh.disabled = false;
|
|
@@ -34364,8 +34499,8 @@ ${detail}` : ""}`
|
|
|
34364
34499
|
}
|
|
34365
34500
|
|
|
34366
34501
|
// src/settings/loaded-sessions-table.ts
|
|
34367
|
-
function mountLoadedSessionsTable(
|
|
34368
|
-
const document2 =
|
|
34502
|
+
function mountLoadedSessionsTable(context2, messages, getClient) {
|
|
34503
|
+
const document2 = context2.content.ownerDocument;
|
|
34369
34504
|
const owner = document2.defaultView;
|
|
34370
34505
|
if (!owner) return () => void 0;
|
|
34371
34506
|
const text = messages.loadedSessions;
|
|
@@ -34401,7 +34536,7 @@ ${detail}` : ""}`
|
|
|
34401
34536
|
scroll.hidden = true;
|
|
34402
34537
|
header.append(title, description);
|
|
34403
34538
|
container.append(header, status, scroll);
|
|
34404
|
-
|
|
34539
|
+
context2.content.append(container);
|
|
34405
34540
|
let disposed = false;
|
|
34406
34541
|
let timer;
|
|
34407
34542
|
let requestTimer;
|
|
@@ -34423,7 +34558,7 @@ ${detail}` : ""}`
|
|
|
34423
34558
|
);
|
|
34424
34559
|
})
|
|
34425
34560
|
]);
|
|
34426
|
-
if (disposed ||
|
|
34561
|
+
if (disposed || context2.signal.aborted) return;
|
|
34427
34562
|
body.replaceChildren();
|
|
34428
34563
|
for (const row of rows.toSorted(
|
|
34429
34564
|
(a, b) => b.inactiveMs - a.inactiveMs || a.harnessId.localeCompare(b.harnessId) || a.threadId.localeCompare(b.threadId)
|
|
@@ -34447,13 +34582,13 @@ ${detail}` : ""}`
|
|
|
34447
34582
|
status.hidden = rows.length > 0;
|
|
34448
34583
|
scroll.hidden = rows.length === 0;
|
|
34449
34584
|
} catch (error51) {
|
|
34450
|
-
if (disposed ||
|
|
34585
|
+
if (disposed || context2.signal.aborted) return;
|
|
34451
34586
|
status.textContent = error51 instanceof RendererMethodUnavailableError ? text.unavailable : text.failed;
|
|
34452
34587
|
status.hidden = false;
|
|
34453
34588
|
scroll.hidden = true;
|
|
34454
34589
|
} finally {
|
|
34455
34590
|
owner.clearTimeout(requestTimer);
|
|
34456
|
-
if (!disposed && !
|
|
34591
|
+
if (!disposed && !context2.signal.aborted)
|
|
34457
34592
|
timer = owner.setTimeout(() => void refresh(), 1e4);
|
|
34458
34593
|
}
|
|
34459
34594
|
};
|
|
@@ -34466,8 +34601,8 @@ ${detail}` : ""}`
|
|
|
34466
34601
|
}
|
|
34467
34602
|
|
|
34468
34603
|
// src/settings/idle-release-controls.ts
|
|
34469
|
-
function mountIdleReleaseControls(
|
|
34470
|
-
const { content } =
|
|
34604
|
+
function mountIdleReleaseControls(context2, messages, getLoadedSessionsClient) {
|
|
34605
|
+
const { content } = context2;
|
|
34471
34606
|
const document2 = content.ownerDocument;
|
|
34472
34607
|
const owner = document2.defaultView;
|
|
34473
34608
|
if (!owner) return () => void 0;
|
|
@@ -34509,7 +34644,7 @@ ${detail}` : ""}`
|
|
|
34509
34644
|
card.append(toggle.item, timeout.item);
|
|
34510
34645
|
content.append(group);
|
|
34511
34646
|
const disposeTable = mountLoadedSessionsTable(
|
|
34512
|
-
{ ...
|
|
34647
|
+
{ ...context2, content: card },
|
|
34513
34648
|
messages,
|
|
34514
34649
|
getLoadedSessionsClient
|
|
34515
34650
|
);
|
|
@@ -34582,8 +34717,8 @@ ${detail}` : ""}`
|
|
|
34582
34717
|
id: "appearance",
|
|
34583
34718
|
label: messages.pageLabels.appearance,
|
|
34584
34719
|
icon: "settings",
|
|
34585
|
-
mount(
|
|
34586
|
-
const document2 =
|
|
34720
|
+
mount(context2) {
|
|
34721
|
+
const document2 = context2.content.ownerDocument;
|
|
34587
34722
|
const ownerWindow = document2.defaultView;
|
|
34588
34723
|
if (!ownerWindow) return;
|
|
34589
34724
|
const heading = document2.createElement("div");
|
|
@@ -34610,9 +34745,9 @@ ${detail}` : ""}`
|
|
|
34610
34745
|
ownerWindow.addEventListener(REASONING_SOFT_WRAP_CHANGE_EVENT, sync);
|
|
34611
34746
|
row.item.append(toggle);
|
|
34612
34747
|
card.append(row.item);
|
|
34613
|
-
|
|
34748
|
+
context2.content.append(heading, description, group);
|
|
34614
34749
|
const disposeIdleRelease = mountIdleReleaseControls(
|
|
34615
|
-
|
|
34750
|
+
context2,
|
|
34616
34751
|
messages,
|
|
34617
34752
|
getLoadedSessionsClient
|
|
34618
34753
|
);
|
|
@@ -34849,7 +34984,7 @@ ${detail}` : ""}`
|
|
|
34849
34984
|
}
|
|
34850
34985
|
function defaultImportName(source, existing) {
|
|
34851
34986
|
const base = source.provider === "openai-codex" ? "codex" : "grok";
|
|
34852
|
-
const used = new Set(existing.map((
|
|
34987
|
+
const used = new Set(existing.map((record12) => record12.name));
|
|
34853
34988
|
const valid = (name) => credentialImportNameSchema.safeParse(name).success;
|
|
34854
34989
|
if (!used.has(base)) return base;
|
|
34855
34990
|
const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
|
|
@@ -34872,7 +35007,7 @@ ${detail}` : ""}`
|
|
|
34872
35007
|
const shown = (text) => accountDisplayText(text, hideEmails);
|
|
34873
35008
|
const targetButtons = /* @__PURE__ */ new Map();
|
|
34874
35009
|
const importedRecords = () => snapshot.targets.find((target) => target.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
|
|
34875
|
-
const sourceOf = (
|
|
35010
|
+
const sourceOf = (record12) => snapshot.sources.find((source) => source.id === record12.source.id);
|
|
34876
35011
|
const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
|
|
34877
35012
|
const compatibleSources = () => {
|
|
34878
35013
|
const target = piTarget();
|
|
@@ -34910,7 +35045,7 @@ ${detail}` : ""}`
|
|
|
34910
35045
|
sectionImport.addEventListener("click", () => {
|
|
34911
35046
|
const sources = compatibleSources();
|
|
34912
35047
|
const free = sources.find(
|
|
34913
|
-
(source2) => !importedRecords().some((
|
|
35048
|
+
(source2) => !importedRecords().some((record12) => record12.source.id === source2.id)
|
|
34914
35049
|
);
|
|
34915
35050
|
const source = free ?? sources[0];
|
|
34916
35051
|
if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
|
|
@@ -34960,30 +35095,30 @@ ${detail}` : ""}`
|
|
|
34960
35095
|
mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
|
|
34961
35096
|
return mark;
|
|
34962
35097
|
};
|
|
34963
|
-
const renderRow = (
|
|
35098
|
+
const renderRow = (record12) => {
|
|
34964
35099
|
const row = document2.createElement("div");
|
|
34965
35100
|
row.className = "settings-pi-accounts__row";
|
|
34966
35101
|
row.tabIndex = -1;
|
|
34967
|
-
row.dataset.importName =
|
|
34968
|
-
row.setAttribute("aria-label", shown(
|
|
34969
|
-
const agent =
|
|
35102
|
+
row.dataset.importName = record12.name;
|
|
35103
|
+
row.setAttribute("aria-label", shown(record12.source.label));
|
|
35104
|
+
const agent = record12.source.harnessId;
|
|
34970
35105
|
const mark = createMark(agent);
|
|
34971
35106
|
const identity = document2.createElement("div");
|
|
34972
35107
|
identity.className = "settings-pi-accounts__identity";
|
|
34973
35108
|
const label = document2.createElement("strong");
|
|
34974
35109
|
label.className = "settings-account-email";
|
|
34975
|
-
label.textContent = shown(
|
|
35110
|
+
label.textContent = shown(record12.source.label);
|
|
34976
35111
|
label.title = label.textContent;
|
|
34977
35112
|
label.translate = false;
|
|
34978
35113
|
const meta3 = document2.createElement("div");
|
|
34979
35114
|
meta3.className = "settings-account-metadata";
|
|
34980
|
-
const source = sourceOf(
|
|
35115
|
+
const source = sourceOf(record12);
|
|
34981
35116
|
const parts = [
|
|
34982
35117
|
metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
|
|
34983
|
-
metaPart(`${
|
|
35118
|
+
metaPart(`${record12.name}/\u2026`, void 0, true),
|
|
34984
35119
|
metaPart(messages.copied)
|
|
34985
35120
|
];
|
|
34986
|
-
const time3 = formatImportedAt(
|
|
35121
|
+
const time3 = formatImportedAt(record12.importedAt);
|
|
34987
35122
|
if (time3) parts.push(metaPart(time3));
|
|
34988
35123
|
parts.forEach((part, index) => {
|
|
34989
35124
|
if (index > 0) {
|
|
@@ -35000,23 +35135,23 @@ ${detail}` : ""}`
|
|
|
35000
35135
|
reimport.type = "button";
|
|
35001
35136
|
reimport.className = "settings-account-action";
|
|
35002
35137
|
reimport.textContent = messages.rowReimport;
|
|
35003
|
-
reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(
|
|
35138
|
+
reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record12.source.label)}`);
|
|
35004
35139
|
reimport.disabled = busy || !source;
|
|
35005
35140
|
reimport.title = messages.reimport;
|
|
35006
35141
|
reimport.addEventListener("click", () => {
|
|
35007
|
-
if (source) openDialog("reimport", { source, record:
|
|
35142
|
+
if (source) openDialog("reimport", { source, record: record12 }, `row:${record12.name}`);
|
|
35008
35143
|
});
|
|
35009
35144
|
const remove = document2.createElement("button");
|
|
35010
35145
|
remove.type = "button";
|
|
35011
35146
|
remove.className = "settings-account-action settings-pi-accounts__remove";
|
|
35012
35147
|
remove.textContent = messages.rowRemove;
|
|
35013
|
-
remove.setAttribute("aria-label", `${messages.remove}: ${shown(
|
|
35148
|
+
remove.setAttribute("aria-label", `${messages.remove}: ${shown(record12.source.label)}`);
|
|
35014
35149
|
remove.disabled = busy;
|
|
35015
|
-
remove.addEventListener("click", () => openDialog("remove", { record:
|
|
35150
|
+
remove.addEventListener("click", () => openDialog("remove", { record: record12 }, `row:${record12.name}`));
|
|
35016
35151
|
if (source) actions.append(reimport);
|
|
35017
35152
|
actions.append(remove);
|
|
35018
35153
|
row.append(mark, identity, actions);
|
|
35019
|
-
rows.set(
|
|
35154
|
+
rows.set(record12.name, row);
|
|
35020
35155
|
return row;
|
|
35021
35156
|
};
|
|
35022
35157
|
const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
|
|
@@ -35169,7 +35304,7 @@ ${detail}` : ""}`
|
|
|
35169
35304
|
const label = document2.createElement("strong");
|
|
35170
35305
|
label.textContent = shown(choice.label);
|
|
35171
35306
|
label.translate = false;
|
|
35172
|
-
const existing = importedRecords().find((
|
|
35307
|
+
const existing = importedRecords().find((record12) => record12.source.id === choice.id);
|
|
35173
35308
|
const agent = choice.harnessId;
|
|
35174
35309
|
const detail = document2.createElement("span");
|
|
35175
35310
|
detail.textContent = [
|
|
@@ -35210,7 +35345,7 @@ ${detail}` : ""}`
|
|
|
35210
35345
|
const name = request.action === "list" ? void 0 : request.name;
|
|
35211
35346
|
state = {
|
|
35212
35347
|
source: state.source,
|
|
35213
|
-
record: importedRecords().find((
|
|
35348
|
+
record: importedRecords().find((record12) => record12.name === name) ?? state.record
|
|
35214
35349
|
};
|
|
35215
35350
|
show(next);
|
|
35216
35351
|
} else {
|
|
@@ -35224,12 +35359,12 @@ ${detail}` : ""}`
|
|
|
35224
35359
|
sourceRadios = [];
|
|
35225
35360
|
body.replaceChildren();
|
|
35226
35361
|
controls.replaceChildren();
|
|
35227
|
-
const { source, record:
|
|
35362
|
+
const { source, record: record12 } = state;
|
|
35228
35363
|
const close = () => modal.close();
|
|
35229
35364
|
if (mode === "add" || mode === "reimport") {
|
|
35230
35365
|
title.textContent = mode === "add" ? messages.add : messages.reimport;
|
|
35231
35366
|
modal.setAttribute("aria-label", title.textContent);
|
|
35232
|
-
const active = source ??
|
|
35367
|
+
const active = source ?? record12?.source;
|
|
35233
35368
|
const choices = mode === "add" && state.choose ? compatibleSources() : [];
|
|
35234
35369
|
if (choices.length > 1) body.append(sourcePicker(choices));
|
|
35235
35370
|
else if (active) body.append(line(messages.source, shown(active.label)));
|
|
@@ -35238,8 +35373,8 @@ ${detail}` : ""}`
|
|
|
35238
35373
|
input.maxLength = 48;
|
|
35239
35374
|
input.autocomplete = "off";
|
|
35240
35375
|
input.spellcheck = false;
|
|
35241
|
-
input.value =
|
|
35242
|
-
input.readOnly = Boolean(
|
|
35376
|
+
input.value = record12?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
|
|
35377
|
+
input.readOnly = Boolean(record12);
|
|
35243
35378
|
input.addEventListener("input", () => {
|
|
35244
35379
|
nameEdited = true;
|
|
35245
35380
|
});
|
|
@@ -35273,7 +35408,7 @@ ${detail}` : ""}`
|
|
|
35273
35408
|
{
|
|
35274
35409
|
action: mode === "reimport" ? "reimport" : "import",
|
|
35275
35410
|
sourceId: source2.id,
|
|
35276
|
-
name:
|
|
35411
|
+
name: record12?.name ?? input.value,
|
|
35277
35412
|
confirmed: true
|
|
35278
35413
|
},
|
|
35279
35414
|
"done"
|
|
@@ -35283,16 +35418,16 @@ ${detail}` : ""}`
|
|
|
35283
35418
|
)
|
|
35284
35419
|
);
|
|
35285
35420
|
(mode === "add" ? input : controls.children[0]).focus();
|
|
35286
|
-
} else if (mode === "remove" &&
|
|
35421
|
+
} else if (mode === "remove" && record12) {
|
|
35287
35422
|
title.textContent = messages.remove;
|
|
35288
35423
|
modal.setAttribute("aria-label", title.textContent);
|
|
35289
|
-
body.append(note(messages.removeWarning.replace("{name}",
|
|
35424
|
+
body.append(note(messages.removeWarning.replace("{name}", record12.name)));
|
|
35290
35425
|
const cancel = command(messages.cancel, close);
|
|
35291
35426
|
controls.append(
|
|
35292
35427
|
cancel,
|
|
35293
35428
|
command(
|
|
35294
35429
|
messages.remove,
|
|
35295
|
-
() => submit({ action: "remove", name:
|
|
35430
|
+
() => submit({ action: "remove", name: record12.name, confirmed: true }, null),
|
|
35296
35431
|
"danger"
|
|
35297
35432
|
)
|
|
35298
35433
|
);
|
|
@@ -35300,7 +35435,7 @@ ${detail}` : ""}`
|
|
|
35300
35435
|
} else {
|
|
35301
35436
|
title.textContent = messages.doneTitle;
|
|
35302
35437
|
modal.setAttribute("aria-label", title.textContent);
|
|
35303
|
-
const name =
|
|
35438
|
+
const name = record12?.name;
|
|
35304
35439
|
if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
|
|
35305
35440
|
body.append(note(messages.done));
|
|
35306
35441
|
const done = command(messages.close, close, "primary");
|
|
@@ -35347,21 +35482,21 @@ ${detail}` : ""}`
|
|
|
35347
35482
|
(candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
|
|
35348
35483
|
);
|
|
35349
35484
|
if (!source || !target) return null;
|
|
35350
|
-
const
|
|
35485
|
+
const record12 = target.imports.find((candidate) => candidate.source.id === source.id);
|
|
35351
35486
|
const key = `${harnessId}:${accountLabel}:import`;
|
|
35352
35487
|
const button2 = document2.createElement("button");
|
|
35353
35488
|
button2.type = "button";
|
|
35354
35489
|
button2.className = "settings-account-pi-import";
|
|
35355
35490
|
button2.dataset.accountFocus = key;
|
|
35356
35491
|
button2.disabled = busy;
|
|
35357
|
-
const hint =
|
|
35492
|
+
const hint = record12 ? messages.importedHint.replace("{name}", record12.name) : messages.add;
|
|
35358
35493
|
button2.title = hint;
|
|
35359
35494
|
button2.setAttribute("aria-label", hint);
|
|
35360
35495
|
button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
|
|
35361
|
-
if (
|
|
35496
|
+
if (record12) {
|
|
35362
35497
|
button2.dataset.state = "imported";
|
|
35363
35498
|
const name = document2.createElement("code");
|
|
35364
|
-
name.textContent = `${
|
|
35499
|
+
name.textContent = `${record12.name}/\u2026`;
|
|
35365
35500
|
name.translate = false;
|
|
35366
35501
|
button2.append(name, createRendererSettingsIcon("check", 12));
|
|
35367
35502
|
} else {
|
|
@@ -35369,7 +35504,7 @@ ${detail}` : ""}`
|
|
|
35369
35504
|
button2.append(messages.add);
|
|
35370
35505
|
}
|
|
35371
35506
|
button2.addEventListener("click", () => {
|
|
35372
|
-
if (!
|
|
35507
|
+
if (!record12) {
|
|
35373
35508
|
openDialog("add", { source }, key);
|
|
35374
35509
|
return;
|
|
35375
35510
|
}
|
|
@@ -35378,7 +35513,7 @@ ${detail}` : ""}`
|
|
|
35378
35513
|
renderSection();
|
|
35379
35514
|
sectionToggle.setAttribute("aria-expanded", "true");
|
|
35380
35515
|
}
|
|
35381
|
-
const row = rows.get(
|
|
35516
|
+
const row = rows.get(record12.name);
|
|
35382
35517
|
row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
35383
35518
|
row?.focus();
|
|
35384
35519
|
});
|
|
@@ -36150,8 +36285,8 @@ ${detail}` : ""}`
|
|
|
36150
36285
|
id: "accounts",
|
|
36151
36286
|
label: messages.pageLabels.accounts,
|
|
36152
36287
|
icon: "accounts",
|
|
36153
|
-
mount(
|
|
36154
|
-
const document2 =
|
|
36288
|
+
mount(context2) {
|
|
36289
|
+
const document2 = context2.content.ownerDocument;
|
|
36155
36290
|
const header = document2.createElement("div");
|
|
36156
36291
|
header.className = "settings-connection-page-header";
|
|
36157
36292
|
const headingCopy = document2.createElement("div");
|
|
@@ -36242,15 +36377,15 @@ ${detail}` : ""}`
|
|
|
36242
36377
|
let plugins = [];
|
|
36243
36378
|
const pluginFor = (id) => plugins.find((plugin) => plugin.id === id);
|
|
36244
36379
|
const credentialImports = mountCredentialImports(
|
|
36245
|
-
|
|
36246
|
-
|
|
36380
|
+
context2.content,
|
|
36381
|
+
context2.signal,
|
|
36247
36382
|
getClient,
|
|
36248
36383
|
messages.credentialImports,
|
|
36249
36384
|
() => render(),
|
|
36250
36385
|
pluginFor
|
|
36251
36386
|
);
|
|
36252
|
-
|
|
36253
|
-
const stopCountdowns = mountAccountResetCountdowns(groups, messages,
|
|
36387
|
+
context2.content.append(header, status, toolbar, groups, credentialImports.section);
|
|
36388
|
+
const stopCountdowns = mountAccountResetCountdowns(groups, messages, context2.signal);
|
|
36254
36389
|
let accounts = [];
|
|
36255
36390
|
let currentAccountId = null;
|
|
36256
36391
|
let accountPhase = "unavailable";
|
|
@@ -36409,7 +36544,7 @@ ${detail}` : ""}`
|
|
|
36409
36544
|
requests.map(async ({ account, loading }) => {
|
|
36410
36545
|
try {
|
|
36411
36546
|
const result = await inspect({ accountId: account.accountId });
|
|
36412
|
-
if (
|
|
36547
|
+
if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
|
|
36413
36548
|
return;
|
|
36414
36549
|
usageByAccountId.set(
|
|
36415
36550
|
account.accountId,
|
|
@@ -36421,7 +36556,7 @@ ${detail}` : ""}`
|
|
|
36421
36556
|
} : { status: "empty" }
|
|
36422
36557
|
);
|
|
36423
36558
|
} catch {
|
|
36424
|
-
if (
|
|
36559
|
+
if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
|
|
36425
36560
|
return;
|
|
36426
36561
|
usageByAccountId.set(account.accountId, { status: "error" });
|
|
36427
36562
|
}
|
|
@@ -36450,7 +36585,7 @@ ${detail}` : ""}`
|
|
|
36450
36585
|
};
|
|
36451
36586
|
const refreshInBackground = () => {
|
|
36452
36587
|
if (!client().refreshCodexAccounts) return;
|
|
36453
|
-
void
|
|
36588
|
+
void context2.runLatest(
|
|
36454
36589
|
() => client().refreshCodexAccounts?.() ?? client().listCodexAccounts(),
|
|
36455
36590
|
{
|
|
36456
36591
|
success(result) {
|
|
@@ -36462,7 +36597,7 @@ ${detail}` : ""}`
|
|
|
36462
36597
|
);
|
|
36463
36598
|
};
|
|
36464
36599
|
const load = () => {
|
|
36465
|
-
void
|
|
36600
|
+
void context2.runLatest(() => client().listCodexAccounts(), {
|
|
36466
36601
|
success(result) {
|
|
36467
36602
|
loadMessage = null;
|
|
36468
36603
|
setAccounts(result);
|
|
@@ -36482,11 +36617,11 @@ ${detail}` : ""}`
|
|
|
36482
36617
|
});
|
|
36483
36618
|
} catch {
|
|
36484
36619
|
}
|
|
36485
|
-
const harnessAccounts = createHarnessAccounts(
|
|
36620
|
+
const harnessAccounts = createHarnessAccounts(context2.signal, getClient, render);
|
|
36486
36621
|
void credentialImports.refresh();
|
|
36487
36622
|
const directoryClient = getClient();
|
|
36488
36623
|
void directoryClient?.listHarnessPlugins?.().then(({ plugins: next }) => {
|
|
36489
|
-
if (
|
|
36624
|
+
if (context2.signal.aborted || getClient() !== directoryClient) return;
|
|
36490
36625
|
plugins = next;
|
|
36491
36626
|
render();
|
|
36492
36627
|
void credentialImports.refresh();
|
|
@@ -36508,14 +36643,14 @@ ${detail}` : ""}`
|
|
|
36508
36643
|
id: "harness-schedules",
|
|
36509
36644
|
label: t("\u5B9A\u65F6\u4EFB\u52A1", "Schedules"),
|
|
36510
36645
|
icon: "schedules",
|
|
36511
|
-
mount(
|
|
36646
|
+
mount(context2) {
|
|
36512
36647
|
const navigate = () => {
|
|
36513
|
-
|
|
36514
|
-
void
|
|
36648
|
+
context2.content.replaceChildren();
|
|
36649
|
+
void context2.runLatest((signal) => options.openSchedules(signal), {
|
|
36515
36650
|
success() {
|
|
36516
36651
|
},
|
|
36517
36652
|
failure() {
|
|
36518
|
-
const document2 =
|
|
36653
|
+
const document2 = context2.content.ownerDocument;
|
|
36519
36654
|
const status = document2.createElement("p");
|
|
36520
36655
|
status.setAttribute("role", "status");
|
|
36521
36656
|
status.className = "text-sm text-settings-muted";
|
|
@@ -36528,7 +36663,7 @@ ${detail}` : ""}`
|
|
|
36528
36663
|
retry.className = "rounded-lg px-3 py-2 text-sm text-settings-text hover:bg-settings-hover focus-visible:outline-2 focus-visible:outline-settings-focus";
|
|
36529
36664
|
retry.textContent = t("\u91CD\u8BD5", "Retry");
|
|
36530
36665
|
retry.addEventListener("click", navigate);
|
|
36531
|
-
|
|
36666
|
+
context2.content.replaceChildren(status, retry);
|
|
36532
36667
|
}
|
|
36533
36668
|
});
|
|
36534
36669
|
};
|
|
@@ -36731,8 +36866,8 @@ ${detail}` : ""}`
|
|
|
36731
36866
|
id: "about",
|
|
36732
36867
|
label: messages.pageLabels.about,
|
|
36733
36868
|
icon: "about",
|
|
36734
|
-
mount(
|
|
36735
|
-
const document2 =
|
|
36869
|
+
mount(context2) {
|
|
36870
|
+
const document2 = context2.content.ownerDocument;
|
|
36736
36871
|
const page = document2.createElement("div");
|
|
36737
36872
|
page.className = "settings-about-page";
|
|
36738
36873
|
const heading = document2.createElement("div");
|
|
@@ -36829,7 +36964,7 @@ ${detail}` : ""}`
|
|
|
36829
36964
|
brandCopy.append(brandName, brandTagline);
|
|
36830
36965
|
brand.append(brandVideo, brandCopy);
|
|
36831
36966
|
page.append(heading, introPanel, repositoryPanel, brand);
|
|
36832
|
-
|
|
36967
|
+
context2.content.append(page);
|
|
36833
36968
|
return void 0;
|
|
36834
36969
|
}
|
|
36835
36970
|
});
|
|
@@ -36856,8 +36991,8 @@ ${detail}` : ""}`
|
|
|
36856
36991
|
id: "updates",
|
|
36857
36992
|
label: messages.pageLabels.updates,
|
|
36858
36993
|
icon: "updates",
|
|
36859
|
-
mount(
|
|
36860
|
-
const document2 =
|
|
36994
|
+
mount(context2) {
|
|
36995
|
+
const document2 = context2.content.ownerDocument;
|
|
36861
36996
|
const windows = isWindowsRenderer(document2.defaultView);
|
|
36862
36997
|
const header = document2.createElement("div");
|
|
36863
36998
|
header.className = "settings-connection-page-header settings-update-header";
|
|
@@ -36971,7 +37106,7 @@ ${detail}` : ""}`
|
|
|
36971
37106
|
const notes = document2.createElement("div");
|
|
36972
37107
|
notes.className = "settings-update-notes-section";
|
|
36973
37108
|
const starBanner = updateStarBanner(document2, messages);
|
|
36974
|
-
|
|
37109
|
+
context2.content.append(header, metadata, panel, controls, starBanner, notes);
|
|
36975
37110
|
const setManualFallback = (fallback) => {
|
|
36976
37111
|
controls.className = fallback ? "settings-update-controls" : "settings-update-controls is-quiet";
|
|
36977
37112
|
const windowsNpm = windows && installationValue.textContent === messages.updateInstallationNpm;
|
|
@@ -37025,7 +37160,7 @@ ${detail}` : ""}`
|
|
|
37025
37160
|
}
|
|
37026
37161
|
pollAttempts += 1;
|
|
37027
37162
|
pollTimer = document2.defaultView?.setTimeout(() => {
|
|
37028
|
-
void
|
|
37163
|
+
void context2.runLatest(
|
|
37029
37164
|
(signal) => runBoundedRendererUpdateRequest(() => client.readUpdateStatus(), signal),
|
|
37030
37165
|
{
|
|
37031
37166
|
success(result) {
|
|
@@ -37073,7 +37208,7 @@ ${detail}` : ""}`
|
|
|
37073
37208
|
if (pending) return;
|
|
37074
37209
|
pending = true;
|
|
37075
37210
|
renderPendingStatus(null, messages.updatePreparing);
|
|
37076
|
-
void
|
|
37211
|
+
void context2.runLatest(
|
|
37077
37212
|
(signal) => runBoundedRendererUpdateRequest(() => client.startUpdate(), signal),
|
|
37078
37213
|
{
|
|
37079
37214
|
success(result) {
|
|
@@ -37172,7 +37307,7 @@ ${detail}` : ""}`
|
|
|
37172
37307
|
}
|
|
37173
37308
|
pending = true;
|
|
37174
37309
|
renderPendingStatus(null, messages.updateChecking);
|
|
37175
|
-
return
|
|
37310
|
+
return context2.runLatest(
|
|
37176
37311
|
(signal) => runBoundedRendererUpdateRequest(() => client.checkUpdate(), signal),
|
|
37177
37312
|
{
|
|
37178
37313
|
success(result) {
|
|
@@ -44939,6 +45074,7 @@ ${usage_default}`;
|
|
|
44939
45074
|
});
|
|
44940
45075
|
const mountedByComposer = /* @__PURE__ */ new Map();
|
|
44941
45076
|
const catalogRequests = /* @__PURE__ */ new WeakMap();
|
|
45077
|
+
const draftUsageRequests = /* @__PURE__ */ new WeakMap();
|
|
44942
45078
|
const pendingReplacements = /* @__PURE__ */ new Map();
|
|
44943
45079
|
let disposed = false;
|
|
44944
45080
|
const disposeReasoningSoftWrap = installReasoningTranscriptSoftWrap(document);
|
|
@@ -45074,7 +45210,7 @@ ${usage_default}`;
|
|
|
45074
45210
|
for (const mounted of mountedByComposer.values()) {
|
|
45075
45211
|
if (mounted.hostId !== hostId2) continue;
|
|
45076
45212
|
renderMounted(mounted);
|
|
45077
|
-
void
|
|
45213
|
+
if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
|
|
45078
45214
|
}
|
|
45079
45215
|
});
|
|
45080
45216
|
});
|
|
@@ -45143,7 +45279,11 @@ ${usage_default}`;
|
|
|
45143
45279
|
const agent = controller.get(mounted.composer).agent;
|
|
45144
45280
|
return state.plugins && agent !== "codex" && !state.plugins.some(({ id }) => id === agent) ? { ...state.availability, [agent]: "unavailable" } : state.availability;
|
|
45145
45281
|
};
|
|
45146
|
-
const composerAdapterState = (mounted) =>
|
|
45282
|
+
const composerAdapterState = (mounted) => {
|
|
45283
|
+
const manager = mounted.hostId ? window.__codexhostHostRoutingV1?.forHost(mounted.hostId)?.manager : null;
|
|
45284
|
+
const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
|
|
45285
|
+
return composerClient(mounted) && (!needsRpcSteering || window.__codexhostRpcSteeringV1) ? "ready" : "installing";
|
|
45286
|
+
};
|
|
45147
45287
|
const renderMounted = (mounted) => {
|
|
45148
45288
|
if (!isMountedComposer(mounted.composer)) return;
|
|
45149
45289
|
const hostId2 = mounted.hostId;
|
|
@@ -45257,36 +45397,61 @@ ${usage_default}`;
|
|
|
45257
45397
|
renderMounted(mounted);
|
|
45258
45398
|
}
|
|
45259
45399
|
};
|
|
45260
|
-
const
|
|
45400
|
+
const refreshDraftUsage = async (mounted) => {
|
|
45261
45401
|
const state = controller.get(mounted.composer);
|
|
45262
|
-
if (state.
|
|
45402
|
+
if (state.phase !== "draft" || controller.isSwitching(mounted.composer) || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget))
|
|
45263
45403
|
return;
|
|
45264
|
-
const
|
|
45265
|
-
const
|
|
45404
|
+
const agent = state.agent;
|
|
45405
|
+
const accounts = agent === "codex" ? composerCodexAccounts(mounted.composer) : null;
|
|
45266
45406
|
const accountId = accounts?.readyAccountId;
|
|
45407
|
+
const client = composerClient(mounted);
|
|
45267
45408
|
const hostId2 = mounted.hostId;
|
|
45409
|
+
const previous = draftUsageRequests.get(mounted);
|
|
45410
|
+
if (agent !== "codex" && previous?.pending && previous.client === client && previous.generation === mounted.usageRequestGeneration)
|
|
45411
|
+
return;
|
|
45268
45412
|
const generation = ++mounted.usageRequestGeneration;
|
|
45413
|
+
const request = { client, generation, pending: true };
|
|
45414
|
+
draftUsageRequests.set(mounted, request);
|
|
45415
|
+
mounted.draftUsageClient = null;
|
|
45269
45416
|
mounted.usage = null;
|
|
45270
45417
|
mounted.accountCredits = null;
|
|
45418
|
+
mounted.accountCreditsSupported = false;
|
|
45271
45419
|
renderMounted(mounted);
|
|
45272
|
-
|
|
45420
|
+
const isCurrent = () => !disposed && mounted.hostId === hostId2 && composerClient(mounted) === client && mounted.composer.isConnected && mountedByComposer.get(mounted.composer) === mounted && mounted.usageRequestGeneration === generation && controller.get(mounted.composer).agent === agent && controller.get(mounted.composer).phase === "draft" && !controller.isSwitching(mounted.composer) && !controller.isSubmissionPending(mounted.composer) && !threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
45273
45421
|
try {
|
|
45274
|
-
|
|
45275
|
-
if (
|
|
45276
|
-
return;
|
|
45277
|
-
|
|
45278
|
-
|
|
45422
|
+
if (!client) return;
|
|
45423
|
+
if (agent === "codex") {
|
|
45424
|
+
if (!accountId || !client.inspectCodexAccountUsage) return;
|
|
45425
|
+
const result = await client.inspectCodexAccountUsage({ accountId });
|
|
45426
|
+
if (!isCurrent() || composerCodexAccounts(mounted.composer) !== accounts || accounts?.readyAccountId !== accountId || result.accountId !== accountId)
|
|
45427
|
+
return;
|
|
45428
|
+
mounted.usage = result.usage;
|
|
45429
|
+
mounted.accountCredits = result.accountCredits ?? null;
|
|
45430
|
+
} else {
|
|
45431
|
+
if (!client.inspectHarnessAccount) return;
|
|
45432
|
+
const result = await client.inspectHarnessAccount({
|
|
45433
|
+
harnessId: harnessIdSchema.parse(agent),
|
|
45434
|
+
refresh: true
|
|
45435
|
+
});
|
|
45436
|
+
if (!isCurrent() || result.harnessId !== agent) return;
|
|
45437
|
+
mounted.accountCredits = result.account?.credits ?? null;
|
|
45438
|
+
}
|
|
45439
|
+
if (agent === "codex")
|
|
45440
|
+
mounted.accountCredits = composerAccountCredits(mounted.accountCredits);
|
|
45441
|
+
mounted.draftUsageClient = client;
|
|
45279
45442
|
renderMounted(mounted);
|
|
45280
45443
|
} catch {
|
|
45444
|
+
} finally {
|
|
45445
|
+
request.pending = false;
|
|
45281
45446
|
}
|
|
45282
45447
|
};
|
|
45283
45448
|
const refreshThreadUsage = async (mounted, refresh) => {
|
|
45284
45449
|
const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
45285
|
-
if (!threadId
|
|
45286
|
-
await
|
|
45450
|
+
if (!threadId) {
|
|
45451
|
+
await refreshDraftUsage(mounted);
|
|
45287
45452
|
return;
|
|
45288
45453
|
}
|
|
45289
|
-
if (!
|
|
45454
|
+
if (!modelControl) {
|
|
45290
45455
|
mounted.usage = null;
|
|
45291
45456
|
mounted.accountCredits = null;
|
|
45292
45457
|
usageRefreshAttempts.delete(mounted.composer);
|
|
@@ -45341,7 +45506,7 @@ ${usage_default}`;
|
|
|
45341
45506
|
const isExternalConfigurationReady = (mounted) => {
|
|
45342
45507
|
const current = controller.get(mounted.composer);
|
|
45343
45508
|
if (current.agent === "codex") return true;
|
|
45344
|
-
return isExternalConfigurationReadyView(mounted.modelView, mounted.permissionModeView);
|
|
45509
|
+
return composerAdapterState(mounted) === "ready" && isExternalConfigurationReadyView(mounted.modelView, mounted.permissionModeView);
|
|
45345
45510
|
};
|
|
45346
45511
|
const clearDraftPrewarm = async (composer) => {
|
|
45347
45512
|
const policy = await waitForRendererDraftPrewarmPolicy(window, composer);
|
|
@@ -46081,8 +46246,23 @@ ${usage_default}`;
|
|
|
46081
46246
|
if (agent !== "codex" && composerAvailability(mounted)[agent] !== "ready") {
|
|
46082
46247
|
return false;
|
|
46083
46248
|
}
|
|
46249
|
+
const state = controller.get(mounted.composer);
|
|
46250
|
+
if (state.phase !== "draft" || controller.isSwitching(mounted.composer)) return false;
|
|
46084
46251
|
controller.clearPendingSubmission(mounted.composer);
|
|
46085
|
-
const composerId =
|
|
46252
|
+
const composerId = state.composerId;
|
|
46253
|
+
for (const candidate of mountedByComposer.values()) {
|
|
46254
|
+
if (controller.get(candidate.composer).composerId !== composerId) continue;
|
|
46255
|
+
candidate.usageRequestGeneration += 1;
|
|
46256
|
+
candidate.usage = null;
|
|
46257
|
+
candidate.accountCredits = null;
|
|
46258
|
+
candidate.accountCreditsSupported = false;
|
|
46259
|
+
usageRefreshAttempts.delete(candidate.composer);
|
|
46260
|
+
const timer = usageRefreshTimers.get(candidate.composer);
|
|
46261
|
+
if (timer !== void 0) {
|
|
46262
|
+
window.clearTimeout(timer);
|
|
46263
|
+
usageRefreshTimers.delete(candidate.composer);
|
|
46264
|
+
}
|
|
46265
|
+
}
|
|
46086
46266
|
controller.invalidateModelRequests(mounted.composer);
|
|
46087
46267
|
const switching = controller.switchAgent(mounted.composer, agent, {
|
|
46088
46268
|
applyAgent: (nextAgent) => applyDraftAgentCarrier(mounted.composer, nextAgent),
|
|
@@ -46110,7 +46290,9 @@ ${usage_default}`;
|
|
|
46110
46290
|
return false;
|
|
46111
46291
|
} finally {
|
|
46112
46292
|
for (const candidate of mountedByComposer.values()) {
|
|
46113
|
-
if (controller.get(candidate.composer).composerId
|
|
46293
|
+
if (controller.get(candidate.composer).composerId !== composerId) continue;
|
|
46294
|
+
renderMounted(candidate);
|
|
46295
|
+
void refreshDraftUsage(candidate);
|
|
46114
46296
|
}
|
|
46115
46297
|
}
|
|
46116
46298
|
};
|
|
@@ -46125,7 +46307,7 @@ ${usage_default}`;
|
|
|
46125
46307
|
for (const mounted of mountedByComposer.values()) {
|
|
46126
46308
|
if (mounted.hostId !== hostId2) continue;
|
|
46127
46309
|
renderMounted(mounted);
|
|
46128
|
-
void
|
|
46310
|
+
if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
|
|
46129
46311
|
}
|
|
46130
46312
|
})
|
|
46131
46313
|
);
|
|
@@ -46334,6 +46516,7 @@ ${usage_default}`;
|
|
|
46334
46516
|
void clearDraftPrewarm(mounted.composer).catch(() => void 0);
|
|
46335
46517
|
}
|
|
46336
46518
|
void loadExternalCatalog(mounted);
|
|
46519
|
+
void refreshDraftUsage(mounted);
|
|
46337
46520
|
continue;
|
|
46338
46521
|
}
|
|
46339
46522
|
const target = controllerTarget(mounted.modelTarget, hostId2);
|
|
@@ -46362,11 +46545,18 @@ ${usage_default}`;
|
|
|
46362
46545
|
}
|
|
46363
46546
|
if (changed) sidebarAgentIcons.refresh();
|
|
46364
46547
|
};
|
|
46365
|
-
function reconcileHarnessAvailabilityHost() {
|
|
46548
|
+
function reconcileHarnessAvailabilityHost(retryDraftUsage = false) {
|
|
46366
46549
|
for (const hostId3 of modelControl?.knownHostIds?.() ?? []) {
|
|
46367
46550
|
hostHarnessAvailabilityState(hostId3);
|
|
46368
46551
|
}
|
|
46369
46552
|
reloadMountedOwnershipForHost();
|
|
46553
|
+
for (const mounted of mountedByComposer.values()) {
|
|
46554
|
+
const client = composerClient(mounted);
|
|
46555
|
+
const request = draftUsageRequests.get(mounted);
|
|
46556
|
+
if (controller.get(mounted.composer).agent !== "codex" && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
|
|
46557
|
+
void refreshDraftUsage(mounted);
|
|
46558
|
+
}
|
|
46559
|
+
}
|
|
46370
46560
|
let connectionsChanged = false;
|
|
46371
46561
|
for (const target of new Set([...mountedByComposer.values()].map((m) => m.hostId))) {
|
|
46372
46562
|
if (!target) continue;
|
|
@@ -46582,6 +46772,7 @@ ${usage_default}`;
|
|
|
46582
46772
|
accountCreditsSupported: inherited?.accountCreditsSupported ?? false,
|
|
46583
46773
|
hostId: inherited?.hostId ?? hostId2,
|
|
46584
46774
|
usageRequestGeneration: 0,
|
|
46775
|
+
draftUsageClient: null,
|
|
46585
46776
|
commandRequestGeneration: 0
|
|
46586
46777
|
};
|
|
46587
46778
|
mountedByComposer.set(composer, mounted);
|
|
@@ -46601,7 +46792,7 @@ ${usage_default}`;
|
|
|
46601
46792
|
} else if (state.agent !== "codex" && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
|
|
46602
46793
|
void loadExternalCatalog(mounted);
|
|
46603
46794
|
}
|
|
46604
|
-
if (!threadIdFromComposerModelTarget(modelTarget)) void
|
|
46795
|
+
if (!threadIdFromComposerModelTarget(modelTarget)) void refreshDraftUsage(mounted);
|
|
46605
46796
|
void refreshCommands(mounted);
|
|
46606
46797
|
};
|
|
46607
46798
|
const scan = () => {
|
|
@@ -46881,7 +47072,7 @@ ${usage_default}`;
|
|
|
46881
47072
|
document.addEventListener("keydown", onKeyDown, true);
|
|
46882
47073
|
document.addEventListener("click", onClick, true);
|
|
46883
47074
|
const onWindowFocus = () => {
|
|
46884
|
-
reconcileHarnessAvailabilityHost();
|
|
47075
|
+
reconcileHarnessAvailabilityHost(true);
|
|
46885
47076
|
void loadCodexAccounts();
|
|
46886
47077
|
for (const mounted of mountedByComposer.values()) {
|
|
46887
47078
|
if (mounted.hostId === activeModelHostId(mounted.composer) && mounted.ownershipStatus === "error") {
|
|
@@ -47065,6 +47256,7 @@ ${usage_default}`;
|
|
|
47065
47256
|
for (const mounted of mountedByComposer.values()) {
|
|
47066
47257
|
renderMounted(mounted);
|
|
47067
47258
|
void refreshCommands(mounted);
|
|
47259
|
+
if (controller.get(mounted.composer).agent !== "codex") void refreshDraftUsage(mounted);
|
|
47068
47260
|
}
|
|
47069
47261
|
},
|
|
47070
47262
|
dispose() {
|
|
@@ -47141,7 +47333,268 @@ ${usage_default}`;
|
|
|
47141
47333
|
return binding;
|
|
47142
47334
|
}
|
|
47143
47335
|
|
|
47336
|
+
// src/renderer-rpc-steering-queue.ts
|
|
47337
|
+
var INTERRUPTED = "Interrupted before the steer was accepted.";
|
|
47338
|
+
var record10 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
47339
|
+
async function prepareRpcSteeringQueue(hostId2, threadId, manager, coordinator, messageId) {
|
|
47340
|
+
const snapshot = Promise.withResolvers();
|
|
47341
|
+
let lease;
|
|
47342
|
+
let released = false;
|
|
47343
|
+
const dispose = (value) => {
|
|
47344
|
+
if (value != null) value[Symbol.dispose]?.();
|
|
47345
|
+
};
|
|
47346
|
+
const pending = manager("subscribe", {
|
|
47347
|
+
type: "thread",
|
|
47348
|
+
key: { hostId: hostId2, threadId },
|
|
47349
|
+
field: "queuedMessages",
|
|
47350
|
+
listener(value) {
|
|
47351
|
+
if (Array.isArray(value)) snapshot.resolve(value);
|
|
47352
|
+
}
|
|
47353
|
+
});
|
|
47354
|
+
let timeout;
|
|
47355
|
+
let messages;
|
|
47356
|
+
try {
|
|
47357
|
+
timeout = setTimeout(
|
|
47358
|
+
() => snapshot.reject(new Error("Native follow-up queue did not become ready")),
|
|
47359
|
+
5e3
|
|
47360
|
+
);
|
|
47361
|
+
const ready = Promise.resolve(pending).then((value) => {
|
|
47362
|
+
if (released) dispose(value);
|
|
47363
|
+
else lease = value;
|
|
47364
|
+
});
|
|
47365
|
+
[messages] = await Promise.all([snapshot.promise, ready]);
|
|
47366
|
+
} finally {
|
|
47367
|
+
released = true;
|
|
47368
|
+
clearTimeout(timeout);
|
|
47369
|
+
for (const value of /* @__PURE__ */ new Set([pending, lease])) dispose(value);
|
|
47370
|
+
}
|
|
47371
|
+
if (messages.some(
|
|
47372
|
+
(message2) => record10(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
|
|
47373
|
+
))
|
|
47374
|
+
throw new Error(
|
|
47375
|
+
"Resume or remove the other previously paused messages before changing direction"
|
|
47376
|
+
);
|
|
47377
|
+
return async (turnId) => {
|
|
47378
|
+
await coordinator("removeQueuedMessage", threadId, messageId);
|
|
47379
|
+
const state = await manager("getThreadExecutionState", threadId);
|
|
47380
|
+
const stillRunning = record10(state) && state.inProgress === true && state.activeTurnId === turnId;
|
|
47381
|
+
const turn = stillRunning ? null : await manager("getTurnById", threadId, turnId);
|
|
47382
|
+
if (stillRunning || record10(turn) && turn.status === "completed")
|
|
47383
|
+
await coordinator("resumeInterruptedQueuedMessages", threadId);
|
|
47384
|
+
};
|
|
47385
|
+
}
|
|
47386
|
+
|
|
47387
|
+
// src/renderer-rpc-steering.ts
|
|
47388
|
+
var record11 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
47389
|
+
var invoke = (target, name, ...args) => Reflect.apply(Reflect.get(target, name), target, args);
|
|
47390
|
+
var running = (state) => record11(state) && (state.inProgress === true || !!state.activeTurnId);
|
|
47391
|
+
var context = (previous, marker) => ({
|
|
47392
|
+
...record11(previous) ? previous : {},
|
|
47393
|
+
[THREAD_STEERING_CONTEXT_PARAM]: { kind: "application", value: JSON.stringify(marker) }
|
|
47394
|
+
});
|
|
47395
|
+
function installRendererRpcSteering(value) {
|
|
47396
|
+
if (!record11(value) || typeof value.forHost !== "function") return null;
|
|
47397
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, "forHost");
|
|
47398
|
+
if (!descriptor?.writable) return null;
|
|
47399
|
+
const controller = value;
|
|
47400
|
+
const original = controller.forHost;
|
|
47401
|
+
const cached2 = /* @__PURE__ */ new WeakMap();
|
|
47402
|
+
let disposed = false;
|
|
47403
|
+
const wrap = (rpc, hostId2, owner = rpc) => {
|
|
47404
|
+
const existing = cached2.get(rpc);
|
|
47405
|
+
if (existing) return existing;
|
|
47406
|
+
const current = () => {
|
|
47407
|
+
if (disposed || original.call(controller, hostId2) !== owner)
|
|
47408
|
+
throw new Error("Steering connection was retired");
|
|
47409
|
+
};
|
|
47410
|
+
const inspect = async (threadId, input) => {
|
|
47411
|
+
const text = Array.isArray(input) ? input.filter(record11).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
|
|
47412
|
+
current();
|
|
47413
|
+
const delivery = await inspectRendererSteeringDelivery(
|
|
47414
|
+
(method, params) => {
|
|
47415
|
+
current();
|
|
47416
|
+
return invoke(rpc, "sendRequest", method, params);
|
|
47417
|
+
},
|
|
47418
|
+
threadId,
|
|
47419
|
+
text
|
|
47420
|
+
);
|
|
47421
|
+
current();
|
|
47422
|
+
return delivery;
|
|
47423
|
+
};
|
|
47424
|
+
const target = async (threadId, messageId, delivery) => {
|
|
47425
|
+
const state = await invoke(rpc, "getThreadExecutionState", threadId);
|
|
47426
|
+
current();
|
|
47427
|
+
if (!record11(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
|
|
47428
|
+
throw new Error("Native steering target or message identity is unavailable");
|
|
47429
|
+
return { expectedTurnId: state.activeTurnId, clientUserMessageId: messageId, delivery };
|
|
47430
|
+
};
|
|
47431
|
+
const withoutQueueRow = async (request) => {
|
|
47432
|
+
if (!record11(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
|
|
47433
|
+
return request;
|
|
47434
|
+
try {
|
|
47435
|
+
const state = await invoke(rpc, "getThreadExecutionState", request.conversationId);
|
|
47436
|
+
current();
|
|
47437
|
+
if (!running(state)) return request;
|
|
47438
|
+
const message2 = request.message;
|
|
47439
|
+
const text = record11(message2) && typeof message2.text === "string" ? message2.text : "";
|
|
47440
|
+
const delivery = await inspect(request.conversationId, [{ text }]);
|
|
47441
|
+
return delivery === "newTurn" ? { ...request, acceptLocally: false } : request;
|
|
47442
|
+
} catch {
|
|
47443
|
+
return request;
|
|
47444
|
+
}
|
|
47445
|
+
};
|
|
47446
|
+
const coordinator = (remote) => new Proxy(remote, {
|
|
47447
|
+
get(handle, key) {
|
|
47448
|
+
if (key === "then") {
|
|
47449
|
+
const then = Reflect.get(handle, key);
|
|
47450
|
+
return typeof then === "function" ? (resolve, reject) => Reflect.apply(then, handle, [(value2) => resolve(coordinator(value2)), reject]) : then;
|
|
47451
|
+
}
|
|
47452
|
+
if (key === "dup") return () => coordinator(invoke(handle, "dup"));
|
|
47453
|
+
if (key !== "sendMessage" && key !== "sendQueuedMessageNow")
|
|
47454
|
+
return Reflect.get(handle, key);
|
|
47455
|
+
return async (...args) => {
|
|
47456
|
+
current();
|
|
47457
|
+
const index = key === "sendMessage" ? 1 : 3;
|
|
47458
|
+
const callback = args[index];
|
|
47459
|
+
if (typeof callback !== "function")
|
|
47460
|
+
throw new Error("Native submission preparation is unavailable");
|
|
47461
|
+
let marker = null;
|
|
47462
|
+
let threadId;
|
|
47463
|
+
let messageId;
|
|
47464
|
+
let finish;
|
|
47465
|
+
const apply = (prepared) => {
|
|
47466
|
+
if (!marker || !record11(prepared.steer)) return prepared;
|
|
47467
|
+
const result2 = {
|
|
47468
|
+
...prepared,
|
|
47469
|
+
steer: {
|
|
47470
|
+
...prepared.steer,
|
|
47471
|
+
additionalContext: context(prepared.steer.additionalContext, marker)
|
|
47472
|
+
}
|
|
47473
|
+
};
|
|
47474
|
+
if (marker.delivery !== "newTurn") return result2;
|
|
47475
|
+
if (!record11(prepared.start) || !record11(prepared.start.request))
|
|
47476
|
+
throw new Error("Native start preparation is unavailable for steering");
|
|
47477
|
+
return {
|
|
47478
|
+
...result2,
|
|
47479
|
+
afterInactiveTurnId: marker.expectedTurnId,
|
|
47480
|
+
start: {
|
|
47481
|
+
...prepared.start,
|
|
47482
|
+
request: {
|
|
47483
|
+
...prepared.start.request,
|
|
47484
|
+
additionalContext: context(prepared.start.request.additionalContext, marker)
|
|
47485
|
+
}
|
|
47486
|
+
}
|
|
47487
|
+
};
|
|
47488
|
+
};
|
|
47489
|
+
const prepare = async (...input) => {
|
|
47490
|
+
current();
|
|
47491
|
+
const prepared = await callback(...input);
|
|
47492
|
+
current();
|
|
47493
|
+
if (!record11(prepared)) throw new Error("Native submission preparation is malformed");
|
|
47494
|
+
if (marker) return apply(prepared);
|
|
47495
|
+
if (input[1] !== "steer" || !record11(prepared.steer) || typeof prepared.conversationId !== "string")
|
|
47496
|
+
return prepared;
|
|
47497
|
+
threadId = prepared.conversationId;
|
|
47498
|
+
const execution = await invoke(rpc, "getThreadExecutionState", threadId);
|
|
47499
|
+
current();
|
|
47500
|
+
if (!running(execution)) return prepared;
|
|
47501
|
+
const delivery = await inspect(threadId, prepared.steer.input);
|
|
47502
|
+
if (delivery === "official") return prepared;
|
|
47503
|
+
const restore = prepared.steer.restoreMessage;
|
|
47504
|
+
messageId = record11(restore) && typeof restore.id === "string" ? restore.id : void 0;
|
|
47505
|
+
const clientId = prepared.steer.clientUserMessageId ?? messageId;
|
|
47506
|
+
marker = await target(threadId, clientId, delivery);
|
|
47507
|
+
if (delivery === "activeTurn") return apply(prepared);
|
|
47508
|
+
if (!messageId) throw new Error("Native queued message identity is unavailable");
|
|
47509
|
+
finish = await prepareRpcSteeringQueue(
|
|
47510
|
+
hostId2,
|
|
47511
|
+
threadId,
|
|
47512
|
+
(name, ...values) => invoke(rpc, name, ...values),
|
|
47513
|
+
(name, ...values) => invoke(remote, name, ...values),
|
|
47514
|
+
messageId
|
|
47515
|
+
);
|
|
47516
|
+
const start = await callback(input[0], "start");
|
|
47517
|
+
current();
|
|
47518
|
+
if (!record11(start)) throw new Error("Native start preparation is malformed");
|
|
47519
|
+
return apply(start);
|
|
47520
|
+
};
|
|
47521
|
+
const forwarded = [...args];
|
|
47522
|
+
forwarded[index] = prepare;
|
|
47523
|
+
if (key === "sendMessage") forwarded[0] = await withoutQueueRow(args[0]);
|
|
47524
|
+
const result = await invoke(handle, key, ...forwarded);
|
|
47525
|
+
if (finish && record11(result) && result.status === "sent" && typeof result.turnId === "string") {
|
|
47526
|
+
await finish(result.turnId).catch(
|
|
47527
|
+
() => console.error("codexhost could not reconcile native steering queue")
|
|
47528
|
+
);
|
|
47529
|
+
}
|
|
47530
|
+
return result;
|
|
47531
|
+
};
|
|
47532
|
+
}
|
|
47533
|
+
});
|
|
47534
|
+
const wrapped = new Proxy(rpc, {
|
|
47535
|
+
get(handle, key) {
|
|
47536
|
+
if (key === "then") {
|
|
47537
|
+
const then = Reflect.get(handle, key);
|
|
47538
|
+
return typeof then === "function" ? (resolve, reject) => Reflect.apply(then, handle, [
|
|
47539
|
+
(value2) => resolve(wrap(value2, hostId2, owner)),
|
|
47540
|
+
reject
|
|
47541
|
+
]) : then;
|
|
47542
|
+
}
|
|
47543
|
+
if (key === "dup") return () => wrap(invoke(handle, "dup"), hostId2, owner);
|
|
47544
|
+
if (key === "getTurnCoordinator")
|
|
47545
|
+
return () => {
|
|
47546
|
+
current();
|
|
47547
|
+
return coordinator(invoke(handle, "getTurnCoordinator"));
|
|
47548
|
+
};
|
|
47549
|
+
return Reflect.get(handle, key);
|
|
47550
|
+
}
|
|
47551
|
+
});
|
|
47552
|
+
cached2.set(rpc, wrapped);
|
|
47553
|
+
return wrapped;
|
|
47554
|
+
};
|
|
47555
|
+
const forHost = (hostId2) => wrap(original.call(controller, hostId2), hostId2);
|
|
47556
|
+
controller.forHost = forHost;
|
|
47557
|
+
return () => {
|
|
47558
|
+
disposed = true;
|
|
47559
|
+
if (controller.forHost === forHost) Object.defineProperty(controller, "forHost", descriptor);
|
|
47560
|
+
};
|
|
47561
|
+
}
|
|
47562
|
+
|
|
47144
47563
|
// src/production-entry.ts
|
|
47564
|
+
Object.defineProperty(window, "__codexhostInstallRpcSteeringV1", {
|
|
47565
|
+
configurable: true,
|
|
47566
|
+
value(controller) {
|
|
47567
|
+
const state = window;
|
|
47568
|
+
if (state.__codexhostRpcSteeringV1)
|
|
47569
|
+
return window.__codexhostRpcSteeringV1?.controller === controller;
|
|
47570
|
+
const routing = window.__codexhostHostRoutingV1;
|
|
47571
|
+
if (!routing) return false;
|
|
47572
|
+
const cleanup = installRendererRpcSteering(controller);
|
|
47573
|
+
if (!cleanup) return false;
|
|
47574
|
+
const originalDispose = routing.dispose;
|
|
47575
|
+
const dispose = () => {
|
|
47576
|
+
cleanup();
|
|
47577
|
+
delete state.__codexhostRpcSteeringV1;
|
|
47578
|
+
window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
47579
|
+
if (routing.dispose === dispose) routing.dispose = originalDispose;
|
|
47580
|
+
originalDispose.call(routing);
|
|
47581
|
+
};
|
|
47582
|
+
routing.dispose = dispose;
|
|
47583
|
+
state.__codexhostRpcSteeringV1 = {
|
|
47584
|
+
controller,
|
|
47585
|
+
// A later native Remote Control install replaces this method; the Controller
|
|
47586
|
+
// compares it on every tick and releases a displaced wrapper to reinstall.
|
|
47587
|
+
forHost: controller.forHost,
|
|
47588
|
+
release() {
|
|
47589
|
+
cleanup();
|
|
47590
|
+
delete state.__codexhostRpcSteeringV1;
|
|
47591
|
+
window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
47592
|
+
}
|
|
47593
|
+
};
|
|
47594
|
+
window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
47595
|
+
return true;
|
|
47596
|
+
}
|
|
47597
|
+
});
|
|
47145
47598
|
var install = () => {
|
|
47146
47599
|
installRendererBinding();
|
|
47147
47600
|
};
|