@codexhost/cli-darwin-arm64 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +15 -0
- package/app/console-web.js +15 -0
- package/app/desktop-controller.mjs +131 -2
- package/app/host-runtime.mjs +194 -9
- package/app/plugins/antigravity/plugin.mjs +15 -0
- package/app/plugins/claude-code/plugin.mjs +15 -0
- package/app/plugins/codebuddy/plugin.mjs +15 -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 +15 -0
- package/app/plugins/deepseek-harness/plugin.mjs +15 -0
- package/app/plugins/devin/plugin.mjs +15 -0
- package/app/plugins/grok/plugin.mjs +15 -0
- package/app/plugins/hermes/plugin.mjs +15 -0
- package/app/plugins/kimi-code/plugin.mjs +15 -0
- package/app/plugins/kiro-cli/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 +15 -0
- package/app/plugins/qoder/plugin.mjs +15 -0
- package/app/plugins/qoder-cn/plugin.mjs +15 -0
- package/app/plugins/qwen-code/plugin.mjs +15 -0
- package/app/plugins/workbuddy/plugin.mjs +15 -0
- package/app/plugins/zcode/plugin.mjs +15 -0
- package/app/renderer-extension.js +558 -215
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -15243,49 +15243,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15243
15243
|
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
15244
15244
|
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
15245
15245
|
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
15246
|
-
}).strict().superRefine((usage,
|
|
15246
|
+
}).strict().superRefine((usage, context2) => {
|
|
15247
15247
|
if (Object.keys(usage).length === 0) {
|
|
15248
|
-
|
|
15248
|
+
context2.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
15249
15249
|
}
|
|
15250
15250
|
const hasContextUsed = usage.contextUsedTokens !== void 0;
|
|
15251
15251
|
const hasContextWindow = usage.contextWindowTokens !== void 0;
|
|
15252
15252
|
if (hasContextUsed !== hasContextWindow) {
|
|
15253
|
-
|
|
15253
|
+
context2.addIssue({
|
|
15254
15254
|
code: "custom",
|
|
15255
15255
|
message: "Thread Usage context fields must be provided together",
|
|
15256
15256
|
path: [hasContextUsed ? "contextWindowTokens" : "contextUsedTokens"]
|
|
15257
15257
|
});
|
|
15258
15258
|
}
|
|
15259
15259
|
if (usage.contextWindowTokens === 0) {
|
|
15260
|
-
|
|
15260
|
+
context2.addIssue({
|
|
15261
15261
|
code: "custom",
|
|
15262
15262
|
message: "Thread Usage contextWindowTokens must be greater than zero",
|
|
15263
15263
|
path: ["contextWindowTokens"]
|
|
15264
15264
|
});
|
|
15265
15265
|
}
|
|
15266
15266
|
if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
|
|
15267
|
-
|
|
15267
|
+
context2.addIssue({
|
|
15268
15268
|
code: "custom",
|
|
15269
15269
|
message: "Thread Usage costSource must be provided with totalCostUsd",
|
|
15270
15270
|
path: ["costSource"]
|
|
15271
15271
|
});
|
|
15272
15272
|
}
|
|
15273
15273
|
if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
|
|
15274
|
-
|
|
15274
|
+
context2.addIssue({
|
|
15275
15275
|
code: "custom",
|
|
15276
15276
|
message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
|
|
15277
15277
|
path: ["unpricedModels"]
|
|
15278
15278
|
});
|
|
15279
15279
|
}
|
|
15280
15280
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
15281
|
-
|
|
15281
|
+
context2.addIssue({
|
|
15282
15282
|
code: "custom",
|
|
15283
15283
|
message: "Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent",
|
|
15284
15284
|
path: ["planFiveHourResetsAtUnix"]
|
|
15285
15285
|
});
|
|
15286
15286
|
}
|
|
15287
15287
|
if (usage.planSevenDayResetsAtUnix !== void 0 && usage.planSevenDayUsedPercent === void 0) {
|
|
15288
|
-
|
|
15288
|
+
context2.addIssue({
|
|
15289
15289
|
code: "custom",
|
|
15290
15290
|
message: "Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent",
|
|
15291
15291
|
path: ["planSevenDayResetsAtUnix"]
|
|
@@ -15393,10 +15393,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15393
15393
|
|
|
15394
15394
|
// ../shared-contracts/dist/json-value.js
|
|
15395
15395
|
function rejectExplicitUndefined(keys) {
|
|
15396
|
-
return (value,
|
|
15396
|
+
return (value, context2) => {
|
|
15397
15397
|
for (const key of keys) {
|
|
15398
15398
|
if (Object.hasOwn(value, key) && value[key] === void 0) {
|
|
15399
|
-
|
|
15399
|
+
context2.addIssue({
|
|
15400
15400
|
code: "custom",
|
|
15401
15401
|
path: [key],
|
|
15402
15402
|
message: "Explicit undefined is not valid JSON"
|
|
@@ -15480,11 +15480,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15480
15480
|
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15481
15481
|
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
15482
15482
|
defaultModeId: harnessPermissionModeIdSchema
|
|
15483
|
-
}).strict().superRefine((catalog,
|
|
15483
|
+
}).strict().superRefine((catalog, context2) => {
|
|
15484
15484
|
const ids = /* @__PURE__ */ new Set();
|
|
15485
15485
|
for (const [index, mode] of catalog.modes.entries()) {
|
|
15486
15486
|
if (ids.has(mode.id)) {
|
|
15487
|
-
|
|
15487
|
+
context2.addIssue({
|
|
15488
15488
|
code: "custom",
|
|
15489
15489
|
message: "Permission Mode IDs must be unique",
|
|
15490
15490
|
path: ["modes", index, "id"]
|
|
@@ -15493,7 +15493,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15493
15493
|
ids.add(mode.id);
|
|
15494
15494
|
}
|
|
15495
15495
|
if (!ids.has(catalog.defaultModeId)) {
|
|
15496
|
-
|
|
15496
|
+
context2.addIssue({
|
|
15497
15497
|
code: "custom",
|
|
15498
15498
|
message: "Default Permission Mode must exist in the catalog",
|
|
15499
15499
|
path: ["defaultModeId"]
|
|
@@ -15536,11 +15536,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15536
15536
|
return void 0;
|
|
15537
15537
|
return catalog?.models.find((model2) => model2.ref.id === ref.id || model2.fastModel?.id === ref.id);
|
|
15538
15538
|
}
|
|
15539
|
-
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options,
|
|
15539
|
+
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context2) => {
|
|
15540
15540
|
const ids = /* @__PURE__ */ new Set();
|
|
15541
15541
|
for (const [index, option] of options.entries()) {
|
|
15542
15542
|
if (ids.has(option.id)) {
|
|
15543
|
-
|
|
15543
|
+
context2.addIssue({
|
|
15544
15544
|
code: "custom",
|
|
15545
15545
|
message: "Thinking option IDs must be unique",
|
|
15546
15546
|
path: [index, "id"]
|
|
@@ -15554,12 +15554,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15554
15554
|
defaultModel: harnessModelRefSchema.optional(),
|
|
15555
15555
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
15556
15556
|
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
15557
|
-
}).strict().superRefine((catalog,
|
|
15557
|
+
}).strict().superRefine((catalog, context2) => {
|
|
15558
15558
|
const refs = /* @__PURE__ */ new Set();
|
|
15559
15559
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
15560
15560
|
for (const [index, model2] of catalog.models.entries()) {
|
|
15561
15561
|
if (refs.has(model2.ref.id)) {
|
|
15562
|
-
|
|
15562
|
+
context2.addIssue({
|
|
15563
15563
|
code: "custom",
|
|
15564
15564
|
message: "Model Catalog refs must be unique",
|
|
15565
15565
|
path: ["models", index, "ref", "id"]
|
|
@@ -15568,7 +15568,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15568
15568
|
refs.add(model2.ref.id);
|
|
15569
15569
|
if (model2.fastModel) {
|
|
15570
15570
|
if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
|
|
15571
|
-
|
|
15571
|
+
context2.addIssue({
|
|
15572
15572
|
code: "custom",
|
|
15573
15573
|
message: "Fast Model refs must be distinct and unique",
|
|
15574
15574
|
path: ["models", index, "fastModel"]
|
|
@@ -15579,7 +15579,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15579
15579
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15580
15580
|
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
15581
15581
|
if (supportedThinkingIds.has(optionId)) {
|
|
15582
|
-
|
|
15582
|
+
context2.addIssue({
|
|
15583
15583
|
code: "custom",
|
|
15584
15584
|
message: "Supported Thinking option IDs must be unique per Model",
|
|
15585
15585
|
path: ["models", index, "supportedThinkingOptionIds", optionIndex]
|
|
@@ -15587,7 +15587,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15587
15587
|
}
|
|
15588
15588
|
supportedThinkingIds.add(optionId);
|
|
15589
15589
|
if (!thinkingIds.has(optionId)) {
|
|
15590
|
-
|
|
15590
|
+
context2.addIssue({
|
|
15591
15591
|
code: "custom",
|
|
15592
15592
|
message: "Supported Thinking option must exist in the catalog",
|
|
15593
15593
|
path: ["models", index, "supportedThinkingOptionIds", optionIndex]
|
|
@@ -15596,14 +15596,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15596
15596
|
}
|
|
15597
15597
|
}
|
|
15598
15598
|
if (catalog.defaultModel && !refs.has(catalog.defaultModel.id)) {
|
|
15599
|
-
|
|
15599
|
+
context2.addIssue({
|
|
15600
15600
|
code: "custom",
|
|
15601
15601
|
message: "Default Model must exist in the Model Catalog",
|
|
15602
15602
|
path: ["defaultModel", "id"]
|
|
15603
15603
|
});
|
|
15604
15604
|
}
|
|
15605
15605
|
if (catalog.defaultThinkingOptionId && !thinkingIds.has(catalog.defaultThinkingOptionId)) {
|
|
15606
|
-
|
|
15606
|
+
context2.addIssue({
|
|
15607
15607
|
code: "custom",
|
|
15608
15608
|
message: "Default Thinking option must exist in the catalog",
|
|
15609
15609
|
path: ["defaultThinkingOptionId"]
|
|
@@ -15646,9 +15646,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15646
15646
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15647
15647
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
15648
15648
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15649
|
-
}).strict().superRefine((state,
|
|
15649
|
+
}).strict().superRefine((state, context2) => {
|
|
15650
15650
|
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
|
|
15651
|
-
|
|
15651
|
+
context2.addIssue({
|
|
15652
15652
|
code: "custom",
|
|
15653
15653
|
message: "Effective Thinking option must be currently available",
|
|
15654
15654
|
path: ["effectiveThinkingOptionId"]
|
|
@@ -15665,10 +15665,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15665
15665
|
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
15666
15666
|
capabilities: harnessSessionCapabilitiesSchema,
|
|
15667
15667
|
webUi: harnessWebUiCapabilitySchema.optional()
|
|
15668
|
-
}).strict().superRefine((inspection,
|
|
15668
|
+
}).strict().superRefine((inspection, context2) => {
|
|
15669
15669
|
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
15670
15670
|
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
15671
|
-
|
|
15671
|
+
context2.addIssue({
|
|
15672
15672
|
code: "custom",
|
|
15673
15673
|
message: "Permission Mode catalog and capability must agree",
|
|
15674
15674
|
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
@@ -15730,11 +15730,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15730
15730
|
]);
|
|
15731
15731
|
var threadOwnershipListParamsSchema = external_exports.object({
|
|
15732
15732
|
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15733
|
-
}).strict().superRefine(({ threadIds },
|
|
15733
|
+
}).strict().superRefine(({ threadIds }, context2) => {
|
|
15734
15734
|
const seen = /* @__PURE__ */ new Set();
|
|
15735
15735
|
for (const [index, threadId] of threadIds.entries()) {
|
|
15736
15736
|
if (seen.has(threadId)) {
|
|
15737
|
-
|
|
15737
|
+
context2.addIssue({
|
|
15738
15738
|
code: "custom",
|
|
15739
15739
|
message: "Thread ownership-list IDs must be unique",
|
|
15740
15740
|
path: ["threadIds", index]
|
|
@@ -15758,11 +15758,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15758
15758
|
]);
|
|
15759
15759
|
var threadOwnershipListResultSchema = external_exports.object({
|
|
15760
15760
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15761
|
-
}).strict().superRefine(({ threads },
|
|
15761
|
+
}).strict().superRefine(({ threads }, context2) => {
|
|
15762
15762
|
const seen = /* @__PURE__ */ new Set();
|
|
15763
15763
|
for (const [index, thread] of threads.entries()) {
|
|
15764
15764
|
if (seen.has(thread.threadId)) {
|
|
15765
|
-
|
|
15765
|
+
context2.addIssue({
|
|
15766
15766
|
code: "custom",
|
|
15767
15767
|
message: "Thread ownership-list results must be unique",
|
|
15768
15768
|
path: ["threads", index, "threadId"]
|
|
@@ -15777,6 +15777,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15777
15777
|
text: external_exports.string().optional()
|
|
15778
15778
|
}).strict();
|
|
15779
15779
|
var THREAD_STEER_DELIVERY_PARAM = "codexhostSteerDelivery";
|
|
15780
|
+
var THREAD_STEERING_CONTEXT_PARAM = "codexhost_external_steering";
|
|
15781
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15782
|
+
kind: external_exports.literal("application"),
|
|
15783
|
+
value: external_exports.string().transform((text, context2) => {
|
|
15784
|
+
try {
|
|
15785
|
+
return JSON.parse(text);
|
|
15786
|
+
} catch {
|
|
15787
|
+
context2.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15788
|
+
return external_exports.NEVER;
|
|
15789
|
+
}
|
|
15790
|
+
}).pipe(external_exports.object({
|
|
15791
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15792
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15793
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15794
|
+
}).strict())
|
|
15795
|
+
}).strict().transform((context2) => context2.value);
|
|
15780
15796
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15781
15797
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15782
15798
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -16083,11 +16099,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16083
16099
|
* Omitted by Adapters; set by the Host on inspection results.
|
|
16084
16100
|
*/
|
|
16085
16101
|
source: external_exports.enum(["live", "static"]).optional()
|
|
16086
|
-
}).strict().superRefine((catalog,
|
|
16102
|
+
}).strict().superRefine((catalog, context2) => {
|
|
16087
16103
|
const ids = /* @__PURE__ */ new Set();
|
|
16088
16104
|
for (const [index, command] of catalog.commands.entries()) {
|
|
16089
16105
|
if (ids.has(command.id)) {
|
|
16090
|
-
|
|
16106
|
+
context2.addIssue({
|
|
16091
16107
|
code: "custom",
|
|
16092
16108
|
message: "Harness command IDs must be unique",
|
|
16093
16109
|
path: ["commands", index, "id"]
|
|
@@ -16210,9 +16226,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16210
16226
|
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
16211
16227
|
totalBytes: external_exports.number().int().positive().optional(),
|
|
16212
16228
|
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable()
|
|
16213
|
-
}).superRefine((status,
|
|
16229
|
+
}).superRefine((status, context2) => {
|
|
16214
16230
|
if (status.downloadedBytes !== void 0 && status.totalBytes !== void 0 && status.downloadedBytes > status.totalBytes) {
|
|
16215
|
-
|
|
16231
|
+
context2.addIssue({
|
|
16216
16232
|
code: "custom",
|
|
16217
16233
|
path: ["downloadedBytes"],
|
|
16218
16234
|
message: "downloadedBytes must not exceed totalBytes"
|
|
@@ -16270,10 +16286,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16270
16286
|
var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f]/u;
|
|
16271
16287
|
function desktopImageAttachmentPaths(text) {
|
|
16272
16288
|
const end = text.search(REQUEST_HEADING);
|
|
16273
|
-
const
|
|
16274
|
-
if (!ATTACHED_FILES_HEADING.test(
|
|
16289
|
+
const context2 = end < 0 ? text : text.slice(0, end);
|
|
16290
|
+
if (!ATTACHED_FILES_HEADING.test(context2))
|
|
16275
16291
|
return [];
|
|
16276
|
-
return [...
|
|
16292
|
+
return [...context2.matchAll(IMAGE_ATTACHMENT_PATTERN)].map((match) => match[1] ?? "").filter((path) => path.length > 0 && !CONTROL_CHARACTER_PATTERN.test(path));
|
|
16277
16293
|
}
|
|
16278
16294
|
|
|
16279
16295
|
// ../shared-contracts/dist/remote-runtime.js
|
|
@@ -16362,6 +16378,39 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16362
16378
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
16363
16379
|
|
|
16364
16380
|
// src/codex-native-services.ts
|
|
16381
|
+
var MAX_RUNTIME_MODULES = 32768;
|
|
16382
|
+
var MAX_RUNTIME_EXPORTS = 131072;
|
|
16383
|
+
var RUNTIME_SCAN_SLICE = 2048;
|
|
16384
|
+
var COMPILED_EXPORT_GETTER = /^(?:\(\)=>|function\(\)\{return )[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[(?:[A-Za-z_$][\w$]*|"[^"\\]*"|'[^'\\]*')\])*\}?$/;
|
|
16385
|
+
var objectLike = (value) => (typeof value === "object" || typeof value === "function") && value !== null;
|
|
16386
|
+
function instantiatedModules(namespace) {
|
|
16387
|
+
const runtime = namespace.__webpack_require__;
|
|
16388
|
+
if (typeof runtime !== "function") return null;
|
|
16389
|
+
const cache = Object.getOwnPropertyDescriptor(runtime, "c")?.value;
|
|
16390
|
+
return objectLike(cache) ? cache : null;
|
|
16391
|
+
}
|
|
16392
|
+
function compiledExportValues(module) {
|
|
16393
|
+
if (!objectLike(module) || Object.hasOwn(module, "error")) return [];
|
|
16394
|
+
const exports = Object.getOwnPropertyDescriptor(module, "exports")?.value;
|
|
16395
|
+
if (typeof exports !== "object" || exports === null) return [];
|
|
16396
|
+
const prototype = Object.getPrototypeOf(exports);
|
|
16397
|
+
if (prototype !== Object.prototype && prototype !== null) return [];
|
|
16398
|
+
const values = [];
|
|
16399
|
+
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(exports))) {
|
|
16400
|
+
if (!descriptor.enumerable || descriptor.configurable) continue;
|
|
16401
|
+
if ("value" in descriptor) {
|
|
16402
|
+
values.push(descriptor.value);
|
|
16403
|
+
continue;
|
|
16404
|
+
}
|
|
16405
|
+
if (!descriptor.get) continue;
|
|
16406
|
+
try {
|
|
16407
|
+
if (COMPILED_EXPORT_GETTER.test(Function.prototype.toString.call(descriptor.get)))
|
|
16408
|
+
values.push(descriptor.get.call(exports));
|
|
16409
|
+
} catch {
|
|
16410
|
+
}
|
|
16411
|
+
}
|
|
16412
|
+
return values;
|
|
16413
|
+
}
|
|
16365
16414
|
async function loadCodexNativeServices(ownerWindow, matchesServices, importModule = (url2) => import(url2)) {
|
|
16366
16415
|
if (!ownerWindow.document || !ownerWindow.location) return null;
|
|
16367
16416
|
const page = new URL(ownerWindow.location.href);
|
|
@@ -16391,6 +16440,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16391
16440
|
(a, b) => Number(b.includes("/app-shared-")) - Number(a.includes("/app-shared-"))
|
|
16392
16441
|
);
|
|
16393
16442
|
const matches = /* @__PURE__ */ new Set();
|
|
16443
|
+
const addMatch = (value) => {
|
|
16444
|
+
if (matchesServices(value)) matches.add(value);
|
|
16445
|
+
if (matches.size > 1) throw new Error("Codex native services are unavailable in this window");
|
|
16446
|
+
};
|
|
16447
|
+
const runtimes = /* @__PURE__ */ new Set();
|
|
16394
16448
|
for (const url2 of candidates) {
|
|
16395
16449
|
let module;
|
|
16396
16450
|
try {
|
|
@@ -16398,8 +16452,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16398
16452
|
} catch {
|
|
16399
16453
|
continue;
|
|
16400
16454
|
}
|
|
16401
|
-
|
|
16402
|
-
|
|
16455
|
+
Object.values(module).forEach(addMatch);
|
|
16456
|
+
const runtime = instantiatedModules(module);
|
|
16457
|
+
if (runtime) runtimes.add(runtime);
|
|
16458
|
+
}
|
|
16459
|
+
let scannedExports = 0;
|
|
16460
|
+
for (const runtime of runtimes) {
|
|
16461
|
+
const modules = Object.values(runtime);
|
|
16462
|
+
if (modules.length > MAX_RUNTIME_MODULES)
|
|
16463
|
+
throw new Error("Codex native services are unavailable in this window");
|
|
16464
|
+
for (const [index, module] of modules.entries()) {
|
|
16465
|
+
if (index > 0 && index % RUNTIME_SCAN_SLICE === 0)
|
|
16466
|
+
await new Promise((resolve) => setTimeout(resolve));
|
|
16467
|
+
const values = compiledExportValues(module);
|
|
16468
|
+
scannedExports += values.length;
|
|
16469
|
+
if (scannedExports > MAX_RUNTIME_EXPORTS)
|
|
16470
|
+
throw new Error("Codex native services are unavailable in this window");
|
|
16471
|
+
values.forEach(addMatch);
|
|
16472
|
+
}
|
|
16403
16473
|
}
|
|
16404
16474
|
if (catalog !== void 0 && Reflect.get(ownerWindow, "__codexhostLoadedModulesV1") !== catalog)
|
|
16405
16475
|
throw new Error("Codex loaded module catalog changed during discovery. Try again once ready.");
|
|
@@ -17109,7 +17179,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17109
17179
|
let disposed = false;
|
|
17110
17180
|
let inFlight = false;
|
|
17111
17181
|
let revision = 0;
|
|
17112
|
-
let
|
|
17182
|
+
let context2 = null;
|
|
17113
17183
|
let card = null;
|
|
17114
17184
|
let cardKey = null;
|
|
17115
17185
|
const unsupported = /* @__PURE__ */ new WeakSet();
|
|
@@ -17127,12 +17197,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17127
17197
|
const refresh = async () => {
|
|
17128
17198
|
if (disposed) return;
|
|
17129
17199
|
const next = readContext();
|
|
17130
|
-
if (!same(
|
|
17200
|
+
if (!same(context2, next)) {
|
|
17131
17201
|
clear();
|
|
17132
|
-
|
|
17202
|
+
context2 = next;
|
|
17133
17203
|
revision++;
|
|
17134
17204
|
}
|
|
17135
|
-
const current =
|
|
17205
|
+
const current = context2;
|
|
17136
17206
|
if (!current || inFlight || unsupported.has(current.route)) return;
|
|
17137
17207
|
const startedRevision = revision;
|
|
17138
17208
|
inFlight = true;
|
|
@@ -17177,7 +17247,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17177
17247
|
);
|
|
17178
17248
|
threadQuestionRespondResultSchema.parse(raw2);
|
|
17179
17249
|
drafts.delete(key);
|
|
17180
|
-
if (same(current,
|
|
17250
|
+
if (same(current, context2)) {
|
|
17181
17251
|
revision++;
|
|
17182
17252
|
if (cardKey === key) clear(false);
|
|
17183
17253
|
}
|
|
@@ -17187,7 +17257,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17187
17257
|
current.composer.before(card.root);
|
|
17188
17258
|
} catch (error51) {
|
|
17189
17259
|
if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
|
|
17190
|
-
if (revision === startedRevision && same(current,
|
|
17260
|
+
if (revision === startedRevision && same(current, context2)) clear();
|
|
17191
17261
|
} finally {
|
|
17192
17262
|
inFlight = false;
|
|
17193
17263
|
}
|
|
@@ -17199,7 +17269,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17199
17269
|
return {
|
|
17200
17270
|
refresh,
|
|
17201
17271
|
refreshContext() {
|
|
17202
|
-
if (!same(
|
|
17272
|
+
if (!same(context2, readContext()) || card && !card.root.isConnected) void refresh();
|
|
17203
17273
|
},
|
|
17204
17274
|
dispose() {
|
|
17205
17275
|
disposed = true;
|
|
@@ -17356,11 +17426,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17356
17426
|
for (const row of rows) {
|
|
17357
17427
|
if (row.length !== 24 || row[7] !== null || row[10] !== true || !updates.has(row[13]))
|
|
17358
17428
|
continue;
|
|
17359
|
-
const
|
|
17429
|
+
const context2 = row[12];
|
|
17360
17430
|
const result = row[23];
|
|
17361
|
-
if (
|
|
17431
|
+
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]) {
|
|
17362
17432
|
update ??= row[13];
|
|
17363
|
-
modes.add(
|
|
17433
|
+
modes.add(context2.usesAccountPreferences);
|
|
17364
17434
|
const settings = result.modelSettings;
|
|
17365
17435
|
const group = groups.get(row);
|
|
17366
17436
|
const candidate = group?.[group.indexOf(row) - 1];
|
|
@@ -17506,14 +17576,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17506
17576
|
|
|
17507
17577
|
// ../desktop-control/dist/renderer-host-discovery.js
|
|
17508
17578
|
function requestManagerFromHookState(value, hostId2) {
|
|
17509
|
-
const
|
|
17579
|
+
const record12 = (candidate) => typeof candidate === "object" && candidate !== null;
|
|
17510
17580
|
const manager = (candidate) => {
|
|
17511
|
-
if (!
|
|
17581
|
+
if (!record12(candidate) || !record12(candidate.requestClient) || !record12(candidate.prewarmedThreadManager))
|
|
17512
17582
|
return null;
|
|
17513
17583
|
const bridge = candidate.requestClient;
|
|
17514
17584
|
return typeof candidate.sendRequest === "function" && typeof bridge.sendRequest === "function" && typeof bridge.prewarmThreadStart === "function" && typeof bridge.enqueueRequest === "function" && typeof candidate.prewarmedThreadManager.discardAllPrewarmedThreads === "function" ? candidate : null;
|
|
17515
17585
|
};
|
|
17516
|
-
if (!
|
|
17586
|
+
if (!record12(value))
|
|
17517
17587
|
return null;
|
|
17518
17588
|
const direct = manager(value) ?? manager(value.manager);
|
|
17519
17589
|
if (direct)
|
|
@@ -17576,18 +17646,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17576
17646
|
|
|
17577
17647
|
// ../desktop-control/dist/renderer-host-rpc-discovery.js
|
|
17578
17648
|
function findRendererHostRpcFamily(store) {
|
|
17579
|
-
const
|
|
17649
|
+
const record12 = (value) => typeof value === "object" && value !== null;
|
|
17580
17650
|
const families = /* @__PURE__ */ new Set();
|
|
17581
17651
|
for (const [definition, members] of store.familyBindings) {
|
|
17582
|
-
if (!
|
|
17652
|
+
if (!record12(definition) || definition.kind !== "signal-family")
|
|
17583
17653
|
continue;
|
|
17584
|
-
if (!
|
|
17654
|
+
if (!record12(members) || typeof members.get !== "function")
|
|
17585
17655
|
continue;
|
|
17586
17656
|
for (const [hostId2, member] of members) {
|
|
17587
|
-
if (typeof hostId2 !== "string" ||
|
|
17657
|
+
if (typeof hostId2 !== "string" || !/^(?:local$|durable$|remote[-:])/u.test(hostId2))
|
|
17658
|
+
continue;
|
|
17659
|
+
if (!record12(member))
|
|
17588
17660
|
continue;
|
|
17589
17661
|
const signal = member.value;
|
|
17590
|
-
if (!
|
|
17662
|
+
if (!record12(signal) || typeof signal.get !== "function")
|
|
17591
17663
|
continue;
|
|
17592
17664
|
let value;
|
|
17593
17665
|
try {
|
|
@@ -17595,7 +17667,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17595
17667
|
} catch {
|
|
17596
17668
|
continue;
|
|
17597
17669
|
}
|
|
17598
|
-
if (
|
|
17670
|
+
if (record12(value) && Object.keys(value).length === 2 && typeof value.status === "string" && record12(value.client) && value.client.hostId === hostId2 && "rpc" in value.client) {
|
|
17599
17671
|
families.add(members);
|
|
17600
17672
|
break;
|
|
17601
17673
|
}
|
|
@@ -17606,9 +17678,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17606
17678
|
return { store, family: families.values().next().value };
|
|
17607
17679
|
}
|
|
17608
17680
|
function resolveRendererHostRpc(discovery, hostId2) {
|
|
17609
|
-
const
|
|
17681
|
+
const record12 = (value2) => typeof value2 === "object" && value2 !== null;
|
|
17610
17682
|
const signal = discovery.family.get(hostId2)?.value;
|
|
17611
|
-
if (!
|
|
17683
|
+
if (!record12(signal) || typeof signal.get !== "function")
|
|
17612
17684
|
return null;
|
|
17613
17685
|
let value;
|
|
17614
17686
|
try {
|
|
@@ -17616,10 +17688,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17616
17688
|
} catch {
|
|
17617
17689
|
return null;
|
|
17618
17690
|
}
|
|
17619
|
-
if (!
|
|
17691
|
+
if (!record12(value) || value.status !== "ready" || !record12(value.client) || value.client.hostId !== hostId2)
|
|
17620
17692
|
return null;
|
|
17621
17693
|
const rpc = value.client.rpc;
|
|
17622
|
-
return typeof rpc === "function" ||
|
|
17694
|
+
return typeof rpc === "function" || record12(rpc) ? rpc : null;
|
|
17623
17695
|
}
|
|
17624
17696
|
|
|
17625
17697
|
// ../desktop-control/dist/renderer-schedule-workspace-rpc.js
|
|
@@ -19563,8 +19635,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
19563
19635
|
id: "connections",
|
|
19564
19636
|
label: messages.pageLabels.connections,
|
|
19565
19637
|
icon: "connections",
|
|
19566
|
-
mount(
|
|
19567
|
-
const document2 =
|
|
19638
|
+
mount(context2) {
|
|
19639
|
+
const document2 = context2.content.ownerDocument;
|
|
19568
19640
|
const header = document2.createElement("div");
|
|
19569
19641
|
header.className = "settings-connection-page-header";
|
|
19570
19642
|
const headingCopy = document2.createElement("div");
|
|
@@ -19586,7 +19658,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
19586
19658
|
const syncMessage = document2.createElement("p");
|
|
19587
19659
|
syncMessage.className = "settings-page-description";
|
|
19588
19660
|
syncMessage.setAttribute("role", "status");
|
|
19589
|
-
|
|
19661
|
+
context2.content.append(header, syncMessage, content);
|
|
19590
19662
|
let pending = false;
|
|
19591
19663
|
let selectedHostId = null;
|
|
19592
19664
|
let selectedItemKey = null;
|
|
@@ -19598,12 +19670,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
19598
19670
|
let renderQueued = false;
|
|
19599
19671
|
let renderFrame = null;
|
|
19600
19672
|
const scheduleRender = () => {
|
|
19601
|
-
if (disposed ||
|
|
19673
|
+
if (disposed || context2.signal.aborted || renderQueued) return;
|
|
19602
19674
|
renderQueued = true;
|
|
19603
19675
|
const flush = () => {
|
|
19604
19676
|
renderFrame = null;
|
|
19605
19677
|
renderQueued = false;
|
|
19606
|
-
if (!disposed && !
|
|
19678
|
+
if (!disposed && !context2.signal.aborted) {
|
|
19607
19679
|
render(diagnostics?.snapshot() ?? latestSnapshot);
|
|
19608
19680
|
}
|
|
19609
19681
|
};
|
|
@@ -19622,12 +19694,12 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
19622
19694
|
const versions = createConnectionVersions(
|
|
19623
19695
|
document2,
|
|
19624
19696
|
messages,
|
|
19625
|
-
|
|
19697
|
+
context2.signal,
|
|
19626
19698
|
diagnostics,
|
|
19627
19699
|
scheduleRender
|
|
19628
19700
|
);
|
|
19629
19701
|
const installs = diagnostics ? harnessInstallStore(diagnostics) : null;
|
|
19630
|
-
const updates = createConnectionUpdates(document2, messages,
|
|
19702
|
+
const updates = createConnectionUpdates(document2, messages, context2.signal, scheduleRender);
|
|
19631
19703
|
const runRefresh = () => {
|
|
19632
19704
|
if (pending || !diagnostics) return;
|
|
19633
19705
|
pending = true;
|
|
@@ -19636,7 +19708,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
19636
19708
|
createRendererSettingsIcon("diagnose", 16),
|
|
19637
19709
|
messages.connectionRefreshing
|
|
19638
19710
|
);
|
|
19639
|
-
void
|
|
19711
|
+
void context2.runLatest(() => diagnostics.refresh(), {
|
|
19640
19712
|
success() {
|
|
19641
19713
|
installs?.clearErrors();
|
|
19642
19714
|
pending = false;
|
|
@@ -19992,9 +20064,9 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
19992
20064
|
}
|
|
19993
20065
|
};
|
|
19994
20066
|
render(diagnostics?.snapshot() ?? null);
|
|
19995
|
-
void getRemoteConnections()?.ssh.list(
|
|
20067
|
+
void getRemoteConnections()?.ssh.list(context2.signal).then(
|
|
19996
20068
|
(connections) => {
|
|
19997
|
-
if (
|
|
20069
|
+
if (context2.signal.aborted) return;
|
|
19998
20070
|
for (const connection of connections) {
|
|
19999
20071
|
hostNames.set(connection.hostId, connection.displayName.trim());
|
|
20000
20072
|
}
|
|
@@ -24174,7 +24246,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24174
24246
|
let fiber = fiberName ? Object.getOwnPropertyDescriptor(element, fiberName)?.value : null;
|
|
24175
24247
|
for (let depth = 0; fiber && depth < 60; depth += 1) {
|
|
24176
24248
|
const props = fiber.memoizedProps;
|
|
24177
|
-
if (isRecord(props) && typeof props.onSelectModel === "function" && typeof props.onSelectReasoningEffort === "function" && "
|
|
24249
|
+
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))) {
|
|
24178
24250
|
return true;
|
|
24179
24251
|
}
|
|
24180
24252
|
const parent = fiber.return;
|
|
@@ -24268,8 +24340,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24268
24340
|
}
|
|
24269
24341
|
}
|
|
24270
24342
|
function usagePlacementAnchor(control) {
|
|
24271
|
-
const
|
|
24272
|
-
const contextWrapper =
|
|
24343
|
+
const context2 = control.nativeContextUsageControl?.element;
|
|
24344
|
+
const contextWrapper = context2?.parentElement;
|
|
24273
24345
|
if (contextWrapper?.parentElement) return contextWrapper;
|
|
24274
24346
|
const modelRoot = control.modelPicker?.root;
|
|
24275
24347
|
return modelRoot?.parentElement ? modelRoot : null;
|
|
@@ -24484,7 +24556,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24484
24556
|
const modelReady = selectedModel !== void 0 && selectedCatalogModel !== void 0;
|
|
24485
24557
|
const modelBlocked = state.agent !== "codex" && (modelView.status === "selecting" || !modelReady || !thinkingReady);
|
|
24486
24558
|
const permissionModeBlocked = state.agent !== "codex" && !isPermissionModeControlReady(permissionModeView);
|
|
24487
|
-
const submissionBlocked = switching || ownershipError || modelBlocked || permissionModeBlocked;
|
|
24559
|
+
const submissionBlocked = switching || ownershipError || state.agent !== "codex" && adapterState !== "ready" || modelBlocked || permissionModeBlocked;
|
|
24488
24560
|
if (submissionBlocked && control.sendDisabledBeforeSwitch === null) {
|
|
24489
24561
|
control.sendDisabledBeforeSwitch = control.sendButton.disabled;
|
|
24490
24562
|
control.sendButton.disabled = true;
|
|
@@ -25580,9 +25652,31 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25580
25652
|
};
|
|
25581
25653
|
}
|
|
25582
25654
|
|
|
25655
|
+
// src/renderer-steering-delivery.ts
|
|
25656
|
+
async function inspectRendererSteeringDelivery(send, threadId, text) {
|
|
25657
|
+
const inspect = "codexhost/thread/steering/inspect";
|
|
25658
|
+
try {
|
|
25659
|
+
const response2 = await send(inspect, { threadId, ...text !== void 0 ? { text } : {} });
|
|
25660
|
+
return threadSteeringInspectResultSchema.parse(response2).delivery;
|
|
25661
|
+
} catch (error51) {
|
|
25662
|
+
if (!isUnsupportedMethod(error51, inspect)) throw error51;
|
|
25663
|
+
}
|
|
25664
|
+
const ownership = "codexhost/thread/ownership/list";
|
|
25665
|
+
let response;
|
|
25666
|
+
try {
|
|
25667
|
+
response = await send(ownership, { threadIds: [threadId] });
|
|
25668
|
+
} catch (error51) {
|
|
25669
|
+
if (!isUnsupportedMethod(error51, ownership)) throw error51;
|
|
25670
|
+
await verifyNativeCodexThread(send, threadId);
|
|
25671
|
+
return "official";
|
|
25672
|
+
}
|
|
25673
|
+
const result = threadOwnershipListResultSchema.parse(response);
|
|
25674
|
+
const owner = result.threads.find((thread) => thread.threadId === threadId)?.owner;
|
|
25675
|
+
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
25676
|
+
return owner === "codex" ? "official" : "newTurn";
|
|
25677
|
+
}
|
|
25678
|
+
|
|
25583
25679
|
// src/renderer-external-steering.ts
|
|
25584
|
-
var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
|
|
25585
|
-
var THREAD_OWNERSHIP_LIST_METHOD2 = "codexhost/thread/ownership/list";
|
|
25586
25680
|
function isRecord7(value) {
|
|
25587
25681
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25588
25682
|
}
|
|
@@ -25721,34 +25815,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25721
25815
|
};
|
|
25722
25816
|
});
|
|
25723
25817
|
};
|
|
25724
|
-
const inspectDelivery =
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
});
|
|
25730
|
-
return threadSteeringInspectResultSchema.parse(response).delivery;
|
|
25731
|
-
} catch (error51) {
|
|
25732
|
-
if (!isUnsupportedMethod(error51, THREAD_STEERING_INSPECT_METHOD)) throw error51;
|
|
25733
|
-
}
|
|
25734
|
-
let ownershipResponse;
|
|
25735
|
-
try {
|
|
25736
|
-
ownershipResponse = await originalSend.call(manager, THREAD_OWNERSHIP_LIST_METHOD2, {
|
|
25737
|
-
threadIds: [threadId]
|
|
25738
|
-
});
|
|
25739
|
-
} catch (error51) {
|
|
25740
|
-
if (!isUnsupportedMethod(error51, THREAD_OWNERSHIP_LIST_METHOD2)) throw error51;
|
|
25741
|
-
await verifyNativeCodexThread(
|
|
25742
|
-
(method, params) => originalSend.call(manager, method, params),
|
|
25743
|
-
threadId
|
|
25744
|
-
);
|
|
25745
|
-
return "official";
|
|
25746
|
-
}
|
|
25747
|
-
const ownership = threadOwnershipListResultSchema.parse(ownershipResponse);
|
|
25748
|
-
const owner = ownership.threads.find((thread) => thread.threadId === threadId)?.owner;
|
|
25749
|
-
if (!owner) throw new Error("Thread ownership could not be resolved for steering");
|
|
25750
|
-
return owner === "codex" ? "official" : "newTurn";
|
|
25751
|
-
};
|
|
25818
|
+
const inspectDelivery = (threadId, text) => inspectRendererSteeringDelivery(
|
|
25819
|
+
(method, params) => originalSend.call(manager, method, params),
|
|
25820
|
+
threadId,
|
|
25821
|
+
text
|
|
25822
|
+
);
|
|
25752
25823
|
const steer = async function(...args) {
|
|
25753
25824
|
const [
|
|
25754
25825
|
threadId,
|
|
@@ -25759,7 +25830,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25759
25830
|
clientUserMessageId,
|
|
25760
25831
|
additionalContext,
|
|
25761
25832
|
toolOutput,
|
|
25762
|
-
onMessageAdded
|
|
25833
|
+
onMessageAdded,
|
|
25834
|
+
beforeSendRequest,
|
|
25835
|
+
assertRequestCurrent
|
|
25763
25836
|
] = args;
|
|
25764
25837
|
if (typeof threadId !== "string") return originalSteer.apply(manager, args);
|
|
25765
25838
|
const role = manager.getStreamRole?.(threadId);
|
|
@@ -25818,7 +25891,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25818
25891
|
if (expectedTurnId == null && host.hasPendingTurnStart(threadId)) {
|
|
25819
25892
|
throw new Error("Previous Turn submission has not been confirmed yet");
|
|
25820
25893
|
}
|
|
25821
|
-
const
|
|
25894
|
+
const context2 = restoreMessage.context;
|
|
25822
25895
|
const routeKey = `${threadId}\0${messageId}`;
|
|
25823
25896
|
if (typeof expectedTurnId === "string") routes.set(routeKey, { threadId, expectedTurnId });
|
|
25824
25897
|
const promise2 = Promise.resolve().then(async () => {
|
|
@@ -25838,13 +25911,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25838
25911
|
serviceTier,
|
|
25839
25912
|
model: null,
|
|
25840
25913
|
effort: null,
|
|
25841
|
-
collaborationMode:
|
|
25914
|
+
collaborationMode: context2.collaborationMode ?? null
|
|
25842
25915
|
},
|
|
25843
25916
|
context: {
|
|
25844
25917
|
attachments: attachments ?? [],
|
|
25845
|
-
commentAttachments:
|
|
25846
|
-
mcpAppModelContextAttachments:
|
|
25847
|
-
useAppServerPermissionDefault: true
|
|
25918
|
+
commentAttachments: context2.commentAttachments ?? [],
|
|
25919
|
+
mcpAppModelContextAttachments: context2.mcpAppModelContextAttachments,
|
|
25920
|
+
useAppServerPermissionDefault: true,
|
|
25921
|
+
beforeSendRequest,
|
|
25922
|
+
assertRequestCurrent
|
|
25848
25923
|
}
|
|
25849
25924
|
},
|
|
25850
25925
|
onMessageAdded
|
|
@@ -27320,9 +27395,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27320
27395
|
const connected = !disposed && (client !== null || localClient !== null || (window.__codexhostHostRoutingV1?.knownHostIds?.() ?? []).some(
|
|
27321
27396
|
(hostId2) => window.__codexhostHostRoutingV1?.forHost(hostId2) != null
|
|
27322
27397
|
));
|
|
27398
|
+
const manager = route?.manager;
|
|
27399
|
+
const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
|
|
27400
|
+
const steeringReady = !needsRpcSteering || window.__codexhostRpcSteeringV1 !== void 0;
|
|
27323
27401
|
updateStatus(
|
|
27324
27402
|
connected ? "ready" : "installing",
|
|
27325
|
-
connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
|
|
27403
|
+
connected && !steeringReady ? "native-steering-policy-unavailable" : connected ? "ready" : fiberWalkLimited ? "react-fiber-walk-limit-exceeded" : "draft-routing-policy-unavailable",
|
|
27326
27404
|
connected ? "request-bridge" : null
|
|
27327
27405
|
);
|
|
27328
27406
|
return route;
|
|
@@ -27744,7 +27822,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27744
27822
|
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
27745
27823
|
};
|
|
27746
27824
|
}
|
|
27747
|
-
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices,
|
|
27825
|
+
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke2) {
|
|
27748
27826
|
if (signal?.aborted) return Promise.reject(abortError2());
|
|
27749
27827
|
return new Promise((resolve, reject) => {
|
|
27750
27828
|
let settled = false;
|
|
@@ -27771,7 +27849,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27771
27849
|
const native = await loadCodexNativeServices(ownerWindow, matchesServices);
|
|
27772
27850
|
if (settled) return;
|
|
27773
27851
|
if (!native) throw new Error("Codex native locale services are unavailable");
|
|
27774
|
-
nativeRequest =
|
|
27852
|
+
nativeRequest = invoke2(native);
|
|
27775
27853
|
const response = await nativeRequest;
|
|
27776
27854
|
settle(() => resolve(response));
|
|
27777
27855
|
})().catch((error51) => settle(() => reject(error51)));
|
|
@@ -29248,8 +29326,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29248
29326
|
id: "usage-statistics",
|
|
29249
29327
|
label: messages.label,
|
|
29250
29328
|
icon: "dashboard",
|
|
29251
|
-
mount(
|
|
29252
|
-
const document2 =
|
|
29329
|
+
mount(context2) {
|
|
29330
|
+
const document2 = context2.content.ownerDocument;
|
|
29253
29331
|
const locale = pageLocale ?? (document2.documentElement.lang || "en");
|
|
29254
29332
|
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
29255
29333
|
const count3 = (value) => count2(value, locale);
|
|
@@ -29307,7 +29385,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29307
29385
|
document2,
|
|
29308
29386
|
consoleMessages2,
|
|
29309
29387
|
(method, params2) => request(method, params2, view.hostId),
|
|
29310
|
-
|
|
29388
|
+
context2.signal,
|
|
29311
29389
|
load
|
|
29312
29390
|
);
|
|
29313
29391
|
let offeredHosts = usageHosts ? [] : void 0;
|
|
@@ -29315,7 +29393,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29315
29393
|
label: messages.host,
|
|
29316
29394
|
searchLabel: messages.search,
|
|
29317
29395
|
emptyLabel: messages.noMatches,
|
|
29318
|
-
signal:
|
|
29396
|
+
signal: context2.signal,
|
|
29319
29397
|
searchable: false,
|
|
29320
29398
|
display: (option) => `${messages.host} \xB7 ${option.label}`,
|
|
29321
29399
|
onChange: (key) => {
|
|
@@ -29345,7 +29423,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29345
29423
|
const offerHosts = () => {
|
|
29346
29424
|
if (!usageHosts) return;
|
|
29347
29425
|
void usageHosts().then((hosts) => {
|
|
29348
|
-
if (
|
|
29426
|
+
if (context2.signal.aborted) return;
|
|
29349
29427
|
offeredHosts = hosts;
|
|
29350
29428
|
hostOptions();
|
|
29351
29429
|
}).catch(() => void 0);
|
|
@@ -29371,7 +29449,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29371
29449
|
label: messages.autoRefresh,
|
|
29372
29450
|
searchLabel: messages.search,
|
|
29373
29451
|
emptyLabel: messages.noMatches,
|
|
29374
|
-
signal:
|
|
29452
|
+
signal: context2.signal,
|
|
29375
29453
|
searchable: false,
|
|
29376
29454
|
display: (option) => `${messages.autoRefresh} \xB7 ${option.label}`,
|
|
29377
29455
|
onChange: (key) => {
|
|
@@ -29416,7 +29494,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29416
29494
|
label: messages.filterModel,
|
|
29417
29495
|
searchLabel: messages.search,
|
|
29418
29496
|
emptyLabel: messages.noMatches,
|
|
29419
|
-
signal:
|
|
29497
|
+
signal: context2.signal,
|
|
29420
29498
|
onChange: (key) => {
|
|
29421
29499
|
view.model = key;
|
|
29422
29500
|
changed();
|
|
@@ -29426,7 +29504,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
29426
29504
|
label: messages.filterProject,
|
|
29427
29505
|
searchLabel: messages.search,
|
|
29428
29506
|
emptyLabel: messages.noMatches,
|
|
29429
|
-
signal:
|
|
29507
|
+
signal: context2.signal,
|
|
29430
29508
|
onChange: (key) => {
|
|
29431
29509
|
view.project = key;
|
|
29432
29510
|
changed();
|
|
@@ -30214,7 +30292,7 @@ ${detail}` : ""}`
|
|
|
30214
30292
|
}
|
|
30215
30293
|
function schedule() {
|
|
30216
30294
|
window.clearTimeout(poll);
|
|
30217
|
-
if (
|
|
30295
|
+
if (context2.signal.aborted) return;
|
|
30218
30296
|
if (result && !result.reading.complete) poll = window.setTimeout(load, POLL_MS);
|
|
30219
30297
|
else if (view.autoRefreshMs > 0) poll = window.setTimeout(load, view.autoRefreshMs);
|
|
30220
30298
|
}
|
|
@@ -30232,12 +30310,12 @@ ${detail}` : ""}`
|
|
|
30232
30310
|
} catch {
|
|
30233
30311
|
if (!isCurrent()) return;
|
|
30234
30312
|
}
|
|
30235
|
-
if (!
|
|
30313
|
+
if (!context2.signal.aborted) render();
|
|
30236
30314
|
}
|
|
30237
30315
|
function load() {
|
|
30238
30316
|
window.clearTimeout(poll);
|
|
30239
30317
|
const requested = params();
|
|
30240
|
-
void
|
|
30318
|
+
void context2.runLatest(() => request(USAGE_STATISTICS_METHOD, requested, view.hostId), {
|
|
30241
30319
|
success(value) {
|
|
30242
30320
|
const parsed = usageStatisticsResultSchema.safeParse(value);
|
|
30243
30321
|
if (parsed.success) {
|
|
@@ -30260,7 +30338,7 @@ ${detail}` : ""}`
|
|
|
30260
30338
|
}
|
|
30261
30339
|
});
|
|
30262
30340
|
}
|
|
30263
|
-
|
|
30341
|
+
context2.content.replaceChildren(header, prices.element, filters, notices, body);
|
|
30264
30342
|
render();
|
|
30265
30343
|
offerHosts();
|
|
30266
30344
|
void refreshHarnessNames();
|
|
@@ -32149,8 +32227,8 @@ ${detail}` : ""}`
|
|
|
32149
32227
|
id: "session-import",
|
|
32150
32228
|
label: messages.pageLabels["session-import"],
|
|
32151
32229
|
icon: "session-import",
|
|
32152
|
-
mount(
|
|
32153
|
-
const document2 =
|
|
32230
|
+
mount(context2) {
|
|
32231
|
+
const document2 = context2.content.ownerDocument;
|
|
32154
32232
|
const header = document2.createElement("div");
|
|
32155
32233
|
header.className = "settings-session-import-header";
|
|
32156
32234
|
const heading = document2.createElement("h2");
|
|
@@ -32270,7 +32348,7 @@ ${detail}` : ""}`
|
|
|
32270
32348
|
const content = document2.createElement("section");
|
|
32271
32349
|
content.className = "settings-session-import-content";
|
|
32272
32350
|
const listControls = createSessionImportListControls(document2, messages, () => load());
|
|
32273
|
-
|
|
32351
|
+
context2.content.append(
|
|
32274
32352
|
header,
|
|
32275
32353
|
hostLabel,
|
|
32276
32354
|
harness2,
|
|
@@ -32403,7 +32481,7 @@ ${detail}` : ""}`
|
|
|
32403
32481
|
retry.addEventListener("click", () => {
|
|
32404
32482
|
if (retry.disabled) return;
|
|
32405
32483
|
setRetrying(true);
|
|
32406
|
-
void
|
|
32484
|
+
void context2.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
|
|
32407
32485
|
success() {
|
|
32408
32486
|
setRetrying(false);
|
|
32409
32487
|
},
|
|
@@ -32464,16 +32542,16 @@ ${detail}` : ""}`
|
|
|
32464
32542
|
const actionArea = document2.createElement("div");
|
|
32465
32543
|
actionArea.className = "settings-session-import-row__action";
|
|
32466
32544
|
if (candidate.running === true) {
|
|
32467
|
-
const
|
|
32468
|
-
|
|
32469
|
-
|
|
32470
|
-
|
|
32471
|
-
|
|
32545
|
+
const running2 = document2.createElement("span");
|
|
32546
|
+
running2.className = "settings-session-import-running";
|
|
32547
|
+
running2.textContent = messages.sessionImportRunning;
|
|
32548
|
+
running2.title = messages.sessionImportRunningHint;
|
|
32549
|
+
running2.setAttribute("aria-hidden", "true");
|
|
32472
32550
|
actionArea.append(
|
|
32473
|
-
|
|
32551
|
+
running2,
|
|
32474
32552
|
createAccessibleText(
|
|
32475
32553
|
document2,
|
|
32476
|
-
`${
|
|
32554
|
+
`${running2.textContent}: ${messages.sessionImportRunningHint}`
|
|
32477
32555
|
)
|
|
32478
32556
|
);
|
|
32479
32557
|
}
|
|
@@ -32494,7 +32572,7 @@ ${detail}` : ""}`
|
|
|
32494
32572
|
refresh.disabled = true;
|
|
32495
32573
|
updateImportActions();
|
|
32496
32574
|
let committedThreadId = null;
|
|
32497
|
-
void
|
|
32575
|
+
void context2.runLatest(
|
|
32498
32576
|
async (signal) => {
|
|
32499
32577
|
importStatus.replaceChildren();
|
|
32500
32578
|
const result = await client.importHarnessSession({
|
|
@@ -32538,7 +32616,7 @@ ${detail}` : ""}`
|
|
|
32538
32616
|
updateImportActions();
|
|
32539
32617
|
};
|
|
32540
32618
|
const load = (refreshDiagnostics = false) => {
|
|
32541
|
-
if (importingId !== null ||
|
|
32619
|
+
if (importingId !== null || context2.signal.aborted) return;
|
|
32542
32620
|
loadedClient = null;
|
|
32543
32621
|
let client = getClient(selectedHostId);
|
|
32544
32622
|
if (client?.hostId === "durable") {
|
|
@@ -32554,7 +32632,7 @@ ${detail}` : ""}`
|
|
|
32554
32632
|
else renderUnavailable();
|
|
32555
32633
|
const requestedHarness = selectedHarness;
|
|
32556
32634
|
const pageParams = listControls.params();
|
|
32557
|
-
void
|
|
32635
|
+
void context2.runLatest(
|
|
32558
32636
|
async (signal) => {
|
|
32559
32637
|
if (!client) throw new RendererSessionImportUnavailableError();
|
|
32560
32638
|
const harnesses = await loadSessionImportSources(
|
|
@@ -32620,8 +32698,8 @@ ${detail}` : ""}`
|
|
|
32620
32698
|
}
|
|
32621
32699
|
|
|
32622
32700
|
// src/settings/loaded-sessions-table.ts
|
|
32623
|
-
function mountLoadedSessionsTable(
|
|
32624
|
-
const document2 =
|
|
32701
|
+
function mountLoadedSessionsTable(context2, messages, getClient) {
|
|
32702
|
+
const document2 = context2.content.ownerDocument;
|
|
32625
32703
|
const owner = document2.defaultView;
|
|
32626
32704
|
if (!owner) return () => void 0;
|
|
32627
32705
|
const text = messages.loadedSessions;
|
|
@@ -32657,7 +32735,7 @@ ${detail}` : ""}`
|
|
|
32657
32735
|
scroll.hidden = true;
|
|
32658
32736
|
header.append(title, description);
|
|
32659
32737
|
container.append(header, status, scroll);
|
|
32660
|
-
|
|
32738
|
+
context2.content.append(container);
|
|
32661
32739
|
let disposed = false;
|
|
32662
32740
|
let timer;
|
|
32663
32741
|
let requestTimer;
|
|
@@ -32679,7 +32757,7 @@ ${detail}` : ""}`
|
|
|
32679
32757
|
);
|
|
32680
32758
|
})
|
|
32681
32759
|
]);
|
|
32682
|
-
if (disposed ||
|
|
32760
|
+
if (disposed || context2.signal.aborted) return;
|
|
32683
32761
|
body.replaceChildren();
|
|
32684
32762
|
for (const row of rows.toSorted(
|
|
32685
32763
|
(a, b) => b.inactiveMs - a.inactiveMs || a.harnessId.localeCompare(b.harnessId) || a.threadId.localeCompare(b.threadId)
|
|
@@ -32703,13 +32781,13 @@ ${detail}` : ""}`
|
|
|
32703
32781
|
status.hidden = rows.length > 0;
|
|
32704
32782
|
scroll.hidden = rows.length === 0;
|
|
32705
32783
|
} catch (error51) {
|
|
32706
|
-
if (disposed ||
|
|
32784
|
+
if (disposed || context2.signal.aborted) return;
|
|
32707
32785
|
status.textContent = error51 instanceof RendererMethodUnavailableError ? text.unavailable : text.failed;
|
|
32708
32786
|
status.hidden = false;
|
|
32709
32787
|
scroll.hidden = true;
|
|
32710
32788
|
} finally {
|
|
32711
32789
|
owner.clearTimeout(requestTimer);
|
|
32712
|
-
if (!disposed && !
|
|
32790
|
+
if (!disposed && !context2.signal.aborted)
|
|
32713
32791
|
timer = owner.setTimeout(() => void refresh(), 1e4);
|
|
32714
32792
|
}
|
|
32715
32793
|
};
|
|
@@ -32722,8 +32800,8 @@ ${detail}` : ""}`
|
|
|
32722
32800
|
}
|
|
32723
32801
|
|
|
32724
32802
|
// src/settings/idle-release-controls.ts
|
|
32725
|
-
function mountIdleReleaseControls(
|
|
32726
|
-
const { content } =
|
|
32803
|
+
function mountIdleReleaseControls(context2, messages, getLoadedSessionsClient) {
|
|
32804
|
+
const { content } = context2;
|
|
32727
32805
|
const document2 = content.ownerDocument;
|
|
32728
32806
|
const owner = document2.defaultView;
|
|
32729
32807
|
if (!owner) return () => void 0;
|
|
@@ -32765,7 +32843,7 @@ ${detail}` : ""}`
|
|
|
32765
32843
|
card.append(toggle.item, timeout.item);
|
|
32766
32844
|
content.append(group);
|
|
32767
32845
|
const disposeTable = mountLoadedSessionsTable(
|
|
32768
|
-
{ ...
|
|
32846
|
+
{ ...context2, content: card },
|
|
32769
32847
|
messages,
|
|
32770
32848
|
getLoadedSessionsClient
|
|
32771
32849
|
);
|
|
@@ -32838,8 +32916,8 @@ ${detail}` : ""}`
|
|
|
32838
32916
|
id: "appearance",
|
|
32839
32917
|
label: messages.pageLabels.appearance,
|
|
32840
32918
|
icon: "settings",
|
|
32841
|
-
mount(
|
|
32842
|
-
const document2 =
|
|
32919
|
+
mount(context2) {
|
|
32920
|
+
const document2 = context2.content.ownerDocument;
|
|
32843
32921
|
const ownerWindow = document2.defaultView;
|
|
32844
32922
|
if (!ownerWindow) return;
|
|
32845
32923
|
const heading = document2.createElement("div");
|
|
@@ -32866,9 +32944,9 @@ ${detail}` : ""}`
|
|
|
32866
32944
|
ownerWindow.addEventListener(REASONING_SOFT_WRAP_CHANGE_EVENT, sync);
|
|
32867
32945
|
row.item.append(toggle);
|
|
32868
32946
|
card.append(row.item);
|
|
32869
|
-
|
|
32947
|
+
context2.content.append(heading, description, group);
|
|
32870
32948
|
const disposeIdleRelease = mountIdleReleaseControls(
|
|
32871
|
-
|
|
32949
|
+
context2,
|
|
32872
32950
|
messages,
|
|
32873
32951
|
getLoadedSessionsClient
|
|
32874
32952
|
);
|
|
@@ -33105,7 +33183,7 @@ ${detail}` : ""}`
|
|
|
33105
33183
|
}
|
|
33106
33184
|
function defaultImportName(source, existing) {
|
|
33107
33185
|
const base = source.provider === "openai-codex" ? "codex" : "grok";
|
|
33108
|
-
const used = new Set(existing.map((
|
|
33186
|
+
const used = new Set(existing.map((record12) => record12.name));
|
|
33109
33187
|
const valid = (name) => credentialImportNameSchema.safeParse(name).success;
|
|
33110
33188
|
if (!used.has(base)) return base;
|
|
33111
33189
|
const local = source.label.includes("@") ? source.label.split("@")[0] ?? "" : "";
|
|
@@ -33128,7 +33206,7 @@ ${detail}` : ""}`
|
|
|
33128
33206
|
const shown = (text) => accountDisplayText(text, hideEmails);
|
|
33129
33207
|
const targetButtons = /* @__PURE__ */ new Map();
|
|
33130
33208
|
const importedRecords = () => snapshot.targets.find((target) => target.harnessId === TARGET_HARNESS_ID)?.imports ?? [];
|
|
33131
|
-
const sourceOf = (
|
|
33209
|
+
const sourceOf = (record12) => snapshot.sources.find((source) => source.id === record12.source.id);
|
|
33132
33210
|
const piTarget = () => snapshot.targets.find((candidate) => candidate.harnessId === TARGET_HARNESS_ID);
|
|
33133
33211
|
const compatibleSources = () => {
|
|
33134
33212
|
const target = piTarget();
|
|
@@ -33166,7 +33244,7 @@ ${detail}` : ""}`
|
|
|
33166
33244
|
sectionImport.addEventListener("click", () => {
|
|
33167
33245
|
const sources = compatibleSources();
|
|
33168
33246
|
const free = sources.find(
|
|
33169
|
-
(source2) => !importedRecords().some((
|
|
33247
|
+
(source2) => !importedRecords().some((record12) => record12.source.id === source2.id)
|
|
33170
33248
|
);
|
|
33171
33249
|
const source = free ?? sources[0];
|
|
33172
33250
|
if (source) openDialog("add", { source, choose: true }, SECTION_IMPORT_KEY);
|
|
@@ -33216,30 +33294,30 @@ ${detail}` : ""}`
|
|
|
33216
33294
|
mark.append(createRendererAgentIcon(agent ?? "pi", 26, document2, pluginFor(agent ?? "pi")));
|
|
33217
33295
|
return mark;
|
|
33218
33296
|
};
|
|
33219
|
-
const renderRow = (
|
|
33297
|
+
const renderRow = (record12) => {
|
|
33220
33298
|
const row = document2.createElement("div");
|
|
33221
33299
|
row.className = "settings-pi-accounts__row";
|
|
33222
33300
|
row.tabIndex = -1;
|
|
33223
|
-
row.dataset.importName =
|
|
33224
|
-
row.setAttribute("aria-label", shown(
|
|
33225
|
-
const agent =
|
|
33301
|
+
row.dataset.importName = record12.name;
|
|
33302
|
+
row.setAttribute("aria-label", shown(record12.source.label));
|
|
33303
|
+
const agent = record12.source.harnessId;
|
|
33226
33304
|
const mark = createMark(agent);
|
|
33227
33305
|
const identity = document2.createElement("div");
|
|
33228
33306
|
identity.className = "settings-pi-accounts__identity";
|
|
33229
33307
|
const label = document2.createElement("strong");
|
|
33230
33308
|
label.className = "settings-account-email";
|
|
33231
|
-
label.textContent = shown(
|
|
33309
|
+
label.textContent = shown(record12.source.label);
|
|
33232
33310
|
label.title = label.textContent;
|
|
33233
33311
|
label.translate = false;
|
|
33234
33312
|
const meta3 = document2.createElement("div");
|
|
33235
33313
|
meta3.className = "settings-account-metadata";
|
|
33236
|
-
const source = sourceOf(
|
|
33314
|
+
const source = sourceOf(record12);
|
|
33237
33315
|
const parts = [
|
|
33238
33316
|
metaPart(rendererAgentLabel(agent, pluginFor(agent)), "settings-pi-accounts__agent"),
|
|
33239
|
-
metaPart(`${
|
|
33317
|
+
metaPart(`${record12.name}/\u2026`, void 0, true),
|
|
33240
33318
|
metaPart(messages.copied)
|
|
33241
33319
|
];
|
|
33242
|
-
const time3 = formatImportedAt(
|
|
33320
|
+
const time3 = formatImportedAt(record12.importedAt);
|
|
33243
33321
|
if (time3) parts.push(metaPart(time3));
|
|
33244
33322
|
parts.forEach((part, index) => {
|
|
33245
33323
|
if (index > 0) {
|
|
@@ -33256,23 +33334,23 @@ ${detail}` : ""}`
|
|
|
33256
33334
|
reimport.type = "button";
|
|
33257
33335
|
reimport.className = "settings-account-action";
|
|
33258
33336
|
reimport.textContent = messages.rowReimport;
|
|
33259
|
-
reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(
|
|
33337
|
+
reimport.setAttribute("aria-label", `${messages.reimport}: ${shown(record12.source.label)}`);
|
|
33260
33338
|
reimport.disabled = busy || !source;
|
|
33261
33339
|
reimport.title = messages.reimport;
|
|
33262
33340
|
reimport.addEventListener("click", () => {
|
|
33263
|
-
if (source) openDialog("reimport", { source, record:
|
|
33341
|
+
if (source) openDialog("reimport", { source, record: record12 }, `row:${record12.name}`);
|
|
33264
33342
|
});
|
|
33265
33343
|
const remove = document2.createElement("button");
|
|
33266
33344
|
remove.type = "button";
|
|
33267
33345
|
remove.className = "settings-account-action settings-pi-accounts__remove";
|
|
33268
33346
|
remove.textContent = messages.rowRemove;
|
|
33269
|
-
remove.setAttribute("aria-label", `${messages.remove}: ${shown(
|
|
33347
|
+
remove.setAttribute("aria-label", `${messages.remove}: ${shown(record12.source.label)}`);
|
|
33270
33348
|
remove.disabled = busy;
|
|
33271
|
-
remove.addEventListener("click", () => openDialog("remove", { record:
|
|
33349
|
+
remove.addEventListener("click", () => openDialog("remove", { record: record12 }, `row:${record12.name}`));
|
|
33272
33350
|
if (source) actions.append(reimport);
|
|
33273
33351
|
actions.append(remove);
|
|
33274
33352
|
row.append(mark, identity, actions);
|
|
33275
|
-
rows.set(
|
|
33353
|
+
rows.set(record12.name, row);
|
|
33276
33354
|
return row;
|
|
33277
33355
|
};
|
|
33278
33356
|
const loginTypeLabel = (type) => type === "oauth" ? messages.typeOauth : type === "api_key" ? messages.typeApiKey : messages.typeOther;
|
|
@@ -33425,7 +33503,7 @@ ${detail}` : ""}`
|
|
|
33425
33503
|
const label = document2.createElement("strong");
|
|
33426
33504
|
label.textContent = shown(choice.label);
|
|
33427
33505
|
label.translate = false;
|
|
33428
|
-
const existing = importedRecords().find((
|
|
33506
|
+
const existing = importedRecords().find((record12) => record12.source.id === choice.id);
|
|
33429
33507
|
const agent = choice.harnessId;
|
|
33430
33508
|
const detail = document2.createElement("span");
|
|
33431
33509
|
detail.textContent = [
|
|
@@ -33466,7 +33544,7 @@ ${detail}` : ""}`
|
|
|
33466
33544
|
const name = request.action === "list" ? void 0 : request.name;
|
|
33467
33545
|
state = {
|
|
33468
33546
|
source: state.source,
|
|
33469
|
-
record: importedRecords().find((
|
|
33547
|
+
record: importedRecords().find((record12) => record12.name === name) ?? state.record
|
|
33470
33548
|
};
|
|
33471
33549
|
show(next);
|
|
33472
33550
|
} else {
|
|
@@ -33480,12 +33558,12 @@ ${detail}` : ""}`
|
|
|
33480
33558
|
sourceRadios = [];
|
|
33481
33559
|
body.replaceChildren();
|
|
33482
33560
|
controls.replaceChildren();
|
|
33483
|
-
const { source, record:
|
|
33561
|
+
const { source, record: record12 } = state;
|
|
33484
33562
|
const close = () => modal.close();
|
|
33485
33563
|
if (mode === "add" || mode === "reimport") {
|
|
33486
33564
|
title.textContent = mode === "add" ? messages.add : messages.reimport;
|
|
33487
33565
|
modal.setAttribute("aria-label", title.textContent);
|
|
33488
|
-
const active = source ??
|
|
33566
|
+
const active = source ?? record12?.source;
|
|
33489
33567
|
const choices = mode === "add" && state.choose ? compatibleSources() : [];
|
|
33490
33568
|
if (choices.length > 1) body.append(sourcePicker(choices));
|
|
33491
33569
|
else if (active) body.append(line(messages.source, shown(active.label)));
|
|
@@ -33494,8 +33572,8 @@ ${detail}` : ""}`
|
|
|
33494
33572
|
input.maxLength = 48;
|
|
33495
33573
|
input.autocomplete = "off";
|
|
33496
33574
|
input.spellcheck = false;
|
|
33497
|
-
input.value =
|
|
33498
|
-
input.readOnly = Boolean(
|
|
33575
|
+
input.value = record12?.name ?? (source ? defaultImportName(source, importedRecords()) : "codex");
|
|
33576
|
+
input.readOnly = Boolean(record12);
|
|
33499
33577
|
input.addEventListener("input", () => {
|
|
33500
33578
|
nameEdited = true;
|
|
33501
33579
|
});
|
|
@@ -33529,7 +33607,7 @@ ${detail}` : ""}`
|
|
|
33529
33607
|
{
|
|
33530
33608
|
action: mode === "reimport" ? "reimport" : "import",
|
|
33531
33609
|
sourceId: source2.id,
|
|
33532
|
-
name:
|
|
33610
|
+
name: record12?.name ?? input.value,
|
|
33533
33611
|
confirmed: true
|
|
33534
33612
|
},
|
|
33535
33613
|
"done"
|
|
@@ -33539,16 +33617,16 @@ ${detail}` : ""}`
|
|
|
33539
33617
|
)
|
|
33540
33618
|
);
|
|
33541
33619
|
(mode === "add" ? input : controls.children[0]).focus();
|
|
33542
|
-
} else if (mode === "remove" &&
|
|
33620
|
+
} else if (mode === "remove" && record12) {
|
|
33543
33621
|
title.textContent = messages.remove;
|
|
33544
33622
|
modal.setAttribute("aria-label", title.textContent);
|
|
33545
|
-
body.append(note(messages.removeWarning.replace("{name}",
|
|
33623
|
+
body.append(note(messages.removeWarning.replace("{name}", record12.name)));
|
|
33546
33624
|
const cancel = command(messages.cancel, close);
|
|
33547
33625
|
controls.append(
|
|
33548
33626
|
cancel,
|
|
33549
33627
|
command(
|
|
33550
33628
|
messages.remove,
|
|
33551
|
-
() => submit({ action: "remove", name:
|
|
33629
|
+
() => submit({ action: "remove", name: record12.name, confirmed: true }, null),
|
|
33552
33630
|
"danger"
|
|
33553
33631
|
)
|
|
33554
33632
|
);
|
|
@@ -33556,7 +33634,7 @@ ${detail}` : ""}`
|
|
|
33556
33634
|
} else {
|
|
33557
33635
|
title.textContent = messages.doneTitle;
|
|
33558
33636
|
modal.setAttribute("aria-label", title.textContent);
|
|
33559
|
-
const name =
|
|
33637
|
+
const name = record12?.name;
|
|
33560
33638
|
if (name) body.append(line(messages.entry, `${name}/\u2026`, true));
|
|
33561
33639
|
body.append(note(messages.done));
|
|
33562
33640
|
const done = command(messages.close, close, "primary");
|
|
@@ -33603,21 +33681,21 @@ ${detail}` : ""}`
|
|
|
33603
33681
|
(candidate) => candidate.harnessId === TARGET_HARNESS_ID && source && candidate.providers.includes(source.provider)
|
|
33604
33682
|
);
|
|
33605
33683
|
if (!source || !target) return null;
|
|
33606
|
-
const
|
|
33684
|
+
const record12 = target.imports.find((candidate) => candidate.source.id === source.id);
|
|
33607
33685
|
const key = `${harnessId}:${accountLabel}:import`;
|
|
33608
33686
|
const button2 = document2.createElement("button");
|
|
33609
33687
|
button2.type = "button";
|
|
33610
33688
|
button2.className = "settings-account-pi-import";
|
|
33611
33689
|
button2.dataset.accountFocus = key;
|
|
33612
33690
|
button2.disabled = busy;
|
|
33613
|
-
const hint =
|
|
33691
|
+
const hint = record12 ? messages.importedHint.replace("{name}", record12.name) : messages.add;
|
|
33614
33692
|
button2.title = hint;
|
|
33615
33693
|
button2.setAttribute("aria-label", hint);
|
|
33616
33694
|
button2.append(createRendererAgentIcon("pi", 12, document2, pluginFor("pi")));
|
|
33617
|
-
if (
|
|
33695
|
+
if (record12) {
|
|
33618
33696
|
button2.dataset.state = "imported";
|
|
33619
33697
|
const name = document2.createElement("code");
|
|
33620
|
-
name.textContent = `${
|
|
33698
|
+
name.textContent = `${record12.name}/\u2026`;
|
|
33621
33699
|
name.translate = false;
|
|
33622
33700
|
button2.append(name, createRendererSettingsIcon("check", 12));
|
|
33623
33701
|
} else {
|
|
@@ -33625,7 +33703,7 @@ ${detail}` : ""}`
|
|
|
33625
33703
|
button2.append(messages.add);
|
|
33626
33704
|
}
|
|
33627
33705
|
button2.addEventListener("click", () => {
|
|
33628
|
-
if (!
|
|
33706
|
+
if (!record12) {
|
|
33629
33707
|
openDialog("add", { source }, key);
|
|
33630
33708
|
return;
|
|
33631
33709
|
}
|
|
@@ -33634,7 +33712,7 @@ ${detail}` : ""}`
|
|
|
33634
33712
|
renderSection();
|
|
33635
33713
|
sectionToggle.setAttribute("aria-expanded", "true");
|
|
33636
33714
|
}
|
|
33637
|
-
const row = rows.get(
|
|
33715
|
+
const row = rows.get(record12.name);
|
|
33638
33716
|
row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
33639
33717
|
row?.focus();
|
|
33640
33718
|
});
|
|
@@ -34337,8 +34415,8 @@ ${detail}` : ""}`
|
|
|
34337
34415
|
id: "accounts",
|
|
34338
34416
|
label: messages.pageLabels.accounts,
|
|
34339
34417
|
icon: "accounts",
|
|
34340
|
-
mount(
|
|
34341
|
-
const document2 =
|
|
34418
|
+
mount(context2) {
|
|
34419
|
+
const document2 = context2.content.ownerDocument;
|
|
34342
34420
|
const header = document2.createElement("div");
|
|
34343
34421
|
header.className = "settings-account-header";
|
|
34344
34422
|
const copy = document2.createElement("div");
|
|
@@ -34423,15 +34501,15 @@ ${detail}` : ""}`
|
|
|
34423
34501
|
let plugins = [];
|
|
34424
34502
|
const pluginFor = (id) => plugins.find((plugin) => plugin.id === id);
|
|
34425
34503
|
const credentialImports = mountCredentialImports(
|
|
34426
|
-
|
|
34427
|
-
|
|
34504
|
+
context2.content,
|
|
34505
|
+
context2.signal,
|
|
34428
34506
|
getClient,
|
|
34429
34507
|
messages.credentialImports,
|
|
34430
34508
|
() => render(),
|
|
34431
34509
|
pluginFor
|
|
34432
34510
|
);
|
|
34433
|
-
|
|
34434
|
-
const stopCountdowns = mountAccountResetCountdowns(list, messages,
|
|
34511
|
+
context2.content.append(header, status, toolbar, list, credentialImports.section);
|
|
34512
|
+
const stopCountdowns = mountAccountResetCountdowns(list, messages, context2.signal);
|
|
34435
34513
|
let accounts = [];
|
|
34436
34514
|
let currentAccountId = null;
|
|
34437
34515
|
let accountPhase = "unavailable";
|
|
@@ -34537,7 +34615,7 @@ ${detail}` : ""}`
|
|
|
34537
34615
|
requests.map(async ({ account, loading }) => {
|
|
34538
34616
|
try {
|
|
34539
34617
|
const result = await inspect({ accountId: account.accountId });
|
|
34540
|
-
if (
|
|
34618
|
+
if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
|
|
34541
34619
|
return;
|
|
34542
34620
|
usageByAccountId.set(
|
|
34543
34621
|
account.accountId,
|
|
@@ -34549,7 +34627,7 @@ ${detail}` : ""}`
|
|
|
34549
34627
|
} : { status: "empty" }
|
|
34550
34628
|
);
|
|
34551
34629
|
} catch {
|
|
34552
|
-
if (
|
|
34630
|
+
if (context2.signal.aborted || usageByAccountId.get(account.accountId) !== loading)
|
|
34553
34631
|
return;
|
|
34554
34632
|
usageByAccountId.set(account.accountId, { status: "error" });
|
|
34555
34633
|
}
|
|
@@ -34578,7 +34656,7 @@ ${detail}` : ""}`
|
|
|
34578
34656
|
};
|
|
34579
34657
|
const refreshInBackground = () => {
|
|
34580
34658
|
if (!client().refreshCodexAccounts) return;
|
|
34581
|
-
void
|
|
34659
|
+
void context2.runLatest(
|
|
34582
34660
|
() => client().refreshCodexAccounts?.() ?? client().listCodexAccounts(),
|
|
34583
34661
|
{
|
|
34584
34662
|
success(result) {
|
|
@@ -34590,7 +34668,7 @@ ${detail}` : ""}`
|
|
|
34590
34668
|
);
|
|
34591
34669
|
};
|
|
34592
34670
|
const load = () => {
|
|
34593
|
-
void
|
|
34671
|
+
void context2.runLatest(() => client().listCodexAccounts(), {
|
|
34594
34672
|
success(result) {
|
|
34595
34673
|
loadMessage = null;
|
|
34596
34674
|
setAccounts(result);
|
|
@@ -34610,10 +34688,10 @@ ${detail}` : ""}`
|
|
|
34610
34688
|
});
|
|
34611
34689
|
} catch {
|
|
34612
34690
|
}
|
|
34613
|
-
const harnessAccounts = createHarnessAccounts(
|
|
34691
|
+
const harnessAccounts = createHarnessAccounts(context2.signal, getClient, render);
|
|
34614
34692
|
const directoryClient = getClient();
|
|
34615
34693
|
void directoryClient?.listHarnessPlugins?.().then(({ plugins: next }) => {
|
|
34616
|
-
if (
|
|
34694
|
+
if (context2.signal.aborted || getClient() !== directoryClient) return;
|
|
34617
34695
|
plugins = next;
|
|
34618
34696
|
render();
|
|
34619
34697
|
void credentialImports.refresh();
|
|
@@ -34636,14 +34714,14 @@ ${detail}` : ""}`
|
|
|
34636
34714
|
id: "harness-schedules",
|
|
34637
34715
|
label: t("\u5B9A\u65F6\u4EFB\u52A1", "Schedules"),
|
|
34638
34716
|
icon: "schedules",
|
|
34639
|
-
mount(
|
|
34717
|
+
mount(context2) {
|
|
34640
34718
|
const navigate = () => {
|
|
34641
|
-
|
|
34642
|
-
void
|
|
34719
|
+
context2.content.replaceChildren();
|
|
34720
|
+
void context2.runLatest((signal) => options.openSchedules(signal), {
|
|
34643
34721
|
success() {
|
|
34644
34722
|
},
|
|
34645
34723
|
failure() {
|
|
34646
|
-
const document2 =
|
|
34724
|
+
const document2 = context2.content.ownerDocument;
|
|
34647
34725
|
const status = document2.createElement("p");
|
|
34648
34726
|
status.setAttribute("role", "status");
|
|
34649
34727
|
status.className = "text-sm text-settings-muted";
|
|
@@ -34656,7 +34734,7 @@ ${detail}` : ""}`
|
|
|
34656
34734
|
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";
|
|
34657
34735
|
retry.textContent = t("\u91CD\u8BD5", "Retry");
|
|
34658
34736
|
retry.addEventListener("click", navigate);
|
|
34659
|
-
|
|
34737
|
+
context2.content.replaceChildren(status, retry);
|
|
34660
34738
|
}
|
|
34661
34739
|
});
|
|
34662
34740
|
};
|
|
@@ -34819,8 +34897,8 @@ ${detail}` : ""}`
|
|
|
34819
34897
|
id: "about",
|
|
34820
34898
|
label: messages.pageLabels.about,
|
|
34821
34899
|
icon: "about",
|
|
34822
|
-
mount(
|
|
34823
|
-
const document2 =
|
|
34900
|
+
mount(context2) {
|
|
34901
|
+
const document2 = context2.content.ownerDocument;
|
|
34824
34902
|
const heading = document2.createElement("div");
|
|
34825
34903
|
heading.className = "settings-section-label";
|
|
34826
34904
|
heading.textContent = messages.pageLabels.about;
|
|
@@ -34862,7 +34940,7 @@ ${detail}` : ""}`
|
|
|
34862
34940
|
panel.append(product, tagline, introduction, starCallout, repositorySection);
|
|
34863
34941
|
const consoleEntry = consoleSection(document2, messages, getClient());
|
|
34864
34942
|
if (consoleEntry) panel.append(consoleEntry);
|
|
34865
|
-
|
|
34943
|
+
context2.content.append(heading, panel);
|
|
34866
34944
|
return void 0;
|
|
34867
34945
|
}
|
|
34868
34946
|
});
|
|
@@ -34889,8 +34967,8 @@ ${detail}` : ""}`
|
|
|
34889
34967
|
id: "updates",
|
|
34890
34968
|
label: messages.pageLabels.updates,
|
|
34891
34969
|
icon: "updates",
|
|
34892
|
-
mount(
|
|
34893
|
-
const document2 =
|
|
34970
|
+
mount(context2) {
|
|
34971
|
+
const document2 = context2.content.ownerDocument;
|
|
34894
34972
|
const windows = isWindowsRenderer(document2.defaultView);
|
|
34895
34973
|
const heading = document2.createElement("div");
|
|
34896
34974
|
heading.className = "settings-section-label";
|
|
@@ -34991,7 +35069,7 @@ ${detail}` : ""}`
|
|
|
34991
35069
|
const notes = document2.createElement("div");
|
|
34992
35070
|
notes.className = "settings-update-notes-section";
|
|
34993
35071
|
const starBanner = updateStarBanner(document2, messages);
|
|
34994
|
-
|
|
35072
|
+
context2.content.append(heading, metadata, panel, controls, starBanner, notes);
|
|
34995
35073
|
const setManualFallback = (fallback) => {
|
|
34996
35074
|
controls.className = fallback ? "settings-update-controls" : "settings-update-controls is-quiet";
|
|
34997
35075
|
manualNpmDescription.textContent = fallback ? messages.updateManualFallbackDescription : messages.updateManualNpmDescription;
|
|
@@ -35044,7 +35122,7 @@ ${detail}` : ""}`
|
|
|
35044
35122
|
}
|
|
35045
35123
|
pollAttempts += 1;
|
|
35046
35124
|
pollTimer = document2.defaultView?.setTimeout(() => {
|
|
35047
|
-
void
|
|
35125
|
+
void context2.runLatest(
|
|
35048
35126
|
(signal) => runBoundedRendererUpdateRequest(() => client.readUpdateStatus(), signal),
|
|
35049
35127
|
{
|
|
35050
35128
|
success(result) {
|
|
@@ -35091,7 +35169,7 @@ ${detail}` : ""}`
|
|
|
35091
35169
|
if (pending) return;
|
|
35092
35170
|
pending = true;
|
|
35093
35171
|
renderPendingStatus(null, messages.updatePreparing);
|
|
35094
|
-
void
|
|
35172
|
+
void context2.runLatest(
|
|
35095
35173
|
(signal) => runBoundedRendererUpdateRequest(() => client.startUpdate(), signal),
|
|
35096
35174
|
{
|
|
35097
35175
|
success(result) {
|
|
@@ -35197,7 +35275,7 @@ ${detail}` : ""}`
|
|
|
35197
35275
|
}
|
|
35198
35276
|
pending = true;
|
|
35199
35277
|
renderPendingStatus(null, messages.updateChecking);
|
|
35200
|
-
return
|
|
35278
|
+
return context2.runLatest(
|
|
35201
35279
|
(signal) => runBoundedRendererUpdateRequest(() => client.checkUpdate(), signal),
|
|
35202
35280
|
{
|
|
35203
35281
|
success(result) {
|
|
@@ -42578,7 +42656,11 @@ ${usage_default}`;
|
|
|
42578
42656
|
const agent = controller.get(mounted.composer).agent;
|
|
42579
42657
|
return state.plugins && agent !== "codex" && !state.plugins.some(({ id }) => id === agent) ? { ...state.availability, [agent]: "unavailable" } : state.availability;
|
|
42580
42658
|
};
|
|
42581
|
-
const composerAdapterState = (mounted) =>
|
|
42659
|
+
const composerAdapterState = (mounted) => {
|
|
42660
|
+
const manager = mounted.hostId ? window.__codexhostHostRoutingV1?.forHost(mounted.hostId)?.manager : null;
|
|
42661
|
+
const needsRpcSteering = manager != null && "kind" in manager && manager.kind === "main-process-rpc";
|
|
42662
|
+
return composerClient(mounted) && (!needsRpcSteering || window.__codexhostRpcSteeringV1) ? "ready" : "installing";
|
|
42663
|
+
};
|
|
42582
42664
|
const renderMounted = (mounted) => {
|
|
42583
42665
|
if (!isMountedComposer(mounted.composer)) return;
|
|
42584
42666
|
const hostId2 = mounted.hostId;
|
|
@@ -42799,7 +42881,7 @@ ${usage_default}`;
|
|
|
42799
42881
|
const isExternalConfigurationReady = (mounted) => {
|
|
42800
42882
|
const current = controller.get(mounted.composer);
|
|
42801
42883
|
if (current.agent === "codex") return true;
|
|
42802
|
-
return isExternalConfigurationReadyView(mounted.modelView, mounted.permissionModeView);
|
|
42884
|
+
return composerAdapterState(mounted) === "ready" && isExternalConfigurationReadyView(mounted.modelView, mounted.permissionModeView);
|
|
42803
42885
|
};
|
|
42804
42886
|
const clearDraftPrewarm = async (composer) => {
|
|
42805
42887
|
const policy = await waitForRendererDraftPrewarmPolicy(window, composer);
|
|
@@ -44619,7 +44701,268 @@ ${usage_default}`;
|
|
|
44619
44701
|
return binding;
|
|
44620
44702
|
}
|
|
44621
44703
|
|
|
44704
|
+
// src/renderer-rpc-steering-queue.ts
|
|
44705
|
+
var INTERRUPTED = "Interrupted before the steer was accepted.";
|
|
44706
|
+
var record10 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
44707
|
+
async function prepareRpcSteeringQueue(hostId2, threadId, manager, coordinator, messageId) {
|
|
44708
|
+
const snapshot = Promise.withResolvers();
|
|
44709
|
+
let lease;
|
|
44710
|
+
let released = false;
|
|
44711
|
+
const dispose = (value) => {
|
|
44712
|
+
if (value != null) value[Symbol.dispose]?.();
|
|
44713
|
+
};
|
|
44714
|
+
const pending = manager("subscribe", {
|
|
44715
|
+
type: "thread",
|
|
44716
|
+
key: { hostId: hostId2, threadId },
|
|
44717
|
+
field: "queuedMessages",
|
|
44718
|
+
listener(value) {
|
|
44719
|
+
if (Array.isArray(value)) snapshot.resolve(value);
|
|
44720
|
+
}
|
|
44721
|
+
});
|
|
44722
|
+
let timeout;
|
|
44723
|
+
let messages;
|
|
44724
|
+
try {
|
|
44725
|
+
timeout = setTimeout(
|
|
44726
|
+
() => snapshot.reject(new Error("Native follow-up queue did not become ready")),
|
|
44727
|
+
5e3
|
|
44728
|
+
);
|
|
44729
|
+
const ready = Promise.resolve(pending).then((value) => {
|
|
44730
|
+
if (released) dispose(value);
|
|
44731
|
+
else lease = value;
|
|
44732
|
+
});
|
|
44733
|
+
[messages] = await Promise.all([snapshot.promise, ready]);
|
|
44734
|
+
} finally {
|
|
44735
|
+
released = true;
|
|
44736
|
+
clearTimeout(timeout);
|
|
44737
|
+
for (const value of /* @__PURE__ */ new Set([pending, lease])) dispose(value);
|
|
44738
|
+
}
|
|
44739
|
+
if (messages.some(
|
|
44740
|
+
(message2) => record10(message2) && message2.id !== messageId && message2.pausedReason === INTERRUPTED
|
|
44741
|
+
))
|
|
44742
|
+
throw new Error(
|
|
44743
|
+
"Resume or remove the other previously paused messages before changing direction"
|
|
44744
|
+
);
|
|
44745
|
+
return async (turnId) => {
|
|
44746
|
+
await coordinator("removeQueuedMessage", threadId, messageId);
|
|
44747
|
+
const state = await manager("getThreadExecutionState", threadId);
|
|
44748
|
+
const stillRunning = record10(state) && state.inProgress === true && state.activeTurnId === turnId;
|
|
44749
|
+
const turn = stillRunning ? null : await manager("getTurnById", threadId, turnId);
|
|
44750
|
+
if (stillRunning || record10(turn) && turn.status === "completed")
|
|
44751
|
+
await coordinator("resumeInterruptedQueuedMessages", threadId);
|
|
44752
|
+
};
|
|
44753
|
+
}
|
|
44754
|
+
|
|
44755
|
+
// src/renderer-rpc-steering.ts
|
|
44756
|
+
var record11 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
44757
|
+
var invoke = (target, name, ...args) => Reflect.apply(Reflect.get(target, name), target, args);
|
|
44758
|
+
var running = (state) => record11(state) && (state.inProgress === true || !!state.activeTurnId);
|
|
44759
|
+
var context = (previous, marker) => ({
|
|
44760
|
+
...record11(previous) ? previous : {},
|
|
44761
|
+
[THREAD_STEERING_CONTEXT_PARAM]: { kind: "application", value: JSON.stringify(marker) }
|
|
44762
|
+
});
|
|
44763
|
+
function installRendererRpcSteering(value) {
|
|
44764
|
+
if (!record11(value) || typeof value.forHost !== "function") return null;
|
|
44765
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, "forHost");
|
|
44766
|
+
if (!descriptor?.writable) return null;
|
|
44767
|
+
const controller = value;
|
|
44768
|
+
const original = controller.forHost;
|
|
44769
|
+
const cached2 = /* @__PURE__ */ new WeakMap();
|
|
44770
|
+
let disposed = false;
|
|
44771
|
+
const wrap = (rpc, hostId2, owner = rpc) => {
|
|
44772
|
+
const existing = cached2.get(rpc);
|
|
44773
|
+
if (existing) return existing;
|
|
44774
|
+
const current = () => {
|
|
44775
|
+
if (disposed || original.call(controller, hostId2) !== owner)
|
|
44776
|
+
throw new Error("Steering connection was retired");
|
|
44777
|
+
};
|
|
44778
|
+
const inspect = async (threadId, input) => {
|
|
44779
|
+
const text = Array.isArray(input) ? input.filter(record11).map((item) => typeof item.text === "string" ? item.text : "").join("\n") : "";
|
|
44780
|
+
current();
|
|
44781
|
+
const delivery = await inspectRendererSteeringDelivery(
|
|
44782
|
+
(method, params) => {
|
|
44783
|
+
current();
|
|
44784
|
+
return invoke(rpc, "sendRequest", method, params);
|
|
44785
|
+
},
|
|
44786
|
+
threadId,
|
|
44787
|
+
text
|
|
44788
|
+
);
|
|
44789
|
+
current();
|
|
44790
|
+
return delivery;
|
|
44791
|
+
};
|
|
44792
|
+
const target = async (threadId, messageId, delivery) => {
|
|
44793
|
+
const state = await invoke(rpc, "getThreadExecutionState", threadId);
|
|
44794
|
+
current();
|
|
44795
|
+
if (!record11(state) || typeof state.activeTurnId !== "string" || !state.activeTurnId || typeof messageId !== "string" || !messageId)
|
|
44796
|
+
throw new Error("Native steering target or message identity is unavailable");
|
|
44797
|
+
return { expectedTurnId: state.activeTurnId, clientUserMessageId: messageId, delivery };
|
|
44798
|
+
};
|
|
44799
|
+
const withoutQueueRow = async (request) => {
|
|
44800
|
+
if (!record11(request) || request.acceptLocally !== true || typeof request.conversationId !== "string")
|
|
44801
|
+
return request;
|
|
44802
|
+
try {
|
|
44803
|
+
const state = await invoke(rpc, "getThreadExecutionState", request.conversationId);
|
|
44804
|
+
current();
|
|
44805
|
+
if (!running(state)) return request;
|
|
44806
|
+
const message2 = request.message;
|
|
44807
|
+
const text = record11(message2) && typeof message2.text === "string" ? message2.text : "";
|
|
44808
|
+
const delivery = await inspect(request.conversationId, [{ text }]);
|
|
44809
|
+
return delivery === "newTurn" ? { ...request, acceptLocally: false } : request;
|
|
44810
|
+
} catch {
|
|
44811
|
+
return request;
|
|
44812
|
+
}
|
|
44813
|
+
};
|
|
44814
|
+
const coordinator = (remote) => new Proxy(remote, {
|
|
44815
|
+
get(handle, key) {
|
|
44816
|
+
if (key === "then") {
|
|
44817
|
+
const then = Reflect.get(handle, key);
|
|
44818
|
+
return typeof then === "function" ? (resolve, reject) => Reflect.apply(then, handle, [(value2) => resolve(coordinator(value2)), reject]) : then;
|
|
44819
|
+
}
|
|
44820
|
+
if (key === "dup") return () => coordinator(invoke(handle, "dup"));
|
|
44821
|
+
if (key !== "sendMessage" && key !== "sendQueuedMessageNow")
|
|
44822
|
+
return Reflect.get(handle, key);
|
|
44823
|
+
return async (...args) => {
|
|
44824
|
+
current();
|
|
44825
|
+
const index = key === "sendMessage" ? 1 : 3;
|
|
44826
|
+
const callback = args[index];
|
|
44827
|
+
if (typeof callback !== "function")
|
|
44828
|
+
throw new Error("Native submission preparation is unavailable");
|
|
44829
|
+
let marker = null;
|
|
44830
|
+
let threadId;
|
|
44831
|
+
let messageId;
|
|
44832
|
+
let finish;
|
|
44833
|
+
const apply = (prepared) => {
|
|
44834
|
+
if (!marker || !record11(prepared.steer)) return prepared;
|
|
44835
|
+
const result2 = {
|
|
44836
|
+
...prepared,
|
|
44837
|
+
steer: {
|
|
44838
|
+
...prepared.steer,
|
|
44839
|
+
additionalContext: context(prepared.steer.additionalContext, marker)
|
|
44840
|
+
}
|
|
44841
|
+
};
|
|
44842
|
+
if (marker.delivery !== "newTurn") return result2;
|
|
44843
|
+
if (!record11(prepared.start) || !record11(prepared.start.request))
|
|
44844
|
+
throw new Error("Native start preparation is unavailable for steering");
|
|
44845
|
+
return {
|
|
44846
|
+
...result2,
|
|
44847
|
+
afterInactiveTurnId: marker.expectedTurnId,
|
|
44848
|
+
start: {
|
|
44849
|
+
...prepared.start,
|
|
44850
|
+
request: {
|
|
44851
|
+
...prepared.start.request,
|
|
44852
|
+
additionalContext: context(prepared.start.request.additionalContext, marker)
|
|
44853
|
+
}
|
|
44854
|
+
}
|
|
44855
|
+
};
|
|
44856
|
+
};
|
|
44857
|
+
const prepare = async (...input) => {
|
|
44858
|
+
current();
|
|
44859
|
+
const prepared = await callback(...input);
|
|
44860
|
+
current();
|
|
44861
|
+
if (!record11(prepared)) throw new Error("Native submission preparation is malformed");
|
|
44862
|
+
if (marker) return apply(prepared);
|
|
44863
|
+
if (input[1] !== "steer" || !record11(prepared.steer) || typeof prepared.conversationId !== "string")
|
|
44864
|
+
return prepared;
|
|
44865
|
+
threadId = prepared.conversationId;
|
|
44866
|
+
const execution = await invoke(rpc, "getThreadExecutionState", threadId);
|
|
44867
|
+
current();
|
|
44868
|
+
if (!running(execution)) return prepared;
|
|
44869
|
+
const delivery = await inspect(threadId, prepared.steer.input);
|
|
44870
|
+
if (delivery === "official") return prepared;
|
|
44871
|
+
const restore = prepared.steer.restoreMessage;
|
|
44872
|
+
messageId = record11(restore) && typeof restore.id === "string" ? restore.id : void 0;
|
|
44873
|
+
const clientId = prepared.steer.clientUserMessageId ?? messageId;
|
|
44874
|
+
marker = await target(threadId, clientId, delivery);
|
|
44875
|
+
if (delivery === "activeTurn") return apply(prepared);
|
|
44876
|
+
if (!messageId) throw new Error("Native queued message identity is unavailable");
|
|
44877
|
+
finish = await prepareRpcSteeringQueue(
|
|
44878
|
+
hostId2,
|
|
44879
|
+
threadId,
|
|
44880
|
+
(name, ...values) => invoke(rpc, name, ...values),
|
|
44881
|
+
(name, ...values) => invoke(remote, name, ...values),
|
|
44882
|
+
messageId
|
|
44883
|
+
);
|
|
44884
|
+
const start = await callback(input[0], "start");
|
|
44885
|
+
current();
|
|
44886
|
+
if (!record11(start)) throw new Error("Native start preparation is malformed");
|
|
44887
|
+
return apply(start);
|
|
44888
|
+
};
|
|
44889
|
+
const forwarded = [...args];
|
|
44890
|
+
forwarded[index] = prepare;
|
|
44891
|
+
if (key === "sendMessage") forwarded[0] = await withoutQueueRow(args[0]);
|
|
44892
|
+
const result = await invoke(handle, key, ...forwarded);
|
|
44893
|
+
if (finish && record11(result) && result.status === "sent" && typeof result.turnId === "string") {
|
|
44894
|
+
await finish(result.turnId).catch(
|
|
44895
|
+
() => console.error("codexhost could not reconcile native steering queue")
|
|
44896
|
+
);
|
|
44897
|
+
}
|
|
44898
|
+
return result;
|
|
44899
|
+
};
|
|
44900
|
+
}
|
|
44901
|
+
});
|
|
44902
|
+
const wrapped = new Proxy(rpc, {
|
|
44903
|
+
get(handle, key) {
|
|
44904
|
+
if (key === "then") {
|
|
44905
|
+
const then = Reflect.get(handle, key);
|
|
44906
|
+
return typeof then === "function" ? (resolve, reject) => Reflect.apply(then, handle, [
|
|
44907
|
+
(value2) => resolve(wrap(value2, hostId2, owner)),
|
|
44908
|
+
reject
|
|
44909
|
+
]) : then;
|
|
44910
|
+
}
|
|
44911
|
+
if (key === "dup") return () => wrap(invoke(handle, "dup"), hostId2, owner);
|
|
44912
|
+
if (key === "getTurnCoordinator")
|
|
44913
|
+
return () => {
|
|
44914
|
+
current();
|
|
44915
|
+
return coordinator(invoke(handle, "getTurnCoordinator"));
|
|
44916
|
+
};
|
|
44917
|
+
return Reflect.get(handle, key);
|
|
44918
|
+
}
|
|
44919
|
+
});
|
|
44920
|
+
cached2.set(rpc, wrapped);
|
|
44921
|
+
return wrapped;
|
|
44922
|
+
};
|
|
44923
|
+
const forHost = (hostId2) => wrap(original.call(controller, hostId2), hostId2);
|
|
44924
|
+
controller.forHost = forHost;
|
|
44925
|
+
return () => {
|
|
44926
|
+
disposed = true;
|
|
44927
|
+
if (controller.forHost === forHost) Object.defineProperty(controller, "forHost", descriptor);
|
|
44928
|
+
};
|
|
44929
|
+
}
|
|
44930
|
+
|
|
44622
44931
|
// src/production-entry.ts
|
|
44932
|
+
Object.defineProperty(window, "__codexhostInstallRpcSteeringV1", {
|
|
44933
|
+
configurable: true,
|
|
44934
|
+
value(controller) {
|
|
44935
|
+
const state = window;
|
|
44936
|
+
if (state.__codexhostRpcSteeringV1)
|
|
44937
|
+
return window.__codexhostRpcSteeringV1?.controller === controller;
|
|
44938
|
+
const routing = window.__codexhostHostRoutingV1;
|
|
44939
|
+
if (!routing) return false;
|
|
44940
|
+
const cleanup = installRendererRpcSteering(controller);
|
|
44941
|
+
if (!cleanup) return false;
|
|
44942
|
+
const originalDispose = routing.dispose;
|
|
44943
|
+
const dispose = () => {
|
|
44944
|
+
cleanup();
|
|
44945
|
+
delete state.__codexhostRpcSteeringV1;
|
|
44946
|
+
window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
44947
|
+
if (routing.dispose === dispose) routing.dispose = originalDispose;
|
|
44948
|
+
originalDispose.call(routing);
|
|
44949
|
+
};
|
|
44950
|
+
routing.dispose = dispose;
|
|
44951
|
+
state.__codexhostRpcSteeringV1 = {
|
|
44952
|
+
controller,
|
|
44953
|
+
// A later native Remote Control install replaces this method; the Controller
|
|
44954
|
+
// compares it on every tick and releases a displaced wrapper to reinstall.
|
|
44955
|
+
forHost: controller.forHost,
|
|
44956
|
+
release() {
|
|
44957
|
+
cleanup();
|
|
44958
|
+
delete state.__codexhostRpcSteeringV1;
|
|
44959
|
+
window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
44960
|
+
}
|
|
44961
|
+
};
|
|
44962
|
+
window.dispatchEvent(new CustomEvent("codexhost:draft-prewarm-policy-changed"));
|
|
44963
|
+
return true;
|
|
44964
|
+
}
|
|
44965
|
+
});
|
|
44623
44966
|
var install = () => {
|
|
44624
44967
|
installRendererBinding();
|
|
44625
44968
|
};
|