@liberseek/boft-cli-win32-arm64 0.8.1 → 0.8.3
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 +36 -3
- package/app/console-web.js +100 -75
- package/app/desktop-controller.mjs +36 -3
- package/app/host-runtime.mjs +81 -21
- package/app/plugins/antigravity/plugin.mjs +52 -7
- package/app/plugins/claude-code/plugin.mjs +206 -54
- package/app/plugins/codebuddy/plugin.mjs +110 -8
- package/app/plugins/codex-usage/plugin.mjs +36 -3
- package/app/plugins/cursor-cli/plugin.mjs +71 -10
- package/app/plugins/deepseek-harness/manifest.json +2 -2
- package/app/plugins/deepseek-harness/plugin.mjs +198 -26
- package/app/plugins/grok/plugin.mjs +100 -21
- package/app/plugins/hermes/plugin.mjs +63 -3
- package/app/plugins/kimi-code/plugin.mjs +64 -9
- package/app/plugins/kiro-cli/plugin.mjs +45 -3
- package/app/plugins/muse/plugin.mjs +36 -3
- package/app/plugins/omp/plugin.mjs +46 -3
- package/app/plugins/opencode/plugin.mjs +52 -5
- package/app/plugins/pi/plugin.mjs +37 -3
- package/app/plugins/qoder/plugin.mjs +50 -3
- package/app/plugins/qoder-cn/plugin.mjs +50 -3
- package/app/plugins/workbuddy/plugin.mjs +227 -12
- package/app/plugins/zcode/plugin.mjs +49 -3
- package/app/renderer-extension.js +369 -281
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -14835,6 +14835,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14835
14835
|
initializeOnly: external_exports.boolean().optional()
|
|
14836
14836
|
});
|
|
14837
14837
|
|
|
14838
|
+
// ../shared-contracts/dist/harness-presentation.js
|
|
14839
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
14840
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
|
|
14841
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
14842
|
+
label: displayText(256).optional(),
|
|
14843
|
+
description: displayText(1024).optional()
|
|
14844
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14845
|
+
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14846
|
+
function translation(entries, locale) {
|
|
14847
|
+
if (!entries)
|
|
14848
|
+
return void 0;
|
|
14849
|
+
const language = locale.split("-")[0] ?? locale;
|
|
14850
|
+
for (const candidate of [locale, language]) {
|
|
14851
|
+
if (Object.hasOwn(entries, candidate))
|
|
14852
|
+
return entries[candidate];
|
|
14853
|
+
}
|
|
14854
|
+
return void 0;
|
|
14855
|
+
}
|
|
14856
|
+
function localizeHarnessPresentation(value, locale) {
|
|
14857
|
+
const localized = translation(value.localizations, locale);
|
|
14858
|
+
const language = translation(value.localizations, locale.split("-")[0] ?? locale);
|
|
14859
|
+
return {
|
|
14860
|
+
label: localized?.label ?? language?.label ?? value.label,
|
|
14861
|
+
description: localized?.description ?? language?.description ?? value.description
|
|
14862
|
+
};
|
|
14863
|
+
}
|
|
14864
|
+
function localizeHarnessText(value, locale) {
|
|
14865
|
+
return translation(value, locale) ?? value.en ?? "";
|
|
14866
|
+
}
|
|
14867
|
+
|
|
14868
|
+
// ../shared-contracts/dist/account-credits-presentation.js
|
|
14869
|
+
function accountCreditsWindowLabel(window2, locale, periodLabel) {
|
|
14870
|
+
if (window2.periodType && window2.periodType !== "unknown" && (window2.scope || !window2.label)) {
|
|
14871
|
+
const period = periodLabel(window2.periodType);
|
|
14872
|
+
return window2.scope ? `${localizeHarnessPresentation(window2.scope, locale).label} \xB7 ${period}` : period;
|
|
14873
|
+
}
|
|
14874
|
+
return localizeHarnessPresentation({
|
|
14875
|
+
label: window2.label ?? window2.product ?? periodLabel("unknown"),
|
|
14876
|
+
...window2.localizations ? { localizations: window2.localizations } : {}
|
|
14877
|
+
}, locale).label;
|
|
14878
|
+
}
|
|
14879
|
+
|
|
14838
14880
|
// ../shared-contracts/dist/model-price-overrides.js
|
|
14839
14881
|
var MODEL_PRICE_OVERRIDES_GET_METHOD = "codexhost/usage/model-prices/get";
|
|
14840
14882
|
var MODEL_PRICE_OVERRIDES_SET_METHOD = "codexhost/usage/model-prices/set";
|
|
@@ -15263,8 +15305,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15263
15305
|
}
|
|
15264
15306
|
});
|
|
15265
15307
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15308
|
+
var accountCreditsPeriodSchema = external_exports.enum([
|
|
15309
|
+
"weekly",
|
|
15310
|
+
"monthly",
|
|
15311
|
+
"five_hour",
|
|
15312
|
+
"seven_day",
|
|
15313
|
+
"unknown"
|
|
15314
|
+
]);
|
|
15315
|
+
var accountCreditsScopeSchema = external_exports.object({
|
|
15316
|
+
id: external_exports.string().min(1).max(256),
|
|
15317
|
+
label: external_exports.string().min(1).max(256),
|
|
15318
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15319
|
+
}).strict();
|
|
15266
15320
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
15267
15321
|
product: external_exports.string().min(1),
|
|
15322
|
+
/** Native period and scope, never inferred from the display name. */
|
|
15323
|
+
periodType: accountCreditsPeriodSchema.optional(),
|
|
15324
|
+
scope: accountCreditsScopeSchema.optional(),
|
|
15325
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
15268
15326
|
used: external_exports.number().finite().nonnegative().optional(),
|
|
15269
15327
|
// Zero is a real empty cap, not an absent field.
|
|
15270
15328
|
limit: external_exports.number().finite().nonnegative().optional(),
|
|
@@ -15286,8 +15344,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15286
15344
|
label: external_exports.string().min(1).optional(),
|
|
15287
15345
|
usedPercent: usagePercentSchema.optional(),
|
|
15288
15346
|
remaining: external_exports.number().finite().optional(),
|
|
15347
|
+
scope: accountCreditsScopeSchema.optional(),
|
|
15348
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
15289
15349
|
resetsAt: external_exports.string().min(1).optional(),
|
|
15290
|
-
periodType:
|
|
15350
|
+
periodType: accountCreditsPeriodSchema,
|
|
15291
15351
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
15292
15352
|
resetCredits: accountResetCreditsSchema.optional()
|
|
15293
15353
|
}).strict().superRefine((credits, context) => {
|
|
@@ -15312,7 +15372,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15312
15372
|
var threadUsageInspectionSchema = external_exports.object({
|
|
15313
15373
|
threadId: hostThreadIdSchema,
|
|
15314
15374
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
15315
|
-
accountCredits: accountCreditsSnapshotSchema.optional()
|
|
15375
|
+
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
15376
|
+
/** Whether this source can provide cached account quota independently of usage. */
|
|
15377
|
+
accountCreditsSupported: external_exports.boolean().optional()
|
|
15316
15378
|
}).strict();
|
|
15317
15379
|
|
|
15318
15380
|
// ../shared-contracts/dist/harness-accounts.js
|
|
@@ -15439,7 +15501,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15439
15501
|
id: harnessPermissionModeIdSchema,
|
|
15440
15502
|
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15441
15503
|
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15442
|
-
dangerous: external_exports.boolean().optional()
|
|
15504
|
+
dangerous: external_exports.boolean().optional(),
|
|
15505
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15443
15506
|
}).strict();
|
|
15444
15507
|
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15445
15508
|
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
@@ -15798,6 +15861,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15798
15861
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15799
15862
|
message: external_exports.string().max(2048).optional(),
|
|
15800
15863
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
15864
|
+
/** Safe plugin-owned explanation, distinct from raw diagnostic message. */
|
|
15865
|
+
notice: harnessLocalizedTextSchema.optional(),
|
|
15801
15866
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15802
15867
|
}).strict();
|
|
15803
15868
|
|
|
@@ -15942,6 +16007,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15942
16007
|
invocation: commandInvocationSchema,
|
|
15943
16008
|
label: commandLabelSchema,
|
|
15944
16009
|
description: commandDescriptionSchema.optional(),
|
|
16010
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
15945
16011
|
argumentMode: external_exports.enum(["none", "text"]),
|
|
15946
16012
|
/**
|
|
15947
16013
|
* Native distinction reported by the Harness. Omitted when the Harness does
|
|
@@ -17810,37 +17876,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17810
17876
|
|
|
17811
17877
|
// src/settings/harness-version-messages.ts
|
|
17812
17878
|
var harnessVersionEnglish = Object.freeze({
|
|
17879
|
+
locale: "en",
|
|
17813
17880
|
unknown: "Unknown",
|
|
17814
17881
|
trackingBranch: "Tracking branch (new commits)",
|
|
17815
17882
|
notes: Object.freeze({
|
|
17816
|
-
"original-installer": "Use the original installer, package manager, or launcher to update this installation."
|
|
17817
|
-
"claude-policy-restricted": "Claude updates are restricted by the installation's settings or policy.",
|
|
17818
|
-
"codebuddy-npm-required": "Use CodeBuddy's native updater or original package manager. Latest-version checks here require an identified npm installation.",
|
|
17819
|
-
"deepseek-original-installer": "Update with the original installer. Python, desktop, and project-local installations are not upgraded through global npm.",
|
|
17820
|
-
"kiro-native-updater": "Use Kiro CLI's original installer or native updater to check for and install updates.",
|
|
17821
|
-
"zcode-desktop-updater": "The CLI ships inside ZCode Desktop. Update ZCode Desktop itself to update it.",
|
|
17822
|
-
"qoder-check-unavailable": "This Qoder China release does not expose a non-installing update check. Use its original installer.",
|
|
17823
|
-
"hermes-update-plan-unavailable": "This Hermes release does not expose a safe update plan. Use the original installer.",
|
|
17824
|
-
"hermes-externally-managed": "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager.",
|
|
17825
|
-
"hermes-update-channel": "Uses Hermes's configured update channel. Gateway restarts are deferred; existing processes keep their running code.",
|
|
17826
|
-
"hermes-manual-update": "Use the native updater manually. Safe non-interactive updates require a clean source checkout, commit identity, and Gateway restart deferral."
|
|
17883
|
+
"original-installer": "Use the original installer, package manager, or launcher to update this installation."
|
|
17827
17884
|
})
|
|
17828
17885
|
});
|
|
17829
17886
|
var harnessVersionChinese = Object.freeze({
|
|
17887
|
+
locale: "zh-CN",
|
|
17830
17888
|
unknown: "\u672A\u77E5",
|
|
17831
17889
|
trackingBranch: "\u8DDF\u8E2A\u5206\u652F\uFF08\u6709\u65B0\u63D0\u4EA4\uFF09",
|
|
17832
17890
|
notes: Object.freeze({
|
|
17833
|
-
"original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u7A0B\u5E8F\u3001\u5305\u7BA1\u7406\u5668\u6216\u542F\u52A8\u5668\u66F4\u65B0\u6B64\u5B89\u88C5\u3002"
|
|
17834
|
-
"claude-policy-restricted": "\u6B64 Claude \u5B89\u88C5\u7684\u8BBE\u7F6E\u6216\u7B56\u7565\u9650\u5236\u4E86\u66F4\u65B0\u3002",
|
|
17835
|
-
"codebuddy-npm-required": "\u8BF7\u4F7F\u7528 CodeBuddy \u539F\u751F\u66F4\u65B0\u5668\u6216\u539F\u5305\u7BA1\u7406\u5668\u66F4\u65B0\u3002\u6B64\u5904\u4EC5\u80FD\u67E5\u8BE2\u5DF2\u8BC6\u522B\u7684 npm \u5B89\u88C5\u7684\u6700\u65B0\u7248\u672C\u3002",
|
|
17836
|
-
"deepseek-original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u65B9\u5F0F\u66F4\u65B0\u3002Python\u3001\u684C\u9762\u5E94\u7528\u53CA\u9879\u76EE\u5185\u5B89\u88C5\u4E0D\u4F1A\u901A\u8FC7\u5168\u5C40 npm \u66F4\u65B0\u3002",
|
|
17837
|
-
"kiro-native-updater": "\u8BF7\u4F7F\u7528 Kiro CLI \u539F\u5B89\u88C5\u7A0B\u5E8F\u6216\u539F\u751F\u66F4\u65B0\u5668\u68C0\u67E5\u5E76\u5B89\u88C5\u66F4\u65B0\u3002",
|
|
17838
|
-
"zcode-desktop-updater": "CLI \u968F ZCode Desktop \u4E00\u8D77\u53D1\u5E03\uFF0C\u8BF7\u76F4\u63A5\u66F4\u65B0 ZCode Desktop\u3002",
|
|
17839
|
-
"qoder-check-unavailable": "\u6B64 Qoder \u4E2D\u56FD\u7248\u5C1A\u4E0D\u652F\u6301\u53EA\u68C0\u67E5\u3001\u4E0D\u5B89\u88C5\u7684\u66F4\u65B0\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u65B9\u5F0F\u66F4\u65B0\u3002",
|
|
17840
|
-
"hermes-update-plan-unavailable": "\u6B64 Hermes \u7248\u672C\u4E0D\u63D0\u4F9B\u5B89\u5168\u7684\u66F4\u65B0\u8BA1\u5212\uFF0C\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u65B9\u5F0F\u66F4\u65B0\u3002",
|
|
17841
|
-
"hermes-externally-managed": "\u6B64 Hermes \u5B89\u88C5\u7531\u5916\u90E8\u5DE5\u5177\u7BA1\u7406\uFF0C\u8BF7\u901A\u8FC7\u5176\u684C\u9762\u5E94\u7528\u3001\u5BB9\u5668\u6216\u539F\u5305\u7BA1\u7406\u5668\u66F4\u65B0\u3002",
|
|
17842
|
-
"hermes-update-channel": "\u4F7F\u7528 Hermes \u914D\u7F6E\u7684\u66F4\u65B0\u6E20\u9053\uFF0C\u6682\u4E0D\u91CD\u542F Gateway\uFF1B\u73B0\u6709\u8FDB\u7A0B\u7EE7\u7EED\u8FD0\u884C\u539F\u6709\u4EE3\u7801\u3002",
|
|
17843
|
-
"hermes-manual-update": "\u8BF7\u624B\u52A8\u4F7F\u7528\u539F\u751F\u66F4\u65B0\u5668\u3002\u5B89\u5168\u7684\u975E\u4EA4\u4E92\u66F4\u65B0\u8981\u6C42\u6E90\u7801\u76EE\u5F55\u65E0\u672A\u63D0\u4EA4\u4FEE\u6539\u3001\u53EF\u8BC6\u522B\u5F53\u524D\u63D0\u4EA4\uFF0C\u5E76\u652F\u6301\u63A8\u8FDF Gateway \u91CD\u542F\u3002"
|
|
17891
|
+
"original-installer": "\u8BF7\u4F7F\u7528\u539F\u5B89\u88C5\u7A0B\u5E8F\u3001\u5305\u7BA1\u7406\u5668\u6216\u542F\u52A8\u5668\u66F4\u65B0\u6B64\u5B89\u88C5\u3002"
|
|
17844
17892
|
})
|
|
17845
17893
|
});
|
|
17846
17894
|
function harnessVersionLabel(state, messages) {
|
|
@@ -17852,6 +17900,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17852
17900
|
return state.latestVersion;
|
|
17853
17901
|
}
|
|
17854
17902
|
function harnessVersionNote(state, messages) {
|
|
17903
|
+
if (state?.notice) return localizeHarnessText(state.notice, messages.locale);
|
|
17855
17904
|
const code = state?.messageCode;
|
|
17856
17905
|
return code && Object.hasOwn(messages.notes, code) ? messages.notes[code] : void 0;
|
|
17857
17906
|
}
|
|
@@ -19302,7 +19351,7 @@ ${error51.stderrTail}`] : []
|
|
|
19302
19351
|
connectionOfficialWebsite: "Visit official website",
|
|
19303
19352
|
connectionOpenInstallation: "Open official installation page",
|
|
19304
19353
|
connectionOpenHarnessWeb: "Open DeepSeek Harness Web",
|
|
19305
|
-
connectionDeepSeekTestedVersions: "Supported DSH versions: 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1 and 0.2.
|
|
19354
|
+
connectionDeepSeekTestedVersions: "Supported DSH versions: 0.1.7-rc.1, 0.1.7-rc.2, 0.2.0-rc.1, 0.2.0-rc.2, 0.2.1-rc.1 and 0.2.1-rc.2. Versions newer than 0.2.1-rc.2 can be tried, but compatibility may be limited; versions older than 0.1.7-rc.1 must be upgraded first.",
|
|
19306
19355
|
connectionInstall: "Install",
|
|
19307
19356
|
connectionLongContextLabel: "1M",
|
|
19308
19357
|
connectionLongContextOn: "On: Claude models use a 1M context window. Claude CLI uses that larger window locally.",
|
|
@@ -19610,7 +19659,7 @@ ${error51.stderrTail}`] : []
|
|
|
19610
19659
|
connectionOfficialWebsite: "\u8BBF\u95EE\u5B98\u7F51",
|
|
19611
19660
|
connectionOpenInstallation: "\u524D\u5F80\u5B98\u65B9\u5B89\u88C5\u9875\u9762",
|
|
19612
19661
|
connectionOpenHarnessWeb: "\u6253\u5F00 DeepSeek Harness Web",
|
|
19613
|
-
connectionDeepSeekTestedVersions: "\u652F\u6301 DSH \u7248\u672C\uFF1A0.1.7-rc.1\u30010.1.7-rc.2\u30010.2.0-rc.1 \u548C 0.2.
|
|
19662
|
+
connectionDeepSeekTestedVersions: "\u652F\u6301 DSH \u7248\u672C\uFF1A0.1.7-rc.1\u30010.1.7-rc.2\u30010.2.0-rc.1\u30010.2.0-rc.2\u30010.2.1-rc.1 \u548C 0.2.1-rc.2\u3002\u9AD8\u4E8E 0.2.1-rc.2 \u7684\u7248\u672C\u53EF\u4EE5\u5C1D\u8BD5\u8FDE\u63A5\uFF0C\u4F46\u9002\u914D\u5EA6\u53EF\u80FD\u6709\u9650\uFF1B\u4F4E\u4E8E 0.1.7-rc.1 \u7684\u7248\u672C\u9700\u8981\u5148\u5347\u7EA7\u3002",
|
|
19614
19663
|
connectionInstall: "\u5B89\u88C5",
|
|
19615
19664
|
connectionLongContextLabel: "1M",
|
|
19616
19665
|
connectionLongContextOn: "\u5F00\u542F\u540E: Claude \u6A21\u578B\u4F7F\u7528 1M \u4E0A\u4E0B\u6587\u3002Claude CLI \u4F1A\u5728\u672C\u5730\u6309\u8FD9\u4E2A\u66F4\u5927\u7684\u7A97\u53E3\u5DE5\u4F5C\u3002",
|
|
@@ -20631,8 +20680,8 @@ ${error51.stderrTail}`] : []
|
|
|
20631
20680
|
const parts = [
|
|
20632
20681
|
usage?.totalCredits !== void 0 ? formatRendererCredits(usage.totalCredits) : null,
|
|
20633
20682
|
usage?.cacheHitRatePercent !== void 0 ? formatRendererCacheHitRate(usage.cacheHitRatePercent) : null,
|
|
20634
|
-
usage?.outputTokensPerSecond !== void 0 ? formatRendererTokenRate(usage.outputTokensPerSecond, locale) : null,
|
|
20635
|
-
usage?.totalCostUsd !== void 0 ?
|
|
20683
|
+
usage?.outputTokensPerSecond !== void 0 ? formatRendererTokenRate(usage.outputTokensPerSecond, locale) : usage?.apiOutputTokensPerSecond !== void 0 ? `API ${formatRendererTokenRate(usage.apiOutputTokensPerSecond, locale)}` : null,
|
|
20684
|
+
usage?.totalCostUsd !== void 0 ? formatUsageCost({ ...usage, totalCostUsd: usage.totalCostUsd }) : null
|
|
20636
20685
|
].filter((value) => value !== null);
|
|
20637
20686
|
if (usage?.contextUsagePercent !== void 0 && parts.length === 0) parts.push(messages.usage);
|
|
20638
20687
|
if (parts.length === 0 && hasContext && usage?.contextWindowTokens !== void 0) {
|
|
@@ -20660,10 +20709,10 @@ ${error51.stderrTail}`] : []
|
|
|
20660
20709
|
popover.style.color = "CanvasText";
|
|
20661
20710
|
popover.style.boxShadow = "light-dark(0 10px 24px rgba(15, 23, 42, 0.12), 0 20px 45px rgba(0, 0, 0, 0.42)), 0 2px 8px light-dark(rgba(15, 23, 42, 0.06), rgba(0, 0, 0, 0.28))";
|
|
20662
20711
|
}
|
|
20663
|
-
function addDetailRow(parent, label, value
|
|
20712
|
+
function addDetailRow(parent, label, value) {
|
|
20664
20713
|
const row = document.createElement("div");
|
|
20665
20714
|
row.style.display = "grid";
|
|
20666
|
-
row.style.gridTemplateColumns =
|
|
20715
|
+
row.style.gridTemplateColumns = "minmax(0, 1fr) auto";
|
|
20667
20716
|
row.style.gap = "20px";
|
|
20668
20717
|
row.style.padding = "4px 0";
|
|
20669
20718
|
const labelElement = document.createElement("span");
|
|
@@ -20673,10 +20722,6 @@ ${error51.stderrTail}`] : []
|
|
|
20673
20722
|
valueElement.textContent = value;
|
|
20674
20723
|
valueElement.style.fontVariantNumeric = "tabular-nums";
|
|
20675
20724
|
valueElement.style.textAlign = "right";
|
|
20676
|
-
if (wrap) {
|
|
20677
|
-
valueElement.style.overflowWrap = "anywhere";
|
|
20678
|
-
valueElement.title = value;
|
|
20679
|
-
}
|
|
20680
20725
|
row.append(labelElement, valueElement);
|
|
20681
20726
|
parent.append(row);
|
|
20682
20727
|
}
|
|
@@ -20734,7 +20779,7 @@ ${error51.stderrTail}`] : []
|
|
|
20734
20779
|
heading.style.fontWeight = "600";
|
|
20735
20780
|
heading.style.marginBottom = "6px";
|
|
20736
20781
|
popover.append(heading);
|
|
20737
|
-
if (accountName) addDetailRow(popover, messages.account, accountName
|
|
20782
|
+
if (accountName) addDetailRow(popover, messages.account, accountName);
|
|
20738
20783
|
if (usage?.contextUsagePercent !== void 0) {
|
|
20739
20784
|
addContextRow(
|
|
20740
20785
|
popover,
|
|
@@ -21254,7 +21299,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
21254
21299
|
loadingPermissions: "Loading permissions...",
|
|
21255
21300
|
selecting: "Selecting...",
|
|
21256
21301
|
permissionsUnavailable: "Permissions unavailable",
|
|
21257
|
-
permissionModeFixedAtCreate: "
|
|
21302
|
+
permissionModeFixedAtCreate: "This Permission Mode is fixed when the Session is created. Start a new Thread to change it.",
|
|
21258
21303
|
codexUsageGateUnavailable: "Could not separate this Harness from the Codex usage limit in this Desktop version. Codex usage limits still apply to sending.",
|
|
21259
21304
|
modelSelectionRejected: "Couldn't switch Model",
|
|
21260
21305
|
thinkingSelectionRejected: "Couldn't switch Thinking option"
|
|
@@ -21271,7 +21316,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
21271
21316
|
loadingPermissions: "\u6B63\u5728\u52A0\u8F7D\u6743\u9650...",
|
|
21272
21317
|
selecting: "\u6B63\u5728\u9009\u62E9...",
|
|
21273
21318
|
permissionsUnavailable: "\u6743\u9650\u4E0D\u53EF\u7528",
|
|
21274
|
-
permissionModeFixedAtCreate: "
|
|
21319
|
+
permissionModeFixedAtCreate: "\u6B64\u6743\u9650\u6A21\u5F0F\u5728\u4F1A\u8BDD\u521B\u5EFA\u65F6\u786E\u5B9A\uFF0C\u5982\u9700\u66F4\u6539\u8BF7\u65B0\u5EFA\u4F1A\u8BDD",
|
|
21275
21320
|
codexUsageGateUnavailable: "\u5F53\u524D Desktop \u7248\u672C\u65E0\u6CD5\u5C06\u6B64 Harness \u4E0E Codex \u989D\u5EA6\u9650\u5236\u5206\u79BB\uFF0C\u53D1\u9001\u4ECD\u53D7 Codex \u989D\u5EA6\u9650\u5236",
|
|
21276
21321
|
modelSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u6A21\u578B",
|
|
21277
21322
|
thinkingSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u601D\u8003\u9009\u9879"
|
|
@@ -21380,20 +21425,20 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
21380
21425
|
return locale === "zh-CN" ? CHINESE_HARNESS_MESSAGES : ENGLISH_HARNESS_MESSAGES;
|
|
21381
21426
|
}
|
|
21382
21427
|
function rendererHarnessCommandPresentation(command, locale) {
|
|
21383
|
-
if (locale === "zh-CN" && command.invocation === "/compact") {
|
|
21428
|
+
if (!command.localizations && locale === "zh-CN" && command.invocation === "/compact") {
|
|
21384
21429
|
return { label: "\u538B\u7F29\u4E0A\u4E0B\u6587", description: "\u538B\u7F29\u5F53\u524D\u5BF9\u8BDD\u4E0A\u4E0B\u6587" };
|
|
21385
21430
|
}
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
description: command.description ?? command.label
|
|
21389
|
-
};
|
|
21431
|
+
const presentation = localizeHarnessPresentation(command, locale);
|
|
21432
|
+
return { ...presentation, description: presentation.description ?? presentation.label };
|
|
21390
21433
|
}
|
|
21391
21434
|
function rendererPermissionModePresentation(mode, locale) {
|
|
21392
|
-
const
|
|
21393
|
-
if (
|
|
21435
|
+
const presentation = localizeHarnessPresentation(mode, locale);
|
|
21436
|
+
if (mode.localizations) return presentation;
|
|
21437
|
+
const label = ENGLISH_PERMISSION_MODE_LABELS.get(presentation.label) ?? presentation.label;
|
|
21438
|
+
if (locale !== "zh-CN") return { label, description: presentation.description };
|
|
21394
21439
|
return {
|
|
21395
21440
|
label: CHINESE_PERMISSION_MODE_LABELS.get(label) ?? label,
|
|
21396
|
-
description:
|
|
21441
|
+
description: presentation.description === void 0 ? void 0 : CHINESE_PERMISSION_MODE_DESCRIPTIONS.get(presentation.description) ?? presentation.description
|
|
21397
21442
|
};
|
|
21398
21443
|
}
|
|
21399
21444
|
function rendererLiveCommandsPendingNotice(locale, harnessLabel) {
|
|
@@ -22711,30 +22756,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
22711
22756
|
return messages.account;
|
|
22712
22757
|
}
|
|
22713
22758
|
function productLabel(product, locale = "en") {
|
|
22714
|
-
|
|
22715
|
-
if (product === "GrokChat") return "Chat";
|
|
22716
|
-
if (product === "GrokImagine") return "Imagine";
|
|
22717
|
-
if (product === "GrokVoice") return "Voice";
|
|
22718
|
-
const messages = rendererCreditsMessages(locale);
|
|
22719
|
-
if (product === "5-hour window") return messages.fiveHour;
|
|
22720
|
-
if (product === "7-day window") return messages.sevenDay;
|
|
22721
|
-
if (product === "Weekly window") return messages.weekly;
|
|
22722
|
-
if (product.endsWith(" \xB7 5-hour window")) {
|
|
22723
|
-
return `${product.slice(0, -"5-hour window".length)}${messages.fiveHour}`;
|
|
22724
|
-
}
|
|
22725
|
-
if (product.endsWith(" \xB7 7-day window")) {
|
|
22726
|
-
return `${product.slice(0, -"7-day window".length)}${messages.sevenDay}`;
|
|
22727
|
-
}
|
|
22728
|
-
if (product.endsWith(" \xB7 Weekly window")) {
|
|
22729
|
-
return `${product.slice(0, -"Weekly window".length)}${messages.weekly}`;
|
|
22730
|
-
}
|
|
22731
|
-
if (product.endsWith(" \xB7 5-hour")) {
|
|
22732
|
-
return `${product.slice(0, -"5-hour".length)}${messages.fiveHour}`;
|
|
22733
|
-
}
|
|
22734
|
-
if (product.endsWith(" \xB7 7-day")) {
|
|
22735
|
-
return `${product.slice(0, -"7-day".length)}${messages.sevenDay}`;
|
|
22736
|
-
}
|
|
22737
|
-
return product;
|
|
22759
|
+
return accountCreditsWindowLabel(product, locale, (period) => creditsPeriodLabel(period, locale));
|
|
22738
22760
|
}
|
|
22739
22761
|
function toneColor(tone) {
|
|
22740
22762
|
if (tone === "hot") return "#c45c4a";
|
|
@@ -22775,7 +22797,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
22775
22797
|
top.style.marginBottom = "5px";
|
|
22776
22798
|
const left = document.createElement("div");
|
|
22777
22799
|
const label = document.createElement("div");
|
|
22778
|
-
label.textContent =
|
|
22800
|
+
label.textContent = productLabel(credits, locale);
|
|
22779
22801
|
label.style.fontSize = "12.5px";
|
|
22780
22802
|
label.style.fontWeight = "600";
|
|
22781
22803
|
left.append(label);
|
|
@@ -22866,7 +22888,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
22866
22888
|
popover.append(renderCreditsHeader(credits, locale, messages));
|
|
22867
22889
|
const tiles = (credits.productUsage ?? []).map(
|
|
22868
22890
|
(product) => renderCreditsTile(
|
|
22869
|
-
productLabel(product
|
|
22891
|
+
productLabel(product, locale),
|
|
22870
22892
|
product.usagePercent,
|
|
22871
22893
|
locale,
|
|
22872
22894
|
messages,
|
|
@@ -23041,7 +23063,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23041
23063
|
}
|
|
23042
23064
|
const remaining = remainingPercent(accountCredits.usedPercent);
|
|
23043
23065
|
const percent2 = formatRendererCreditsPercent(remaining);
|
|
23044
|
-
const periodLabel = accountCredits.label ? productLabel(accountCredits
|
|
23066
|
+
const periodLabel = accountCredits.label ? productLabel(accountCredits, locale) : creditsPeriodLabel(accountCredits.periodType, locale);
|
|
23045
23067
|
const title = `${periodLabel} ${percent2}`;
|
|
23046
23068
|
const tone = rendererCreditsTone(accountCredits.usedPercent);
|
|
23047
23069
|
const ringSlot = control.trigger.querySelector("[data-codexhost-credits-ring]");
|
|
@@ -23822,62 +23844,141 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23822
23844
|
}
|
|
23823
23845
|
};
|
|
23824
23846
|
|
|
23847
|
+
// src/renderer-codex-usage-banner.ts
|
|
23848
|
+
var MAX_FIBERS = 2e4;
|
|
23849
|
+
function isRecord2(value) {
|
|
23850
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23851
|
+
}
|
|
23852
|
+
function isUsageBanner(props) {
|
|
23853
|
+
return isRecord2(props) && "banner" in props && "rateLimitStatus" in props && typeof props.sendBlocked === "boolean";
|
|
23854
|
+
}
|
|
23855
|
+
function isElement(value) {
|
|
23856
|
+
return isRecord2(value) && typeof value.setAttribute === "function" && isRecord2(value.style);
|
|
23857
|
+
}
|
|
23858
|
+
function hostElements(fiber, budget) {
|
|
23859
|
+
const result = [];
|
|
23860
|
+
const visit = (node) => {
|
|
23861
|
+
for (let current = node; isRecord2(current); current = current.sibling) {
|
|
23862
|
+
if (budget.remaining-- <= 0) return;
|
|
23863
|
+
const { stateNode } = current;
|
|
23864
|
+
if (isElement(stateNode)) result.push(stateNode);
|
|
23865
|
+
else visit(current.child);
|
|
23866
|
+
}
|
|
23867
|
+
};
|
|
23868
|
+
visit(fiber.child);
|
|
23869
|
+
return result;
|
|
23870
|
+
}
|
|
23871
|
+
function findCodexUsageBannerElements(owner) {
|
|
23872
|
+
if (!isRecord2(owner)) return [];
|
|
23873
|
+
const budget = { remaining: MAX_FIBERS };
|
|
23874
|
+
const found = [];
|
|
23875
|
+
const stack = [owner.child];
|
|
23876
|
+
while (stack.length > 0 && budget.remaining > 0) {
|
|
23877
|
+
const node = stack.pop();
|
|
23878
|
+
if (!isRecord2(node)) continue;
|
|
23879
|
+
budget.remaining -= 1;
|
|
23880
|
+
const fiber = node;
|
|
23881
|
+
stack.push(fiber.sibling);
|
|
23882
|
+
if (isUsageBanner(fiber.memoizedProps)) found.push(...hostElements(fiber, budget));
|
|
23883
|
+
else stack.push(fiber.child);
|
|
23884
|
+
}
|
|
23885
|
+
return budget.remaining > 0 ? found : [];
|
|
23886
|
+
}
|
|
23887
|
+
var HIDDEN_ATTRIBUTE = "data-codexhost-usage-banner-hidden";
|
|
23888
|
+
function createRendererCodexUsageBanner() {
|
|
23889
|
+
const hidden = /* @__PURE__ */ new Map();
|
|
23890
|
+
const show = (element) => {
|
|
23891
|
+
const previous = hidden.get(element);
|
|
23892
|
+
hidden.delete(element);
|
|
23893
|
+
if (!previous || element.getAttribute(HIDDEN_ATTRIBUTE) === null) return;
|
|
23894
|
+
element.removeAttribute(HIDDEN_ATTRIBUTE);
|
|
23895
|
+
if (previous.value) element.style.setProperty("display", previous.value, previous.priority);
|
|
23896
|
+
else element.style.removeProperty("display");
|
|
23897
|
+
};
|
|
23898
|
+
return {
|
|
23899
|
+
hide(owner) {
|
|
23900
|
+
const current = new Set(findCodexUsageBannerElements(owner));
|
|
23901
|
+
for (const element of [...hidden.keys()]) if (!current.has(element)) show(element);
|
|
23902
|
+
for (const element of current) {
|
|
23903
|
+
if (hidden.has(element)) continue;
|
|
23904
|
+
hidden.set(element, {
|
|
23905
|
+
value: element.style.getPropertyValue("display"),
|
|
23906
|
+
priority: element.style.getPropertyPriority("display")
|
|
23907
|
+
});
|
|
23908
|
+
element.setAttribute(HIDDEN_ATTRIBUTE, "");
|
|
23909
|
+
element.style.setProperty("display", "none", "important");
|
|
23910
|
+
}
|
|
23911
|
+
},
|
|
23912
|
+
restore() {
|
|
23913
|
+
for (const element of [...hidden.keys()]) show(element);
|
|
23914
|
+
}
|
|
23915
|
+
};
|
|
23916
|
+
}
|
|
23917
|
+
|
|
23825
23918
|
// src/renderer-codex-usage-gate.ts
|
|
23826
23919
|
var EDITOR_SELECTOR2 = '[contenteditable="true"][role="textbox"]';
|
|
23827
23920
|
var MAX_HOOKS = 4096;
|
|
23828
23921
|
var MAX_DOM_DEPTH = 12;
|
|
23829
23922
|
var RETRY_DELAY_MS = 1e3;
|
|
23830
|
-
function
|
|
23923
|
+
function isRecord3(value) {
|
|
23831
23924
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23832
23925
|
}
|
|
23833
23926
|
function hooksOf(fiber) {
|
|
23834
23927
|
const result = [];
|
|
23835
|
-
let hook =
|
|
23836
|
-
while (
|
|
23928
|
+
let hook = isRecord3(fiber) ? fiber.memoizedState : null;
|
|
23929
|
+
while (isRecord3(hook) && result.length < MAX_HOOKS) {
|
|
23837
23930
|
result.push(hook);
|
|
23838
23931
|
hook = hook.next;
|
|
23839
23932
|
}
|
|
23840
23933
|
return hook == null ? result : [];
|
|
23841
23934
|
}
|
|
23842
|
-
function submitOwners(composer) {
|
|
23935
|
+
function submitOwners(composer, projections) {
|
|
23843
23936
|
let element = composer.querySelector(EDITOR_SELECTOR2) ?? composer;
|
|
23844
23937
|
for (let depth = 0; element && depth < MAX_DOM_DEPTH; depth += 1) {
|
|
23845
23938
|
const key = Object.getOwnPropertyNames(element).find(
|
|
23846
23939
|
(name) => name.startsWith("__reactFiber$")
|
|
23847
23940
|
);
|
|
23848
23941
|
if (key) {
|
|
23849
|
-
const
|
|
23942
|
+
const ancestors = committedReactAncestors(
|
|
23850
23943
|
Object.getOwnPropertyDescriptor(element, key)?.value
|
|
23851
|
-
).filter(
|
|
23852
|
-
({ memoizedProps: props }) => isRecord2(props) && "onLocalSubmitStart" in props && typeof props.submitDisabled === "boolean"
|
|
23853
23944
|
);
|
|
23854
|
-
|
|
23855
|
-
|
|
23945
|
+
const scopes = [];
|
|
23946
|
+
ancestors.forEach(({ memoizedProps: props }, index) => {
|
|
23947
|
+
if (isRecord3(props) && "onLocalSubmitStart" in props && typeof props.submitDisabled === "boolean") {
|
|
23948
|
+
scopes.push({ owner: ancestors[index], fibers: ancestors.slice(0, index + 1) });
|
|
23949
|
+
}
|
|
23950
|
+
});
|
|
23951
|
+
const valid = scopes.filter((scope) => {
|
|
23952
|
+
const gates = gateSubscriptions(scope, projections);
|
|
23856
23953
|
return !gates.invalid && gates.reserve.length > 0;
|
|
23857
23954
|
});
|
|
23955
|
+
return valid.filter(
|
|
23956
|
+
(scope) => !valid.some((other) => other !== scope && scope.fibers.includes(other.owner))
|
|
23957
|
+
);
|
|
23858
23958
|
}
|
|
23859
23959
|
element = element.parentElement;
|
|
23860
23960
|
}
|
|
23861
23961
|
return [];
|
|
23862
23962
|
}
|
|
23863
|
-
function
|
|
23864
|
-
const
|
|
23865
|
-
return
|
|
23963
|
+
function findSubmitScope(composer, projections) {
|
|
23964
|
+
const scopes = submitOwners(composer, projections);
|
|
23965
|
+
return scopes.length === 1 ? scopes[0] ?? null : null;
|
|
23866
23966
|
}
|
|
23867
|
-
function subscriptionAt(hook) {
|
|
23967
|
+
function subscriptionAt(hook, fiber) {
|
|
23868
23968
|
const memo = hook.memoizedState;
|
|
23869
23969
|
if (!Array.isArray(memo) || !Array.isArray(memo[1])) return null;
|
|
23870
23970
|
const [subscriber, dependencies] = memo;
|
|
23871
23971
|
if (dependencies.length !== 2) return null;
|
|
23872
23972
|
const signal = dependencies[0];
|
|
23873
|
-
const adapted = dependencies[1] === void 0 &&
|
|
23973
|
+
const adapted = dependencies[1] === void 0 && isRecord3(signal) && typeof signal.get === "function" && typeof signal.subscribe === "function";
|
|
23874
23974
|
const [store, atom] = adapted ? [signal.store, signal.atom] : dependencies;
|
|
23875
23975
|
const instance = hook.next?.queue;
|
|
23876
23976
|
const effect = hook.next?.next?.memoizedState;
|
|
23877
|
-
if (!
|
|
23977
|
+
if (!isRecord3(subscriber) || typeof subscriber.getSnapshot !== "function" || typeof subscriber.subscribe !== "function" || !isRecord3(store) || typeof store.get !== "function" || typeof store.sub !== "function" || !isRecord3(atom) || typeof atom.read !== "function" || "write" in atom || !isRecord3(instance) || typeof instance.value !== "boolean" || typeof instance.getSnapshot !== "function" || !isRecord3(effect) || typeof effect.create !== "function" || !Array.isArray(effect.deps) || effect.deps[0] !== subscriber.subscribe) {
|
|
23878
23978
|
return null;
|
|
23879
23979
|
}
|
|
23880
23980
|
return {
|
|
23981
|
+
fiber,
|
|
23881
23982
|
subscriber,
|
|
23882
23983
|
store,
|
|
23883
23984
|
atom,
|
|
@@ -23915,10 +24016,10 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23915
24016
|
visiting.delete(dependency);
|
|
23916
24017
|
}
|
|
23917
24018
|
}
|
|
23918
|
-
if (!
|
|
24019
|
+
if (!isRecord3(value)) return value;
|
|
23919
24020
|
if (typeof value.hardBlocked === "boolean") return trace(value, "reserve");
|
|
23920
24021
|
if ("authMethod" in value) return trace(value, "auth");
|
|
23921
|
-
if (
|
|
24022
|
+
if (isRecord3(value.data) && isRecord3(value.data.rate_limit)) {
|
|
23922
24023
|
return {
|
|
23923
24024
|
...value,
|
|
23924
24025
|
data: { ...value.data, rate_limit: trace(value.data.rate_limit, "limit") }
|
|
@@ -23934,12 +24035,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23934
24035
|
}
|
|
23935
24036
|
const reserve = read.has("reserve.hardBlocked") && !read.has("reserve.active");
|
|
23936
24037
|
const account = read.has("auth.authMethod") && read.has("limit.allowed");
|
|
23937
|
-
if (account &&
|
|
24038
|
+
if (account && read.has("reserve.hardBlocked")) return "mixed";
|
|
23938
24039
|
if (reserve) return "reserve";
|
|
23939
24040
|
if (account) return "account";
|
|
23940
24041
|
return null;
|
|
23941
24042
|
}
|
|
23942
|
-
function snapshotsMatch({ subscriber, instance, store, atom },
|
|
24043
|
+
function snapshotsMatch({ subscriber, instance, store, atom }, projections) {
|
|
24044
|
+
const projected = projections?.get(instance);
|
|
23943
24045
|
try {
|
|
23944
24046
|
if (typeof subscriber.createRender === "function" && subscriber.createRender() != null) {
|
|
23945
24047
|
return false;
|
|
@@ -23952,35 +24054,40 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23952
24054
|
return false;
|
|
23953
24055
|
}
|
|
23954
24056
|
}
|
|
23955
|
-
function gateSubscriptions(
|
|
24057
|
+
function gateSubscriptions(scope, projections) {
|
|
23956
24058
|
const found = {
|
|
23957
24059
|
account: [],
|
|
23958
24060
|
reserve: [],
|
|
23959
24061
|
invalid: false
|
|
23960
24062
|
};
|
|
23961
|
-
for (const
|
|
23962
|
-
const
|
|
23963
|
-
|
|
23964
|
-
|
|
23965
|
-
if (
|
|
23966
|
-
|
|
23967
|
-
|
|
24063
|
+
for (const fiber of scope.fibers) {
|
|
24064
|
+
for (const hook of hooksOf(fiber)) {
|
|
24065
|
+
const subscription = subscriptionAt(hook, fiber);
|
|
24066
|
+
const kind = subscription && gateKind(subscription);
|
|
24067
|
+
if (subscription && kind) {
|
|
24068
|
+
if (kind !== "mixed" && snapshotsMatch(subscription, projections)) {
|
|
24069
|
+
found[kind].push(subscription);
|
|
24070
|
+
} else found.invalid = true;
|
|
24071
|
+
}
|
|
23968
24072
|
}
|
|
23969
24073
|
}
|
|
23970
24074
|
return found;
|
|
23971
24075
|
}
|
|
23972
|
-
function discoverGates(
|
|
23973
|
-
const gates = gateSubscriptions(
|
|
24076
|
+
function discoverGates(scope, projections) {
|
|
24077
|
+
const gates = gateSubscriptions(scope, projections);
|
|
23974
24078
|
if (gates.invalid) return null;
|
|
23975
|
-
const found =
|
|
24079
|
+
const found = [];
|
|
23976
24080
|
for (const kind of ["account", "reserve"]) {
|
|
23977
|
-
const
|
|
23978
|
-
|
|
23979
|
-
|
|
24081
|
+
const fibers = /* @__PURE__ */ new Set();
|
|
24082
|
+
for (const subscription of gates[kind]) {
|
|
24083
|
+
if (fibers.has(subscription.fiber)) return null;
|
|
24084
|
+
fibers.add(subscription.fiber);
|
|
24085
|
+
found.push([kind, subscription]);
|
|
24086
|
+
}
|
|
23980
24087
|
}
|
|
23981
24088
|
return found;
|
|
23982
24089
|
}
|
|
23983
|
-
function project2({ subscriber, store, atom, instance, subscribeEffect }) {
|
|
24090
|
+
function project2(kind, { fiber, subscriber, store, atom, instance, subscribeEffect }) {
|
|
23984
24091
|
for (const [target, key] of [
|
|
23985
24092
|
[store, "sub"],
|
|
23986
24093
|
[subscriber, "getSnapshot"],
|
|
@@ -24011,6 +24118,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24011
24118
|
instance.getSnapshot = allowed;
|
|
24012
24119
|
if (instance.value !== false) onChange();
|
|
24013
24120
|
return {
|
|
24121
|
+
kind,
|
|
24122
|
+
fiber,
|
|
24014
24123
|
subscriber,
|
|
24015
24124
|
instance,
|
|
24016
24125
|
restore() {
|
|
@@ -24020,13 +24129,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24020
24129
|
}
|
|
24021
24130
|
};
|
|
24022
24131
|
}
|
|
24023
|
-
function isBound(
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
return bound.every(
|
|
24029
|
-
({ subscriber, instance }) => hooks.some(
|
|
24132
|
+
function isBound(projections) {
|
|
24133
|
+
return [...projections].every(({ fiber, subscriber, instance }) => {
|
|
24134
|
+
const alternate = isRecord3(fiber.alternate) ? fiber.alternate : null;
|
|
24135
|
+
return [fiber, alternate].some(
|
|
24136
|
+
(candidate) => hooksOf(candidate).some(
|
|
24030
24137
|
(hook) => Array.isArray(hook.memoizedState) && hook.memoizedState[0] === subscriber && hook.next?.queue === instance
|
|
24031
24138
|
)
|
|
24032
24139
|
);
|
|
@@ -24037,7 +24144,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24037
24144
|
const projections = /* @__PURE__ */ new Map();
|
|
24038
24145
|
let retryAt = 0;
|
|
24039
24146
|
let allowed = false;
|
|
24147
|
+
const banner = createRendererCodexUsageBanner();
|
|
24040
24148
|
const release = () => {
|
|
24149
|
+
banner.restore();
|
|
24041
24150
|
const previous = [...projections.values()];
|
|
24042
24151
|
owner = null;
|
|
24043
24152
|
projections.clear();
|
|
@@ -24049,26 +24158,33 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24049
24158
|
}
|
|
24050
24159
|
};
|
|
24051
24160
|
const bind = () => {
|
|
24052
|
-
const current =
|
|
24161
|
+
const current = findSubmitScope(composer, projections);
|
|
24053
24162
|
const gates = current && discoverGates(current, projections);
|
|
24054
|
-
if (!current || !gates?.
|
|
24163
|
+
if (!current || !gates?.some(([kind]) => kind === "reserve")) {
|
|
24164
|
+
throw new Error("Codex usage gate is unavailable");
|
|
24165
|
+
}
|
|
24055
24166
|
owner = current;
|
|
24056
24167
|
for (const [kind, gate] of gates) {
|
|
24057
|
-
if (!projections.has(
|
|
24168
|
+
if (!projections.has(gate.instance)) projections.set(gate.instance, project2(kind, gate));
|
|
24058
24169
|
}
|
|
24059
24170
|
return "bypassed";
|
|
24060
24171
|
};
|
|
24061
24172
|
const apply = () => {
|
|
24173
|
+
const status = applyGate();
|
|
24174
|
+
if (status === "bypassed" && owner) banner.hide(owner.owner);
|
|
24175
|
+
else banner.restore();
|
|
24176
|
+
return status;
|
|
24177
|
+
};
|
|
24178
|
+
const applyGate = () => {
|
|
24062
24179
|
if (!allowed || !composer.isConnected) {
|
|
24063
24180
|
release();
|
|
24064
24181
|
retryAt = 0;
|
|
24065
24182
|
return "native";
|
|
24066
24183
|
}
|
|
24067
|
-
if (owner && !isBound(
|
|
24184
|
+
if (owner && !isBound(projections.values())) {
|
|
24068
24185
|
release();
|
|
24069
24186
|
retryAt = 0;
|
|
24070
24187
|
}
|
|
24071
|
-
if (owner && projections.size === 2) return "bypassed";
|
|
24072
24188
|
if (Date.now() < retryAt) return owner ? "bypassed" : "unsupported";
|
|
24073
24189
|
retryAt = Date.now() + RETRY_DELAY_MS;
|
|
24074
24190
|
try {
|
|
@@ -24193,13 +24309,13 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24193
24309
|
}
|
|
24194
24310
|
|
|
24195
24311
|
// src/renderer-native-thread.ts
|
|
24196
|
-
function
|
|
24312
|
+
function isRecord4(value) {
|
|
24197
24313
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24198
24314
|
}
|
|
24199
24315
|
async function verifyNativeCodexThread(sendRequest, threadId) {
|
|
24200
24316
|
const native = await sendRequest("thread/read", { threadId, includeTurns: false });
|
|
24201
|
-
const thread =
|
|
24202
|
-
if (!
|
|
24317
|
+
const thread = isRecord4(native) ? native.thread : null;
|
|
24318
|
+
if (!isRecord4(thread) || thread.id !== threadId || typeof thread.modelProvider !== "string" || !thread.modelProvider || thread.modelProvider === "codexhost" || typeof thread.cliVersion !== "string" || !thread.cliVersion || thread.cliVersion === "codexhost") {
|
|
24203
24319
|
throw new Error("Native Thread response cannot establish Codex ownership");
|
|
24204
24320
|
}
|
|
24205
24321
|
}
|
|
@@ -24279,15 +24395,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24279
24395
|
var CODEX_ACCOUNT_LIST_METHOD = "codexhost/account/list";
|
|
24280
24396
|
var CODEX_ACCOUNT_REFRESH_METHOD = "codexhost/account/refresh";
|
|
24281
24397
|
var CODEX_ACCOUNT_CHANGED_METHOD = "codexhost/account/changed";
|
|
24282
|
-
function
|
|
24398
|
+
function isRecord5(value) {
|
|
24283
24399
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24284
24400
|
}
|
|
24285
24401
|
function notifiedThreadId(notification) {
|
|
24286
|
-
if (!
|
|
24402
|
+
if (!isRecord5(notification) || !THREAD_USAGE_REFRESH_METHODS.includes(notification.method)) {
|
|
24287
24403
|
return null;
|
|
24288
24404
|
}
|
|
24289
24405
|
const params = notification.params;
|
|
24290
|
-
if (!
|
|
24406
|
+
if (!isRecord5(params)) return null;
|
|
24291
24407
|
const parsed = hostThreadIdSchema.safeParse(params.threadId);
|
|
24292
24408
|
return parsed.success ? parsed.data : null;
|
|
24293
24409
|
}
|
|
@@ -24634,7 +24750,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24634
24750
|
throw new Error("Renderer Account notification callback is unavailable");
|
|
24635
24751
|
}
|
|
24636
24752
|
return notifications.addNotificationCallback(CODEX_ACCOUNT_CHANGED_METHOD, (notification) => {
|
|
24637
|
-
if (!
|
|
24753
|
+
if (!isRecord5(notification) || notification.method !== CODEX_ACCOUNT_CHANGED_METHOD) return;
|
|
24638
24754
|
const state = codexAccountChangedSchema.safeParse(notification.params);
|
|
24639
24755
|
if (state.success) listener(state.data);
|
|
24640
24756
|
});
|
|
@@ -24643,16 +24759,16 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24643
24759
|
}
|
|
24644
24760
|
|
|
24645
24761
|
// src/renderer-external-queue.ts
|
|
24646
|
-
function
|
|
24762
|
+
function isRecord6(value) {
|
|
24647
24763
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24648
24764
|
}
|
|
24649
24765
|
function installRendererExternalQueue(target) {
|
|
24650
|
-
if (!
|
|
24766
|
+
if (!isRecord6(target) || typeof target.getTurnCoordinator !== "function" || typeof target.getConversation !== "function") {
|
|
24651
24767
|
return null;
|
|
24652
24768
|
}
|
|
24653
24769
|
const coordinator = target.getTurnCoordinator();
|
|
24654
|
-
const queue =
|
|
24655
|
-
if (!
|
|
24770
|
+
const queue = isRecord6(coordinator) ? coordinator.serverQueue : null;
|
|
24771
|
+
if (!isRecord6(queue) || typeof queue.isEnabled !== "function") return null;
|
|
24656
24772
|
const descriptor = Object.getOwnPropertyDescriptor(queue, "isEnabled");
|
|
24657
24773
|
if (!descriptor?.writable) return null;
|
|
24658
24774
|
const original = queue.isEnabled;
|
|
@@ -24661,7 +24777,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24661
24777
|
const threadId = args[0];
|
|
24662
24778
|
if (typeof threadId === "string") {
|
|
24663
24779
|
const conversation = getConversation.call(target, threadId);
|
|
24664
|
-
if (
|
|
24780
|
+
if (isRecord6(conversation) && conversation.id === threadId && // Reserved transport marker from externalThreadValue, retained by
|
|
24665
24781
|
// Desktop in both newly created and hydrated conversation metadata.
|
|
24666
24782
|
conversation.modelProvider === "codexhost") {
|
|
24667
24783
|
return false;
|
|
@@ -24677,19 +24793,19 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24677
24793
|
|
|
24678
24794
|
// src/renderer-external-steering.ts
|
|
24679
24795
|
var THREAD_OWNERSHIP_LIST_METHOD2 = "codexhost/thread/ownership/list";
|
|
24680
|
-
function
|
|
24796
|
+
function isRecord7(value) {
|
|
24681
24797
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24682
24798
|
}
|
|
24683
24799
|
function isManager(value) {
|
|
24684
|
-
return
|
|
24800
|
+
return isRecord7(value) && ["sendRequest", "steerTurn", "startTurn", "getTurnCoordinator"].every(
|
|
24685
24801
|
(key) => typeof value[key] === "function"
|
|
24686
24802
|
);
|
|
24687
24803
|
}
|
|
24688
24804
|
function submissionHost(manager) {
|
|
24689
24805
|
const coordinator = manager.getTurnCoordinator();
|
|
24690
|
-
const options =
|
|
24691
|
-
const host =
|
|
24692
|
-
if (!
|
|
24806
|
+
const options = isRecord7(coordinator) ? coordinator.options : null;
|
|
24807
|
+
const host = isRecord7(options) ? options.submissionHost : null;
|
|
24808
|
+
if (!isRecord7(host) || typeof host.getActiveTurnId !== "function" || typeof host.hasPendingTurnStart !== "function") {
|
|
24693
24809
|
throw new Error("Desktop turn submission binding is unavailable");
|
|
24694
24810
|
}
|
|
24695
24811
|
return {
|
|
@@ -24731,20 +24847,20 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24731
24847
|
var INTERRUPTED_QUEUE_REASON = "Interrupted before the steer was accepted.";
|
|
24732
24848
|
async function preserveQueuedFollowUps(manager, threadId) {
|
|
24733
24849
|
const coordinator = manager.getTurnCoordinator();
|
|
24734
|
-
if (!
|
|
24850
|
+
if (!isRecord7(coordinator) || typeof coordinator.loadMessages !== "function" || typeof coordinator.readMessages !== "function" || typeof coordinator.mutate !== "function") {
|
|
24735
24851
|
throw new Error("Desktop follow-up queue binding is unavailable");
|
|
24736
24852
|
}
|
|
24737
24853
|
await coordinator.loadMessages.call(coordinator, threadId);
|
|
24738
24854
|
const messages = coordinator.readMessages.call(coordinator, threadId);
|
|
24739
24855
|
if (!Array.isArray(messages)) throw new Error("Desktop follow-up queue is unavailable");
|
|
24740
24856
|
const alreadyPaused = new Set(
|
|
24741
|
-
messages.filter((message2) =>
|
|
24857
|
+
messages.filter((message2) => isRecord7(message2) && message2.pausedReason != null).map((message2) => message2.id)
|
|
24742
24858
|
);
|
|
24743
24859
|
return () => {
|
|
24744
24860
|
coordinator.mutate.call(coordinator, threadId, (current) => {
|
|
24745
24861
|
if (!Array.isArray(current)) return current;
|
|
24746
24862
|
return current.map((message2) => {
|
|
24747
|
-
if (!
|
|
24863
|
+
if (!isRecord7(message2) || alreadyPaused.has(message2.id) || message2.pausedReason !== INTERRUPTED_QUEUE_REASON)
|
|
24748
24864
|
return message2;
|
|
24749
24865
|
const resumed = { ...message2 };
|
|
24750
24866
|
delete resumed.pausedReason;
|
|
@@ -24765,9 +24881,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24765
24881
|
if ((method === "turn/start" || method === "turn/steer") && prepareTurnInput) {
|
|
24766
24882
|
params = prepareTurnInput(params);
|
|
24767
24883
|
}
|
|
24768
|
-
const messageId =
|
|
24769
|
-
const route = typeof messageId === "string" &&
|
|
24770
|
-
if (method !== "turn/start" || !
|
|
24884
|
+
const messageId = isRecord7(params) ? params.clientUserMessageId : null;
|
|
24885
|
+
const route = typeof messageId === "string" && isRecord7(params) ? routes.get(`${params.threadId}\0${messageId}`) : void 0;
|
|
24886
|
+
if (method !== "turn/start" || !isRecord7(params) || !route || route.threadId !== params.threadId) {
|
|
24771
24887
|
if (method === "turn/start" && sendTurnStart) {
|
|
24772
24888
|
return sendTurnStart(params, (input) => {
|
|
24773
24889
|
if (disposed) throw new Error("External submission binding was disposed");
|
|
@@ -24793,7 +24909,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24793
24909
|
options
|
|
24794
24910
|
)
|
|
24795
24911
|
).then((response) => {
|
|
24796
|
-
if (!
|
|
24912
|
+
if (!isRecord7(response) || typeof response.turnId !== "string" || !response.turnId) {
|
|
24797
24913
|
throw new Error("External steering returned no replacement Turn identity");
|
|
24798
24914
|
}
|
|
24799
24915
|
return {
|
|
@@ -24824,7 +24940,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24824
24940
|
] = args;
|
|
24825
24941
|
if (typeof threadId !== "string") return originalSteer.apply(manager, args);
|
|
24826
24942
|
const role = manager.getStreamRole?.(threadId);
|
|
24827
|
-
if (
|
|
24943
|
+
if (isRecord7(role) && role.role === "follower") return originalSteer.apply(manager, args);
|
|
24828
24944
|
let host = null;
|
|
24829
24945
|
let expectedTurnId;
|
|
24830
24946
|
try {
|
|
@@ -24853,15 +24969,15 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24853
24969
|
if (owner === "codex") return originalSteer.apply(manager, args);
|
|
24854
24970
|
if (!host) throw new Error("Desktop turn submission binding is unavailable");
|
|
24855
24971
|
const currentRole = manager.getStreamRole?.(threadId);
|
|
24856
|
-
if (
|
|
24972
|
+
if (isRecord7(currentRole) && currentRole.role === "follower")
|
|
24857
24973
|
return originalSteer.apply(manager, args);
|
|
24858
24974
|
if (!Array.isArray(input) || input.length === 0 || input.some(
|
|
24859
|
-
(item) => !
|
|
24860
|
-
) || !input.some((item) =>
|
|
24975
|
+
(item) => !isRecord7(item) || item.type !== "text" || typeof item.text !== "string"
|
|
24976
|
+
) || !input.some((item) => isRecord7(item) && typeof item.text === "string" && item.text.trim())) {
|
|
24861
24977
|
throw new Error("External steering requires non-empty text input");
|
|
24862
24978
|
}
|
|
24863
24979
|
if (toolOutput != null) throw new Error("External steering cannot replace a tool response");
|
|
24864
|
-
if (!
|
|
24980
|
+
if (!isRecord7(restoreMessage) || !isRecord7(restoreMessage.context)) {
|
|
24865
24981
|
throw new Error("Desktop steering message context is unavailable");
|
|
24866
24982
|
}
|
|
24867
24983
|
const messageId = typeof clientUserMessageId === "string" && clientUserMessageId ? clientUserMessageId : typeof restoreMessage.id === "string" && restoreMessage.id ? restoreMessage.id : crypto.randomUUID();
|
|
@@ -24909,7 +25025,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24909
25025
|
},
|
|
24910
25026
|
onMessageAdded
|
|
24911
25027
|
);
|
|
24912
|
-
if (!
|
|
25028
|
+
if (!isRecord7(response) || !isRecord7(response.turn) || typeof response.turn.id !== "string") {
|
|
24913
25029
|
throw new Error("Desktop returned no replacement Turn identity");
|
|
24914
25030
|
}
|
|
24915
25031
|
try {
|
|
@@ -24940,7 +25056,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24940
25056
|
}
|
|
24941
25057
|
|
|
24942
25058
|
// src/renderer-remote-attachments.ts
|
|
24943
|
-
function
|
|
25059
|
+
function isRecord8(value) {
|
|
24944
25060
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24945
25061
|
}
|
|
24946
25062
|
var MAX_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
@@ -24992,14 +25108,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24992
25108
|
function createRemoteAttachmentSender(target, hostId2, isCurrent) {
|
|
24993
25109
|
const prepared = /* @__PURE__ */ new WeakMap();
|
|
24994
25110
|
return (params, send) => {
|
|
24995
|
-
if (hostId2 === "local" || !
|
|
25111
|
+
if (hostId2 === "local" || !isRecord8(target) || !isRecord8(params) || typeof params.threadId !== "string" || !Array.isArray(params.input) || typeof target.getConversation !== "function")
|
|
24996
25112
|
return send(params);
|
|
24997
25113
|
const images = params.input.filter(
|
|
24998
|
-
(item) =>
|
|
25114
|
+
(item) => isRecord8(item) && (item.type === "image" || item.type === "localImage")
|
|
24999
25115
|
);
|
|
25000
25116
|
if (images.length === 0) return send(params);
|
|
25001
25117
|
const conversation = target.getConversation.call(target, params.threadId);
|
|
25002
|
-
if (!
|
|
25118
|
+
if (!isRecord8(conversation) || conversation.id !== params.threadId || conversation.modelProvider !== "codexhost")
|
|
25003
25119
|
return send(params);
|
|
25004
25120
|
const assertCurrent = () => {
|
|
25005
25121
|
if (!isCurrent()) throw new Error("Remote attachment connection is no longer available");
|
|
@@ -25012,7 +25128,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25012
25128
|
const cached2 = prepared.get(params);
|
|
25013
25129
|
if (cached2) return cached2.then(dispatch);
|
|
25014
25130
|
const input = params.input;
|
|
25015
|
-
const text = input.filter((item) =>
|
|
25131
|
+
const text = input.filter((item) => isRecord8(item) && item.type === "text").map((item) => isRecord8(item) && typeof item.text === "string" ? item.text : "").join("\n");
|
|
25016
25132
|
const existingPaths = nativeImagePaths(text);
|
|
25017
25133
|
const prepare = async () => {
|
|
25018
25134
|
if (existingPaths.length === images.length) return params;
|
|
@@ -25044,7 +25160,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25044
25160
|
contents: file2.contents,
|
|
25045
25161
|
label: `image-${index + 1}.${file2.extension}`
|
|
25046
25162
|
});
|
|
25047
|
-
if (!
|
|
25163
|
+
if (!isRecord8(saved) || !filePath(saved.path) || saved.fsPath !== saved.path) {
|
|
25048
25164
|
throw new Error("Desktop returned an invalid remote attachment path");
|
|
25049
25165
|
}
|
|
25050
25166
|
created.push(saved.path);
|
|
@@ -25151,11 +25267,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25151
25267
|
}
|
|
25152
25268
|
|
|
25153
25269
|
// src/renderer-manual-compaction.ts
|
|
25154
|
-
function
|
|
25270
|
+
function isRecord9(value) {
|
|
25155
25271
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25156
25272
|
}
|
|
25157
25273
|
function installRendererManualCompaction(target, hostId2, messages) {
|
|
25158
|
-
if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !
|
|
25274
|
+
if (!messages || typeof messages.addEventListener !== "function" || typeof messages.removeEventListener !== "function" || !isRecord9(target) || typeof target.registerPendingManualContextCompaction !== "function" || typeof target.getConversation !== "function") {
|
|
25159
25275
|
return null;
|
|
25160
25276
|
}
|
|
25161
25277
|
const register = target.registerPendingManualContextCompaction;
|
|
@@ -25164,18 +25280,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25164
25280
|
const listener = (event) => {
|
|
25165
25281
|
if (event.source != null && event.source !== messages) return;
|
|
25166
25282
|
const message2 = event.data;
|
|
25167
|
-
if (!
|
|
25283
|
+
if (!isRecord9(message2) || message2.type !== "mcp-notification" || message2.hostId !== hostId2 || message2.method !== THREAD_MANUAL_COMPACTION_STARTED_METHOD) {
|
|
25168
25284
|
return;
|
|
25169
25285
|
}
|
|
25170
25286
|
const params = threadManualCompactionStartedSchema.safeParse(message2.params);
|
|
25171
25287
|
if (!params.success) return;
|
|
25172
25288
|
const { threadId } = params.data;
|
|
25173
25289
|
const conversation = getConversation.call(target, threadId);
|
|
25174
|
-
if (!
|
|
25290
|
+
if (!isRecord9(conversation) || conversation.id !== threadId || conversation.modelProvider !== "codexhost") {
|
|
25175
25291
|
return;
|
|
25176
25292
|
}
|
|
25177
25293
|
const role = getStreamRole?.call(target, threadId);
|
|
25178
|
-
if (
|
|
25294
|
+
if (isRecord9(role) && role.role === "follower") return;
|
|
25179
25295
|
register.call(target, threadId);
|
|
25180
25296
|
};
|
|
25181
25297
|
messages.addEventListener("message", listener);
|
|
@@ -25392,7 +25508,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25392
25508
|
var SIDEBAR_EXTERNAL_THREAD_ATTRIBUTE = "data-codexhost-sidebar-external-thread";
|
|
25393
25509
|
var OWNERSHIP_RETRY_DELAYS_MS = [100, 300, 800, 1500, 3e3];
|
|
25394
25510
|
var PIN_REPLAY_RETRY_DELAYS_MS = [50, 150, 300];
|
|
25395
|
-
function
|
|
25511
|
+
function isRecord10(value) {
|
|
25396
25512
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25397
25513
|
}
|
|
25398
25514
|
function sidebarThreadAttributes(element) {
|
|
@@ -25419,19 +25535,19 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25419
25535
|
const fiberName = fiberNames[0];
|
|
25420
25536
|
if (fiberNames.length !== 1 || !fiberName) return null;
|
|
25421
25537
|
const firstFiber2 = Object.getOwnPropertyDescriptor(element, fiberName)?.value;
|
|
25422
|
-
if (!
|
|
25538
|
+
if (!isRecord10(firstFiber2)) return null;
|
|
25423
25539
|
const candidates = /* @__PURE__ */ new Set();
|
|
25424
25540
|
let fiber = firstFiber2;
|
|
25425
25541
|
for (let depth = 0; fiber && depth < 12; depth += 1) {
|
|
25426
25542
|
const props = fiber.memoizedProps;
|
|
25427
|
-
if (
|
|
25543
|
+
if (isRecord10(props) && isRecord10(props.dataAttributes)) {
|
|
25428
25544
|
const dataAttributes = props.dataAttributes;
|
|
25429
25545
|
const threadId = hostThreadIdSchema.safeParse(props.conversationId);
|
|
25430
25546
|
if (threadId.success && dataAttributes[SIDEBAR_THREAD_ROW_ATTRIBUTE] === rowMarker && dataAttributes[SIDEBAR_THREAD_ID_ATTRIBUTE] === taskKey && dataAttributes[SIDEBAR_THREAD_HOST_ID_ATTRIBUTE] === hostId2) {
|
|
25431
25547
|
candidates.add(threadId.data);
|
|
25432
25548
|
}
|
|
25433
25549
|
}
|
|
25434
|
-
fiber =
|
|
25550
|
+
fiber = isRecord10(fiber.return) ? fiber.return : null;
|
|
25435
25551
|
}
|
|
25436
25552
|
return candidates.size === 1 ? candidates.values().next().value ?? null : null;
|
|
25437
25553
|
}
|
|
@@ -25916,7 +26032,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25916
26032
|
if (row) finish(row);
|
|
25917
26033
|
});
|
|
25918
26034
|
}
|
|
25919
|
-
function
|
|
26035
|
+
function isRecord11(value) {
|
|
25920
26036
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25921
26037
|
}
|
|
25922
26038
|
function firstFiber(element) {
|
|
@@ -25926,7 +26042,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25926
26042
|
const name = names[0];
|
|
25927
26043
|
if (names.length !== 1 || !name) return null;
|
|
25928
26044
|
const value = Object.getOwnPropertyDescriptor(element, name)?.value;
|
|
25929
|
-
return
|
|
26045
|
+
return isRecord11(value) ? value : null;
|
|
25930
26046
|
}
|
|
25931
26047
|
function directForkAncestors(first) {
|
|
25932
26048
|
const ancestors = [];
|
|
@@ -25936,7 +26052,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25936
26052
|
if (seen.has(fiber)) return [];
|
|
25937
26053
|
seen.add(fiber);
|
|
25938
26054
|
ancestors.push(fiber);
|
|
25939
|
-
fiber =
|
|
26055
|
+
fiber = isRecord11(fiber.return) ? fiber.return : null;
|
|
25940
26056
|
}
|
|
25941
26057
|
return ancestors;
|
|
25942
26058
|
}
|
|
@@ -25954,7 +26070,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25954
26070
|
let hasForkCallback = false;
|
|
25955
26071
|
for (const fiber of ancestors) {
|
|
25956
26072
|
const props = fiber.memoizedProps;
|
|
25957
|
-
if (!
|
|
26073
|
+
if (!isRecord11(props)) continue;
|
|
25958
26074
|
if (!hasForkCallback && typeof props.onFork !== "function" && ownsOtherCallback(fiber, props)) {
|
|
25959
26075
|
return null;
|
|
25960
26076
|
}
|
|
@@ -25986,7 +26102,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
25986
26102
|
if (!threadId.success || !turnId.success) return null;
|
|
25987
26103
|
const fiber = firstFiber(button2);
|
|
25988
26104
|
const buttonProps = fiber?.memoizedProps;
|
|
25989
|
-
if (!fiber || !
|
|
26105
|
+
if (!fiber || !isRecord11(buttonProps) || !Object.hasOwn(buttonProps, "aria-busy")) return null;
|
|
25990
26106
|
return forkTargetFromAncestors(button2, threadId.data, turnId.data, directForkAncestors(fiber)) ?? forkTargetFromAncestors(button2, threadId.data, turnId.data, committedReactAncestors(fiber));
|
|
25991
26107
|
}
|
|
25992
26108
|
var BrowserRendererForkDom = class {
|
|
@@ -26076,7 +26192,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26076
26192
|
}
|
|
26077
26193
|
var DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS = 1e4;
|
|
26078
26194
|
var DRAFT_PREWARM_POLICY_POLL_INTERVAL_MS = 25;
|
|
26079
|
-
function
|
|
26195
|
+
function isRecord12(value) {
|
|
26080
26196
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26081
26197
|
}
|
|
26082
26198
|
function decodeOpenCodeTransportModelId(value) {
|
|
@@ -26241,7 +26357,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26241
26357
|
let fiber = findComposerFiber(composer);
|
|
26242
26358
|
for (let depth = 0; fiber && depth < 120; depth += 1) {
|
|
26243
26359
|
const props = fiber.memoizedProps;
|
|
26244
|
-
if (
|
|
26360
|
+
if (isRecord12(props) && "conversationId" in props && props.conversationId != null) {
|
|
26245
26361
|
const candidate = hostThreadIdSchema.safeParse(props.conversationId);
|
|
26246
26362
|
if (!candidate.success || threadId !== void 0 && threadId !== candidate.data) {
|
|
26247
26363
|
return null;
|
|
@@ -26254,12 +26370,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26254
26370
|
return threadId;
|
|
26255
26371
|
}
|
|
26256
26372
|
function isLegacySevenSlotDraftWrapper(value) {
|
|
26257
|
-
if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !
|
|
26373
|
+
if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord12(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
|
|
26258
26374
|
return false;
|
|
26259
26375
|
}
|
|
26260
26376
|
try {
|
|
26261
26377
|
const draft = value[3].get();
|
|
26262
|
-
return
|
|
26378
|
+
return isRecord12(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
|
|
26263
26379
|
} catch {
|
|
26264
26380
|
return false;
|
|
26265
26381
|
}
|
|
@@ -26293,8 +26409,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26293
26409
|
let fiber = findComposerFiber(composer);
|
|
26294
26410
|
for (let depth = 0; fiber && depth < 120; depth += 1) {
|
|
26295
26411
|
const updateQueue = fiber.updateQueue;
|
|
26296
|
-
const memoCache =
|
|
26297
|
-
const data =
|
|
26412
|
+
const memoCache = isRecord12(updateQueue) ? updateQueue.memoCache : null;
|
|
26413
|
+
const data = isRecord12(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
|
|
26298
26414
|
for (const value of data) {
|
|
26299
26415
|
const draftId = draftIdFromMemoValue(value);
|
|
26300
26416
|
if (draftId) draftIds.add(draftId);
|
|
@@ -26322,7 +26438,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26322
26438
|
return ["default", draftIds.values().next().value];
|
|
26323
26439
|
}
|
|
26324
26440
|
function isDraftPrewarmPolicyReady(value) {
|
|
26325
|
-
return
|
|
26441
|
+
return isRecord12(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
|
|
26326
26442
|
}
|
|
26327
26443
|
async function waitForRendererDraftPrewarmPolicy(target, composer) {
|
|
26328
26444
|
const deadline = Date.now() + DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS;
|
|
@@ -26575,16 +26691,16 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26575
26691
|
}
|
|
26576
26692
|
|
|
26577
26693
|
// src/renderer-subagent-thread-model.ts
|
|
26578
|
-
function
|
|
26694
|
+
function isRecord13(value) {
|
|
26579
26695
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26580
26696
|
}
|
|
26581
26697
|
function nonBlank(value) {
|
|
26582
26698
|
return typeof value === "string" && value.trim().length > 0;
|
|
26583
26699
|
}
|
|
26584
26700
|
function threadFromReadResult(value, expectedThreadId) {
|
|
26585
|
-
if (!
|
|
26586
|
-
const directThread =
|
|
26587
|
-
const nestedThread =
|
|
26701
|
+
if (!isRecord13(value)) return null;
|
|
26702
|
+
const directThread = isRecord13(value.thread) ? value.thread : null;
|
|
26703
|
+
const nestedThread = isRecord13(value.result) && isRecord13(value.result.thread) ? value.result.thread : null;
|
|
26588
26704
|
const thread = directThread ?? nestedThread;
|
|
26589
26705
|
if (!thread) return null;
|
|
26590
26706
|
if (expectedThreadId && (!nonBlank(thread.id) || thread.id.trim() !== expectedThreadId)) {
|
|
@@ -26598,7 +26714,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26598
26714
|
if (typeof policy?.requestTarget !== "function") return null;
|
|
26599
26715
|
try {
|
|
26600
26716
|
const target = policy.requestTarget();
|
|
26601
|
-
return
|
|
26717
|
+
return isRecord13(target) && typeof target.sendRequest === "function" ? target : null;
|
|
26602
26718
|
} catch {
|
|
26603
26719
|
return null;
|
|
26604
26720
|
}
|
|
@@ -26639,10 +26755,10 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26639
26755
|
function subagentStatusFromReadResult(value, expectedThreadId) {
|
|
26640
26756
|
const thread = threadFromReadResult(value, expectedThreadId);
|
|
26641
26757
|
if (!thread) return null;
|
|
26642
|
-
const threadStatus =
|
|
26758
|
+
const threadStatus = isRecord13(thread.status) && nonBlank(thread.status.type) ? thread.status.type : void 0;
|
|
26643
26759
|
if (threadStatus === "systemError") return "failed";
|
|
26644
26760
|
const turns = Array.isArray(thread.turns) ? thread.turns : [];
|
|
26645
|
-
const lastTurn = [...turns].reverse().find(
|
|
26761
|
+
const lastTurn = [...turns].reverse().find(isRecord13);
|
|
26646
26762
|
const turnStatus = lastTurn && nonBlank(lastTurn.status) ? lastTurn.status : void 0;
|
|
26647
26763
|
if (turnStatus === "completed") return "completed";
|
|
26648
26764
|
if (turnStatus === "failed") return "failed";
|
|
@@ -26786,7 +26902,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26786
26902
|
var SUBAGENT_ROW_COPY_ATTRIBUTE = "data-codexhost-subagent-copy";
|
|
26787
26903
|
var SUBAGENT_ITEM_BUTTON_SELECTOR = 'button[data-slot="thread-summary-panel-item-button"]';
|
|
26788
26904
|
var SUBAGENT_ITEM_LABEL_SELECTOR = '[data-slot="thread-summary-panel-item-label"]';
|
|
26789
|
-
function
|
|
26905
|
+
function isRecord14(value) {
|
|
26790
26906
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26791
26907
|
}
|
|
26792
26908
|
function nonBlank2(value) {
|
|
@@ -26904,12 +27020,12 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26904
27020
|
if (nonBlank2(source.status) && !target.status) {
|
|
26905
27021
|
target.status = source.status.trim();
|
|
26906
27022
|
}
|
|
26907
|
-
if (
|
|
27023
|
+
if (isRecord14(source.agentState) && nonBlank2(source.agentState.status) && !target.status) {
|
|
26908
27024
|
target.status = source.agentState.status.trim();
|
|
26909
27025
|
}
|
|
26910
|
-
if (
|
|
27026
|
+
if (isRecord14(source.agentsStates) && target.conversationId) {
|
|
26911
27027
|
const state = source.agentsStates[target.conversationId];
|
|
26912
|
-
if (
|
|
27028
|
+
if (isRecord14(state) && nonBlank2(state.status) && !target.status) {
|
|
26913
27029
|
target.status = state.status.trim();
|
|
26914
27030
|
}
|
|
26915
27031
|
}
|
|
@@ -26920,28 +27036,28 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
26920
27036
|
if (Array.isArray(item.receiverThreadIds) && item.receiverThreadIds.includes(conversationId)) {
|
|
26921
27037
|
return true;
|
|
26922
27038
|
}
|
|
26923
|
-
return
|
|
27039
|
+
return isRecord14(item.agentsStates) && conversationId in item.agentsStates;
|
|
26924
27040
|
}
|
|
26925
27041
|
function harvestFromValue(value, target) {
|
|
26926
|
-
if (!
|
|
27042
|
+
if (!isRecord14(value)) return;
|
|
26927
27043
|
contribute(target, value);
|
|
26928
27044
|
const nested = [
|
|
26929
|
-
|
|
26930
|
-
|
|
26931
|
-
|
|
26932
|
-
|
|
26933
|
-
|
|
26934
|
-
|
|
27045
|
+
isRecord14(value.row) ? value.row : null,
|
|
27046
|
+
isRecord14(value.backgroundAgent) ? value.backgroundAgent : null,
|
|
27047
|
+
isRecord14(value.item) ? value.item : null,
|
|
27048
|
+
isRecord14(value.item) && isRecord14(value.item.backgroundAgent) ? value.item.backgroundAgent : null,
|
|
27049
|
+
isRecord14(value.thread) && (!target.conversationId || nonBlank2(value.thread.id) && value.thread.id.trim() === target.conversationId) ? value.thread : null,
|
|
27050
|
+
isRecord14(value.childConversation) ? value.childConversation : null
|
|
26935
27051
|
];
|
|
26936
27052
|
for (const source of nested) {
|
|
26937
27053
|
if (source) contribute(target, source);
|
|
26938
27054
|
}
|
|
26939
27055
|
if (!target.conversationId) return;
|
|
26940
27056
|
const items = Array.isArray(value.items) ? value.items : Array.isArray(value.turns) ? value.turns.flatMap(
|
|
26941
|
-
(turn) =>
|
|
27057
|
+
(turn) => isRecord14(turn) && Array.isArray(turn.items) ? turn.items : []
|
|
26942
27058
|
) : [];
|
|
26943
27059
|
for (const item of items) {
|
|
26944
|
-
if (!
|
|
27060
|
+
if (!isRecord14(item)) continue;
|
|
26945
27061
|
if (collabMatches(item, target.conversationId)) contribute(target, item, true);
|
|
26946
27062
|
}
|
|
26947
27063
|
}
|
|
@@ -27008,7 +27124,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27008
27124
|
const name = names[0];
|
|
27009
27125
|
if (!name) return null;
|
|
27010
27126
|
const fiber = Object.getOwnPropertyDescriptor(element, name)?.value ?? element[name];
|
|
27011
|
-
return
|
|
27127
|
+
return isRecord14(fiber) ? fiber : null;
|
|
27012
27128
|
}
|
|
27013
27129
|
function metaFromFiberProps(fiber) {
|
|
27014
27130
|
if (!fiber) return null;
|
|
@@ -27037,7 +27153,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27037
27153
|
};
|
|
27038
27154
|
}
|
|
27039
27155
|
function metaFromDescendants(start) {
|
|
27040
|
-
if (!start || !
|
|
27156
|
+
if (!start || !isRecord14(start.child)) return null;
|
|
27041
27157
|
const stack = [start.child];
|
|
27042
27158
|
const seen = /* @__PURE__ */ new Set();
|
|
27043
27159
|
let found = null;
|
|
@@ -27048,8 +27164,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27048
27164
|
seen.add(fiber);
|
|
27049
27165
|
steps += 1;
|
|
27050
27166
|
found = mergeRow(found, metaFromFiberProps(fiber));
|
|
27051
|
-
if (
|
|
27052
|
-
if (
|
|
27167
|
+
if (isRecord14(fiber.child)) stack.push(fiber.child);
|
|
27168
|
+
if (isRecord14(fiber.sibling)) stack.push(fiber.sibling);
|
|
27053
27169
|
}
|
|
27054
27170
|
return found;
|
|
27055
27171
|
}
|
|
@@ -27058,7 +27174,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27058
27174
|
let found = metaFromDescendants(fiber);
|
|
27059
27175
|
for (let depth = 0; fiber && depth < 12; depth += 1) {
|
|
27060
27176
|
found = mergeRow(found, metaFromFiberProps(fiber));
|
|
27061
|
-
fiber =
|
|
27177
|
+
fiber = isRecord14(fiber.return) ? fiber.return : null;
|
|
27062
27178
|
}
|
|
27063
27179
|
return found;
|
|
27064
27180
|
}
|
|
@@ -27245,11 +27361,11 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27245
27361
|
return null;
|
|
27246
27362
|
}
|
|
27247
27363
|
}
|
|
27248
|
-
function
|
|
27364
|
+
function isRecord15(value) {
|
|
27249
27365
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27250
27366
|
}
|
|
27251
27367
|
function parseExternalConfiguration(value) {
|
|
27252
|
-
if (!
|
|
27368
|
+
if (!isRecord15(value)) return void 0;
|
|
27253
27369
|
const model2 = harnessModelRefSchema.safeParse(value.model);
|
|
27254
27370
|
if (!model2.success) return void 0;
|
|
27255
27371
|
const thinkingOptionId = harnessThinkingOptionIdSchema.safeParse(value.thinkingOptionId);
|
|
@@ -27266,10 +27382,10 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27266
27382
|
const raw = storage.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY);
|
|
27267
27383
|
if (!raw) return void 0;
|
|
27268
27384
|
const parsed = JSON.parse(raw);
|
|
27269
|
-
if (!
|
|
27385
|
+
if (!isRecord15(parsed) || parsed.version !== 1) return void 0;
|
|
27270
27386
|
if (parsed.lastAgent !== "codex" && !harnessPluginIdSchema.safeParse(parsed.lastAgent).success)
|
|
27271
27387
|
return void 0;
|
|
27272
|
-
const externalByAgent =
|
|
27388
|
+
const externalByAgent = isRecord15(parsed.externalByAgent) ? parsed.externalByAgent : {};
|
|
27273
27389
|
const parsedExternal = Object.fromEntries(
|
|
27274
27390
|
Object.keys(externalByAgent).filter((agent) => harnessPluginIdSchema.safeParse(agent).success).flatMap((agent) => {
|
|
27275
27391
|
const configuration = parseExternalConfiguration(externalByAgent[agent]);
|
|
@@ -27395,7 +27511,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27395
27511
|
var GET_LOCALE_OVERRIDE_URL = "vscode://codex/get-setting";
|
|
27396
27512
|
var GET_LOCALE_INFO_URL = "vscode://codex/locale-info";
|
|
27397
27513
|
var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
|
|
27398
|
-
function
|
|
27514
|
+
function isRecord16(value) {
|
|
27399
27515
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27400
27516
|
}
|
|
27401
27517
|
function canonicalLocale(value) {
|
|
@@ -27417,7 +27533,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27417
27533
|
return new DOMException("The operation was aborted", "AbortError");
|
|
27418
27534
|
}
|
|
27419
27535
|
function parseLocaleOverride(value) {
|
|
27420
|
-
if (!
|
|
27536
|
+
if (!isRecord16(value) || !("value" in value)) {
|
|
27421
27537
|
throw new Error("Codex locale override response is malformed");
|
|
27422
27538
|
}
|
|
27423
27539
|
if (value.value === null) return { value: null };
|
|
@@ -27432,7 +27548,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27432
27548
|
return locale;
|
|
27433
27549
|
}
|
|
27434
27550
|
function parseLocaleInfo(value) {
|
|
27435
|
-
if (!
|
|
27551
|
+
if (!isRecord16(value)) throw new Error("Codex locale info response is malformed");
|
|
27436
27552
|
return {
|
|
27437
27553
|
ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
|
|
27438
27554
|
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
@@ -27461,7 +27577,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
27461
27577
|
const onAbort = () => settle(() => reject(abortError2()));
|
|
27462
27578
|
const onMessage = (event) => {
|
|
27463
27579
|
const message3 = event.data;
|
|
27464
|
-
if (!
|
|
27580
|
+
if (!isRecord16(message3) || message3.type !== "fetch-response") return;
|
|
27465
27581
|
if (message3.requestId !== requestId) return;
|
|
27466
27582
|
if (message3.responseType !== "success" || typeof message3.status !== "number" || message3.status < 200 || message3.status >= 300 || typeof message3.bodyJsonString !== "string") {
|
|
27467
27583
|
settle(() => reject(new Error("Codex locale request failed")));
|
|
@@ -32699,10 +32815,10 @@ ${detail}` : ""}`
|
|
|
32699
32815
|
let previousWasTranslation = false;
|
|
32700
32816
|
paragraphLines.forEach((line, lineIndex) => {
|
|
32701
32817
|
if (lineIndex > 0 && !primaryIsCjk && CJK_PATTERN.test(line)) {
|
|
32702
|
-
const
|
|
32703
|
-
|
|
32704
|
-
appendInline(document2,
|
|
32705
|
-
paragraph.append(
|
|
32818
|
+
const translation2 = document2.createElement("span");
|
|
32819
|
+
translation2.className = "release-note-translation";
|
|
32820
|
+
appendInline(document2, translation2, line);
|
|
32821
|
+
paragraph.append(translation2);
|
|
32706
32822
|
previousWasTranslation = true;
|
|
32707
32823
|
return;
|
|
32708
32824
|
}
|
|
@@ -33418,17 +33534,6 @@ ${detail}` : ""}`
|
|
|
33418
33534
|
if (periodType === "seven_day") return messages.accountCreditsPeriodSevenDay;
|
|
33419
33535
|
return messages.accountCreditsPeriodUnknown;
|
|
33420
33536
|
}
|
|
33421
|
-
function creditsProductLabel(product, messages) {
|
|
33422
|
-
if (product === "GrokBuild" || product === "Build") return messages.accountCreditsBuild;
|
|
33423
|
-
if (product === "5-hour window") return messages.accountCreditsPeriodFiveHour;
|
|
33424
|
-
if (product === "7-day window") return messages.accountCreditsPeriodSevenDay;
|
|
33425
|
-
if (product.endsWith(" \xB7 monthly"))
|
|
33426
|
-
return `${product.slice(0, -" \xB7 monthly".length)} \xB7 ${messages.accountCreditsPeriodMonthly}`;
|
|
33427
|
-
if (product === "GrokChat") return "Chat";
|
|
33428
|
-
if (product === "GrokImagine") return "Imagine";
|
|
33429
|
-
if (product === "GrokVoice") return "Voice";
|
|
33430
|
-
return product;
|
|
33431
|
-
}
|
|
33432
33537
|
function formatAccountCreditsReset(value, locale, now = /* @__PURE__ */ new Date()) {
|
|
33433
33538
|
if (locale !== "zh-CN") return formatRendererCreditsReset(value, now);
|
|
33434
33539
|
const date5 = new Date(value);
|
|
@@ -33455,36 +33560,22 @@ ${detail}` : ""}`
|
|
|
33455
33560
|
if (periodType === "weekly" || periodType === "seven_day") return "seven_day";
|
|
33456
33561
|
return null;
|
|
33457
33562
|
}
|
|
33458
|
-
function scopedUsageProduct(product) {
|
|
33459
|
-
const suffixes = [
|
|
33460
|
-
[" \xB7 5-hour window", "five_hour"],
|
|
33461
|
-
[" \xB7 Weekly window", "seven_day"],
|
|
33462
|
-
[" \xB7 7-day window", "seven_day"],
|
|
33463
|
-
[" \xB7 5-hour", "five_hour"],
|
|
33464
|
-
[" \xB7 7-day", "seven_day"]
|
|
33465
|
-
];
|
|
33466
|
-
for (const [suffix, period] of suffixes) {
|
|
33467
|
-
if (!product.endsWith(suffix)) continue;
|
|
33468
|
-
const scope = product.slice(0, -suffix.length).trim();
|
|
33469
|
-
if (scope) return { scope, period };
|
|
33470
|
-
}
|
|
33471
|
-
return null;
|
|
33472
|
-
}
|
|
33473
33563
|
function splitUsageWindows(credits, messages, filter) {
|
|
33474
33564
|
const generic = { columns: {} };
|
|
33475
33565
|
const scopedRows = /* @__PURE__ */ new Map();
|
|
33476
33566
|
const additional = [];
|
|
33477
33567
|
const addScoped = (scope, period, window2) => {
|
|
33478
|
-
const
|
|
33568
|
+
const scopeLabel = localizeHarnessPresentation(scope, messages.locale).label;
|
|
33569
|
+
const rows2 = scopedRows.get(scope.id) ?? [];
|
|
33479
33570
|
let row = rows2.find((candidate) => !candidate.columns[period]);
|
|
33480
33571
|
if (!row) {
|
|
33481
|
-
row = { scope, columns: {} };
|
|
33572
|
+
row = { scope: scopeLabel, columns: {} };
|
|
33482
33573
|
rows2.push(row);
|
|
33483
|
-
scopedRows.set(scope, rows2);
|
|
33574
|
+
scopedRows.set(scope.id, rows2);
|
|
33484
33575
|
}
|
|
33485
33576
|
row.columns[period] = {
|
|
33486
33577
|
...window2,
|
|
33487
|
-
label:
|
|
33578
|
+
label: window2.label,
|
|
33488
33579
|
scoped: true
|
|
33489
33580
|
};
|
|
33490
33581
|
};
|
|
@@ -33494,29 +33585,30 @@ ${detail}` : ""}`
|
|
|
33494
33585
|
else additional.push(window2);
|
|
33495
33586
|
};
|
|
33496
33587
|
const primary = {
|
|
33497
|
-
label:
|
|
33588
|
+
label: accountCreditsWindowLabel(
|
|
33589
|
+
credits,
|
|
33590
|
+
messages.locale,
|
|
33591
|
+
(period) => creditsPeriodLabel2(period, messages)
|
|
33592
|
+
),
|
|
33498
33593
|
usedPercent: credits.usedPercent ?? 0,
|
|
33499
33594
|
amount: credits,
|
|
33500
33595
|
resetsAt: credits.resetsAt,
|
|
33501
|
-
scoped: Boolean(credits.
|
|
33596
|
+
scoped: Boolean(credits.scope)
|
|
33502
33597
|
};
|
|
33503
|
-
|
|
33504
|
-
addWindow(
|
|
33505
|
-
primary,
|
|
33506
|
-
primaryScope?.period ?? (credits.label ? null : comparisonPeriod(credits.periodType)),
|
|
33507
|
-
primaryScope?.scope
|
|
33508
|
-
);
|
|
33598
|
+
addWindow(primary, comparisonPeriod(credits.periodType), credits.scope);
|
|
33509
33599
|
for (const product of credits.productUsage ?? []) {
|
|
33510
|
-
const scoped = scopedUsageProduct(product.product);
|
|
33511
33600
|
const window2 = {
|
|
33512
|
-
label:
|
|
33601
|
+
label: accountCreditsWindowLabel(
|
|
33602
|
+
product,
|
|
33603
|
+
messages.locale,
|
|
33604
|
+
(period) => creditsPeriodLabel2(period, messages)
|
|
33605
|
+
),
|
|
33513
33606
|
usedPercent: product.usagePercent,
|
|
33514
33607
|
amount: product,
|
|
33515
33608
|
resetsAt: product.resetsAt,
|
|
33516
|
-
scoped: Boolean(
|
|
33609
|
+
scoped: Boolean(product.scope)
|
|
33517
33610
|
};
|
|
33518
|
-
|
|
33519
|
-
addWindow(window2, scoped?.period ?? genericPeriod, scoped?.scope);
|
|
33611
|
+
addWindow(window2, comparisonPeriod(product.periodType ?? "unknown"), product.scope);
|
|
33520
33612
|
}
|
|
33521
33613
|
const structured = [...scopedRows.values()].flat();
|
|
33522
33614
|
let rows = Object.keys(generic.columns).length > 0 ? [generic, ...structured] : structured;
|
|
@@ -34516,7 +34608,7 @@ ${detail}` : ""}`
|
|
|
34516
34608
|
var CODEXHOST_GITHUB_REPOSITORY_URL = "https://github.com/LIBERSEEK/BOFT-CLI";
|
|
34517
34609
|
var CODEXHOST_RELEASES_LATEST_URL = `${CODEXHOST_GITHUB_REPOSITORY_URL}/releases/latest`;
|
|
34518
34610
|
var CODEXHOST_NPM_MANUAL_UPDATE_COMMAND = "npm install -g @liberseek/boft-cli@latest";
|
|
34519
|
-
var LIBERSEEK_WEBSITE_URL = "https://
|
|
34611
|
+
var LIBERSEEK_WEBSITE_URL = "https://liberseek.ai";
|
|
34520
34612
|
var LIBERSEEK_LOGO_VIDEO_URL = logo_animated_default;
|
|
34521
34613
|
function rendererUserAgentData(navigator2) {
|
|
34522
34614
|
return navigator2.userAgentData;
|
|
@@ -40102,7 +40194,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
40102
40194
|
const bounds = element.getBoundingClientRect();
|
|
40103
40195
|
return bounds.width > 0 && bounds.height > 0;
|
|
40104
40196
|
}
|
|
40105
|
-
function
|
|
40197
|
+
function isElement2(node) {
|
|
40106
40198
|
return node.nodeType === 1 || "hasAttribute" in node;
|
|
40107
40199
|
}
|
|
40108
40200
|
function isRightActionCluster(header, child) {
|
|
@@ -40115,7 +40207,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
40115
40207
|
const toolbar = header.querySelector(SETTINGS_HEADER_TOOLBAR_SELECTOR);
|
|
40116
40208
|
if (!toolbar) return null;
|
|
40117
40209
|
const clusters = [...toolbar.children].filter(
|
|
40118
|
-
(child) =>
|
|
40210
|
+
(child) => isElement2(child) && isRightActionCluster(header, child)
|
|
40119
40211
|
);
|
|
40120
40212
|
clusters.sort(
|
|
40121
40213
|
(left, right) => right.getBoundingClientRect().right - left.getBoundingClientRect().right
|
|
@@ -40146,7 +40238,7 @@ th[aria-sort] .console-usage-sort__mark {
|
|
|
40146
40238
|
if (!cluster) continue;
|
|
40147
40239
|
const summary = summaryClusterChild(cluster);
|
|
40148
40240
|
let before = summary ? summary.nextSibling : null;
|
|
40149
|
-
if (before &&
|
|
40241
|
+
if (before && isElement2(before) && before.hasAttribute(SETTINGS_TRIGGER_ATTRIBUTE)) {
|
|
40150
40242
|
before = before.nextSibling;
|
|
40151
40243
|
}
|
|
40152
40244
|
return { parent: cluster, before };
|
|
@@ -41619,12 +41711,8 @@ ${usage_default}`;
|
|
|
41619
41711
|
const index = Math.max(0, Math.min(Math.trunc(attempt), rendererUsageRefreshDelays.length - 1));
|
|
41620
41712
|
return rendererUsageRefreshDelays[index] ?? rendererUsageRefreshDelays[0];
|
|
41621
41713
|
}
|
|
41622
|
-
function
|
|
41623
|
-
return
|
|
41624
|
-
}
|
|
41625
|
-
function shouldRetryExternalThreadUsage(agent, usage, accountCredits = null) {
|
|
41626
|
-
if (usage === null) return true;
|
|
41627
|
-
return externalAgentHasAccountCredits(agent) && accountCredits === null;
|
|
41714
|
+
function shouldRetryExternalThreadUsage(accountCreditsSupported, usage, accountCredits = null) {
|
|
41715
|
+
return usage === null || accountCreditsSupported && accountCredits === null;
|
|
41628
41716
|
}
|
|
41629
41717
|
function shouldReloadExternalCatalogAfterAvailabilityRefresh(previous, next, configurationReady, explicitRefresh = false) {
|
|
41630
41718
|
const initialDiscoveryReady = previous === "checking" && next === "ready";
|
|
@@ -42235,6 +42323,8 @@ ${usage_default}`;
|
|
|
42235
42323
|
mounted.usageRequestGeneration += 1;
|
|
42236
42324
|
mounted.usage = update.usage;
|
|
42237
42325
|
mounted.accountCredits = composerAccountCredits(update.accountCredits);
|
|
42326
|
+
if (update.accountCreditsSupported !== void 0)
|
|
42327
|
+
mounted.accountCreditsSupported = update.accountCreditsSupported;
|
|
42238
42328
|
usageRefreshAttempts.delete(mounted.composer);
|
|
42239
42329
|
renderMounted(mounted);
|
|
42240
42330
|
}
|
|
@@ -42289,13 +42379,13 @@ ${usage_default}`;
|
|
|
42289
42379
|
}
|
|
42290
42380
|
mounted.usage = result.usage;
|
|
42291
42381
|
mounted.accountCredits = composerAccountCredits(result.accountCredits);
|
|
42292
|
-
|
|
42293
|
-
if (result.usage !== null && (!
|
|
42382
|
+
mounted.accountCreditsSupported = result.accountCreditsSupported ?? false;
|
|
42383
|
+
if (result.usage !== null && (!mounted.accountCreditsSupported || result.accountCredits)) {
|
|
42294
42384
|
usageRefreshAttempts.delete(mounted.composer);
|
|
42295
42385
|
}
|
|
42296
42386
|
renderMounted(mounted);
|
|
42297
42387
|
if (shouldRetryExternalThreadUsage(
|
|
42298
|
-
|
|
42388
|
+
mounted.accountCreditsSupported,
|
|
42299
42389
|
result.usage,
|
|
42300
42390
|
result.accountCredits ?? null
|
|
42301
42391
|
)) {
|
|
@@ -42304,7 +42394,7 @@ ${usage_default}`;
|
|
|
42304
42394
|
} catch (error51) {
|
|
42305
42395
|
if (mountedByComposer.get(mounted.composer) === mounted && mounted.usageRequestGeneration === generation) {
|
|
42306
42396
|
renderMounted(mounted);
|
|
42307
|
-
if (!(error51 instanceof RendererMethodUnavailableError) && shouldRetryExternalThreadUsage(
|
|
42397
|
+
if (!(error51 instanceof RendererMethodUnavailableError) && shouldRetryExternalThreadUsage(mounted.accountCreditsSupported, null, null)) {
|
|
42308
42398
|
scheduleThreadUsageRefresh(mounted);
|
|
42309
42399
|
}
|
|
42310
42400
|
}
|
|
@@ -42412,14 +42502,7 @@ ${usage_default}`;
|
|
|
42412
42502
|
renderMounted(mounted);
|
|
42413
42503
|
if (mounted.ownershipStatus !== "error") void refreshCommands(mounted);
|
|
42414
42504
|
sidebarAgentIcons.refresh();
|
|
42415
|
-
if (mounted.ownershipStatus !== "error")
|
|
42416
|
-
const agent = controller.get(mounted.composer).agent;
|
|
42417
|
-
if (agent === "codex") {
|
|
42418
|
-
void refreshThreadUsage(mounted);
|
|
42419
|
-
} else if (shouldRetryExternalThreadUsage(agent, mounted.usage, mounted.accountCredits)) {
|
|
42420
|
-
scheduleThreadUsageRefresh(mounted);
|
|
42421
|
-
}
|
|
42422
|
-
}
|
|
42505
|
+
if (mounted.ownershipStatus !== "error") void refreshThreadUsage(mounted);
|
|
42423
42506
|
} else if (isRetainedComposer(mounted) && controller.isCurrentOwnershipRequest(mounted.composer, generation) && orbitComposerKind(mounted.composer) === "unknown") {
|
|
42424
42507
|
ownershipRecovery.set(mounted, generation);
|
|
42425
42508
|
scheduleScan();
|
|
@@ -42449,7 +42532,7 @@ ${usage_default}`;
|
|
|
42449
42532
|
if (resolution === "transfer") {
|
|
42450
42533
|
mounted.ownershipStatus = "ready";
|
|
42451
42534
|
renderMounted(mounted);
|
|
42452
|
-
if (shouldRetryExternalThreadUsage(
|
|
42535
|
+
if (shouldRetryExternalThreadUsage(mounted.accountCreditsSupported, null, null)) {
|
|
42453
42536
|
scheduleThreadUsageRefresh(mounted);
|
|
42454
42537
|
}
|
|
42455
42538
|
} else {
|
|
@@ -43544,6 +43627,7 @@ ${usage_default}`;
|
|
|
43544
43627
|
threadConfiguration: inherited?.threadConfiguration,
|
|
43545
43628
|
usage: inherited?.usage ?? null,
|
|
43546
43629
|
accountCredits: composerAccountCredits(inherited?.accountCredits),
|
|
43630
|
+
accountCreditsSupported: inherited?.accountCreditsSupported ?? false,
|
|
43547
43631
|
hostId: inherited?.hostId ?? hostId2,
|
|
43548
43632
|
usageRequestGeneration: 0,
|
|
43549
43633
|
commandRequestGeneration: 0
|
|
@@ -43556,7 +43640,11 @@ ${usage_default}`;
|
|
|
43556
43640
|
sidebarAgentIcons.refresh();
|
|
43557
43641
|
if (threadIdFromComposerModelTarget(modelTarget) && !inherited) {
|
|
43558
43642
|
void loadThreadOwnership(mounted);
|
|
43559
|
-
} else if (threadIdFromComposerModelTarget(modelTarget) && inherited && shouldRetryExternalThreadUsage(
|
|
43643
|
+
} else if (threadIdFromComposerModelTarget(modelTarget) && inherited && shouldRetryExternalThreadUsage(
|
|
43644
|
+
mounted.accountCreditsSupported,
|
|
43645
|
+
mounted.usage,
|
|
43646
|
+
mounted.accountCredits
|
|
43647
|
+
)) {
|
|
43560
43648
|
scheduleThreadUsageRefresh(mounted);
|
|
43561
43649
|
} else if (state.agent !== "codex" && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
|
|
43562
43650
|
void loadExternalCatalog(mounted);
|