@karlorz/codexhost-cli-win32-x64 0.17.3-0 → 0.17.4-1
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/cpa-live-voice-hook.js +12 -7
- package/app/desktop-controller.mjs +21 -4
- package/app/host-runtime.mjs +1739 -816
- package/app/plugins/cursor-cli/plugin.mjs +28 -5
- package/app/plugins/grok/plugin.mjs +41 -5
- package/app/renderer-extension.js +109 -32
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -16929,9 +16929,32 @@ function cursorCommands(native) {
|
|
|
16929
16929
|
}
|
|
16930
16930
|
return { commands: [...commands.values()] };
|
|
16931
16931
|
}
|
|
16932
|
-
var
|
|
16933
|
-
|
|
16934
|
-
|
|
16932
|
+
var CURSOR_GOAL_SKILL = harnessCommandDescriptorSchema.parse({
|
|
16933
|
+
id: "cursor.goal",
|
|
16934
|
+
invocation: "/goal",
|
|
16935
|
+
label: "Goal",
|
|
16936
|
+
description: "Run Cursor's /goal skill for this turn. It does not continue while idle and does not open Desktop Goal mode.",
|
|
16937
|
+
argumentMode: "text",
|
|
16938
|
+
kind: "skill"
|
|
16939
|
+
});
|
|
16940
|
+
var CURSOR_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
|
|
16941
|
+
commands: [
|
|
16942
|
+
...cursorCommands([
|
|
16943
|
+
{ name: "copy-request-id", description: "Copy the current request ID", input: null }
|
|
16944
|
+
]).commands,
|
|
16945
|
+
CURSOR_GOAL_SKILL
|
|
16946
|
+
]
|
|
16947
|
+
});
|
|
16948
|
+
function cursorSessionCatalog(native) {
|
|
16949
|
+
const builtIns = CURSOR_COMMAND_CATALOG.commands;
|
|
16950
|
+
const invocations = new Set(builtIns.map((command) => command.invocation));
|
|
16951
|
+
return {
|
|
16952
|
+
commands: [
|
|
16953
|
+
...builtIns,
|
|
16954
|
+
...cursorCommands(native).commands.filter((command) => !invocations.has(command.invocation))
|
|
16955
|
+
]
|
|
16956
|
+
};
|
|
16957
|
+
}
|
|
16935
16958
|
function cursorCommandPrompt(command, catalog) {
|
|
16936
16959
|
const descriptor = catalog.commands.find(({ id }) => id === command.commandId);
|
|
16937
16960
|
if (!descriptor)
|
|
@@ -23765,11 +23788,11 @@ var CursorSession = class {
|
|
|
23765
23788
|
}
|
|
23766
23789
|
initialUsage = null;
|
|
23767
23790
|
commands = {
|
|
23768
|
-
list: async () => this.#closed ? rejected("invalidState", "Cursor session is closed") : { ok: true, value:
|
|
23791
|
+
list: async () => this.#closed ? rejected("invalidState", "Cursor session is closed") : { ok: true, value: cursorSessionCatalog(this.transport.availableCommands) },
|
|
23769
23792
|
execute: async (command) => {
|
|
23770
23793
|
if (this.#closed)
|
|
23771
23794
|
return rejected("invalidState", "Cursor session is closed");
|
|
23772
|
-
const prompt = cursorCommandPrompt(command,
|
|
23795
|
+
const prompt = cursorCommandPrompt(command, cursorSessionCatalog(this.transport.availableCommands));
|
|
23773
23796
|
if (!prompt.ok)
|
|
23774
23797
|
return prompt;
|
|
23775
23798
|
return this.execute({
|
|
@@ -22495,6 +22495,33 @@ function grokHiddenInput(event) {
|
|
|
22495
22495
|
function grokHostTurn(event) {
|
|
22496
22496
|
return event.metadata?.hostTurn === true || event.metadata?.host_turn === true;
|
|
22497
22497
|
}
|
|
22498
|
+
var GROK_SIBLING_TERMINAL = /^(?:subagent-completed-|task-completed-)/u;
|
|
22499
|
+
function grokSiblingTerminalKey(key) {
|
|
22500
|
+
return GROK_SIBLING_TERMINAL.test(key);
|
|
22501
|
+
}
|
|
22502
|
+
function grokForeignBackgroundEvent(event) {
|
|
22503
|
+
if (event.type === "turn.completed")
|
|
22504
|
+
return grokSiblingTerminalKey(event.nativeTurnKey);
|
|
22505
|
+
if (event.type === "user.text") {
|
|
22506
|
+
return grokHiddenInput(event) && /background subagent completed|Background task/iu.test(event.text);
|
|
22507
|
+
}
|
|
22508
|
+
const promptId = event.metadata?.promptId ?? event.metadata?.prompt_id;
|
|
22509
|
+
return typeof promptId === "string" && grokSiblingTerminalKey(promptId);
|
|
22510
|
+
}
|
|
22511
|
+
function grokBackgroundOwnedTurn(input) {
|
|
22512
|
+
return input.turnId.startsWith("grok-autonomous-") || input.backgroundPromptIndex !== void 0;
|
|
22513
|
+
}
|
|
22514
|
+
function selectGrokSettledTurn(created, expectedKey, backgroundPromptIndex) {
|
|
22515
|
+
if (expectedKey) {
|
|
22516
|
+
const matched = created.filter((turn) => turn.nativeTurnRef.nativeTurnKey === expectedKey);
|
|
22517
|
+
return matched.length === 1 ? matched[0] : void 0;
|
|
22518
|
+
}
|
|
22519
|
+
if (backgroundPromptIndex !== void 0) {
|
|
22520
|
+
const matched = created.filter((turn) => Number(turn.checkpoint?.checkpointId) === backgroundPromptIndex);
|
|
22521
|
+
return matched.length === 1 ? matched[0] : void 0;
|
|
22522
|
+
}
|
|
22523
|
+
return created.length === 1 ? created[0] : void 0;
|
|
22524
|
+
}
|
|
22498
22525
|
var GrokNativeIdentityReuseError = class extends Error {
|
|
22499
22526
|
constructor(key) {
|
|
22500
22527
|
super(`Grok Native terminal identity reused by a new prompt: ${key}`);
|
|
@@ -28817,8 +28844,16 @@ var GrokHarnessSession = class {
|
|
|
28817
28844
|
const active = this.#active;
|
|
28818
28845
|
if (!active)
|
|
28819
28846
|
return;
|
|
28847
|
+
const backgroundOwned = grokBackgroundOwnedTurn({
|
|
28848
|
+
turnId: active.command.turnId,
|
|
28849
|
+
backgroundPromptIndex: active.backgroundPromptIndex
|
|
28850
|
+
});
|
|
28851
|
+
if (!backgroundOwned && grokForeignBackgroundEvent(event))
|
|
28852
|
+
return;
|
|
28820
28853
|
this.#handleEvent(active, event);
|
|
28821
28854
|
if (event.type === "turn.completed") {
|
|
28855
|
+
if (!backgroundOwned)
|
|
28856
|
+
return;
|
|
28822
28857
|
const deadline = Date.now() + 3e3;
|
|
28823
28858
|
while (Date.now() < deadline && this.#phase === "open") {
|
|
28824
28859
|
const history = await this.#transport.getHistory();
|
|
@@ -29799,19 +29834,20 @@ Elapsed seconds: ${value.timeUsedSeconds}` : argument === "clear" ? "Goal cleare
|
|
|
29799
29834
|
const expectedKey = terminalKey ?? (typeof response?._meta?.promptId === "string" ? response._meta.promptId : void 0);
|
|
29800
29835
|
const group = expectedKey ? classifyGrokHistory(history).findLast((g) => g.terminalIndex >= active.historyStart && g.terminal.nativeTurnKey === expectedKey && (active.backgroundPromptIndex === void 0 || g.user && grokPromptIndex(g.user) === active.backgroundPromptIndex)) : void 0;
|
|
29801
29836
|
const created = this.#snapshot.turns.filter((turn) => !active.beforeNativeTurnKeys.has(turn.nativeTurnRef.nativeTurnKey));
|
|
29837
|
+
const settled = selectGrokSettledTurn(created, expectedKey, active.backgroundPromptIndex);
|
|
29802
29838
|
const lastUser = history.findLast((event) => event.type === "user.text");
|
|
29803
29839
|
ephemeral = terminalKey !== void 0 && group?.disposition === "ephemeral" && created.length === 0 || created.length === 0 && active.catalogCommand && outcome.status === "succeeded" && response?.stopReason === "end_turn" && response._meta?.totalTokens === 0 && lastUser?.type === "user.text" && lastUser.text === active.command.input.map(({ text }) => text).join("\n") && (lastUser?.metadata?.hostTurn === true || lastUser?.metadata?.host_turn === true);
|
|
29804
|
-
if (
|
|
29840
|
+
if (!settled && !ephemeral) {
|
|
29805
29841
|
throw new Error(`Grok Turn persisted ${created.length} new Native Turns; exactly one is required`);
|
|
29806
29842
|
}
|
|
29807
|
-
if (!ephemeral && expectedKey && (
|
|
29843
|
+
if (!ephemeral && expectedKey && (settled?.nativeTurnRef.nativeTurnKey !== expectedKey || terminalKey && !group))
|
|
29808
29844
|
throw new Error("Grok persisted terminal does not match the live Turn occurrence");
|
|
29809
|
-
nativeTurnRef =
|
|
29810
|
-
checkpoint =
|
|
29845
|
+
nativeTurnRef = settled?.nativeTurnRef;
|
|
29846
|
+
checkpoint = settled?.checkpoint;
|
|
29811
29847
|
if (nativeTurnRef)
|
|
29812
29848
|
this.#publishGoalHelpers(active, nativeTurnRef.nativeTurnKey);
|
|
29813
29849
|
if (active.backgroundPromptIndex !== void 0 && !ephemeral)
|
|
29814
|
-
persistedItems =
|
|
29850
|
+
persistedItems = settled?.items;
|
|
29815
29851
|
} catch (error53) {
|
|
29816
29852
|
if (outcome.status === "succeeded" || error53 instanceof GrokNativeIdentityReuseError) {
|
|
29817
29853
|
outcome = { status: "failed", error: normalizeError(error53, "protocolError") };
|
|
@@ -18754,10 +18754,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18754
18754
|
function lastVoiceLaunchProductExperience() {
|
|
18755
18755
|
return lastVoiceProductExperience;
|
|
18756
18756
|
}
|
|
18757
|
-
function
|
|
18758
|
-
if (lastVoiceProductExperience === "chat") return false;
|
|
18759
|
-
if (selectedComposerModel(owner).startsWith("codexhost/")) return true;
|
|
18760
|
-
if (lastVoiceProductExperience !== "work") return false;
|
|
18757
|
+
function lastAgentIsExternalHarness(owner) {
|
|
18761
18758
|
const storage = owner.localStorage;
|
|
18762
18759
|
if (!storage) return false;
|
|
18763
18760
|
try {
|
|
@@ -18767,6 +18764,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18767
18764
|
return false;
|
|
18768
18765
|
}
|
|
18769
18766
|
}
|
|
18767
|
+
function isExternalHarnessComposer(owner = globalThis) {
|
|
18768
|
+
if (lastVoiceProductExperience === "chat") return false;
|
|
18769
|
+
if (selectedComposerModel(owner).startsWith("codexhost/")) return true;
|
|
18770
|
+
if (lastVoiceProductExperience === "codex") return false;
|
|
18771
|
+
if (lastVoiceProductExperience !== "work" && !isWorkComposerSurface(owner)) return false;
|
|
18772
|
+
return lastAgentIsExternalHarness(owner);
|
|
18773
|
+
}
|
|
18770
18774
|
function wrapClientOwnedVoiceFetch(client, bridge, workOverride, responseError, chatOverride = () => false, workSurface = () => isWorkComposerSurface(), externalHarness = () => isExternalHarnessComposer()) {
|
|
18771
18775
|
const original = client.fetch;
|
|
18772
18776
|
const wrapped = async function(url2, options) {
|
|
@@ -27462,6 +27466,23 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27462
27466
|
].filter(isNativeContextUsageControlCandidate);
|
|
27463
27467
|
return candidates.length === 1 ? candidates[0] ?? null : null;
|
|
27464
27468
|
}
|
|
27469
|
+
var NATIVE_GOAL_MODE_CLEAR_LABELS = /* @__PURE__ */ new Set(["clear goal", "\u6E05\u9664\u76EE\u6807", "\u6E05\u9664\u76EE\u6A19"]);
|
|
27470
|
+
function composerHidesNativeGoalControl(agent, switching = false) {
|
|
27471
|
+
return switching || agent !== "codex" && agent !== "grok";
|
|
27472
|
+
}
|
|
27473
|
+
function isNativeGoalControlCandidate(element) {
|
|
27474
|
+
if (typeof element.hasAttribute !== "function" || typeof element.matches !== "function" || typeof element.getAttribute !== "function" || isOwnedRendererControl(element) || !element.matches("button")) {
|
|
27475
|
+
return false;
|
|
27476
|
+
}
|
|
27477
|
+
const label = (element.getAttribute("aria-label") ?? "").replace(/\s+/g, " ").trim().toLowerCase();
|
|
27478
|
+
return NATIVE_GOAL_MODE_CLEAR_LABELS.has(label);
|
|
27479
|
+
}
|
|
27480
|
+
function nativeGoalControlForComposer(composer) {
|
|
27481
|
+
const candidates = [...composer.querySelectorAll("button")].filter(
|
|
27482
|
+
isNativeGoalControlCandidate
|
|
27483
|
+
);
|
|
27484
|
+
return candidates.length === 1 ? candidates[0] ?? null : null;
|
|
27485
|
+
}
|
|
27465
27486
|
function isNativeUsageBannerCandidate(element) {
|
|
27466
27487
|
if (element.localName !== "aside") return false;
|
|
27467
27488
|
if (typeof element.querySelector !== "function") return false;
|
|
@@ -27500,6 +27521,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27500
27521
|
restoreNativeControl(control.nativeUsageBanner);
|
|
27501
27522
|
control.nativeUsageBanner = captureNativeControl(candidate);
|
|
27502
27523
|
}
|
|
27524
|
+
function refreshNativeGoalControl(control) {
|
|
27525
|
+
const candidate = nativeGoalControlForComposer(control.composer);
|
|
27526
|
+
if (candidate === control.nativeGoalControl?.element) return;
|
|
27527
|
+
restoreNativeControl(control.nativeGoalControl);
|
|
27528
|
+
control.nativeGoalControl = captureNativeControl(candidate);
|
|
27529
|
+
}
|
|
27503
27530
|
function refreshNativeModelControl(control) {
|
|
27504
27531
|
const candidate = nativeModelControlForComposer(control.composer);
|
|
27505
27532
|
if (!candidate) return;
|
|
@@ -27601,7 +27628,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27601
27628
|
parent.insertBefore(control.permissionModePicker.root, candidate);
|
|
27602
27629
|
}
|
|
27603
27630
|
}
|
|
27604
|
-
function setNativeControlHidden(state, hidden) {
|
|
27631
|
+
function setNativeControlHidden(state, hidden, dismiss = false) {
|
|
27605
27632
|
if (!state) return;
|
|
27606
27633
|
if (!hidden) {
|
|
27607
27634
|
restoreNativeControl(state);
|
|
@@ -27612,15 +27639,17 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27612
27639
|
if (active && typeof active.blur === "function" && state.element.contains(active)) {
|
|
27613
27640
|
active.blur();
|
|
27614
27641
|
}
|
|
27642
|
+
if (dismiss && typeof state.element.click === "function") state.element.click();
|
|
27615
27643
|
if (state.element.getAttribute("aria-expanded") === "true") state.element.click();
|
|
27616
27644
|
state.element.hidden = true;
|
|
27617
27645
|
state.element.setAttribute("aria-hidden", "true");
|
|
27618
27646
|
}
|
|
27619
|
-
function reconcileComposerNativeControls(control, hideModel, hidePermissionMode) {
|
|
27647
|
+
function reconcileComposerNativeControls(control, hideModel, hidePermissionMode, hideGoal = false) {
|
|
27620
27648
|
refreshNativeContextUsageControl(control);
|
|
27621
27649
|
refreshNativeModelControl(control);
|
|
27622
27650
|
refreshNativePermissionModeControl(control);
|
|
27623
27651
|
refreshNativeUsageBanner(control);
|
|
27652
|
+
refreshNativeGoalControl(control);
|
|
27624
27653
|
refreshTrailingClusterPlacement(control);
|
|
27625
27654
|
refreshUsagePlacement(control);
|
|
27626
27655
|
refreshCreditsPlacement(control);
|
|
@@ -27630,6 +27659,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27630
27659
|
setNativeControlHidden(control.nativeModelControl, hideModel);
|
|
27631
27660
|
setNativeControlHidden(control.nativeContextUsageControl, false);
|
|
27632
27661
|
setNativeControlHidden(control.nativePermissionModeControl, hidePermissionMode);
|
|
27662
|
+
setNativeControlHidden(control.nativeGoalControl, hideGoal, hideGoal);
|
|
27633
27663
|
setNativeControlHidden(
|
|
27634
27664
|
control.nativeUsageBanner,
|
|
27635
27665
|
readCodexUsageBannerPreference(preferenceOwner(control))
|
|
@@ -27645,6 +27675,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27645
27675
|
nativeContextUsageControlForComposer(composer)
|
|
27646
27676
|
);
|
|
27647
27677
|
const nativeUsageBanner = captureNativeControl(nativeUsageBannerForComposer(composer));
|
|
27678
|
+
const nativeGoalControl = captureNativeControl(nativeGoalControlForComposer(composer));
|
|
27648
27679
|
const semanticNativePermissionModeControl = semanticNativePermissionModeControlForComposer(composer);
|
|
27649
27680
|
const nativePermissionModeControl = captureNativeControl(semanticNativePermissionModeControl);
|
|
27650
27681
|
const nativePermissionModeControlVerified = semanticNativePermissionModeControl !== null && nativePermissionModeControlForComposer(composer) === semanticNativePermissionModeControl;
|
|
@@ -27707,6 +27738,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27707
27738
|
nativePermissionModeControl,
|
|
27708
27739
|
nativeContextUsageControl,
|
|
27709
27740
|
nativeUsageBanner,
|
|
27741
|
+
nativeGoalControl,
|
|
27710
27742
|
nativePermissionModeControlVerified,
|
|
27711
27743
|
credits,
|
|
27712
27744
|
composerIndicators,
|
|
@@ -27760,7 +27792,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27760
27792
|
reconcileComposerNativeControls(
|
|
27761
27793
|
control,
|
|
27762
27794
|
pickerView.nativeModelHidden,
|
|
27763
|
-
switching || state.agent !== "codex"
|
|
27795
|
+
switching || state.agent !== "codex",
|
|
27796
|
+
composerHidesNativeGoalControl(state.agent, switching)
|
|
27764
27797
|
);
|
|
27765
27798
|
renderRendererModelPicker(
|
|
27766
27799
|
control.modelPicker,
|
|
@@ -27800,6 +27833,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
27800
27833
|
restoreNativeControl(control.nativeModelControl);
|
|
27801
27834
|
restoreNativeControl(control.nativeContextUsageControl);
|
|
27802
27835
|
restoreNativeControl(control.nativeUsageBanner);
|
|
27836
|
+
restoreNativeControl(control.nativeGoalControl);
|
|
27803
27837
|
restoreNativeControl(control.nativePermissionModeControl);
|
|
27804
27838
|
control.composerIndicators?.dispose();
|
|
27805
27839
|
control.credits.dispose();
|
|
@@ -46415,6 +46449,7 @@ ${usage_default}`;
|
|
|
46415
46449
|
retryAttempt: 0
|
|
46416
46450
|
});
|
|
46417
46451
|
const harnessAvailabilityByHost = /* @__PURE__ */ new Map();
|
|
46452
|
+
const codexAccountLoads = /* @__PURE__ */ new WeakMap();
|
|
46418
46453
|
const hostHarnessAvailabilityState = (hostId2) => {
|
|
46419
46454
|
let state = harnessAvailabilityByHost.get(hostId2);
|
|
46420
46455
|
if (!state) {
|
|
@@ -47526,21 +47561,27 @@ ${usage_default}`;
|
|
|
47526
47561
|
}
|
|
47527
47562
|
}
|
|
47528
47563
|
};
|
|
47564
|
+
const loadCodexAccountsForHost = (hostId2) => {
|
|
47565
|
+
const accounts = codexAccountsForHost(hostId2);
|
|
47566
|
+
if (!accounts) return Promise.resolve();
|
|
47567
|
+
const pending = codexAccountLoads.get(accounts);
|
|
47568
|
+
if (pending) return pending;
|
|
47569
|
+
const request = accounts.refresh().then(() => {
|
|
47570
|
+
if (disposed || codexAccountsForHost(hostId2) !== accounts) return;
|
|
47571
|
+
for (const mounted of mountedByComposer.values()) {
|
|
47572
|
+
if (mounted.hostId !== hostId2) continue;
|
|
47573
|
+
renderMounted(mounted);
|
|
47574
|
+
if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
|
|
47575
|
+
}
|
|
47576
|
+
}).finally(() => {
|
|
47577
|
+
if (codexAccountLoads.get(accounts) === request) codexAccountLoads.delete(accounts);
|
|
47578
|
+
});
|
|
47579
|
+
codexAccountLoads.set(accounts, request);
|
|
47580
|
+
return request;
|
|
47581
|
+
};
|
|
47529
47582
|
const loadCodexAccounts = async () => {
|
|
47530
47583
|
const hostIds = new Set([...mountedByComposer.values()].map((mounted) => mounted.hostId));
|
|
47531
|
-
await Promise.all(
|
|
47532
|
-
[...hostIds].map(async (hostId2) => {
|
|
47533
|
-
const accounts = codexAccountsForHost(hostId2);
|
|
47534
|
-
if (!accounts) return;
|
|
47535
|
-
await accounts.refresh();
|
|
47536
|
-
if (disposed || codexAccountsForHost(hostId2) !== accounts) return;
|
|
47537
|
-
for (const mounted of mountedByComposer.values()) {
|
|
47538
|
-
if (mounted.hostId !== hostId2) continue;
|
|
47539
|
-
renderMounted(mounted);
|
|
47540
|
-
if (controller.get(mounted.composer).agent === "codex") void refreshDraftUsage(mounted);
|
|
47541
|
-
}
|
|
47542
|
-
})
|
|
47543
|
-
);
|
|
47584
|
+
await Promise.all([...hostIds].map(loadCodexAccountsForHost));
|
|
47544
47585
|
};
|
|
47545
47586
|
const openInstallPage = (hostId2, agent) => {
|
|
47546
47587
|
const plugin = hostId2 ? hostHarnessAvailabilityState(hostId2).plugins?.find(({ id }) => id === agent) : void 0;
|
|
@@ -47751,7 +47792,8 @@ ${usage_default}`;
|
|
|
47751
47792
|
void clearDraftPrewarm(mounted.composer).catch(() => void 0);
|
|
47752
47793
|
}
|
|
47753
47794
|
void loadExternalCatalog(mounted);
|
|
47754
|
-
void
|
|
47795
|
+
if (state.agent === "codex") void loadCodexAccountsForHost(hostId2);
|
|
47796
|
+
else void refreshDraftUsage(mounted);
|
|
47755
47797
|
continue;
|
|
47756
47798
|
}
|
|
47757
47799
|
const target = controllerTarget(mounted.modelTarget, hostId2);
|
|
@@ -47788,8 +47830,10 @@ ${usage_default}`;
|
|
|
47788
47830
|
for (const mounted of mountedByComposer.values()) {
|
|
47789
47831
|
const client = composerClient(mounted);
|
|
47790
47832
|
const request = draftUsageRequests.get(mounted);
|
|
47791
|
-
|
|
47792
|
-
|
|
47833
|
+
const state = controller.get(mounted.composer);
|
|
47834
|
+
if (state.phase === "draft" && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
|
|
47835
|
+
if (state.agent === "codex") void loadCodexAccountsForHost(mounted.hostId);
|
|
47836
|
+
else void refreshDraftUsage(mounted);
|
|
47793
47837
|
}
|
|
47794
47838
|
}
|
|
47795
47839
|
let connectionsChanged = false;
|
|
@@ -48030,7 +48074,10 @@ ${usage_default}`;
|
|
|
48030
48074
|
} else if (state.agent !== "codex" && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
|
|
48031
48075
|
void loadExternalCatalog(mounted);
|
|
48032
48076
|
}
|
|
48033
|
-
if (!threadIdFromComposerModelTarget(modelTarget))
|
|
48077
|
+
if (!threadIdFromComposerModelTarget(modelTarget)) {
|
|
48078
|
+
if (state.agent === "codex") void loadCodexAccountsForHost(mounted.hostId);
|
|
48079
|
+
else void refreshDraftUsage(mounted);
|
|
48080
|
+
}
|
|
48034
48081
|
void refreshCommands(mounted);
|
|
48035
48082
|
};
|
|
48036
48083
|
const scan = () => {
|
|
@@ -48092,7 +48139,12 @@ ${usage_default}`;
|
|
|
48092
48139
|
}
|
|
48093
48140
|
const state = controller.get(composer);
|
|
48094
48141
|
const hideCodexControls = controller.isSwitching(composer) || state.agent !== "codex";
|
|
48095
|
-
reconcileComposerNativeControls(
|
|
48142
|
+
reconcileComposerNativeControls(
|
|
48143
|
+
mounted.control,
|
|
48144
|
+
hideCodexControls,
|
|
48145
|
+
hideCodexControls,
|
|
48146
|
+
composerHidesNativeGoalControl(state.agent, controller.isSwitching(composer))
|
|
48147
|
+
);
|
|
48096
48148
|
showCodexUsageGateStatus(mounted, mounted.codexUsageGate.refresh());
|
|
48097
48149
|
}
|
|
48098
48150
|
for (const editor of document.querySelectorAll(EDITOR_SELECTOR)) {
|
|
@@ -48343,8 +48395,15 @@ ${usage_default}`;
|
|
|
48343
48395
|
};
|
|
48344
48396
|
const onUsageBannerPreference = () => {
|
|
48345
48397
|
for (const mounted of mountedByComposer.values()) {
|
|
48346
|
-
const
|
|
48347
|
-
|
|
48398
|
+
const switching = controller.isSwitching(mounted.composer);
|
|
48399
|
+
const agent = controller.get(mounted.composer).agent;
|
|
48400
|
+
const hideCodexControls = switching || agent !== "codex";
|
|
48401
|
+
reconcileComposerNativeControls(
|
|
48402
|
+
mounted.control,
|
|
48403
|
+
hideCodexControls,
|
|
48404
|
+
hideCodexControls,
|
|
48405
|
+
composerHidesNativeGoalControl(agent, switching)
|
|
48406
|
+
);
|
|
48348
48407
|
mounted.codexUsageGate.refresh();
|
|
48349
48408
|
}
|
|
48350
48409
|
};
|
|
@@ -48615,7 +48674,20 @@ ${usage_default}`;
|
|
|
48615
48674
|
function isRecord16(value) {
|
|
48616
48675
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48617
48676
|
}
|
|
48618
|
-
function
|
|
48677
|
+
function lastAgentPluginRoute(owner) {
|
|
48678
|
+
try {
|
|
48679
|
+
const storage = owner.localStorage;
|
|
48680
|
+
const parsed = JSON.parse(storage?.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY) ?? "");
|
|
48681
|
+
if (typeof parsed.lastAgent !== "string" || parsed.lastAgent === "" || parsed.lastAgent === "codex")
|
|
48682
|
+
return void 0;
|
|
48683
|
+
const harnessId = harnessPluginIdSchema.safeParse(parsed.lastAgent);
|
|
48684
|
+
if (!harnessId.success) return void 0;
|
|
48685
|
+
return encodeHarnessPluginRoute({ harnessId: harnessId.data });
|
|
48686
|
+
} catch {
|
|
48687
|
+
return void 0;
|
|
48688
|
+
}
|
|
48689
|
+
}
|
|
48690
|
+
function routeExternalVoiceLaunch(request, routing, owner = globalThis) {
|
|
48619
48691
|
rememberVoiceProductExperience(request);
|
|
48620
48692
|
if (!routing || !isRecord16(request) || request.source !== "composer_button_new_thread")
|
|
48621
48693
|
return request;
|
|
@@ -48624,8 +48696,9 @@ ${usage_default}`;
|
|
|
48624
48696
|
if (typeof hostId2 !== "string" || !hostId2) return request;
|
|
48625
48697
|
const route = routing.forComposer();
|
|
48626
48698
|
if (!route || route.hostId !== hostId2 || routing.forHost(hostId2) !== route) return request;
|
|
48627
|
-
const
|
|
48628
|
-
|
|
48699
|
+
const selected = route.policy.selectedModel();
|
|
48700
|
+
const model2 = typeof selected === "string" && selected.startsWith("codexhost/") ? selected : lastAgentPluginRoute(owner);
|
|
48701
|
+
if (!model2) return request;
|
|
48629
48702
|
const mode2 = request.activeCollaborationMode;
|
|
48630
48703
|
if (mode2 !== void 0 && mode2 !== null && !isRecord16(mode2)) return request;
|
|
48631
48704
|
const settings = isRecord16(mode2) ? mode2.settings : void 0;
|
|
@@ -48696,7 +48769,11 @@ ${usage_default}`;
|
|
|
48696
48769
|
const chatStart = startNativeChatVoiceForRequest(request, target);
|
|
48697
48770
|
if (chatStart) return chatStart;
|
|
48698
48771
|
try {
|
|
48699
|
-
request = routeExternalVoiceLaunch(
|
|
48772
|
+
request = routeExternalVoiceLaunch(
|
|
48773
|
+
request,
|
|
48774
|
+
target.__codexhostHostRoutingV1,
|
|
48775
|
+
target
|
|
48776
|
+
);
|
|
48700
48777
|
} catch {
|
|
48701
48778
|
}
|
|
48702
48779
|
return Reflect.apply(start, original, [request, ...args.slice(1)]);
|
|
@@ -48987,7 +49064,7 @@ ${usage_default}`;
|
|
|
48987
49064
|
};
|
|
48988
49065
|
const external = () => {
|
|
48989
49066
|
try {
|
|
48990
|
-
return
|
|
49067
|
+
return isExternalHarnessComposer(target);
|
|
48991
49068
|
} catch {
|
|
48992
49069
|
return false;
|
|
48993
49070
|
}
|
package/bin/codexhost.exe
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|