@karlorz/codexhost-cli-win32-x64 0.14.0-4 → 0.15.0-0
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-web.js +133 -30
- package/app/cpa-live-voice-hook.js +160 -19
- package/app/desktop-controller.mjs +79 -39
- package/app/host-runtime.mjs +3234 -3054
- package/app/plugins/antigravity/plugin.mjs +292 -50
- package/app/plugins/claude-code/plugin.mjs +304 -108
- package/app/plugins/codebuddy/plugin.mjs +139 -25
- package/app/plugins/cursor-cli/plugin.mjs +139 -25
- package/app/plugins/grok/plugin.mjs +31 -18
- package/app/plugins/pi/plugin.mjs +31 -6
- package/app/plugins/workbuddy/plugin.mjs +139 -25
- package/app/plugins/zcode/plugin.mjs +28 -3
- package/app/renderer-extension.js +1384 -1048
- 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
|
@@ -16491,23 +16491,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16491
16491
|
}
|
|
16492
16492
|
|
|
16493
16493
|
// src/renderer-native-chat-voice-assets.ts
|
|
16494
|
-
var NATIVE_CHAT_VOICE_VERSION = "26.
|
|
16495
|
-
var NATIVE_CHAT_INITIAL_ASSET = "app-initial-
|
|
16496
|
-
var START_ASSET = "
|
|
16494
|
+
var NATIVE_CHAT_VOICE_VERSION = "26.1023.51421";
|
|
16495
|
+
var NATIVE_CHAT_INITIAL_ASSET = "app-initial-bc8256c3cccb.js";
|
|
16496
|
+
var START_ASSET = "start-voice-a0564cefdc95.js";
|
|
16497
16497
|
var NATIVE_CHAT_VOICE_ASSETS = [
|
|
16498
16498
|
{
|
|
16499
16499
|
platform: "darwin",
|
|
16500
16500
|
version: NATIVE_CHAT_VOICE_VERSION,
|
|
16501
16501
|
initial: NATIVE_CHAT_INITIAL_ASSET,
|
|
16502
|
+
shared: "app-shared-e9f258fd3588.js",
|
|
16503
|
+
primary: "app-primary-b7f335b763ca.js",
|
|
16504
|
+
start: START_ASSET,
|
|
16505
|
+
prewarm: "voice-prewarm-53aefded152c.js",
|
|
16506
|
+
settings: "voice-settings-1a9f68eb7ae8.js"
|
|
16507
|
+
},
|
|
16508
|
+
{
|
|
16509
|
+
platform: "darwin",
|
|
16510
|
+
version: "26.1021.31345",
|
|
16511
|
+
initial: "app-initial-feb30b196d11.js",
|
|
16502
16512
|
shared: "app-shared-2cae01273bae.js",
|
|
16503
16513
|
primary: "app-primary-7d7313419f84.js",
|
|
16504
|
-
start:
|
|
16514
|
+
start: "entity-business-profile-reference-b68063dfc05d.js",
|
|
16505
16515
|
prewarm: "voice-prewarm-d672f1245523.js",
|
|
16506
16516
|
settings: "voice-settings-14000f5c9fc2.js"
|
|
16507
16517
|
},
|
|
16508
16518
|
{
|
|
16509
16519
|
platform: "win32",
|
|
16510
|
-
version:
|
|
16520
|
+
version: "26.1021.31345",
|
|
16511
16521
|
initial: "app-initial-438d1df57f70.js",
|
|
16512
16522
|
shared: "app-shared-955d52676f9c.js",
|
|
16513
16523
|
primary: "app-primary-844e405f2b90.js",
|
|
@@ -16539,14 +16549,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16539
16549
|
)
|
|
16540
16550
|
);
|
|
16541
16551
|
if (!sharedModule || !initialModule || !startModule || !prewarm) throw new Error();
|
|
16542
|
-
const
|
|
16543
|
-
const
|
|
16544
|
-
const
|
|
16545
|
-
|
|
16552
|
+
const latest = assets.version === NATIVE_CHAT_VOICE_VERSION;
|
|
16553
|
+
const current = latest || assets.version === "26.1021.31345";
|
|
16554
|
+
const initialize = latest ? primary?.gm : current ? primary?.um : initialModule.oT;
|
|
16555
|
+
const start = current && !latest ? { t: startModule.r, n: startModule.i } : startModule;
|
|
16556
|
+
if (typeof start.t !== "function" || typeof start.n !== "function" || typeof initialize !== "function" || typeof (latest ? initialModule["s$t"] : current ? initialModule.qXt : initialModule.SPn) !== "function" || typeof (latest ? sharedModule.OHt : current ? sharedModule.XVt : sharedModule.FBt) !== "function" || typeof (latest ? sharedModule.wPt : current ? sharedModule.KNt : sharedModule.PNt) !== "function" || typeof prewarm.VoiceInstantConnectCacheController !== "function")
|
|
16546
16557
|
throw new Error();
|
|
16547
16558
|
initialize();
|
|
16548
16559
|
start.t();
|
|
16549
|
-
const initial =
|
|
16560
|
+
const initial = latest ? {
|
|
16561
|
+
MOr: initialModule.x1n,
|
|
16562
|
+
CDr: initialModule.MQn,
|
|
16563
|
+
B1n: initialModule.Opn,
|
|
16564
|
+
SPn: initialModule["s$t"],
|
|
16565
|
+
oT: primary?.gm,
|
|
16566
|
+
aT: primary?.hm,
|
|
16567
|
+
Ycr: initialModule.Zir,
|
|
16568
|
+
Nir: initialModule.ejn,
|
|
16569
|
+
n0n: initialModule.Kpn,
|
|
16570
|
+
Y1n: initialModule.zpn,
|
|
16571
|
+
HJt: initialModule.k3
|
|
16572
|
+
} : current ? {
|
|
16550
16573
|
MOr: initialModule.CQn,
|
|
16551
16574
|
CDr: initialModule.PXn,
|
|
16552
16575
|
B1n: initialModule.tdn,
|
|
@@ -16559,7 +16582,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16559
16582
|
Y1n: initialModule.fdn,
|
|
16560
16583
|
HJt: initialModule.R2
|
|
16561
16584
|
} : initialModule;
|
|
16562
|
-
const shared =
|
|
16585
|
+
const shared = latest ? { Qst: sharedModule.uct, FBt: sharedModule.OHt, PNt: sharedModule.wPt, Vot: sharedModule.ast } : current ? {
|
|
16586
|
+
Qst: sharedModule.Bst,
|
|
16587
|
+
FBt: sharedModule.XVt,
|
|
16588
|
+
PNt: sharedModule.KNt,
|
|
16589
|
+
Vot: sharedModule.Fot
|
|
16590
|
+
} : sharedModule;
|
|
16563
16591
|
const scope = (value, brand) => value !== null && typeof value === "object" && value.__scopeBrand === brand;
|
|
16564
16592
|
if (!scope(shared.Qst, "AppScope") || !scope(initial.MOr, "RouteScope") || !scope(initial.CDr, "ComposerScope") || !initial.B1n || !initial.aT)
|
|
16565
16593
|
throw new Error();
|
|
@@ -17490,10 +17518,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17490
17518
|
}
|
|
17491
17519
|
|
|
17492
17520
|
// src/renderer-client-owned-voice.ts
|
|
17493
|
-
var CLIENT_OWNED_VOICE_VERSION = "26.
|
|
17494
|
-
var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-
|
|
17495
|
-
var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-
|
|
17496
|
-
var CLIENT_OWNED_VOICE_OVERLAY_ASSET = "avatar-overlay-native-page-
|
|
17521
|
+
var CLIENT_OWNED_VOICE_VERSION = "26.1023.51421";
|
|
17522
|
+
var CLIENT_OWNED_VOICE_INITIAL_ASSET = "app-initial-bc8256c3cccb.js";
|
|
17523
|
+
var CLIENT_OWNED_VOICE_SHARED_ASSET = "app-shared-e9f258fd3588.js";
|
|
17524
|
+
var CLIENT_OWNED_VOICE_OVERLAY_ASSET = "avatar-overlay-native-page-af6c3662f64f.js";
|
|
17497
17525
|
var CLIENT_OWNED_VOICE_ASSETS = [
|
|
17498
17526
|
{
|
|
17499
17527
|
platform: "darwin",
|
|
@@ -17501,6 +17529,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17501
17529
|
initial: CLIENT_OWNED_VOICE_INITIAL_ASSET,
|
|
17502
17530
|
shared: CLIENT_OWNED_VOICE_SHARED_ASSET,
|
|
17503
17531
|
overlay: CLIENT_OWNED_VOICE_OVERLAY_ASSET,
|
|
17532
|
+
init: "xir",
|
|
17533
|
+
fetch: "yir",
|
|
17534
|
+
fetchFrom: "initial",
|
|
17535
|
+
bridge: "QIt",
|
|
17536
|
+
services: "Sst",
|
|
17537
|
+
capabilityInit: "N4n",
|
|
17538
|
+
capabilityFamily: "M4n",
|
|
17539
|
+
inferenceGateFamily: "Par"
|
|
17540
|
+
},
|
|
17541
|
+
{
|
|
17542
|
+
platform: "darwin",
|
|
17543
|
+
version: "26.1021.31345",
|
|
17544
|
+
initial: "app-initial-feb30b196d11.js",
|
|
17545
|
+
shared: "app-shared-2cae01273bae.js",
|
|
17546
|
+
overlay: "avatar-overlay-native-page-d549db3706f1.js",
|
|
17504
17547
|
fetch: "Htr",
|
|
17505
17548
|
fetchFrom: "initial",
|
|
17506
17549
|
bridge: "bIt",
|
|
@@ -17511,7 +17554,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17511
17554
|
},
|
|
17512
17555
|
{
|
|
17513
17556
|
platform: "win32",
|
|
17514
|
-
version:
|
|
17557
|
+
version: "26.1021.31345",
|
|
17515
17558
|
initial: "app-initial-438d1df57f70.js",
|
|
17516
17559
|
shared: "app-shared-955d52676f9c.js",
|
|
17517
17560
|
overlay: "avatar-overlay-native-page-1549fe5955e1.js",
|
|
@@ -17891,935 +17934,951 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17891
17934
|
};
|
|
17892
17935
|
}
|
|
17893
17936
|
|
|
17894
|
-
//
|
|
17895
|
-
|
|
17896
|
-
|
|
17897
|
-
|
|
17898
|
-
|
|
17899
|
-
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
"stroke-linecap": "round",
|
|
17904
|
-
"stroke-linejoin": "round"
|
|
17905
|
-
};
|
|
17906
|
-
|
|
17907
|
-
// ../../node_modules/lucide/dist/esm/createElement.mjs
|
|
17908
|
-
var createSVGElement = ([tag, attrs, children]) => {
|
|
17909
|
-
const element = document.createElementNS("http://www.w3.org/2000/svg", tag);
|
|
17910
|
-
Object.keys(attrs).forEach((name) => {
|
|
17911
|
-
element.setAttribute(name, String(attrs[name]));
|
|
17912
|
-
});
|
|
17913
|
-
if (children?.length) {
|
|
17914
|
-
children.forEach((child) => {
|
|
17915
|
-
const childElement = createSVGElement(child);
|
|
17916
|
-
element.appendChild(childElement);
|
|
17917
|
-
});
|
|
17937
|
+
// src/codex-native-services.ts
|
|
17938
|
+
async function loadCodexNativeServices(ownerWindow, matchesServices, importModule = (url2) => import(url2)) {
|
|
17939
|
+
if (!ownerWindow.document || !ownerWindow.location) return null;
|
|
17940
|
+
const page = new URL(ownerWindow.location.href);
|
|
17941
|
+
const urls = /* @__PURE__ */ new Set();
|
|
17942
|
+
for (const link of ownerWindow.document.querySelectorAll('link[rel="modulepreload"][href]')) {
|
|
17943
|
+
const url2 = new URL(link.getAttribute("href") ?? "", page);
|
|
17944
|
+
if (url2.protocol === page.protocol && url2.host === page.host && url2.pathname.endsWith(".js") && !url2.search && !url2.hash)
|
|
17945
|
+
urls.add(url2.href);
|
|
17918
17946
|
}
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
const
|
|
17923
|
-
const
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17930
|
-
// ../../node_modules/lucide/dist/esm/icons/check.mjs
|
|
17931
|
-
var Check = [["path", { d: "M20 6 9 17l-5-5" }]];
|
|
17932
|
-
|
|
17933
|
-
// ../../node_modules/lucide/dist/esm/icons/message-circle-question-mark.mjs
|
|
17934
|
-
var MessageCircleQuestionMark = [
|
|
17935
|
-
[
|
|
17936
|
-
"path",
|
|
17937
|
-
{
|
|
17938
|
-
d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"
|
|
17939
|
-
}
|
|
17940
|
-
],
|
|
17941
|
-
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }],
|
|
17942
|
-
["path", { d: "M12 17h.01" }]
|
|
17943
|
-
];
|
|
17944
|
-
|
|
17945
|
-
// ../../node_modules/lucide/dist/esm/icons/pencil.mjs
|
|
17946
|
-
var Pencil = [
|
|
17947
|
-
[
|
|
17948
|
-
"path",
|
|
17949
|
-
{
|
|
17950
|
-
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
|
|
17947
|
+
const candidates = [...urls].sort(
|
|
17948
|
+
(a, b) => Number(b.includes("/app-shared-")) - Number(a.includes("/app-shared-"))
|
|
17949
|
+
);
|
|
17950
|
+
const matches = /* @__PURE__ */ new Set();
|
|
17951
|
+
for (const url2 of candidates) {
|
|
17952
|
+
let module;
|
|
17953
|
+
try {
|
|
17954
|
+
module = await importModule(url2);
|
|
17955
|
+
} catch {
|
|
17956
|
+
continue;
|
|
17951
17957
|
}
|
|
17952
|
-
|
|
17953
|
-
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
// ../../node_modules/lucide/dist/esm/icons/x.mjs
|
|
17957
|
-
var X = [
|
|
17958
|
-
["path", { d: "M18 6 6 18" }],
|
|
17959
|
-
["path", { d: "m6 6 12 12" }]
|
|
17960
|
-
];
|
|
17961
|
-
|
|
17962
|
-
// src/renderer-question-card-style.ts
|
|
17963
|
-
var QUESTION_CARD_CSS = `
|
|
17964
|
-
:host {
|
|
17965
|
-
display: block;
|
|
17966
|
-
min-width: 0;
|
|
17967
|
-
margin: 8px 0;
|
|
17968
|
-
color-scheme: inherit;
|
|
17969
|
-
--question-text: light-dark(#171717, #ececec);
|
|
17970
|
-
--question-muted: light-dark(#737373, #a3a3a3);
|
|
17971
|
-
--question-border: light-dark(rgb(0 0 0 / 8%), rgb(255 255 255 / 8%));
|
|
17972
|
-
--question-selected: light-dark(#e9e9e9, #333333);
|
|
17973
|
-
--question-primary: light-dark(#202020, #ececec);
|
|
17974
|
-
--question-primary-text: light-dark(#fff, #171717);
|
|
17975
|
-
}
|
|
17976
|
-
*, ::before, ::after { box-sizing: border-box; }
|
|
17977
|
-
.card {
|
|
17978
|
-
display: flex;
|
|
17979
|
-
flex-direction: column;
|
|
17980
|
-
max-height: min(60vh, 560px);
|
|
17981
|
-
overflow: hidden;
|
|
17982
|
-
padding: 16px 12px 12px;
|
|
17983
|
-
border: 1px solid var(--question-border);
|
|
17984
|
-
border-radius: 24px;
|
|
17985
|
-
background: light-dark(#f7f7f7, #262626);
|
|
17986
|
-
color: var(--question-text);
|
|
17987
|
-
font: 13px/1.5 system-ui, sans-serif;
|
|
17988
|
-
}
|
|
17989
|
-
.title { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin: 0 6px 14px; color: var(--question-muted); font-weight: 400; }
|
|
17990
|
-
.question-icon { display: inline-flex; justify-content: center; align-items: center; width: 16px; height: 16px; flex-shrink: 0; }
|
|
17991
|
-
.countdown { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
|
|
17992
|
-
.countdown[hidden] { display: none; }
|
|
17993
|
-
.countdown:not([hidden]) + .dismiss { margin-left: 0; }
|
|
17994
|
-
svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
|
17995
|
-
.body { min-height: 0; overflow: auto; }
|
|
17996
|
-
fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 14px; }
|
|
17997
|
-
fieldset:last-child { margin-bottom: 0; }
|
|
17998
|
-
legend { width: 100%; padding: 0 6px; margin-bottom: 14px; font: inherit; }
|
|
17999
|
-
.hint { color: var(--question-muted); font-size: 12px; margin: -10px 6px 10px; }
|
|
18000
|
-
.option {
|
|
18001
|
-
position: relative;
|
|
18002
|
-
display: flex;
|
|
18003
|
-
align-items: flex-start;
|
|
18004
|
-
gap: 10px;
|
|
18005
|
-
min-height: 34px;
|
|
18006
|
-
padding: 6px;
|
|
18007
|
-
margin: 2px 0;
|
|
18008
|
-
border-radius: 12px;
|
|
18009
|
-
cursor: pointer;
|
|
18010
|
-
background: transparent;
|
|
18011
|
-
overflow-wrap: anywhere;
|
|
18012
|
-
}
|
|
18013
|
-
.option:hover, .option:has(:checked) { background: var(--question-selected); }
|
|
18014
|
-
input[type=checkbox], input[type=radio] {
|
|
18015
|
-
appearance: none;
|
|
18016
|
-
display: block;
|
|
18017
|
-
flex: 0 0 21px;
|
|
18018
|
-
width: 21px;
|
|
18019
|
-
height: 21px;
|
|
18020
|
-
margin: 0;
|
|
18021
|
-
padding: 0;
|
|
18022
|
-
border: 1px solid var(--question-border);
|
|
18023
|
-
border-radius: 5px;
|
|
18024
|
-
background: light-dark(#ededed, #303030);
|
|
18025
|
-
cursor: pointer;
|
|
18026
|
-
}
|
|
18027
|
-
.shortcut { position: absolute; top: 6px; left: 6px; width: 21px; height: 21px; text-align: center; line-height: 21px; color: var(--question-muted); pointer-events: none; font-size: 12px; }
|
|
18028
|
-
.option-copy { flex: 1; min-width: 0; white-space: pre-wrap; }
|
|
18029
|
-
.option-name { display: block; font-weight: 400; }
|
|
18030
|
-
.description { display: block; color: var(--question-muted); font-size: 12px; margin-top: 1px; }
|
|
18031
|
-
.selected-indicator { align-self: center; visibility: hidden; color: var(--question-muted); padding-right: 4px; }
|
|
18032
|
-
:checked ~ .selected-indicator { visibility: visible; }
|
|
18033
|
-
.other { align-items: center; flex: 1; min-width: 0; margin: 0; }
|
|
18034
|
-
.other input[type=checkbox], .other input[type=radio] { background: transparent; border-color: transparent; }
|
|
18035
|
-
.other:has(:checked), .other:focus-within { background: var(--question-selected); }
|
|
18036
|
-
.other:has(:checked) .pencil { color: var(--question-text); }
|
|
18037
|
-
.pencil { display: flex; align-items: center; justify-content: center; }
|
|
18038
|
-
.other-copy { display: flex; flex: 1; min-width: 0; }
|
|
18039
|
-
input:not([type=checkbox]):not([type=radio]), textarea {
|
|
18040
|
-
appearance: none;
|
|
18041
|
-
display: block;
|
|
18042
|
-
min-width: 0;
|
|
18043
|
-
width: 100%;
|
|
18044
|
-
padding: 6px;
|
|
18045
|
-
border: 1px solid var(--question-border);
|
|
18046
|
-
border-radius: 8px;
|
|
18047
|
-
background: transparent;
|
|
18048
|
-
color: var(--question-text);
|
|
18049
|
-
font: inherit;
|
|
18050
|
-
}
|
|
18051
|
-
.other-copy input:not([type=checkbox]):not([type=radio]) { border: 0; padding: 0; }
|
|
18052
|
-
textarea { min-height: 60px; resize: vertical; }
|
|
18053
|
-
input::placeholder, textarea::placeholder { color: var(--question-muted); opacity: .65; }
|
|
18054
|
-
input:focus-visible, textarea:focus-visible, button:focus-visible {
|
|
18055
|
-
outline: 2px solid var(--question-muted);
|
|
18056
|
-
outline-offset: 2px;
|
|
17958
|
+
for (const value of Object.values(module).filter(matchesServices)) matches.add(value);
|
|
17959
|
+
if (matches.size > 1) throw new Error("Codex native services are unavailable in this window");
|
|
17960
|
+
}
|
|
17961
|
+
return [...matches][0] ?? null;
|
|
18057
17962
|
}
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
padding: 3px 10px;
|
|
18068
|
-
border: 1px solid var(--question-border);
|
|
18069
|
-
border-radius: 999px;
|
|
18070
|
-
background: transparent;
|
|
18071
|
-
color: var(--question-text);
|
|
18072
|
-
font: inherit;
|
|
18073
|
-
font-weight: 400;
|
|
18074
|
-
cursor: pointer;
|
|
17963
|
+
|
|
17964
|
+
// src/codex-ssh-services.ts
|
|
17965
|
+
var record3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17966
|
+
function isSshServices(value) {
|
|
17967
|
+
if (!record3(value) || !Object.hasOwn(value, "sshConnections") || !Object.hasOwn(value, "remoteConnections"))
|
|
17968
|
+
return false;
|
|
17969
|
+
const ssh = value.sshConnections;
|
|
17970
|
+
const remote = value.remoteConnections;
|
|
17971
|
+
return ssh != null && remote != null && typeof ssh.refresh === "function" && typeof ssh.save === "function" && typeof remote.getState === "function" && typeof remote.setAutoConnect === "function";
|
|
18075
17972
|
}
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
button.primary:hover { opacity: .85; }
|
|
18079
|
-
button.dismiss { display: flex; align-items: center; justify-content: center; border: 0; padding: 0; min-height: 24px; width: 24px; margin-left: auto; color: var(--question-muted); }
|
|
18080
|
-
:disabled { cursor: wait; opacity: .5; }
|
|
18081
|
-
@media (max-width: 420px) { .footer { flex-wrap: wrap; } .footer > .other { flex-basis: 100%; } }
|
|
18082
|
-
@media (forced-colors: active) {
|
|
18083
|
-
.card, input, textarea { background: Canvas; color: CanvasText; }
|
|
18084
|
-
button, .card, input[type=checkbox], input[type=radio] { border-color: ButtonBorder; }
|
|
18085
|
-
.option:has(:checked) { outline: 1px solid Highlight; outline-offset: -1px; }
|
|
18086
|
-
button.primary { background: Highlight; color: HighlightText; }
|
|
17973
|
+
async function loadCodexSshServices(ownerWindow, importModule) {
|
|
17974
|
+
return loadCodexNativeServices(ownerWindow, isSshServices, importModule);
|
|
18087
17975
|
}
|
|
18088
|
-
`;
|
|
18089
17976
|
|
|
18090
|
-
// src/
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
|
|
18095
|
-
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
|
|
18102
|
-
|
|
18103
|
-
selected.setAttribute("aria-hidden", "true");
|
|
18104
|
-
selected.append(icon2(Check));
|
|
18105
|
-
return selected;
|
|
18106
|
-
};
|
|
18107
|
-
const root = document2.createElement("section");
|
|
18108
|
-
root.dataset.codexhostQuestion = question.interactionId;
|
|
18109
|
-
root.setAttribute("aria-label", question.title ?? "Question");
|
|
18110
|
-
root.addEventListener("keydown", (event) => {
|
|
18111
|
-
event.stopPropagation();
|
|
18112
|
-
if (event.key === "Enter" && event.composedPath()[0] instanceof HTMLInputElement)
|
|
18113
|
-
event.preventDefault();
|
|
18114
|
-
});
|
|
18115
|
-
const shadow = root.attachShadow({ mode: "open" });
|
|
18116
|
-
const style = document2.createElement("style");
|
|
18117
|
-
style.textContent = QUESTION_CARD_CSS;
|
|
18118
|
-
const surface = document2.createElement("div");
|
|
18119
|
-
surface.className = "card";
|
|
18120
|
-
shadow.append(style, surface);
|
|
18121
|
-
const title = document2.createElement("div");
|
|
18122
|
-
title.className = "title";
|
|
18123
|
-
const titleIcon = document2.createElement("span");
|
|
18124
|
-
titleIcon.className = "question-icon";
|
|
18125
|
-
titleIcon.append(icon2(MessageCircleQuestionMark));
|
|
18126
|
-
titleIcon.setAttribute("aria-hidden", "true");
|
|
18127
|
-
const titleText = document2.createElement("span");
|
|
18128
|
-
titleText.textContent = "Question";
|
|
18129
|
-
const countdown = document2.createElement("span");
|
|
18130
|
-
countdown.className = "countdown";
|
|
18131
|
-
countdown.setAttribute("role", "timer");
|
|
18132
|
-
countdown.title = "The Harness owns this timeout and its result.";
|
|
18133
|
-
let autoResolution = question.autoResolution;
|
|
18134
|
-
const updateCountdown2 = () => {
|
|
18135
|
-
const timeout = autoResolution;
|
|
18136
|
-
countdown.hidden = !timeout;
|
|
18137
|
-
if (!timeout) return;
|
|
18138
|
-
const remaining = Math.max(0, Math.ceil((timeout.deadlineUnixMs - Date.now()) / 1e3));
|
|
18139
|
-
const clock = `${Math.floor(remaining / 60)}:${String(remaining % 60).padStart(2, "0")}`;
|
|
18140
|
-
const action = timeout.action === "recommended" ? "Auto-select recommended" : "Question timeout";
|
|
18141
|
-
const text = remaining ? `${action} in ${clock}` : "Waiting for Harness\u2026";
|
|
18142
|
-
if (countdown.textContent !== text) countdown.textContent = text;
|
|
18143
|
-
};
|
|
18144
|
-
updateCountdown2();
|
|
18145
|
-
let countdownTimer = autoResolution ? document2.defaultView?.setInterval(updateCountdown2, 250) : void 0;
|
|
18146
|
-
const dismiss = document2.createElement("button");
|
|
18147
|
-
dismiss.type = "button";
|
|
18148
|
-
dismiss.className = "dismiss";
|
|
18149
|
-
dismiss.append(icon2(X));
|
|
18150
|
-
dismiss.setAttribute("aria-label", "Dismiss question");
|
|
18151
|
-
title.append(titleIcon, titleText, countdown, dismiss);
|
|
18152
|
-
const body = document2.createElement("div");
|
|
18153
|
-
body.className = "body";
|
|
18154
|
-
surface.append(title, body);
|
|
18155
|
-
const footer = document2.createElement("div");
|
|
18156
|
-
footer.className = "footer";
|
|
18157
|
-
const readers = /* @__PURE__ */ new Map();
|
|
18158
|
-
const controls = [dismiss];
|
|
18159
|
-
const validOther = [];
|
|
18160
|
-
for (const [index, field2] of question.questions.entries()) {
|
|
18161
|
-
const group = document2.createElement("fieldset");
|
|
18162
|
-
const legend = document2.createElement("legend");
|
|
18163
|
-
legend.textContent = field2.prompt;
|
|
18164
|
-
group.append(legend);
|
|
18165
|
-
const saved = initial[field2.id] ?? [];
|
|
18166
|
-
if (field2.type === "text") {
|
|
18167
|
-
const input = document2.createElement(field2.multiline ? "textarea" : "input");
|
|
18168
|
-
input.value = saved[0] ?? field2.prefill ?? "";
|
|
18169
|
-
input.placeholder = field2.placeholder ?? "Your answer";
|
|
18170
|
-
input.setAttribute("aria-label", field2.prompt);
|
|
18171
|
-
controls.push(input);
|
|
18172
|
-
group.append(input);
|
|
18173
|
-
readers.set(field2.id, () => input.value.trim() ? [input.value] : []);
|
|
18174
|
-
} else {
|
|
18175
|
-
const hint = document2.createElement("div");
|
|
18176
|
-
hint.className = "hint";
|
|
18177
|
-
hint.textContent = "Select all that apply";
|
|
18178
|
-
if (field2.multiple) group.append(hint);
|
|
18179
|
-
const inputs = [];
|
|
18180
|
-
const name = `codexhost-${question.interactionId}-${index}`;
|
|
18181
|
-
for (const [optionIndex, option] of field2.options.entries()) {
|
|
18182
|
-
const label = document2.createElement("label");
|
|
18183
|
-
label.className = "option";
|
|
18184
|
-
const input = document2.createElement("input");
|
|
18185
|
-
input.type = field2.multiple ? "checkbox" : "radio";
|
|
18186
|
-
input.name = name;
|
|
18187
|
-
input.value = option.value;
|
|
18188
|
-
input.checked = saved.includes(option.value);
|
|
18189
|
-
const shortcut = document2.createElement("span");
|
|
18190
|
-
shortcut.className = "shortcut";
|
|
18191
|
-
shortcut.setAttribute("aria-hidden", "true");
|
|
18192
|
-
shortcut.textContent = String(optionIndex + 1);
|
|
18193
|
-
const selected = selectedIndicator();
|
|
18194
|
-
const text = document2.createElement("span");
|
|
18195
|
-
text.className = "option-copy";
|
|
18196
|
-
const optionName = document2.createElement("span");
|
|
18197
|
-
optionName.className = "option-name";
|
|
18198
|
-
optionName.textContent = option.label;
|
|
18199
|
-
text.append(optionName);
|
|
18200
|
-
if (option.description) {
|
|
18201
|
-
const description = document2.createElement("span");
|
|
18202
|
-
description.className = "description";
|
|
18203
|
-
description.textContent = option.description;
|
|
18204
|
-
text.append(description);
|
|
18205
|
-
}
|
|
18206
|
-
label.append(input, shortcut, text, selected);
|
|
18207
|
-
group.append(label);
|
|
18208
|
-
inputs.push(input);
|
|
18209
|
-
controls.push(input);
|
|
17977
|
+
// src/codex-ssh-adapter.ts
|
|
17978
|
+
var record4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17979
|
+
function createCodexSshClient(ownerWindow) {
|
|
17980
|
+
let nativeServices;
|
|
17981
|
+
function services() {
|
|
17982
|
+
nativeServices ??= loadCodexSshServices(ownerWindow).then(
|
|
17983
|
+
(value) => {
|
|
17984
|
+
if (!value) nativeServices = void 0;
|
|
17985
|
+
return value;
|
|
17986
|
+
},
|
|
17987
|
+
(error51) => {
|
|
17988
|
+
nativeServices = void 0;
|
|
17989
|
+
throw error51;
|
|
18210
17990
|
}
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
17991
|
+
);
|
|
17992
|
+
return nativeServices;
|
|
17993
|
+
}
|
|
17994
|
+
function request(operation, params, signal) {
|
|
17995
|
+
const bridge = ownerWindow.electronBridge;
|
|
17996
|
+
if (!bridge?.sendMessageFromView)
|
|
17997
|
+
return Promise.reject(new Error("Codex SSH settings are unavailable in this window"));
|
|
17998
|
+
if (signal?.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
17999
|
+
return new Promise((resolve, reject) => {
|
|
18000
|
+
const requestId2 = ownerWindow.crypto.randomUUID();
|
|
18001
|
+
let settled2 = false;
|
|
18002
|
+
const finish = (error51, value) => {
|
|
18003
|
+
if (settled2) return;
|
|
18004
|
+
settled2 = true;
|
|
18005
|
+
ownerWindow.clearTimeout(timer);
|
|
18006
|
+
ownerWindow.removeEventListener("message", receive);
|
|
18007
|
+
signal?.removeEventListener("abort", abort);
|
|
18008
|
+
if (error51) reject(error51);
|
|
18009
|
+
else resolve(value);
|
|
18010
|
+
};
|
|
18011
|
+
const abort = () => finish(new DOMException("Aborted", "AbortError"));
|
|
18012
|
+
const receive = (event) => {
|
|
18013
|
+
const message2 = event.data;
|
|
18014
|
+
if (!record4(message2) || message2.type !== "fetch-response" || message2.requestId !== requestId2)
|
|
18015
|
+
return;
|
|
18016
|
+
if (message2.responseType !== "success" || typeof message2.status !== "number" || message2.status < 200 || message2.status >= 300 || typeof message2.bodyJsonString !== "string") {
|
|
18017
|
+
const detail = typeof message2.error === "string" ? `: ${message2.error}` : "";
|
|
18018
|
+
finish(
|
|
18019
|
+
new Error(`Codex SSH request failed; check the native Connections settings${detail}`)
|
|
18020
|
+
);
|
|
18021
|
+
return;
|
|
18022
|
+
}
|
|
18023
|
+
try {
|
|
18024
|
+
finish(null, JSON.parse(message2.bodyJsonString));
|
|
18025
|
+
} catch {
|
|
18026
|
+
finish(new Error("Invalid Codex SSH response"));
|
|
18027
|
+
}
|
|
18028
|
+
};
|
|
18029
|
+
const timer = ownerWindow.setTimeout(
|
|
18030
|
+
() => finish(new Error("Codex SSH request timed out; refresh before retrying")),
|
|
18031
|
+
15e3
|
|
18032
|
+
);
|
|
18033
|
+
ownerWindow.addEventListener("message", receive);
|
|
18034
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
18035
|
+
void (async () => {
|
|
18036
|
+
const native = await services();
|
|
18037
|
+
if (settled2) return;
|
|
18038
|
+
if (native) {
|
|
18039
|
+
let result;
|
|
18040
|
+
switch (operation) {
|
|
18041
|
+
case "refresh-remote-connections":
|
|
18042
|
+
result = await native.sshConnections.refresh();
|
|
18043
|
+
break;
|
|
18044
|
+
case "save-codex-managed-remote-ssh-connections":
|
|
18045
|
+
result = await native.sshConnections.save(params);
|
|
18046
|
+
break;
|
|
18047
|
+
case "set-remote-connection-auto-connect":
|
|
18048
|
+
result = await native.remoteConnections.setAutoConnect(params);
|
|
18049
|
+
break;
|
|
18050
|
+
case "app-server-connection-state":
|
|
18051
|
+
result = await native.remoteConnections.getState(String(params.hostId));
|
|
18052
|
+
break;
|
|
18053
|
+
}
|
|
18054
|
+
finish(null, result);
|
|
18055
|
+
} else {
|
|
18056
|
+
await bridge.sendMessageFromView({
|
|
18057
|
+
type: "fetch",
|
|
18058
|
+
requestId: requestId2,
|
|
18059
|
+
method: "POST",
|
|
18060
|
+
url: `vscode://codex/${operation}`,
|
|
18061
|
+
body: JSON.stringify(params),
|
|
18062
|
+
reportUploadProgress: false
|
|
18063
|
+
});
|
|
18064
|
+
}
|
|
18065
|
+
})().catch((error51) => finish(error51));
|
|
18066
|
+
});
|
|
18067
|
+
}
|
|
18068
|
+
async function list(signal) {
|
|
18069
|
+
const result = await request("refresh-remote-connections", {}, signal);
|
|
18070
|
+
if (!record4(result) || !Array.isArray(result.remoteConnections))
|
|
18071
|
+
throw new Error("Invalid Codex SSH connection list");
|
|
18072
|
+
return result.remoteConnections.filter(
|
|
18073
|
+
(item) => !(record4(item) && ["wsl", "remote-control"].includes(String(item.source)))
|
|
18074
|
+
).map((item) => {
|
|
18075
|
+
if (!record4(item) || typeof item.hostId !== "string" || typeof item.displayName !== "string" || !["codex-managed", "discovered"].includes(String(item.source)) || typeof item.sshHost !== "string" || typeof item.autoConnect !== "boolean" || !(item.sshAlias == null || typeof item.sshAlias === "string") || !(item.identity == null || typeof item.identity === "string") || !(item.sshPort == null || Number.isInteger(item.sshPort) && Number(item.sshPort) > 0 && Number(item.sshPort) <= 65535)) {
|
|
18076
|
+
throw new Error(
|
|
18077
|
+
"This Codex version uses an unsupported SSH configuration; open native settings"
|
|
18222
18078
|
);
|
|
18223
|
-
other.checked = unknown2 !== void 0;
|
|
18224
|
-
notes = document2.createElement("input");
|
|
18225
|
-
notes.value = unknown2 ?? "";
|
|
18226
|
-
notes.placeholder = "Or write your own response";
|
|
18227
|
-
notes.setAttribute("aria-label", `${field2.prompt}: Other`);
|
|
18228
|
-
const checkbox = other;
|
|
18229
|
-
const otherText = notes;
|
|
18230
|
-
validOther.push(() => !checkbox.checked || otherText.value.trim().length > 0);
|
|
18231
|
-
notes.addEventListener("input", () => {
|
|
18232
|
-
checkbox.checked = true;
|
|
18233
|
-
});
|
|
18234
|
-
const copy = document2.createElement("span");
|
|
18235
|
-
copy.className = "other-copy";
|
|
18236
|
-
copy.append(notes);
|
|
18237
|
-
const pencil = document2.createElement("span");
|
|
18238
|
-
pencil.className = "shortcut pencil";
|
|
18239
|
-
pencil.append(icon2(Pencil));
|
|
18240
|
-
pencil.setAttribute("aria-hidden", "true");
|
|
18241
|
-
const selected = selectedIndicator();
|
|
18242
|
-
label.append(other, pencil, copy, selected);
|
|
18243
|
-
if (question.questions.length === 1) footer.append(label);
|
|
18244
|
-
else group.append(label);
|
|
18245
|
-
controls.push(other, notes);
|
|
18246
18079
|
}
|
|
18247
|
-
|
|
18248
|
-
...
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18080
|
+
return {
|
|
18081
|
+
...item,
|
|
18082
|
+
sshAlias: item.sshAlias ?? null,
|
|
18083
|
+
identity: item.identity ?? null,
|
|
18084
|
+
sshPort: item.sshPort ?? null
|
|
18085
|
+
};
|
|
18086
|
+
});
|
|
18253
18087
|
}
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
if (
|
|
18269
|
-
|
|
18270
|
-
|
|
18088
|
+
function saved(connection) {
|
|
18089
|
+
return {
|
|
18090
|
+
hostId: connection.hostId,
|
|
18091
|
+
displayName: connection.displayName,
|
|
18092
|
+
source: connection.source,
|
|
18093
|
+
alias: connection.sshAlias,
|
|
18094
|
+
hostname: connection.source === "discovered" ? null : connection.sshHost,
|
|
18095
|
+
sshPort: connection.source === "discovered" ? null : connection.sshPort,
|
|
18096
|
+
identity: connection.source === "discovered" ? null : connection.identity,
|
|
18097
|
+
...connection.connectionAnalyticsId ? { connectionAnalyticsId: connection.connectionAnalyticsId } : {}
|
|
18098
|
+
};
|
|
18099
|
+
}
|
|
18100
|
+
async function mutate(previous, draft, signal) {
|
|
18101
|
+
const current = await list(signal);
|
|
18102
|
+
if (previous) {
|
|
18103
|
+
const latest = current.find((item) => item.hostId === previous.hostId);
|
|
18104
|
+
if (!latest || JSON.stringify(saved(latest)) !== JSON.stringify(saved(previous))) {
|
|
18105
|
+
throw new Error("This connection changed in Codex. Refresh and edit it again.");
|
|
18106
|
+
}
|
|
18271
18107
|
}
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18108
|
+
const next = current.filter((item) => item.hostId !== previous?.hostId).map(saved);
|
|
18109
|
+
if (draft) {
|
|
18110
|
+
const hostname3 = draft.hostname.trim();
|
|
18111
|
+
const displayName = draft.displayName.trim();
|
|
18112
|
+
if (!displayName || !hostname3 || hostname3.startsWith("-") || /\s/u.test(hostname3) || draft.sshPort !== null && (!Number.isInteger(draft.sshPort) || draft.sshPort < 1 || draft.sshPort > 65535)) {
|
|
18113
|
+
throw new Error("Enter a name, SSH hostname (or alias), and a port between 1 and 65535");
|
|
18114
|
+
}
|
|
18115
|
+
if (current.some(
|
|
18116
|
+
(item) => item.hostId !== previous?.hostId && item.displayName.trim() === displayName
|
|
18117
|
+
)) {
|
|
18118
|
+
throw new Error("A connection with this name already exists");
|
|
18119
|
+
}
|
|
18120
|
+
if (previous?.source === "discovered" && (hostname3 !== previous.sshHost || draft.sshPort !== previous.sshPort || draft.identity !== previous.identity)) {
|
|
18121
|
+
throw new Error("Edit SSH-config connection details in native Codex settings");
|
|
18122
|
+
}
|
|
18123
|
+
next.push(
|
|
18124
|
+
previous?.source === "discovered" ? { ...saved(previous), displayName } : {
|
|
18125
|
+
hostId: previous?.hostId ?? `remote-ssh-codex-managed:${ownerWindow.crypto.randomUUID()}`,
|
|
18126
|
+
displayName,
|
|
18127
|
+
source: "codex-managed",
|
|
18128
|
+
alias: null,
|
|
18129
|
+
hostname: hostname3,
|
|
18130
|
+
sshPort: draft.sshPort,
|
|
18131
|
+
identity: draft.identity?.trim() || null,
|
|
18132
|
+
...previous?.connectionAnalyticsId ? { connectionAnalyticsId: previous.connectionAnalyticsId } : {}
|
|
18133
|
+
}
|
|
18134
|
+
);
|
|
18282
18135
|
}
|
|
18283
|
-
|
|
18284
|
-
for (const [label, cancelled] of [
|
|
18285
|
-
["Skip", true],
|
|
18286
|
-
["Send", false]
|
|
18287
|
-
]) {
|
|
18288
|
-
const button2 = document2.createElement("button");
|
|
18289
|
-
button2.type = "button";
|
|
18290
|
-
button2.textContent = label;
|
|
18291
|
-
if (!cancelled) button2.className = "primary";
|
|
18292
|
-
button2.addEventListener("click", () => {
|
|
18293
|
-
void send(cancelled);
|
|
18294
|
-
});
|
|
18295
|
-
controls.push(button2);
|
|
18296
|
-
actions.append(button2);
|
|
18136
|
+
await request("save-codex-managed-remote-ssh-connections", { remoteConnections: next }, signal);
|
|
18297
18137
|
}
|
|
18298
|
-
dismiss.addEventListener("click", () => {
|
|
18299
|
-
void send(true);
|
|
18300
|
-
});
|
|
18301
|
-
footer.append(actions);
|
|
18302
|
-
surface.append(error51, footer);
|
|
18303
18138
|
return {
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
|
|
18309
|
-
updateAutoResolution(next) {
|
|
18310
|
-
if (autoResolution && (!next || next.deadlineUnixMs < autoResolution.deadlineUnixMs)) return;
|
|
18311
|
-
autoResolution = next;
|
|
18312
|
-
if (next && countdownTimer === void 0)
|
|
18313
|
-
countdownTimer = document2.defaultView?.setInterval(updateCountdown2, 250);
|
|
18314
|
-
updateCountdown2();
|
|
18139
|
+
list,
|
|
18140
|
+
save: (draft, previous, signal) => mutate(previous, draft, signal),
|
|
18141
|
+
remove: (previous, signal) => mutate(previous, null, signal),
|
|
18142
|
+
async connect(hostId2, enabled, signal) {
|
|
18143
|
+
await request("set-remote-connection-auto-connect", { hostId: hostId2, autoConnect: enabled }, signal);
|
|
18315
18144
|
},
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18145
|
+
async state(hostId2, signal) {
|
|
18146
|
+
const result = await request("app-server-connection-state", { hostId: hostId2 }, signal);
|
|
18147
|
+
if (!record4(result) || typeof result.state !== "string")
|
|
18148
|
+
throw new Error("Invalid Codex connection state");
|
|
18149
|
+
return {
|
|
18150
|
+
state: result.state,
|
|
18151
|
+
error: typeof result.error === "string" ? result.error : record4(result.error) && typeof result.error.message === "string" ? result.error.message : null
|
|
18152
|
+
};
|
|
18319
18153
|
}
|
|
18320
18154
|
};
|
|
18321
18155
|
}
|
|
18322
18156
|
|
|
18323
|
-
// src/
|
|
18324
|
-
function
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
const
|
|
18331
|
-
const
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
queued = false;
|
|
18341
|
-
return;
|
|
18342
|
-
}
|
|
18343
|
-
queued = false;
|
|
18344
|
-
inFlight = true;
|
|
18157
|
+
// src/remote-connections-control.ts
|
|
18158
|
+
function remoteUpdateTarget(local, remote) {
|
|
18159
|
+
if (!remote.updateSupported || !remote.remote || !remote.installedVersion || !local?.runningVersion)
|
|
18160
|
+
return null;
|
|
18161
|
+
if (["installing", "restarting", "failed"].includes(remote.update.phase)) return null;
|
|
18162
|
+
const stable = /^(\d+)\.(\d+)\.(\d+)$/u;
|
|
18163
|
+
if (!stable.test(local.runningVersion) || !stable.test(remote.installedVersion)) return null;
|
|
18164
|
+
const left = local.runningVersion.split(".").map(Number);
|
|
18165
|
+
const right = remote.installedVersion.split(".").map(Number);
|
|
18166
|
+
const index = left.findIndex((part, index2) => part !== right[index2]);
|
|
18167
|
+
if (index >= 0 && (left[index] ?? 0) > (right[index] ?? 0)) return local.runningVersion;
|
|
18168
|
+
if (index < 0 && remote.restartRequired) return remote.installedVersion;
|
|
18169
|
+
return null;
|
|
18170
|
+
}
|
|
18171
|
+
function createRemoteConnectionsControl(ownerWindow, getClient) {
|
|
18172
|
+
async function bounded(operation, timeoutMs = 8e3) {
|
|
18173
|
+
let timer;
|
|
18345
18174
|
try {
|
|
18346
|
-
await
|
|
18347
|
-
|
|
18175
|
+
return await Promise.race([
|
|
18176
|
+
operation,
|
|
18177
|
+
new Promise((_, reject) => {
|
|
18178
|
+
timer = ownerWindow.setTimeout(
|
|
18179
|
+
() => reject(new Error("Remote service did not respond; reconnect and retry")),
|
|
18180
|
+
timeoutMs
|
|
18181
|
+
);
|
|
18182
|
+
})
|
|
18183
|
+
]);
|
|
18348
18184
|
} finally {
|
|
18349
|
-
|
|
18350
|
-
schedule();
|
|
18185
|
+
ownerWindow.clearTimeout(timer);
|
|
18351
18186
|
}
|
|
18352
|
-
};
|
|
18353
|
-
const activity = (event) => {
|
|
18354
|
-
if (!event.isTrusted || !available()) return;
|
|
18355
|
-
queued = true;
|
|
18356
|
-
schedule();
|
|
18357
|
-
};
|
|
18358
|
-
const blur = (event) => {
|
|
18359
|
-
if (event.isTrusted) blurred = true;
|
|
18360
|
-
};
|
|
18361
|
-
const focus = (event) => {
|
|
18362
|
-
if (!blurred) return;
|
|
18363
|
-
blurred = false;
|
|
18364
|
-
activity(event);
|
|
18365
|
-
};
|
|
18366
|
-
const events = ["pointerdown", "keydown", "input", "wheel"];
|
|
18367
|
-
for (const event of events) root.addEventListener(event, activity, { passive: true });
|
|
18368
|
-
window2.addEventListener("blur", blur);
|
|
18369
|
-
window2.addEventListener("focus", focus);
|
|
18370
|
-
return () => {
|
|
18371
|
-
disposed = true;
|
|
18372
|
-
queued = false;
|
|
18373
|
-
if (timer !== void 0) window2.clearTimeout(timer);
|
|
18374
|
-
for (const event of events) root.removeEventListener(event, activity);
|
|
18375
|
-
window2.removeEventListener("blur", blur);
|
|
18376
|
-
window2.removeEventListener("focus", focus);
|
|
18377
|
-
};
|
|
18378
|
-
}
|
|
18379
|
-
|
|
18380
|
-
// src/renderer-request-sender.ts
|
|
18381
|
-
var RendererMethodUnavailableError = class extends Error {
|
|
18382
|
-
constructor(method, cause) {
|
|
18383
|
-
super(`${method} is unsupported on this Host connection`, { cause });
|
|
18384
|
-
this.method = method;
|
|
18385
|
-
this.name = "RendererMethodUnavailableError";
|
|
18386
18187
|
}
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18188
|
+
const control = {
|
|
18189
|
+
ssh: createCodexSshClient(ownerWindow),
|
|
18190
|
+
async readThread(hostId2, input) {
|
|
18191
|
+
if (!hostId2 || hostId2 === "local") throw new Error("Choose an explicit remote Host");
|
|
18192
|
+
const client = getClient(hostId2);
|
|
18193
|
+
if (!client?.readDelegationThread)
|
|
18194
|
+
throw new Error("Remote Thread reading is unavailable; update codexhost and reconnect");
|
|
18195
|
+
return bounded(client.readDelegationThread(input), REMOTE_THREAD_READ_TIMEOUT_MS);
|
|
18196
|
+
},
|
|
18197
|
+
async setup(connection, action, version2, uninstallPackage) {
|
|
18198
|
+
const client = getClient("local");
|
|
18199
|
+
if (!client?.setupSsh)
|
|
18200
|
+
throw new Error("SSH installation is unavailable; update local codexhost and restart");
|
|
18201
|
+
return client.setupSsh({
|
|
18202
|
+
hostname: connection.sshAlias ?? connection.sshHost,
|
|
18203
|
+
port: connection.sshPort,
|
|
18204
|
+
identity: connection.identity,
|
|
18205
|
+
action,
|
|
18206
|
+
version: version2 ?? null,
|
|
18207
|
+
...action === "uninstall" ? { uninstallPackage: uninstallPackage ?? false } : {}
|
|
18208
|
+
});
|
|
18209
|
+
},
|
|
18210
|
+
async runtime(hostId2) {
|
|
18211
|
+
const client = getClient(hostId2);
|
|
18212
|
+
if (!client?.runtimeStatus)
|
|
18213
|
+
throw new Error(
|
|
18214
|
+
"Version management is unavailable; update codexhost on this host and reconnect"
|
|
18215
|
+
);
|
|
18216
|
+
return bounded(client.runtimeStatus());
|
|
18217
|
+
},
|
|
18218
|
+
async update(hostId2, version2) {
|
|
18219
|
+
if (hostId2 === "local") throw new Error("Choose a remote SSH connection");
|
|
18220
|
+
const client = getClient(hostId2);
|
|
18221
|
+
if (!client?.updateRemote)
|
|
18222
|
+
throw new Error("Remote update is unavailable; update this remote once and reconnect");
|
|
18223
|
+
return bounded(client.updateRemote(version2));
|
|
18408
18224
|
}
|
|
18409
18225
|
};
|
|
18226
|
+
return control;
|
|
18410
18227
|
}
|
|
18411
18228
|
|
|
18412
|
-
//
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
}
|
|
18445
|
-
const current = context;
|
|
18446
|
-
if (!current || inFlight || unsupported.has(current.route)) return;
|
|
18447
|
-
inFlight = true;
|
|
18448
|
-
try {
|
|
18449
|
-
const raw = await current.route.sendRequest(
|
|
18450
|
-
THREAD_QUESTIONS_LIST_METHOD,
|
|
18451
|
-
{ threadId: current.threadId },
|
|
18452
|
-
{ priority: "background", timeoutMs: 5e3 }
|
|
18453
|
-
);
|
|
18454
|
-
if (disposed || !same(current, readContext())) return;
|
|
18455
|
-
const question = threadQuestionsResultSchema.parse(raw).questions[0];
|
|
18456
|
-
if (!question) {
|
|
18457
|
-
if (cardId) drafts.delete(key(cardId));
|
|
18458
|
-
clear(false);
|
|
18459
|
-
return;
|
|
18460
|
-
}
|
|
18461
|
-
if (cardId === question.interactionId && card?.root.isConnected) {
|
|
18462
|
-
card.updateAutoResolution(question.autoResolution);
|
|
18463
|
-
return;
|
|
18464
|
-
}
|
|
18465
|
-
clear(cardId === question.interactionId);
|
|
18466
|
-
cardId = question.interactionId;
|
|
18467
|
-
card = createQuestionCard(
|
|
18468
|
-
current.composer.ownerDocument,
|
|
18469
|
-
question,
|
|
18470
|
-
async (answers, cancelled) => {
|
|
18471
|
-
if (disposed || !same(current, readContext()) || cardId !== question.interactionId)
|
|
18472
|
-
throw new Error("Question owner changed");
|
|
18473
|
-
const result = await current.route.sendRequest(
|
|
18474
|
-
THREAD_QUESTION_RESPOND_METHOD,
|
|
18475
|
-
{
|
|
18476
|
-
threadId: current.threadId,
|
|
18477
|
-
turnId: question.turnId,
|
|
18478
|
-
interactionId: question.interactionId,
|
|
18479
|
-
answers,
|
|
18480
|
-
cancelled
|
|
18481
|
-
},
|
|
18482
|
-
{ priority: "interactive", timeoutMs: 1e4 }
|
|
18483
|
-
);
|
|
18484
|
-
threadQuestionRespondResultSchema.parse(result);
|
|
18485
|
-
drafts.delete(JSON.stringify([current.hostId, current.threadId, question.interactionId]));
|
|
18486
|
-
if (same(current, context) && cardId === question.interactionId) clear(false);
|
|
18487
|
-
},
|
|
18488
|
-
drafts.get(key(question.interactionId))
|
|
18489
|
-
);
|
|
18490
|
-
current.composer.before(card.root);
|
|
18491
|
-
const mounted = card;
|
|
18492
|
-
stopActivity = installQuestionActivity(
|
|
18493
|
-
window2,
|
|
18494
|
-
card.root,
|
|
18495
|
-
() => same(current, readContext()) && card === mounted && mounted.autoResolution?.resetOnActivity === true,
|
|
18496
|
-
async () => {
|
|
18497
|
-
const raw2 = await current.route.sendRequest(
|
|
18498
|
-
THREAD_QUESTION_ACTIVITY_METHOD,
|
|
18499
|
-
{
|
|
18500
|
-
threadId: current.threadId,
|
|
18501
|
-
turnId: question.turnId,
|
|
18502
|
-
interactionId: question.interactionId
|
|
18503
|
-
},
|
|
18504
|
-
{ priority: "background", timeoutMs: 4e3 }
|
|
18505
|
-
);
|
|
18506
|
-
if (disposed || card !== mounted || !same(current, readContext())) return;
|
|
18507
|
-
const ack = threadQuestionActivityResultSchema.parse(raw2).autoResolution;
|
|
18508
|
-
if (ack) mounted.updateAutoResolution(ack);
|
|
18509
|
-
}
|
|
18510
|
-
);
|
|
18511
|
-
} catch (error51) {
|
|
18512
|
-
if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
|
|
18513
|
-
if (same(current, context)) clear();
|
|
18514
|
-
} finally {
|
|
18515
|
-
inFlight = false;
|
|
18516
|
-
}
|
|
18229
|
+
// ../../node_modules/lucide/dist/esm/defaultAttributes.mjs
|
|
18230
|
+
var defaultAttributes = {
|
|
18231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18232
|
+
width: 24,
|
|
18233
|
+
height: 24,
|
|
18234
|
+
viewBox: "0 0 24 24",
|
|
18235
|
+
fill: "none",
|
|
18236
|
+
stroke: "currentColor",
|
|
18237
|
+
"stroke-width": 2,
|
|
18238
|
+
"stroke-linecap": "round",
|
|
18239
|
+
"stroke-linejoin": "round"
|
|
18240
|
+
};
|
|
18241
|
+
|
|
18242
|
+
// ../../node_modules/lucide/dist/esm/createElement.mjs
|
|
18243
|
+
var createSVGElement = ([tag, attrs, children]) => {
|
|
18244
|
+
const element = document.createElementNS("http://www.w3.org/2000/svg", tag);
|
|
18245
|
+
Object.keys(attrs).forEach((name) => {
|
|
18246
|
+
element.setAttribute(name, String(attrs[name]));
|
|
18247
|
+
});
|
|
18248
|
+
if (children?.length) {
|
|
18249
|
+
children.forEach((child) => {
|
|
18250
|
+
const childElement = createSVGElement(child);
|
|
18251
|
+
element.appendChild(childElement);
|
|
18252
|
+
});
|
|
18253
|
+
}
|
|
18254
|
+
return element;
|
|
18255
|
+
};
|
|
18256
|
+
var createElement = (iconNode, customAttrs = {}) => {
|
|
18257
|
+
const tag = "svg";
|
|
18258
|
+
const attrs = {
|
|
18259
|
+
...defaultAttributes,
|
|
18260
|
+
...customAttrs
|
|
18517
18261
|
};
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18528
|
-
|
|
18262
|
+
return createSVGElement([tag, attrs, iconNode]);
|
|
18263
|
+
};
|
|
18264
|
+
|
|
18265
|
+
// ../../node_modules/lucide/dist/esm/icons/check.mjs
|
|
18266
|
+
var Check = [["path", { d: "M20 6 9 17l-5-5" }]];
|
|
18267
|
+
|
|
18268
|
+
// ../../node_modules/lucide/dist/esm/icons/message-circle-question-mark.mjs
|
|
18269
|
+
var MessageCircleQuestionMark = [
|
|
18270
|
+
[
|
|
18271
|
+
"path",
|
|
18272
|
+
{
|
|
18273
|
+
d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"
|
|
18529
18274
|
}
|
|
18530
|
-
|
|
18531
|
-
|
|
18275
|
+
],
|
|
18276
|
+
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }],
|
|
18277
|
+
["path", { d: "M12 17h.01" }]
|
|
18278
|
+
];
|
|
18532
18279
|
|
|
18533
|
-
//
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
const url2 = new URL(link.getAttribute("href") ?? "", page);
|
|
18540
|
-
if (url2.protocol === page.protocol && url2.host === page.host && url2.pathname.endsWith(".js") && !url2.search && !url2.hash)
|
|
18541
|
-
urls.add(url2.href);
|
|
18542
|
-
}
|
|
18543
|
-
const candidates = [...urls].sort(
|
|
18544
|
-
(a, b) => Number(b.includes("/app-shared-")) - Number(a.includes("/app-shared-"))
|
|
18545
|
-
);
|
|
18546
|
-
for (const url2 of candidates) {
|
|
18547
|
-
let module;
|
|
18548
|
-
try {
|
|
18549
|
-
module = await importModule(url2);
|
|
18550
|
-
} catch {
|
|
18551
|
-
continue;
|
|
18280
|
+
// ../../node_modules/lucide/dist/esm/icons/pencil.mjs
|
|
18281
|
+
var Pencil = [
|
|
18282
|
+
[
|
|
18283
|
+
"path",
|
|
18284
|
+
{
|
|
18285
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
|
|
18552
18286
|
}
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
}
|
|
18557
|
-
return null;
|
|
18558
|
-
}
|
|
18287
|
+
],
|
|
18288
|
+
["path", { d: "m15 5 4 4" }]
|
|
18289
|
+
];
|
|
18559
18290
|
|
|
18560
|
-
//
|
|
18561
|
-
var
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18291
|
+
// ../../node_modules/lucide/dist/esm/icons/x.mjs
|
|
18292
|
+
var X = [
|
|
18293
|
+
["path", { d: "M18 6 6 18" }],
|
|
18294
|
+
["path", { d: "m6 6 12 12" }]
|
|
18295
|
+
];
|
|
18296
|
+
|
|
18297
|
+
// src/renderer-question-card-style.ts
|
|
18298
|
+
var QUESTION_CARD_CSS = `
|
|
18299
|
+
:host {
|
|
18300
|
+
display: block;
|
|
18301
|
+
min-width: 0;
|
|
18302
|
+
margin: 8px 0;
|
|
18303
|
+
color-scheme: inherit;
|
|
18304
|
+
--question-text: light-dark(#171717, #ececec);
|
|
18305
|
+
--question-muted: light-dark(#737373, #a3a3a3);
|
|
18306
|
+
--question-border: light-dark(rgb(0 0 0 / 8%), rgb(255 255 255 / 8%));
|
|
18307
|
+
--question-selected: light-dark(#e9e9e9, #333333);
|
|
18308
|
+
--question-primary: light-dark(#202020, #ececec);
|
|
18309
|
+
--question-primary-text: light-dark(#fff, #171717);
|
|
18568
18310
|
}
|
|
18569
|
-
|
|
18570
|
-
|
|
18311
|
+
*, ::before, ::after { box-sizing: border-box; }
|
|
18312
|
+
.card {
|
|
18313
|
+
display: flex;
|
|
18314
|
+
flex-direction: column;
|
|
18315
|
+
max-height: min(60vh, 560px);
|
|
18316
|
+
overflow: hidden;
|
|
18317
|
+
padding: 16px 12px 12px;
|
|
18318
|
+
border: 1px solid var(--question-border);
|
|
18319
|
+
border-radius: 24px;
|
|
18320
|
+
background: light-dark(#f7f7f7, #262626);
|
|
18321
|
+
color: var(--question-text);
|
|
18322
|
+
font: 13px/1.5 system-ui, sans-serif;
|
|
18571
18323
|
}
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
|
|
18575
|
-
|
|
18576
|
-
|
|
18577
|
-
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18324
|
+
.title { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin: 0 6px 14px; color: var(--question-muted); font-weight: 400; }
|
|
18325
|
+
.question-icon { display: inline-flex; justify-content: center; align-items: center; width: 16px; height: 16px; flex-shrink: 0; }
|
|
18326
|
+
.countdown { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
|
|
18327
|
+
.countdown[hidden] { display: none; }
|
|
18328
|
+
.countdown:not([hidden]) + .dismiss { margin-left: 0; }
|
|
18329
|
+
svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
|
18330
|
+
.body { min-height: 0; overflow: auto; }
|
|
18331
|
+
fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 14px; }
|
|
18332
|
+
fieldset:last-child { margin-bottom: 0; }
|
|
18333
|
+
legend { width: 100%; padding: 0 6px; margin-bottom: 14px; font: inherit; }
|
|
18334
|
+
.hint { color: var(--question-muted); font-size: 12px; margin: -10px 6px 10px; }
|
|
18335
|
+
.option {
|
|
18336
|
+
position: relative;
|
|
18337
|
+
display: flex;
|
|
18338
|
+
align-items: flex-start;
|
|
18339
|
+
gap: 10px;
|
|
18340
|
+
min-height: 34px;
|
|
18341
|
+
padding: 6px;
|
|
18342
|
+
margin: 2px 0;
|
|
18343
|
+
border-radius: 12px;
|
|
18344
|
+
cursor: pointer;
|
|
18345
|
+
background: transparent;
|
|
18346
|
+
overflow-wrap: anywhere;
|
|
18347
|
+
}
|
|
18348
|
+
.option:hover, .option:has(:checked) { background: var(--question-selected); }
|
|
18349
|
+
input[type=checkbox], input[type=radio] {
|
|
18350
|
+
appearance: none;
|
|
18351
|
+
display: block;
|
|
18352
|
+
flex: 0 0 21px;
|
|
18353
|
+
width: 21px;
|
|
18354
|
+
height: 21px;
|
|
18355
|
+
margin: 0;
|
|
18356
|
+
padding: 0;
|
|
18357
|
+
border: 1px solid var(--question-border);
|
|
18358
|
+
border-radius: 5px;
|
|
18359
|
+
background: light-dark(#ededed, #303030);
|
|
18360
|
+
cursor: pointer;
|
|
18361
|
+
}
|
|
18362
|
+
.shortcut { position: absolute; top: 6px; left: 6px; width: 21px; height: 21px; text-align: center; line-height: 21px; color: var(--question-muted); pointer-events: none; font-size: 12px; }
|
|
18363
|
+
.option-copy { flex: 1; min-width: 0; white-space: pre-wrap; }
|
|
18364
|
+
.option-name { display: block; font-weight: 400; }
|
|
18365
|
+
.description { display: block; color: var(--question-muted); font-size: 12px; margin-top: 1px; }
|
|
18366
|
+
.selected-indicator { align-self: center; visibility: hidden; color: var(--question-muted); padding-right: 4px; }
|
|
18367
|
+
:checked ~ .selected-indicator { visibility: visible; }
|
|
18368
|
+
.other { align-items: center; flex: 1; min-width: 0; margin: 0; }
|
|
18369
|
+
.other input[type=checkbox], .other input[type=radio] { background: transparent; border-color: transparent; }
|
|
18370
|
+
.other:has(:checked), .other:focus-within { background: var(--question-selected); }
|
|
18371
|
+
.other:has(:checked) .pencil { color: var(--question-text); }
|
|
18372
|
+
.pencil { display: flex; align-items: center; justify-content: center; }
|
|
18373
|
+
.other-copy { display: flex; flex: 1; min-width: 0; }
|
|
18374
|
+
input:not([type=checkbox]):not([type=radio]), textarea {
|
|
18375
|
+
appearance: none;
|
|
18376
|
+
display: block;
|
|
18377
|
+
min-width: 0;
|
|
18378
|
+
width: 100%;
|
|
18379
|
+
padding: 6px;
|
|
18380
|
+
border: 1px solid var(--question-border);
|
|
18381
|
+
border-radius: 8px;
|
|
18382
|
+
background: transparent;
|
|
18383
|
+
color: var(--question-text);
|
|
18384
|
+
font: inherit;
|
|
18385
|
+
}
|
|
18386
|
+
.other-copy input:not([type=checkbox]):not([type=radio]) { border: 0; padding: 0; }
|
|
18387
|
+
textarea { min-height: 60px; resize: vertical; }
|
|
18388
|
+
input::placeholder, textarea::placeholder { color: var(--question-muted); opacity: .65; }
|
|
18389
|
+
input:focus-visible, textarea:focus-visible, button:focus-visible {
|
|
18390
|
+
outline: 2px solid var(--question-muted);
|
|
18391
|
+
outline-offset: 2px;
|
|
18392
|
+
}
|
|
18393
|
+
.other-copy input:focus-visible { outline: none; }
|
|
18394
|
+
.other:has(input:focus-visible) { outline: 2px solid var(--question-muted); outline-offset: -2px; }
|
|
18395
|
+
.error { flex-shrink: 0; color: light-dark(#b42318, #ffaaa3); font-size: 12px; }
|
|
18396
|
+
.error:not(:empty) { margin: 8px 6px 0; }
|
|
18397
|
+
.footer { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-top: 8px; }
|
|
18398
|
+
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; flex-shrink: 0; }
|
|
18399
|
+
button {
|
|
18400
|
+
appearance: none;
|
|
18401
|
+
min-height: 28px;
|
|
18402
|
+
padding: 3px 10px;
|
|
18403
|
+
border: 1px solid var(--question-border);
|
|
18404
|
+
border-radius: 999px;
|
|
18405
|
+
background: transparent;
|
|
18406
|
+
color: var(--question-text);
|
|
18407
|
+
font: inherit;
|
|
18408
|
+
font-weight: 400;
|
|
18409
|
+
cursor: pointer;
|
|
18410
|
+
}
|
|
18411
|
+
button:hover { background: var(--question-selected); }
|
|
18412
|
+
button.primary { background: var(--question-primary); color: var(--question-primary-text); border-color: transparent; }
|
|
18413
|
+
button.primary:hover { opacity: .85; }
|
|
18414
|
+
button.dismiss { display: flex; align-items: center; justify-content: center; border: 0; padding: 0; min-height: 24px; width: 24px; margin-left: auto; color: var(--question-muted); }
|
|
18415
|
+
:disabled { cursor: wait; opacity: .5; }
|
|
18416
|
+
@media (max-width: 420px) { .footer { flex-wrap: wrap; } .footer > .other { flex-basis: 100%; } }
|
|
18417
|
+
@media (forced-colors: active) {
|
|
18418
|
+
.card, input, textarea { background: Canvas; color: CanvasText; }
|
|
18419
|
+
button, .card, input[type=checkbox], input[type=radio] { border-color: ButtonBorder; }
|
|
18420
|
+
.option:has(:checked) { outline: 1px solid Highlight; outline-offset: -1px; }
|
|
18421
|
+
button.primary { background: Highlight; color: HighlightText; }
|
|
18422
|
+
}
|
|
18423
|
+
`;
|
|
18424
|
+
|
|
18425
|
+
// src/renderer-question-card.ts
|
|
18426
|
+
function createQuestionCard(document2, question, submit, initial = {}) {
|
|
18427
|
+
const icon2 = (node) => document2.adoptNode(
|
|
18428
|
+
createElement(node, {
|
|
18429
|
+
width: 16,
|
|
18430
|
+
height: 16,
|
|
18431
|
+
"aria-hidden": "true",
|
|
18432
|
+
focusable: "false"
|
|
18433
|
+
})
|
|
18434
|
+
);
|
|
18435
|
+
const selectedIndicator = () => {
|
|
18436
|
+
const selected = document2.createElement("span");
|
|
18437
|
+
selected.className = "selected-indicator";
|
|
18438
|
+
selected.setAttribute("aria-hidden", "true");
|
|
18439
|
+
selected.append(icon2(Check));
|
|
18440
|
+
return selected;
|
|
18441
|
+
};
|
|
18442
|
+
const root = document2.createElement("section");
|
|
18443
|
+
root.dataset.codexhostQuestion = question.interactionId;
|
|
18444
|
+
root.setAttribute("aria-label", question.title ?? "Question");
|
|
18445
|
+
root.addEventListener("keydown", (event) => {
|
|
18446
|
+
event.stopPropagation();
|
|
18447
|
+
if (event.key === "Enter" && event.composedPath()[0] instanceof HTMLInputElement)
|
|
18448
|
+
event.preventDefault();
|
|
18449
|
+
});
|
|
18450
|
+
const shadow = root.attachShadow({ mode: "open" });
|
|
18451
|
+
const style = document2.createElement("style");
|
|
18452
|
+
style.textContent = QUESTION_CARD_CSS;
|
|
18453
|
+
const surface = document2.createElement("div");
|
|
18454
|
+
surface.className = "card";
|
|
18455
|
+
shadow.append(style, surface);
|
|
18456
|
+
const title = document2.createElement("div");
|
|
18457
|
+
title.className = "title";
|
|
18458
|
+
const titleIcon = document2.createElement("span");
|
|
18459
|
+
titleIcon.className = "question-icon";
|
|
18460
|
+
titleIcon.append(icon2(MessageCircleQuestionMark));
|
|
18461
|
+
titleIcon.setAttribute("aria-hidden", "true");
|
|
18462
|
+
const titleText = document2.createElement("span");
|
|
18463
|
+
titleText.textContent = question.title?.trim() || "Question";
|
|
18464
|
+
const countdown = document2.createElement("span");
|
|
18465
|
+
countdown.className = "countdown";
|
|
18466
|
+
countdown.setAttribute("role", "timer");
|
|
18467
|
+
countdown.title = "The Harness owns this timeout and its result.";
|
|
18468
|
+
let autoResolution = question.autoResolution;
|
|
18469
|
+
const updateCountdown2 = () => {
|
|
18470
|
+
const timeout = autoResolution;
|
|
18471
|
+
countdown.hidden = !timeout;
|
|
18472
|
+
if (!timeout) return;
|
|
18473
|
+
const remaining = Math.max(0, Math.ceil((timeout.deadlineUnixMs - Date.now()) / 1e3));
|
|
18474
|
+
const clock = `${Math.floor(remaining / 60)}:${String(remaining % 60).padStart(2, "0")}`;
|
|
18475
|
+
const action = timeout.action === "recommended" ? "Auto-select recommended" : "Question timeout";
|
|
18476
|
+
const text = remaining ? `${action} in ${clock}` : "Waiting for Harness\u2026";
|
|
18477
|
+
if (countdown.textContent !== text) countdown.textContent = text;
|
|
18478
|
+
};
|
|
18479
|
+
updateCountdown2();
|
|
18480
|
+
let countdownTimer = autoResolution ? document2.defaultView?.setInterval(updateCountdown2, 250) : void 0;
|
|
18481
|
+
const dismiss = document2.createElement("button");
|
|
18482
|
+
dismiss.type = "button";
|
|
18483
|
+
dismiss.className = "dismiss";
|
|
18484
|
+
dismiss.append(icon2(X));
|
|
18485
|
+
dismiss.setAttribute("aria-label", "Dismiss question");
|
|
18486
|
+
title.append(titleIcon, titleText, countdown, dismiss);
|
|
18487
|
+
const body = document2.createElement("div");
|
|
18488
|
+
body.className = "body";
|
|
18489
|
+
surface.append(title, body);
|
|
18490
|
+
const footer = document2.createElement("div");
|
|
18491
|
+
footer.className = "footer";
|
|
18492
|
+
const readers = /* @__PURE__ */ new Map();
|
|
18493
|
+
const controls = [dismiss];
|
|
18494
|
+
const validOther = [];
|
|
18495
|
+
for (const [index, field2] of question.questions.entries()) {
|
|
18496
|
+
const group = document2.createElement("fieldset");
|
|
18497
|
+
const legend = document2.createElement("legend");
|
|
18498
|
+
legend.textContent = field2.prompt;
|
|
18499
|
+
group.append(legend);
|
|
18500
|
+
const saved = initial[field2.id] ?? [];
|
|
18501
|
+
if (field2.type === "text") {
|
|
18502
|
+
const input = document2.createElement(field2.multiline ? "textarea" : "input");
|
|
18503
|
+
input.value = saved[0] ?? field2.prefill ?? "";
|
|
18504
|
+
input.placeholder = field2.placeholder ?? "Your answer";
|
|
18505
|
+
input.setAttribute("aria-label", field2.prompt);
|
|
18506
|
+
controls.push(input);
|
|
18507
|
+
group.append(input);
|
|
18508
|
+
readers.set(field2.id, () => input.value.trim() ? [input.value] : []);
|
|
18509
|
+
} else {
|
|
18510
|
+
const hint = document2.createElement("div");
|
|
18511
|
+
hint.className = "hint";
|
|
18512
|
+
hint.textContent = "Select all that apply";
|
|
18513
|
+
if (field2.multiple) group.append(hint);
|
|
18514
|
+
const inputs = [];
|
|
18515
|
+
const name = `codexhost-${question.interactionId}-${index}`;
|
|
18516
|
+
for (const [optionIndex, option] of field2.options.entries()) {
|
|
18517
|
+
const label = document2.createElement("label");
|
|
18518
|
+
label.className = "option";
|
|
18519
|
+
const input = document2.createElement("input");
|
|
18520
|
+
input.type = field2.multiple ? "checkbox" : "radio";
|
|
18521
|
+
input.name = name;
|
|
18522
|
+
input.value = option.value;
|
|
18523
|
+
input.checked = saved.includes(option.value);
|
|
18524
|
+
const shortcut = document2.createElement("span");
|
|
18525
|
+
shortcut.className = "shortcut";
|
|
18526
|
+
shortcut.setAttribute("aria-hidden", "true");
|
|
18527
|
+
shortcut.textContent = String(optionIndex + 1);
|
|
18528
|
+
const selected = selectedIndicator();
|
|
18529
|
+
const text = document2.createElement("span");
|
|
18530
|
+
text.className = "option-copy";
|
|
18531
|
+
const optionName = document2.createElement("span");
|
|
18532
|
+
optionName.className = "option-name";
|
|
18533
|
+
optionName.textContent = option.label;
|
|
18534
|
+
text.append(optionName);
|
|
18535
|
+
if (option.description) {
|
|
18536
|
+
const description = document2.createElement("span");
|
|
18537
|
+
description.className = "description";
|
|
18538
|
+
description.textContent = option.description;
|
|
18539
|
+
text.append(description);
|
|
18660
18540
|
}
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
const result = await request("refresh-remote-connections", {}, signal);
|
|
18666
|
-
if (!record4(result) || !Array.isArray(result.remoteConnections))
|
|
18667
|
-
throw new Error("Invalid Codex SSH connection list");
|
|
18668
|
-
return result.remoteConnections.filter(
|
|
18669
|
-
(item) => !(record4(item) && ["wsl", "remote-control"].includes(String(item.source)))
|
|
18670
|
-
).map((item) => {
|
|
18671
|
-
if (!record4(item) || typeof item.hostId !== "string" || typeof item.displayName !== "string" || !["codex-managed", "discovered"].includes(String(item.source)) || typeof item.sshHost !== "string" || typeof item.autoConnect !== "boolean" || !(item.sshAlias == null || typeof item.sshAlias === "string") || !(item.identity == null || typeof item.identity === "string") || !(item.sshPort == null || Number.isInteger(item.sshPort) && Number(item.sshPort) > 0 && Number(item.sshPort) <= 65535)) {
|
|
18672
|
-
throw new Error(
|
|
18673
|
-
"This Codex version uses an unsupported SSH configuration; open native settings"
|
|
18674
|
-
);
|
|
18675
|
-
}
|
|
18676
|
-
return {
|
|
18677
|
-
...item,
|
|
18678
|
-
sshAlias: item.sshAlias ?? null,
|
|
18679
|
-
identity: item.identity ?? null,
|
|
18680
|
-
sshPort: item.sshPort ?? null
|
|
18681
|
-
};
|
|
18682
|
-
});
|
|
18683
|
-
}
|
|
18684
|
-
function saved(connection) {
|
|
18685
|
-
return {
|
|
18686
|
-
hostId: connection.hostId,
|
|
18687
|
-
displayName: connection.displayName,
|
|
18688
|
-
source: connection.source,
|
|
18689
|
-
alias: connection.sshAlias,
|
|
18690
|
-
hostname: connection.source === "discovered" ? null : connection.sshHost,
|
|
18691
|
-
sshPort: connection.source === "discovered" ? null : connection.sshPort,
|
|
18692
|
-
identity: connection.source === "discovered" ? null : connection.identity,
|
|
18693
|
-
...connection.connectionAnalyticsId ? { connectionAnalyticsId: connection.connectionAnalyticsId } : {}
|
|
18694
|
-
};
|
|
18695
|
-
}
|
|
18696
|
-
async function mutate(previous, draft, signal) {
|
|
18697
|
-
const current = await list(signal);
|
|
18698
|
-
if (previous) {
|
|
18699
|
-
const latest = current.find((item) => item.hostId === previous.hostId);
|
|
18700
|
-
if (!latest || JSON.stringify(saved(latest)) !== JSON.stringify(saved(previous))) {
|
|
18701
|
-
throw new Error("This connection changed in Codex. Refresh and edit it again.");
|
|
18702
|
-
}
|
|
18703
|
-
}
|
|
18704
|
-
const next = current.filter((item) => item.hostId !== previous?.hostId).map(saved);
|
|
18705
|
-
if (draft) {
|
|
18706
|
-
const hostname3 = draft.hostname.trim();
|
|
18707
|
-
const displayName = draft.displayName.trim();
|
|
18708
|
-
if (!displayName || !hostname3 || hostname3.startsWith("-") || /\s/u.test(hostname3) || draft.sshPort !== null && (!Number.isInteger(draft.sshPort) || draft.sshPort < 1 || draft.sshPort > 65535)) {
|
|
18709
|
-
throw new Error("Enter a name, SSH hostname (or alias), and a port between 1 and 65535");
|
|
18710
|
-
}
|
|
18711
|
-
if (current.some(
|
|
18712
|
-
(item) => item.hostId !== previous?.hostId && item.displayName.trim() === displayName
|
|
18713
|
-
)) {
|
|
18714
|
-
throw new Error("A connection with this name already exists");
|
|
18541
|
+
label.append(input, shortcut, text, selected);
|
|
18542
|
+
group.append(label);
|
|
18543
|
+
inputs.push(input);
|
|
18544
|
+
controls.push(input);
|
|
18715
18545
|
}
|
|
18716
|
-
|
|
18717
|
-
|
|
18546
|
+
let other;
|
|
18547
|
+
let notes;
|
|
18548
|
+
if (field2.allowOther) {
|
|
18549
|
+
const label = document2.createElement("label");
|
|
18550
|
+
label.className = "option other";
|
|
18551
|
+
other = document2.createElement("input");
|
|
18552
|
+
other.type = field2.multiple ? "checkbox" : "radio";
|
|
18553
|
+
other.name = name;
|
|
18554
|
+
other.setAttribute("aria-label", `Other: ${field2.prompt}`);
|
|
18555
|
+
const unknown2 = saved.find(
|
|
18556
|
+
(value) => !field2.options.some((option) => option.value === value)
|
|
18557
|
+
);
|
|
18558
|
+
other.checked = unknown2 !== void 0;
|
|
18559
|
+
notes = document2.createElement("input");
|
|
18560
|
+
notes.value = unknown2 ?? "";
|
|
18561
|
+
notes.placeholder = "Or write your own response";
|
|
18562
|
+
notes.setAttribute("aria-label", `${field2.prompt}: Other`);
|
|
18563
|
+
const checkbox = other;
|
|
18564
|
+
const otherText = notes;
|
|
18565
|
+
validOther.push(() => !checkbox.checked || otherText.value.trim().length > 0);
|
|
18566
|
+
notes.addEventListener("input", () => {
|
|
18567
|
+
checkbox.checked = true;
|
|
18568
|
+
});
|
|
18569
|
+
const copy = document2.createElement("span");
|
|
18570
|
+
copy.className = "other-copy";
|
|
18571
|
+
copy.append(notes);
|
|
18572
|
+
const pencil = document2.createElement("span");
|
|
18573
|
+
pencil.className = "shortcut pencil";
|
|
18574
|
+
pencil.append(icon2(Pencil));
|
|
18575
|
+
pencil.setAttribute("aria-hidden", "true");
|
|
18576
|
+
const selected = selectedIndicator();
|
|
18577
|
+
label.append(other, pencil, copy, selected);
|
|
18578
|
+
if (question.questions.length === 1) footer.append(label);
|
|
18579
|
+
else group.append(label);
|
|
18580
|
+
controls.push(other, notes);
|
|
18718
18581
|
}
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
source: "codex-managed",
|
|
18724
|
-
alias: null,
|
|
18725
|
-
hostname: hostname3,
|
|
18726
|
-
sshPort: draft.sshPort,
|
|
18727
|
-
identity: draft.identity?.trim() || null,
|
|
18728
|
-
...previous?.connectionAnalyticsId ? { connectionAnalyticsId: previous.connectionAnalyticsId } : {}
|
|
18729
|
-
}
|
|
18730
|
-
);
|
|
18582
|
+
readers.set(field2.id, () => [
|
|
18583
|
+
...inputs.filter((input) => input.checked).map((input) => input.value),
|
|
18584
|
+
...other?.checked && notes?.value.trim() ? [notes.value] : []
|
|
18585
|
+
]);
|
|
18731
18586
|
}
|
|
18732
|
-
|
|
18587
|
+
body.append(group);
|
|
18588
|
+
}
|
|
18589
|
+
const error51 = document2.createElement("div");
|
|
18590
|
+
error51.setAttribute("role", "alert");
|
|
18591
|
+
error51.className = "error";
|
|
18592
|
+
const actions = document2.createElement("div");
|
|
18593
|
+
actions.className = "actions";
|
|
18594
|
+
const readAnswers = () => Object.fromEntries([...readers].map(([id, read]) => [id, read()]));
|
|
18595
|
+
let busy = false;
|
|
18596
|
+
const send = async (cancelled) => {
|
|
18597
|
+
if (busy) return;
|
|
18598
|
+
const answers = cancelled ? {} : readAnswers();
|
|
18599
|
+
if (!cancelled && validOther.some((valid) => !valid())) {
|
|
18600
|
+
error51.textContent = "Type an answer for each selected Other option.";
|
|
18601
|
+
return;
|
|
18602
|
+
}
|
|
18603
|
+
if (!cancelled && question.questions.some((field2) => !field2.optional && !answers[field2.id]?.length)) {
|
|
18604
|
+
error51.textContent = "Answer each required question before submitting.";
|
|
18605
|
+
return;
|
|
18606
|
+
}
|
|
18607
|
+
busy = true;
|
|
18608
|
+
error51.textContent = "";
|
|
18609
|
+
for (const control of controls) control.disabled = true;
|
|
18610
|
+
try {
|
|
18611
|
+
await submit(answers, cancelled);
|
|
18612
|
+
} catch {
|
|
18613
|
+
error51.textContent = "Could not submit. The question may have closed. Try again if it is still available.";
|
|
18614
|
+
} finally {
|
|
18615
|
+
busy = false;
|
|
18616
|
+
for (const control of controls) control.disabled = false;
|
|
18617
|
+
}
|
|
18618
|
+
};
|
|
18619
|
+
for (const [label, cancelled] of [
|
|
18620
|
+
["Skip", true],
|
|
18621
|
+
["Send", false]
|
|
18622
|
+
]) {
|
|
18623
|
+
const button2 = document2.createElement("button");
|
|
18624
|
+
button2.type = "button";
|
|
18625
|
+
button2.textContent = label;
|
|
18626
|
+
if (!cancelled) button2.className = "primary";
|
|
18627
|
+
button2.addEventListener("click", () => {
|
|
18628
|
+
void send(cancelled);
|
|
18629
|
+
});
|
|
18630
|
+
controls.push(button2);
|
|
18631
|
+
actions.append(button2);
|
|
18733
18632
|
}
|
|
18633
|
+
dismiss.addEventListener("click", () => {
|
|
18634
|
+
void send(true);
|
|
18635
|
+
});
|
|
18636
|
+
footer.append(actions);
|
|
18637
|
+
surface.append(error51, footer);
|
|
18734
18638
|
return {
|
|
18735
|
-
|
|
18736
|
-
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
await request("set-remote-connection-auto-connect", { hostId: hostId2, autoConnect: enabled }, signal);
|
|
18639
|
+
root,
|
|
18640
|
+
readAnswers,
|
|
18641
|
+
get autoResolution() {
|
|
18642
|
+
return autoResolution;
|
|
18740
18643
|
},
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18644
|
+
updateAutoResolution(next) {
|
|
18645
|
+
if (autoResolution && (!next || next.deadlineUnixMs < autoResolution.deadlineUnixMs)) return;
|
|
18646
|
+
autoResolution = next;
|
|
18647
|
+
if (next && countdownTimer === void 0)
|
|
18648
|
+
countdownTimer = document2.defaultView?.setInterval(updateCountdown2, 250);
|
|
18649
|
+
updateCountdown2();
|
|
18650
|
+
},
|
|
18651
|
+
dispose() {
|
|
18652
|
+
if (countdownTimer !== void 0) document2.defaultView?.clearInterval(countdownTimer);
|
|
18653
|
+
root.remove();
|
|
18749
18654
|
}
|
|
18750
18655
|
};
|
|
18751
18656
|
}
|
|
18752
18657
|
|
|
18753
|
-
// src/
|
|
18754
|
-
function
|
|
18755
|
-
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
const
|
|
18761
|
-
const
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18658
|
+
// src/renderer-question-activity.ts
|
|
18659
|
+
function installQuestionActivity(window2, root, enabled, reset) {
|
|
18660
|
+
let disposed = false;
|
|
18661
|
+
let inFlight = false;
|
|
18662
|
+
let queued = false;
|
|
18663
|
+
let blurred = false;
|
|
18664
|
+
let timer;
|
|
18665
|
+
const available = () => !disposed && root.isConnected && enabled();
|
|
18666
|
+
const schedule = () => {
|
|
18667
|
+
if (timer !== void 0 || inFlight || !queued || !available()) return;
|
|
18668
|
+
timer = window2.setTimeout(() => {
|
|
18669
|
+
void flush();
|
|
18670
|
+
}, 250);
|
|
18671
|
+
};
|
|
18672
|
+
const flush = async () => {
|
|
18673
|
+
timer = void 0;
|
|
18674
|
+
if (!available()) {
|
|
18675
|
+
queued = false;
|
|
18676
|
+
return;
|
|
18677
|
+
}
|
|
18678
|
+
queued = false;
|
|
18679
|
+
inFlight = true;
|
|
18680
|
+
try {
|
|
18681
|
+
await reset();
|
|
18682
|
+
} catch {
|
|
18683
|
+
} finally {
|
|
18684
|
+
inFlight = false;
|
|
18685
|
+
schedule();
|
|
18686
|
+
}
|
|
18687
|
+
};
|
|
18688
|
+
const activity = (event) => {
|
|
18689
|
+
if (!event.isTrusted || !available()) return;
|
|
18690
|
+
queued = true;
|
|
18691
|
+
schedule();
|
|
18692
|
+
};
|
|
18693
|
+
const blur = (event) => {
|
|
18694
|
+
if (event.isTrusted) blurred = true;
|
|
18695
|
+
};
|
|
18696
|
+
const focus = (event) => {
|
|
18697
|
+
if (!blurred) return;
|
|
18698
|
+
blurred = false;
|
|
18699
|
+
activity(event);
|
|
18700
|
+
};
|
|
18701
|
+
const events = ["pointerdown", "keydown", "input", "wheel"];
|
|
18702
|
+
for (const event of events) root.addEventListener(event, activity, { passive: true });
|
|
18703
|
+
window2.addEventListener("blur", blur);
|
|
18704
|
+
window2.addEventListener("focus", focus);
|
|
18705
|
+
return () => {
|
|
18706
|
+
disposed = true;
|
|
18707
|
+
queued = false;
|
|
18708
|
+
if (timer !== void 0) window2.clearTimeout(timer);
|
|
18709
|
+
for (const event of events) root.removeEventListener(event, activity);
|
|
18710
|
+
window2.removeEventListener("blur", blur);
|
|
18711
|
+
window2.removeEventListener("focus", focus);
|
|
18712
|
+
};
|
|
18766
18713
|
}
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18714
|
+
|
|
18715
|
+
// src/renderer-request-sender.ts
|
|
18716
|
+
var RendererMethodUnavailableError = class extends Error {
|
|
18717
|
+
constructor(method, cause) {
|
|
18718
|
+
super(`${method} is unsupported on this Host connection`, { cause });
|
|
18719
|
+
this.method = method;
|
|
18720
|
+
this.name = "RendererMethodUnavailableError";
|
|
18721
|
+
}
|
|
18722
|
+
method;
|
|
18723
|
+
code = -32601;
|
|
18724
|
+
};
|
|
18725
|
+
function isUnsupportedMethod(error51, method) {
|
|
18726
|
+
if (typeof error51 !== "object" || error51 === null) return false;
|
|
18727
|
+
const code = "code" in error51 ? error51.code : void 0;
|
|
18728
|
+
const message2 = "message" in error51 ? error51.message : void 0;
|
|
18729
|
+
return code === -32601 || code === -32600 && typeof message2 === "string" && message2.startsWith(`Invalid request: unknown variant \`${method}\``);
|
|
18730
|
+
}
|
|
18731
|
+
function createRendererRequestSender(send) {
|
|
18732
|
+
const unsupported = /* @__PURE__ */ new Map();
|
|
18733
|
+
return async (method, params, options) => {
|
|
18734
|
+
const known = unsupported.get(method);
|
|
18735
|
+
if (known) throw known;
|
|
18770
18736
|
try {
|
|
18771
|
-
return await
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18737
|
+
return await (options === void 0 ? send(method, params) : send(method, params, options));
|
|
18738
|
+
} catch (error51) {
|
|
18739
|
+
if (!method.startsWith("codexhost/") || !isUnsupportedMethod(error51, method)) throw error51;
|
|
18740
|
+
const unavailable = new RendererMethodUnavailableError(method, error51);
|
|
18741
|
+
unsupported.set(method, unavailable);
|
|
18742
|
+
throw unavailable;
|
|
18743
|
+
}
|
|
18744
|
+
};
|
|
18745
|
+
}
|
|
18746
|
+
|
|
18747
|
+
// src/renderer-questions.ts
|
|
18748
|
+
function same(a, b) {
|
|
18749
|
+
return a?.hostId === b?.hostId && a?.threadId === b?.threadId && a?.composer === b?.composer && a?.route === b?.route;
|
|
18750
|
+
}
|
|
18751
|
+
function installRendererQuestions(window2, readContext) {
|
|
18752
|
+
let disposed = false;
|
|
18753
|
+
let inFlight = false;
|
|
18754
|
+
let revision = 0;
|
|
18755
|
+
let context = null;
|
|
18756
|
+
let card = null;
|
|
18757
|
+
let cardKey = null;
|
|
18758
|
+
let stopActivity;
|
|
18759
|
+
const unsupported = /* @__PURE__ */ new WeakSet();
|
|
18760
|
+
const drafts = /* @__PURE__ */ new Map();
|
|
18761
|
+
const clear = (retain = true) => {
|
|
18762
|
+
stopActivity?.();
|
|
18763
|
+
stopActivity = void 0;
|
|
18764
|
+
if (retain && card && cardKey) {
|
|
18765
|
+
drafts.set(cardKey, card.readAnswers());
|
|
18766
|
+
const oldest = drafts.keys().next().value;
|
|
18767
|
+
if (drafts.size > 50 && oldest !== void 0) drafts.delete(oldest);
|
|
18768
|
+
}
|
|
18769
|
+
card?.dispose();
|
|
18770
|
+
card = null;
|
|
18771
|
+
cardKey = null;
|
|
18772
|
+
};
|
|
18773
|
+
const refresh = async () => {
|
|
18774
|
+
if (disposed) return;
|
|
18775
|
+
const next = readContext();
|
|
18776
|
+
if (!same(context, next)) {
|
|
18777
|
+
clear();
|
|
18778
|
+
context = next;
|
|
18779
|
+
revision++;
|
|
18780
|
+
}
|
|
18781
|
+
const current = context;
|
|
18782
|
+
if (!current || inFlight || unsupported.has(current.route)) return;
|
|
18783
|
+
const startedRevision = revision;
|
|
18784
|
+
inFlight = true;
|
|
18785
|
+
try {
|
|
18786
|
+
const raw = await current.route.sendRequest(
|
|
18787
|
+
THREAD_QUESTIONS_LIST_METHOD,
|
|
18788
|
+
{ threadId: current.threadId },
|
|
18789
|
+
{ priority: "background", timeoutMs: 5e3 }
|
|
18790
|
+
);
|
|
18791
|
+
if (disposed || revision !== startedRevision || !same(current, readContext())) return;
|
|
18792
|
+
const question = threadQuestionsResultSchema.parse(raw).questions[0];
|
|
18793
|
+
if (!question || !question.questions.some(
|
|
18794
|
+
(field2) => field2.type === "choice" && (field2.multiple || field2.allowOther)
|
|
18795
|
+
)) {
|
|
18796
|
+
if (cardKey) drafts.delete(cardKey);
|
|
18797
|
+
clear(false);
|
|
18798
|
+
return;
|
|
18799
|
+
}
|
|
18800
|
+
const key = JSON.stringify([
|
|
18801
|
+
current.hostId,
|
|
18802
|
+
current.threadId,
|
|
18803
|
+
question.turnId,
|
|
18804
|
+
question.interactionId
|
|
18805
|
+
]);
|
|
18806
|
+
if (cardKey === key && card?.root.isConnected) {
|
|
18807
|
+
card.updateAutoResolution(question.autoResolution);
|
|
18808
|
+
return;
|
|
18809
|
+
}
|
|
18810
|
+
clear(cardKey === key);
|
|
18811
|
+
cardKey = key;
|
|
18812
|
+
card = createQuestionCard(
|
|
18813
|
+
current.composer.ownerDocument,
|
|
18814
|
+
question,
|
|
18815
|
+
async (answers, cancelled) => {
|
|
18816
|
+
if (disposed || !same(current, readContext()) || cardKey !== key)
|
|
18817
|
+
throw new Error("Question owner changed");
|
|
18818
|
+
const raw2 = await current.route.sendRequest(
|
|
18819
|
+
THREAD_QUESTION_RESPOND_METHOD,
|
|
18820
|
+
{
|
|
18821
|
+
threadId: current.threadId,
|
|
18822
|
+
turnId: question.turnId,
|
|
18823
|
+
interactionId: question.interactionId,
|
|
18824
|
+
answers,
|
|
18825
|
+
cancelled
|
|
18826
|
+
},
|
|
18827
|
+
{ priority: "interactive", timeoutMs: 1e4 }
|
|
18777
18828
|
);
|
|
18778
|
-
|
|
18779
|
-
|
|
18829
|
+
threadQuestionRespondResultSchema.parse(raw2);
|
|
18830
|
+
drafts.delete(key);
|
|
18831
|
+
if (same(current, context)) {
|
|
18832
|
+
revision++;
|
|
18833
|
+
if (cardKey === key) clear(false);
|
|
18834
|
+
}
|
|
18835
|
+
},
|
|
18836
|
+
drafts.get(key)
|
|
18837
|
+
);
|
|
18838
|
+
current.composer.before(card.root);
|
|
18839
|
+
const mounted = card;
|
|
18840
|
+
stopActivity = installQuestionActivity(
|
|
18841
|
+
window2,
|
|
18842
|
+
card.root,
|
|
18843
|
+
() => same(current, readContext()) && card === mounted && mounted.autoResolution?.resetOnActivity === true,
|
|
18844
|
+
async () => {
|
|
18845
|
+
const raw2 = await current.route.sendRequest(
|
|
18846
|
+
THREAD_QUESTION_ACTIVITY_METHOD,
|
|
18847
|
+
{
|
|
18848
|
+
threadId: current.threadId,
|
|
18849
|
+
turnId: question.turnId,
|
|
18850
|
+
interactionId: question.interactionId
|
|
18851
|
+
},
|
|
18852
|
+
{ priority: "background", timeoutMs: 4e3 }
|
|
18853
|
+
);
|
|
18854
|
+
if (disposed || card !== mounted || !same(current, readContext())) return;
|
|
18855
|
+
const ack = threadQuestionActivityResultSchema.parse(raw2).autoResolution;
|
|
18856
|
+
if (ack) mounted.updateAutoResolution(ack);
|
|
18857
|
+
}
|
|
18858
|
+
);
|
|
18859
|
+
} catch (error51) {
|
|
18860
|
+
if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
|
|
18861
|
+
if (revision === startedRevision && same(current, context)) clear();
|
|
18780
18862
|
} finally {
|
|
18781
|
-
|
|
18863
|
+
inFlight = false;
|
|
18782
18864
|
}
|
|
18783
|
-
}
|
|
18784
|
-
const
|
|
18785
|
-
|
|
18786
|
-
|
|
18787
|
-
|
|
18788
|
-
|
|
18789
|
-
|
|
18790
|
-
|
|
18791
|
-
|
|
18792
|
-
},
|
|
18793
|
-
async setup(connection, action, version2, uninstallPackage) {
|
|
18794
|
-
const client = getClient("local");
|
|
18795
|
-
if (!client?.setupSsh)
|
|
18796
|
-
throw new Error("SSH installation is unavailable; update local codexhost and restart");
|
|
18797
|
-
return client.setupSsh({
|
|
18798
|
-
hostname: connection.sshAlias ?? connection.sshHost,
|
|
18799
|
-
port: connection.sshPort,
|
|
18800
|
-
identity: connection.identity,
|
|
18801
|
-
action,
|
|
18802
|
-
version: version2 ?? null,
|
|
18803
|
-
...action === "uninstall" ? { uninstallPackage: uninstallPackage ?? false } : {}
|
|
18804
|
-
});
|
|
18805
|
-
},
|
|
18806
|
-
async runtime(hostId2) {
|
|
18807
|
-
const client = getClient(hostId2);
|
|
18808
|
-
if (!client?.runtimeStatus)
|
|
18809
|
-
throw new Error(
|
|
18810
|
-
"Version management is unavailable; update codexhost on this host and reconnect"
|
|
18811
|
-
);
|
|
18812
|
-
return bounded(client.runtimeStatus());
|
|
18865
|
+
};
|
|
18866
|
+
const timer = window2.setInterval(() => {
|
|
18867
|
+
void refresh();
|
|
18868
|
+
}, 750);
|
|
18869
|
+
void refresh();
|
|
18870
|
+
return {
|
|
18871
|
+
refresh,
|
|
18872
|
+
refreshContext() {
|
|
18873
|
+
if (!same(context, readContext()) || card && !card.root.isConnected) void refresh();
|
|
18813
18874
|
},
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
|
|
18819
|
-
return bounded(client.updateRemote(version2));
|
|
18875
|
+
dispose() {
|
|
18876
|
+
disposed = true;
|
|
18877
|
+
window2.clearInterval(timer);
|
|
18878
|
+
clear(false);
|
|
18879
|
+
drafts.clear();
|
|
18820
18880
|
}
|
|
18821
18881
|
};
|
|
18822
|
-
return control;
|
|
18823
18882
|
}
|
|
18824
18883
|
|
|
18825
18884
|
// src/renderer-composer-kind.ts
|
|
@@ -21331,12 +21390,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21331
21390
|
notAvailable: "Not available",
|
|
21332
21391
|
runtimeCapabilityNotInstalled: "This runtime capability is not installed yet.",
|
|
21333
21392
|
sessionImportHarness: "Harness",
|
|
21393
|
+
sessionImportSelectHost: "Select the Host to import sessions from",
|
|
21334
21394
|
sessionImportDescription: "Sessions keep their original project path. If a folder is not in the Codex sidebar, add it as a project first. Original history remains managed by the Harness.",
|
|
21335
|
-
sessionImportAvailabilityNote: "Available Harnesses come from the
|
|
21395
|
+
sessionImportAvailabilityNote: "Available Harnesses come from the selected Host. If activity is unknown, close the session in its native client before importing to avoid concurrent writes.",
|
|
21336
21396
|
sessionImportRefresh: "Refresh",
|
|
21337
|
-
sessionImportRefreshing: "Loading
|
|
21338
|
-
sessionImportUnavailable: "Session import is unavailable for this
|
|
21339
|
-
sessionImportEmpty: "No
|
|
21397
|
+
sessionImportRefreshing: "Loading sessions from the selected Host...",
|
|
21398
|
+
sessionImportUnavailable: "Session import is unavailable for this Harness or the selected Host protocol. Update the Host/plugin or choose another Harness.",
|
|
21399
|
+
sessionImportEmpty: "No sessions are available to import on the selected Host.",
|
|
21340
21400
|
sessionImportSearch: "Search",
|
|
21341
21401
|
sessionImportSearchPlaceholder: "Search titles, session IDs or project paths",
|
|
21342
21402
|
sessionImportNoMatches: "No sessions match your search.",
|
|
@@ -21344,7 +21404,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21344
21404
|
sessionImportPrevious: "Previous",
|
|
21345
21405
|
sessionImportNext: "Next",
|
|
21346
21406
|
sessionImportPageSummary: "Page {page} of {pages} \xB7 {total} sessions",
|
|
21347
|
-
sessionImportLoadFailed: "
|
|
21407
|
+
sessionImportLoadFailed: "Sessions could not be loaded from the selected Host. Check directory access or duplicate session IDs, then retry.",
|
|
21348
21408
|
sessionImportFailed: "The session could not be imported.",
|
|
21349
21409
|
sessionImportUntitled: "Untitled session",
|
|
21350
21410
|
sessionImportUpdatedAt: "Updated",
|
|
@@ -21640,12 +21700,13 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21640
21700
|
notAvailable: "\u6682\u4E0D\u53EF\u7528",
|
|
21641
21701
|
runtimeCapabilityNotInstalled: "\u8FD0\u884C\u65F6\u5C1A\u672A\u5B89\u88C5\u8BE5\u9879\u80FD\u529B\uFF0C\u56E0\u6B64\u6682\u4E0D\u53EF\u7528\u3002",
|
|
21642
21702
|
sessionImportHarness: "Harness",
|
|
21703
|
+
sessionImportSelectHost: "\u8BF7\u9009\u62E9\u8981\u5BFC\u5165\u4F1A\u8BDD\u7684 Host",
|
|
21643
21704
|
sessionImportDescription: "\u4F1A\u8BDD\u5C06\u4FDD\u7559\u539F\u59CB\u9879\u76EE\u8DEF\u5F84\uFF1B\u82E5\u8BE5\u6587\u4EF6\u5939\u5C1A\u672A\u51FA\u73B0\u5728 Codex \u4FA7\u680F\uFF0C\u8BF7\u5148\u5C06\u5176\u6DFB\u52A0\u4E3A\u9879\u76EE\u3002\u539F\u59CB\u5386\u53F2\u4ECD\u7531 Harness \u7BA1\u7406\u3002",
|
|
21644
|
-
sessionImportAvailabilityNote: "\u53EF\u9009 Harness \u6765\u81EA\
|
|
21705
|
+
sessionImportAvailabilityNote: "\u53EF\u9009 Harness \u6765\u81EA\u5F53\u524D Host\u3002\u8FD0\u884C\u72B6\u6001\u672A\u77E5\u65F6\uFF0C\u8BF7\u5148\u5728\u539F\u751F\u5BA2\u6237\u7AEF\u5173\u95ED\u8BE5\u4F1A\u8BDD\u518D\u5BFC\u5165\uFF0C\u907F\u514D\u540C\u65F6\u5199\u5165\u3002",
|
|
21645
21706
|
sessionImportRefresh: "\u5237\u65B0",
|
|
21646
|
-
sessionImportRefreshing: "\u6B63\u5728\u8BFB\u53D6\
|
|
21647
|
-
sessionImportUnavailable: "\
|
|
21648
|
-
sessionImportEmpty: "\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\
|
|
21707
|
+
sessionImportRefreshing: "\u6B63\u5728\u8BFB\u53D6\u5F53\u524D Host \u4E0A\u7684\u4F1A\u8BDD\u2026\u2026",
|
|
21708
|
+
sessionImportUnavailable: "\u8BE5 Harness \u6216\u5F53\u524D Host \u534F\u8BAE\u6682\u4E0D\u652F\u6301\u4F1A\u8BDD\u5BFC\u5165\uFF0C\u8BF7\u66F4\u65B0 Host/\u63D2\u4EF6\u6216\u9009\u62E9\u5176\u4ED6 Harness\u3002",
|
|
21709
|
+
sessionImportEmpty: "\u5F53\u524D Host \u4E0A\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u4F1A\u8BDD\u3002",
|
|
21649
21710
|
sessionImportSearch: "\u641C\u7D22",
|
|
21650
21711
|
sessionImportSearchPlaceholder: "\u641C\u7D22\u6807\u9898\u3001\u4F1A\u8BDD ID \u6216\u9879\u76EE\u8DEF\u5F84",
|
|
21651
21712
|
sessionImportNoMatches: "\u6CA1\u6709\u5339\u914D\u7684\u4F1A\u8BDD\u3002",
|
|
@@ -21653,7 +21714,7 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
21653
21714
|
sessionImportPrevious: "\u4E0A\u4E00\u9875",
|
|
21654
21715
|
sessionImportNext: "\u4E0B\u4E00\u9875",
|
|
21655
21716
|
sessionImportPageSummary: "\u7B2C {page} / {pages} \u9875 \xB7 \u5171 {total} \u6761",
|
|
21656
|
-
sessionImportLoadFailed: "\u65E0\u6CD5\u8BFB\u53D6\
|
|
21717
|
+
sessionImportLoadFailed: "\u65E0\u6CD5\u8BFB\u53D6\u5F53\u524D Host \u4E0A\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u76EE\u5F55\u8BBF\u95EE\u6743\u9650\u6216\u91CD\u590D\u7684\u4F1A\u8BDD ID \u540E\u91CD\u8BD5\u3002",
|
|
21657
21718
|
sessionImportFailed: "\u65E0\u6CD5\u5BFC\u5165\u8BE5\u4F1A\u8BDD\u3002",
|
|
21658
21719
|
sessionImportUntitled: "\u672A\u547D\u540D\u4F1A\u8BDD",
|
|
21659
21720
|
sessionImportUpdatedAt: "\u66F4\u65B0\u65F6\u95F4",
|
|
@@ -22502,6 +22563,8 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22502
22563
|
var STYLE_ATTRIBUTE = "data-codexhost-trigger-chip-style";
|
|
22503
22564
|
var TRIGGER_CHIP_CLASS = "codexhost-trigger-chip";
|
|
22504
22565
|
var TRIGGER_CHIP_ROOT_CLASS = "codexhost-trigger-chip-root";
|
|
22566
|
+
var COMPACT_COMPOSER_ATTRIBUTE = "data-codexhost-compact-composer";
|
|
22567
|
+
var COMPACT_COMPOSER_WIDTH = 420;
|
|
22505
22568
|
var TRIGGER_CHIP_SQUEEZE_MIN_WIDTH = "48px";
|
|
22506
22569
|
function rendererModelTriggerMaxWidth() {
|
|
22507
22570
|
return "min(200px, 26vw)";
|
|
@@ -22531,6 +22594,23 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22531
22594
|
trigger.style.maxWidth = "100%";
|
|
22532
22595
|
trigger.style.overflow = "hidden";
|
|
22533
22596
|
}
|
|
22597
|
+
function observeRendererCompactComposer(composer) {
|
|
22598
|
+
const update = () => {
|
|
22599
|
+
const width = composer.getBoundingClientRect().width;
|
|
22600
|
+
if (width > 0) {
|
|
22601
|
+
composer.toggleAttribute(COMPACT_COMPOSER_ATTRIBUTE, width <= COMPACT_COMPOSER_WIDTH);
|
|
22602
|
+
}
|
|
22603
|
+
};
|
|
22604
|
+
update();
|
|
22605
|
+
if (typeof ResizeObserver === "undefined")
|
|
22606
|
+
return () => composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
|
|
22607
|
+
const observer = new ResizeObserver(update);
|
|
22608
|
+
observer.observe(composer, { box: "border-box" });
|
|
22609
|
+
return () => {
|
|
22610
|
+
observer.disconnect();
|
|
22611
|
+
composer.removeAttribute(COMPACT_COMPOSER_ATTRIBUTE);
|
|
22612
|
+
};
|
|
22613
|
+
}
|
|
22534
22614
|
function ensureRendererTriggerChipStyle(ownerDocument) {
|
|
22535
22615
|
if (ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE}]`)) return;
|
|
22536
22616
|
const style = ownerDocument.createElement("style");
|
|
@@ -22569,10 +22649,55 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22569
22649
|
cursor: not-allowed;
|
|
22570
22650
|
opacity: 0.4;
|
|
22571
22651
|
}
|
|
22652
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-model-control] [data-codexhost-model-thinking] {
|
|
22653
|
+
display: none !important;
|
|
22654
|
+
}
|
|
22655
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control] {
|
|
22656
|
+
min-width: 30px !important;
|
|
22657
|
+
max-width: 30px !important;
|
|
22658
|
+
}
|
|
22659
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control] .${TRIGGER_CHIP_CLASS} {
|
|
22660
|
+
padding-inline: 6px !important;
|
|
22661
|
+
}
|
|
22662
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-label],
|
|
22663
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-chevron],
|
|
22664
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-credits-label],
|
|
22665
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-usage-label] {
|
|
22666
|
+
display: none !important;
|
|
22667
|
+
}
|
|
22668
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control]:has([data-codexhost-permission-lock]:not([hidden])) [data-codexhost-permission-shield],
|
|
22669
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-permission-mode-control]:has([data-codexhost-permission-error]:not([hidden])) [data-codexhost-permission-shield] {
|
|
22670
|
+
display: none !important;
|
|
22671
|
+
}
|
|
22672
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-credits-control],
|
|
22673
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-usage-control] {
|
|
22674
|
+
min-width: 28px !important;
|
|
22675
|
+
max-width: 28px !important;
|
|
22676
|
+
}
|
|
22677
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-credits-control] .${TRIGGER_CHIP_CLASS},
|
|
22678
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-usage-control] .${TRIGGER_CHIP_CLASS} {
|
|
22679
|
+
padding-inline: 6px !important;
|
|
22680
|
+
}
|
|
22681
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-usage-icon] {
|
|
22682
|
+
display: inline-flex !important;
|
|
22683
|
+
}
|
|
22684
|
+
[${COMPACT_COMPOSER_ATTRIBUTE}] [data-codexhost-agent-control] {
|
|
22685
|
+
margin-inline: 0 !important;
|
|
22686
|
+
}
|
|
22572
22687
|
`;
|
|
22573
22688
|
(ownerDocument.head ?? ownerDocument.documentElement).append(style);
|
|
22574
22689
|
}
|
|
22575
22690
|
|
|
22691
|
+
// ../../node_modules/lucide/dist/esm/icons/activity.mjs
|
|
22692
|
+
var Activity = [
|
|
22693
|
+
[
|
|
22694
|
+
"path",
|
|
22695
|
+
{
|
|
22696
|
+
d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"
|
|
22697
|
+
}
|
|
22698
|
+
]
|
|
22699
|
+
];
|
|
22700
|
+
|
|
22576
22701
|
// src/renderer-usage-control.ts
|
|
22577
22702
|
var ENGLISH_USAGE_MESSAGES = Object.freeze({
|
|
22578
22703
|
usage: "Usage",
|
|
@@ -22926,13 +23051,19 @@ ${messages.harnessVersionLatest}: ${harnessVersionLabel(version2.state, messages
|
|
|
22926
23051
|
trigger.style.lineHeight = "16px";
|
|
22927
23052
|
trigger.style.fontVariantNumeric = "tabular-nums";
|
|
22928
23053
|
trigger.style.letterSpacing = "0";
|
|
23054
|
+
const icon2 = document.createElement("span");
|
|
23055
|
+
icon2.dataset.codexhostUsageIcon = "";
|
|
23056
|
+
icon2.style.display = "none";
|
|
23057
|
+
icon2.style.alignItems = "center";
|
|
23058
|
+
icon2.append(createElement(Activity, { width: 16, height: 16, "aria-hidden": "true" }));
|
|
22929
23059
|
const label = document.createElement("span");
|
|
23060
|
+
label.dataset.codexhostUsageLabel = "";
|
|
22930
23061
|
label.style.display = "inline-block";
|
|
22931
23062
|
label.style.maxWidth = "100%";
|
|
22932
23063
|
label.style.overflow = "hidden";
|
|
22933
23064
|
label.style.textOverflow = "ellipsis";
|
|
22934
23065
|
label.style.whiteSpace = "nowrap";
|
|
22935
|
-
trigger.append(label);
|
|
23066
|
+
trigger.append(icon2, label);
|
|
22936
23067
|
const popover = document.createElement("div");
|
|
22937
23068
|
popover.id = `${composerId}-usage-popover`;
|
|
22938
23069
|
popover.setAttribute("role", "dialog");
|
|
@@ -23798,6 +23929,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
23798
23929
|
label.style.textOverflow = "ellipsis";
|
|
23799
23930
|
label.style.whiteSpace = "nowrap";
|
|
23800
23931
|
const thinkingLabel = document.createElement("span");
|
|
23932
|
+
thinkingLabel.dataset.codexhostModelThinking = "";
|
|
23801
23933
|
thinkingLabel.style.color = "var(--color-text-tertiary, #8f8f8f)";
|
|
23802
23934
|
thinkingLabel.style.flex = "0 1 auto";
|
|
23803
23935
|
thinkingLabel.style.maxWidth = "72px";
|
|
@@ -24357,9 +24489,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24357
24489
|
trigger.className = TRIGGER_CHIP_CLASS;
|
|
24358
24490
|
applyRendererTriggerChipSqueezeTrigger(trigger);
|
|
24359
24491
|
const shield = document.createElement("span");
|
|
24492
|
+
shield.dataset.codexhostPermissionShield = "";
|
|
24360
24493
|
shield.className = "inline-flex shrink-0 items-center";
|
|
24361
24494
|
shield.append(icon(Shield, 15));
|
|
24362
24495
|
const label = document.createElement("span");
|
|
24496
|
+
label.dataset.codexhostPermissionLabel = "";
|
|
24363
24497
|
label.className = "truncate";
|
|
24364
24498
|
label.style.flex = "1 1 auto";
|
|
24365
24499
|
label.style.minWidth = "0";
|
|
@@ -24367,15 +24501,18 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
24367
24501
|
label.style.textOverflow = "ellipsis";
|
|
24368
24502
|
label.style.whiteSpace = "nowrap";
|
|
24369
24503
|
const chevron = document.createElement("span");
|
|
24504
|
+
chevron.dataset.codexhostPermissionChevron = "";
|
|
24370
24505
|
chevron.className = "inline-flex shrink-0 items-center";
|
|
24371
24506
|
chevron.style.color = "var(--color-text-tertiary, #8f8f8f)";
|
|
24372
24507
|
chevron.append(icon(ChevronDown, 14));
|
|
24373
24508
|
const lockMark = document.createElement("span");
|
|
24509
|
+
lockMark.dataset.codexhostPermissionLock = "";
|
|
24374
24510
|
lockMark.className = "inline-flex shrink-0 items-center";
|
|
24375
24511
|
lockMark.style.color = "var(--color-text-tertiary, #8f8f8f)";
|
|
24376
24512
|
lockMark.hidden = true;
|
|
24377
24513
|
lockMark.append(icon(Lock, 14));
|
|
24378
24514
|
const errorMark = document.createElement("span");
|
|
24515
|
+
errorMark.dataset.codexhostPermissionError = "";
|
|
24379
24516
|
errorMark.className = "inline-flex shrink-0 items-center";
|
|
24380
24517
|
errorMark.style.color = "var(--color-text-danger, #c2413b)";
|
|
24381
24518
|
errorMark.hidden = true;
|
|
@@ -25279,14 +25416,14 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25279
25416
|
const buttons = [...element.querySelectorAll("button")];
|
|
25280
25417
|
return buttons.length > 0 && buttons.every((button2) => isComposerTrailingActionButton(button2));
|
|
25281
25418
|
}
|
|
25282
|
-
function sendButtonWithin(root) {
|
|
25283
|
-
return composerButtonsWithin(root).find((button2) => isComposerSubmitButton(button2)) ?? null;
|
|
25284
|
-
}
|
|
25285
25419
|
function composerButtonsWithin(root) {
|
|
25286
25420
|
return [...root.querySelectorAll("button")].filter(
|
|
25287
25421
|
(button2) => !isNativeComposerRequest(button2)
|
|
25288
25422
|
);
|
|
25289
25423
|
}
|
|
25424
|
+
function sendButtonWithin(root) {
|
|
25425
|
+
return composerButtonsWithin(root).find(isComposerSubmitButton) ?? null;
|
|
25426
|
+
}
|
|
25290
25427
|
function leftmostTrailingSibling(container, before) {
|
|
25291
25428
|
for (const child of container.children) {
|
|
25292
25429
|
if (child === before) break;
|
|
@@ -25329,7 +25466,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25329
25466
|
function composerForElement(element) {
|
|
25330
25467
|
if (isNativeComposerRequest(element)) return null;
|
|
25331
25468
|
const composer = element.closest(CODEX_COMPOSER_SELECTOR);
|
|
25332
|
-
return composer && !isOrbitComposer(composer) ? composer : null;
|
|
25469
|
+
return composer && !hasNativeComposerRequest(composer) && !isOrbitComposer(composer) ? composer : null;
|
|
25333
25470
|
}
|
|
25334
25471
|
function isRecord3(value) {
|
|
25335
25472
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -25484,6 +25621,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25484
25621
|
return false;
|
|
25485
25622
|
}
|
|
25486
25623
|
function refreshSendButton(control) {
|
|
25624
|
+
if (hasNativeComposerRequest(control.composer)) return null;
|
|
25487
25625
|
const current = control.sendButton;
|
|
25488
25626
|
if (current?.isConnected && control.composer.contains(current) && !isNativeComposerRequest(current))
|
|
25489
25627
|
return current;
|
|
@@ -25665,6 +25803,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25665
25803
|
refreshTrailingClusterPlacement(control);
|
|
25666
25804
|
refreshUsagePlacement(control);
|
|
25667
25805
|
refreshCreditsPlacement(control);
|
|
25806
|
+
control.stopCompactLayout = observeRendererCompactComposer(composer);
|
|
25668
25807
|
return control;
|
|
25669
25808
|
}
|
|
25670
25809
|
function nativeSendDisabled(button2, fallback) {
|
|
@@ -25736,6 +25875,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
25736
25875
|
return !submissionBlocked && (state.agent === "codex" || adapterState === "ready");
|
|
25737
25876
|
}
|
|
25738
25877
|
function disposeComposerAgentControl(control) {
|
|
25878
|
+
control.stopCompactLayout?.();
|
|
25739
25879
|
if (control.sendDisabledBeforeSwitch !== null) {
|
|
25740
25880
|
control.sendButton.disabled = nativeSendDisabled(
|
|
25741
25881
|
control.sendButton,
|
|
@@ -26098,8 +26238,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26098
26238
|
}
|
|
26099
26239
|
return found;
|
|
26100
26240
|
}
|
|
26101
|
-
function
|
|
26102
|
-
const gates = gateSubscriptions(scope, projections);
|
|
26241
|
+
function classifiedGates(gates) {
|
|
26103
26242
|
if (gates.invalid) return null;
|
|
26104
26243
|
const found = [];
|
|
26105
26244
|
for (const kind of ["account", "reserve"]) {
|
|
@@ -26112,6 +26251,9 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26112
26251
|
}
|
|
26113
26252
|
return found;
|
|
26114
26253
|
}
|
|
26254
|
+
function discoverGates(scope, projections) {
|
|
26255
|
+
return classifiedGates(gateSubscriptions(scope, projections));
|
|
26256
|
+
}
|
|
26115
26257
|
function project2(kind, { fiber, subscriber, store, atom, instance, subscribeEffect }) {
|
|
26116
26258
|
for (const [target, key] of [
|
|
26117
26259
|
[store, "sub"],
|
|
@@ -26765,12 +26907,57 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26765
26907
|
function isRecord8(value) {
|
|
26766
26908
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
26767
26909
|
}
|
|
26768
|
-
function
|
|
26769
|
-
if (
|
|
26770
|
-
return
|
|
26910
|
+
function notificationTarget2(manager) {
|
|
26911
|
+
if (typeof manager.addNotificationCallback === "function") {
|
|
26912
|
+
return manager;
|
|
26913
|
+
}
|
|
26914
|
+
const nested = manager.requestClient;
|
|
26915
|
+
return isRecord8(nested) && typeof nested.addNotificationCallback === "function" ? nested : null;
|
|
26916
|
+
}
|
|
26917
|
+
function notificationParams(notification) {
|
|
26918
|
+
if (!isRecord8(notification)) return null;
|
|
26919
|
+
return isRecord8(notification.params) ? notification.params : notification;
|
|
26920
|
+
}
|
|
26921
|
+
function notificationThreadId(notification) {
|
|
26922
|
+
const params = notificationParams(notification);
|
|
26923
|
+
if (!params) return null;
|
|
26924
|
+
if (typeof params.threadId === "string" && params.threadId) return params.threadId;
|
|
26925
|
+
if (typeof params.conversationId === "string" && params.conversationId)
|
|
26926
|
+
return params.conversationId;
|
|
26927
|
+
return null;
|
|
26928
|
+
}
|
|
26929
|
+
function turnStatus(notification) {
|
|
26930
|
+
const params = notificationParams(notification);
|
|
26931
|
+
if (!params) return null;
|
|
26932
|
+
if (typeof params.status === "string") return params.status;
|
|
26933
|
+
const turn = params.turn;
|
|
26934
|
+
return isRecord8(turn) && typeof turn.status === "string" ? turn.status : null;
|
|
26935
|
+
}
|
|
26936
|
+
function isExternalConversation(conversation, threadId) {
|
|
26937
|
+
return isRecord8(conversation) && conversation.id === threadId && conversation.modelProvider === "codexhost";
|
|
26938
|
+
}
|
|
26939
|
+
function firstQueuedItemId(items) {
|
|
26940
|
+
if (!Array.isArray(items)) return null;
|
|
26941
|
+
for (const item of items) {
|
|
26942
|
+
if (!isRecord8(item) || item.pausedReason != null) continue;
|
|
26943
|
+
if (typeof item.id === "string" && item.id) return item.id;
|
|
26944
|
+
}
|
|
26945
|
+
return null;
|
|
26946
|
+
}
|
|
26947
|
+
function removeQueuedItem(coordinator, threadId, queuedSubmissionId) {
|
|
26948
|
+
if (!isRecord8(coordinator) || typeof coordinator.mutate !== "function") return;
|
|
26949
|
+
try {
|
|
26950
|
+
coordinator.mutate.call(coordinator, threadId, (current) => {
|
|
26951
|
+
if (!Array.isArray(current)) return current;
|
|
26952
|
+
return current.filter((item) => !isRecord8(item) || item.id !== queuedSubmissionId);
|
|
26953
|
+
});
|
|
26954
|
+
} catch (error51) {
|
|
26955
|
+
console.error("codexhost could not reconcile the submitted local follow-up", error51);
|
|
26771
26956
|
}
|
|
26772
|
-
|
|
26773
|
-
|
|
26957
|
+
}
|
|
26958
|
+
function installLocalQueueGate(target) {
|
|
26959
|
+
const getTurnCoordinator = target.getTurnCoordinator;
|
|
26960
|
+
const coordinator = getTurnCoordinator.call(target);
|
|
26774
26961
|
const queue = isRecord8(coordinator) ? coordinator.serverQueue : null;
|
|
26775
26962
|
if (!isRecord8(queue) || typeof queue.isEnabled !== "function") return null;
|
|
26776
26963
|
const descriptor = Object.getOwnPropertyDescriptor(queue, "isEnabled");
|
|
@@ -26779,13 +26966,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26779
26966
|
const getConversation = target.getConversation;
|
|
26780
26967
|
const isEnabled = (...args) => {
|
|
26781
26968
|
const threadId = args[0];
|
|
26782
|
-
if (typeof threadId === "string") {
|
|
26783
|
-
|
|
26784
|
-
if (isRecord8(conversation) && conversation.id === threadId && // Reserved transport marker from externalThreadValue, retained by
|
|
26785
|
-
// Desktop in both newly created and hydrated conversation metadata.
|
|
26786
|
-
conversation.modelProvider === "codexhost") {
|
|
26787
|
-
return false;
|
|
26788
|
-
}
|
|
26969
|
+
if (typeof threadId === "string" && isExternalConversation(getConversation.call(target, threadId), threadId)) {
|
|
26970
|
+
return false;
|
|
26789
26971
|
}
|
|
26790
26972
|
return original.apply(queue, args);
|
|
26791
26973
|
};
|
|
@@ -26794,6 +26976,92 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
26794
26976
|
if (queue.isEnabled === isEnabled) Object.defineProperty(queue, "isEnabled", descriptor);
|
|
26795
26977
|
};
|
|
26796
26978
|
}
|
|
26979
|
+
function installServerQueueDrain(target) {
|
|
26980
|
+
if (typeof target.sendRequest !== "function") return null;
|
|
26981
|
+
const notifications = notificationTarget2(target);
|
|
26982
|
+
if (!notifications) return null;
|
|
26983
|
+
const getConversation = target.getConversation;
|
|
26984
|
+
const getTurnCoordinator = target.getTurnCoordinator;
|
|
26985
|
+
const getStreamRole = target.getStreamRole;
|
|
26986
|
+
const sendRequest = target.sendRequest;
|
|
26987
|
+
const draining = /* @__PURE__ */ new Set();
|
|
26988
|
+
let disposed = false;
|
|
26989
|
+
const isExternalOwner = (threadId) => {
|
|
26990
|
+
if (!isExternalConversation(getConversation.call(target, threadId), threadId)) return false;
|
|
26991
|
+
const role = getStreamRole.call(target, threadId);
|
|
26992
|
+
return !(isRecord8(role) && role.role === "follower");
|
|
26993
|
+
};
|
|
26994
|
+
const isIdle = (threadId, coordinator) => {
|
|
26995
|
+
const options = isRecord8(coordinator) ? coordinator.options : null;
|
|
26996
|
+
const host = isRecord8(options) ? options.submissionHost : null;
|
|
26997
|
+
if (isRecord8(host) && typeof host.getActiveTurnId === "function" && typeof host.hasPendingTurnStart === "function") {
|
|
26998
|
+
return host.getActiveTurnId.call(host, threadId) == null && host.hasPendingTurnStart.call(host, threadId) !== true;
|
|
26999
|
+
}
|
|
27000
|
+
const conversation = getConversation.call(target, threadId);
|
|
27001
|
+
return isRecord8(conversation) && isRecord8(conversation.threadRuntimeStatus) && conversation.threadRuntimeStatus.type === "idle";
|
|
27002
|
+
};
|
|
27003
|
+
const queuedSubmissionId = (coordinator, threadId) => {
|
|
27004
|
+
if (isRecord8(coordinator) && typeof coordinator.readMessages === "function") {
|
|
27005
|
+
const messages = coordinator.readMessages.call(coordinator, threadId);
|
|
27006
|
+
if (Array.isArray(messages)) return firstQueuedItemId(messages);
|
|
27007
|
+
}
|
|
27008
|
+
const queue = isRecord8(coordinator) ? coordinator.serverQueue : null;
|
|
27009
|
+
if (isRecord8(queue) && typeof queue.read === "function") {
|
|
27010
|
+
return firstQueuedItemId(queue.read.call(queue, threadId));
|
|
27011
|
+
}
|
|
27012
|
+
return null;
|
|
27013
|
+
};
|
|
27014
|
+
const drain = (threadId) => {
|
|
27015
|
+
if (disposed || draining.has(threadId) || !isExternalOwner(threadId)) return;
|
|
27016
|
+
const coordinator = getTurnCoordinator.call(target);
|
|
27017
|
+
if (!isIdle(threadId, coordinator)) return;
|
|
27018
|
+
const queuedSubmissionIdValue = queuedSubmissionId(coordinator, threadId);
|
|
27019
|
+
if (!queuedSubmissionIdValue) return;
|
|
27020
|
+
draining.add(threadId);
|
|
27021
|
+
Promise.resolve(
|
|
27022
|
+
sendRequest.call(target, "thread/queue/start", {
|
|
27023
|
+
threadId,
|
|
27024
|
+
queuedSubmissionId: queuedSubmissionIdValue
|
|
27025
|
+
})
|
|
27026
|
+
).then(() => {
|
|
27027
|
+
removeQueuedItem(coordinator, threadId, queuedSubmissionIdValue);
|
|
27028
|
+
}).catch((error51) => {
|
|
27029
|
+
const message2 = error51 instanceof Error ? error51.message : String(error51);
|
|
27030
|
+
if (message2.includes("Queued follow-up was not found")) return;
|
|
27031
|
+
console.error("codexhost could not start the queued follow-up", error51);
|
|
27032
|
+
}).finally(() => {
|
|
27033
|
+
draining.delete(threadId);
|
|
27034
|
+
});
|
|
27035
|
+
};
|
|
27036
|
+
const onNotification = (notification) => {
|
|
27037
|
+
if (disposed) return;
|
|
27038
|
+
const method = isRecord8(notification) && typeof notification.method === "string" ? notification.method : null;
|
|
27039
|
+
const threadId = notificationThreadId(notification);
|
|
27040
|
+
if (!threadId) return;
|
|
27041
|
+
if (method === "turn/completed") {
|
|
27042
|
+
if (turnStatus(notification) === "interrupted") return;
|
|
27043
|
+
drain(threadId);
|
|
27044
|
+
return;
|
|
27045
|
+
}
|
|
27046
|
+
if (method === "thread/queue/changed") drain(threadId);
|
|
27047
|
+
};
|
|
27048
|
+
const unsubscribe = notifications.addNotificationCallback(
|
|
27049
|
+
["turn/completed", "thread/queue/changed"],
|
|
27050
|
+
onNotification
|
|
27051
|
+
);
|
|
27052
|
+
return () => {
|
|
27053
|
+
disposed = true;
|
|
27054
|
+
draining.clear();
|
|
27055
|
+
if (typeof unsubscribe === "function") unsubscribe();
|
|
27056
|
+
};
|
|
27057
|
+
}
|
|
27058
|
+
function installRendererExternalQueue(target) {
|
|
27059
|
+
if (!isRecord8(target) || typeof target.getTurnCoordinator !== "function" || typeof target.getConversation !== "function") {
|
|
27060
|
+
return null;
|
|
27061
|
+
}
|
|
27062
|
+
if (typeof target.getStreamRole === "function") return installServerQueueDrain(target);
|
|
27063
|
+
return installLocalQueueGate(target);
|
|
27064
|
+
}
|
|
26797
27065
|
|
|
26798
27066
|
// src/renderer-external-steering.ts
|
|
26799
27067
|
var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
|
|
@@ -28746,14 +29014,17 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28746
29014
|
}
|
|
28747
29015
|
|
|
28748
29016
|
// src/codex-locale-adapter.ts
|
|
28749
|
-
var GET_LOCALE_OVERRIDE_URL = "vscode://codex/get-setting";
|
|
28750
|
-
var GET_LOCALE_INFO_URL = "vscode://codex/locale-info";
|
|
28751
29017
|
var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
|
|
28752
29018
|
function isNativeLocaleServices(value) {
|
|
28753
29019
|
if (!isRecord15(value) || !Object.hasOwn(value, "appInfo")) return false;
|
|
28754
29020
|
const appInfo = value.appInfo;
|
|
28755
29021
|
return appInfo != null && typeof appInfo.getLocaleInfo === "function";
|
|
28756
29022
|
}
|
|
29023
|
+
function isNativeSettingsServices(value) {
|
|
29024
|
+
if (!isRecord15(value) || !Object.hasOwn(value, "settings")) return false;
|
|
29025
|
+
const settings = value.settings;
|
|
29026
|
+
return typeof settings?.read === "function" && typeof settings?.write === "function";
|
|
29027
|
+
}
|
|
28757
29028
|
function isRecord15(value) {
|
|
28758
29029
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28759
29030
|
}
|
|
@@ -28775,14 +29046,14 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28775
29046
|
function abortError2() {
|
|
28776
29047
|
return new DOMException("The operation was aborted", "AbortError");
|
|
28777
29048
|
}
|
|
28778
|
-
function parseLocaleOverride(
|
|
28779
|
-
if (!isRecord15(
|
|
28780
|
-
throw new Error("Codex locale override response is malformed");
|
|
29049
|
+
function parseLocaleOverride(response) {
|
|
29050
|
+
if (!isRecord15(response) || !Object.hasOwn(response, "effective")) {
|
|
29051
|
+
throw new Error("Codex native locale override response is malformed");
|
|
28781
29052
|
}
|
|
28782
|
-
if (
|
|
28783
|
-
const locale = canonicalLocale(
|
|
29053
|
+
if (response.effective === null) return null;
|
|
29054
|
+
const locale = canonicalLocale(response.effective);
|
|
28784
29055
|
if (!locale) throw new Error("Codex locale override is invalid");
|
|
28785
|
-
return
|
|
29056
|
+
return locale;
|
|
28786
29057
|
}
|
|
28787
29058
|
function optionalLocale(value, field2) {
|
|
28788
29059
|
if (value === void 0 || value === null) return void 0;
|
|
@@ -28797,95 +29068,39 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28797
29068
|
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
28798
29069
|
};
|
|
28799
29070
|
}
|
|
28800
|
-
function
|
|
28801
|
-
const bridge = ownerWindow.electronBridge;
|
|
28802
|
-
if (request.kind !== "locale-info" && typeof bridge?.sendMessageFromView !== "function") {
|
|
28803
|
-
return Promise.reject(new Error("Codex locale bridge is unavailable"));
|
|
28804
|
-
}
|
|
29071
|
+
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke) {
|
|
28805
29072
|
if (signal?.aborted) return Promise.reject(abortError2());
|
|
28806
|
-
const requestId2 = ownerWindow.crypto.randomUUID();
|
|
28807
29073
|
return new Promise((resolve, reject) => {
|
|
28808
29074
|
let settled2 = false;
|
|
28809
|
-
|
|
28810
|
-
ownerWindow.clearTimeout(timer);
|
|
28811
|
-
ownerWindow.removeEventListener("message", onMessage);
|
|
28812
|
-
signal?.removeEventListener("abort", onAbort);
|
|
28813
|
-
};
|
|
29075
|
+
let nativeRequest;
|
|
28814
29076
|
const settle = (operation) => {
|
|
28815
29077
|
if (settled2) return;
|
|
28816
29078
|
settled2 = true;
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
};
|
|
28820
|
-
const onAbort = () => settle(() => reject(abortError2()));
|
|
28821
|
-
const onMessage = (event) => {
|
|
28822
|
-
const message3 = event.data;
|
|
28823
|
-
if (!isRecord15(message3) || message3.type !== "fetch-response") return;
|
|
28824
|
-
if (message3.requestId !== requestId2) return;
|
|
28825
|
-
if (message3.responseType !== "success" || typeof message3.status !== "number" || message3.status < 200 || message3.status >= 300 || typeof message3.bodyJsonString !== "string") {
|
|
28826
|
-
settle(() => reject(new Error("Codex locale request failed")));
|
|
28827
|
-
return;
|
|
28828
|
-
}
|
|
29079
|
+
ownerWindow.clearTimeout(timer);
|
|
29080
|
+
signal?.removeEventListener("abort", onAbort);
|
|
28829
29081
|
try {
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
} catch {
|
|
28833
|
-
|
|
29082
|
+
nativeRequest?.[Symbol.dispose]?.();
|
|
29083
|
+
operation();
|
|
29084
|
+
} catch (error51) {
|
|
29085
|
+
reject(error51);
|
|
28834
29086
|
}
|
|
28835
29087
|
};
|
|
29088
|
+
const onAbort = () => settle(() => reject(abortError2()));
|
|
28836
29089
|
const timer = ownerWindow.setTimeout(
|
|
28837
29090
|
() => settle(() => reject(new Error("Codex locale request timed out"))),
|
|
28838
29091
|
timeoutMs
|
|
28839
29092
|
);
|
|
28840
|
-
ownerWindow.addEventListener("message", onMessage);
|
|
28841
29093
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
28842
|
-
const message2 = {
|
|
28843
|
-
type: "fetch",
|
|
28844
|
-
requestId: requestId2,
|
|
28845
|
-
method: "POST",
|
|
28846
|
-
url: request.url,
|
|
28847
|
-
...request.body === void 0 ? {} : { body: request.body },
|
|
28848
|
-
reportUploadProgress: false
|
|
28849
|
-
};
|
|
28850
29094
|
void (async () => {
|
|
28851
|
-
|
|
28852
|
-
|
|
28853
|
-
|
|
28854
|
-
|
|
28855
|
-
|
|
28856
|
-
|
|
28857
|
-
return;
|
|
28858
|
-
}
|
|
28859
|
-
}
|
|
28860
|
-
if (typeof bridge?.sendMessageFromView !== "function") {
|
|
28861
|
-
throw new Error("Codex locale bridge is unavailable");
|
|
28862
|
-
}
|
|
28863
|
-
await bridge.sendMessageFromView(message2);
|
|
29095
|
+
const native = await loadCodexNativeServices(ownerWindow, matchesServices);
|
|
29096
|
+
if (settled2) return;
|
|
29097
|
+
if (!native) throw new Error("Codex native locale services are unavailable");
|
|
29098
|
+
nativeRequest = invoke(native);
|
|
29099
|
+
const response = await nativeRequest;
|
|
29100
|
+
settle(() => resolve(response));
|
|
28864
29101
|
})().catch((error51) => settle(() => reject(error51)));
|
|
28865
29102
|
});
|
|
28866
29103
|
}
|
|
28867
|
-
async function readLocaleOverride(ownerWindow, signal, timeoutMs) {
|
|
28868
|
-
const response = await sendFixedLocaleRequest(
|
|
28869
|
-
{
|
|
28870
|
-
kind: "locale-override",
|
|
28871
|
-
url: GET_LOCALE_OVERRIDE_URL,
|
|
28872
|
-
body: JSON.stringify({ key: "localeOverride" })
|
|
28873
|
-
},
|
|
28874
|
-
ownerWindow,
|
|
28875
|
-
signal,
|
|
28876
|
-
timeoutMs
|
|
28877
|
-
);
|
|
28878
|
-
return parseLocaleOverride(response);
|
|
28879
|
-
}
|
|
28880
|
-
async function readLocaleInfo(ownerWindow, signal, timeoutMs) {
|
|
28881
|
-
const response = await sendFixedLocaleRequest(
|
|
28882
|
-
{ kind: "locale-info", url: GET_LOCALE_INFO_URL },
|
|
28883
|
-
ownerWindow,
|
|
28884
|
-
signal,
|
|
28885
|
-
timeoutMs
|
|
28886
|
-
);
|
|
28887
|
-
return parseLocaleInfo(response);
|
|
28888
|
-
}
|
|
28889
29104
|
async function readCodexLocaleSettings(options = {}) {
|
|
28890
29105
|
const ownerWindow = options.ownerWindow ?? window;
|
|
28891
29106
|
const timeoutMs = options.timeoutMs ?? DEFAULT_LOCALE_REQUEST_TIMEOUT_MS;
|
|
@@ -28894,13 +29109,25 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
28894
29109
|
}
|
|
28895
29110
|
if (options.signal?.aborted) throw abortError2();
|
|
28896
29111
|
const [overrideResult, localeInfoResult] = await Promise.allSettled([
|
|
28897
|
-
|
|
28898
|
-
|
|
29112
|
+
requestNativeLocale(
|
|
29113
|
+
ownerWindow,
|
|
29114
|
+
options.signal,
|
|
29115
|
+
timeoutMs,
|
|
29116
|
+
isNativeSettingsServices,
|
|
29117
|
+
(native) => native.settings.read("localeOverride")
|
|
29118
|
+
).then(parseLocaleOverride),
|
|
29119
|
+
requestNativeLocale(
|
|
29120
|
+
ownerWindow,
|
|
29121
|
+
options.signal,
|
|
29122
|
+
timeoutMs,
|
|
29123
|
+
isNativeLocaleServices,
|
|
29124
|
+
(native) => native.appInfo.getLocaleInfo()
|
|
29125
|
+
).then(parseLocaleInfo)
|
|
28899
29126
|
]);
|
|
28900
29127
|
if (options.signal?.aborted) throw abortError2();
|
|
28901
29128
|
const navigatorLocale = firstNavigatorLocale(ownerWindow);
|
|
28902
29129
|
const overrideKnown = overrideResult.status === "fulfilled";
|
|
28903
|
-
const localeOverride = overrideKnown ? overrideResult.value
|
|
29130
|
+
const localeOverride = overrideKnown ? overrideResult.value : void 0;
|
|
28904
29131
|
const localeInfo = localeInfoResult.status === "fulfilled" ? localeInfoResult.value : { ideLocale: void 0, systemLocale: void 0 };
|
|
28905
29132
|
if (typeof localeOverride === "string") {
|
|
28906
29133
|
return Object.freeze({
|
|
@@ -33615,6 +33842,50 @@ ${detail}` : ""}`
|
|
|
33615
33842
|
};
|
|
33616
33843
|
setRefreshLabel(false);
|
|
33617
33844
|
header.append(heading, refresh);
|
|
33845
|
+
let selectedHostId;
|
|
33846
|
+
let availableHostIds = [];
|
|
33847
|
+
let displayedHostId = "";
|
|
33848
|
+
let hostsLocked = false;
|
|
33849
|
+
const hostButtons = [];
|
|
33850
|
+
const hostLabel = document2.createElement("div");
|
|
33851
|
+
hostLabel.className = "settings-session-import-host";
|
|
33852
|
+
const hostCaption = document2.createElement("span");
|
|
33853
|
+
hostCaption.textContent = "Host";
|
|
33854
|
+
const hostOptions = document2.createElement("div");
|
|
33855
|
+
hostOptions.className = "settings-connection-host-tabs";
|
|
33856
|
+
hostOptions.setAttribute("role", "group");
|
|
33857
|
+
hostOptions.setAttribute("aria-label", "Host");
|
|
33858
|
+
hostLabel.append(hostCaption, hostOptions);
|
|
33859
|
+
const lockHosts = (locked) => {
|
|
33860
|
+
hostsLocked = locked;
|
|
33861
|
+
for (const button2 of hostButtons) button2.disabled = locked;
|
|
33862
|
+
};
|
|
33863
|
+
const renderHosts = (client) => {
|
|
33864
|
+
const current = selectedHostId ?? (client ? client.hostId ?? "local" : "");
|
|
33865
|
+
availableHostIds = [
|
|
33866
|
+
.../* @__PURE__ */ new Set([
|
|
33867
|
+
...getDiagnostics()?.snapshot().hosts.map(({ hostId: hostId2 }) => hostId2) ?? [],
|
|
33868
|
+
...current ? [current] : []
|
|
33869
|
+
])
|
|
33870
|
+
];
|
|
33871
|
+
displayedHostId = current;
|
|
33872
|
+
const scrollLeft = hostOptions.scrollLeft;
|
|
33873
|
+
hostOptions.replaceChildren();
|
|
33874
|
+
hostButtons.length = 0;
|
|
33875
|
+
for (const hostId2 of availableHostIds) {
|
|
33876
|
+
const button2 = document2.createElement("button");
|
|
33877
|
+
button2.type = "button";
|
|
33878
|
+
button2.className = "settings-connection-host-tab";
|
|
33879
|
+
button2.dataset.sessionImportHost = hostId2;
|
|
33880
|
+
button2.textContent = connectionHostName(hostId2, messages);
|
|
33881
|
+
button2.setAttribute("aria-pressed", String(hostId2 === current));
|
|
33882
|
+
button2.disabled = hostsLocked;
|
|
33883
|
+
button2.addEventListener("click", () => selectHost(hostId2));
|
|
33884
|
+
hostButtons.push(button2);
|
|
33885
|
+
hostOptions.append(button2);
|
|
33886
|
+
}
|
|
33887
|
+
hostOptions.scrollLeft = scrollLeft;
|
|
33888
|
+
};
|
|
33618
33889
|
const harness2 = document2.createElement("div");
|
|
33619
33890
|
harness2.className = "settings-session-import-harness";
|
|
33620
33891
|
const harnessLabel = document2.createElement("span");
|
|
@@ -33675,6 +33946,7 @@ ${detail}` : ""}`
|
|
|
33675
33946
|
const listControls = createSessionImportListControls(document2, messages, () => load());
|
|
33676
33947
|
context.content.append(
|
|
33677
33948
|
header,
|
|
33949
|
+
hostLabel,
|
|
33678
33950
|
harness2,
|
|
33679
33951
|
description,
|
|
33680
33952
|
availabilityNote,
|
|
@@ -33684,9 +33956,11 @@ ${detail}` : ""}`
|
|
|
33684
33956
|
listControls.pagination
|
|
33685
33957
|
);
|
|
33686
33958
|
let candidates = [];
|
|
33959
|
+
let loadedClient = null;
|
|
33687
33960
|
let importingId = null;
|
|
33688
33961
|
let actions = [];
|
|
33689
33962
|
const updateImportActions = () => {
|
|
33963
|
+
lockHosts(importingId !== null);
|
|
33690
33964
|
listControls.setBusy(importingId !== null, importingId !== null);
|
|
33691
33965
|
for (const button2 of sourceButtons) button2.disabled = importingId !== null;
|
|
33692
33966
|
for (const { button: button2, candidate } of actions) {
|
|
@@ -33707,7 +33981,10 @@ ${detail}` : ""}`
|
|
|
33707
33981
|
listControls.setTotal(0);
|
|
33708
33982
|
candidates = [];
|
|
33709
33983
|
actions = [];
|
|
33710
|
-
const status = createStatus(
|
|
33984
|
+
const status = createStatus(
|
|
33985
|
+
document2,
|
|
33986
|
+
!displayedHostId && availableHostIds.length > 1 ? messages.sessionImportSelectHost : messages.sessionImportUnavailable
|
|
33987
|
+
);
|
|
33711
33988
|
content.replaceChildren(status);
|
|
33712
33989
|
if (focus) {
|
|
33713
33990
|
status.tabIndex = -1;
|
|
@@ -33732,7 +34009,7 @@ ${detail}` : ""}`
|
|
|
33732
34009
|
status.focus();
|
|
33733
34010
|
}
|
|
33734
34011
|
};
|
|
33735
|
-
const renderOpenRecovery = (candidate, threadId) => {
|
|
34012
|
+
const renderOpenRecovery = (candidate, threadId, hostId2) => {
|
|
33736
34013
|
if (!openImportedThread) return;
|
|
33737
34014
|
actions = [];
|
|
33738
34015
|
refresh.disabled = false;
|
|
@@ -33785,6 +34062,7 @@ ${detail}` : ""}`
|
|
|
33785
34062
|
retry.className = "settings-command-button";
|
|
33786
34063
|
retry.dataset.sessionImportAction = "retry-open";
|
|
33787
34064
|
const setRetrying = (pending) => {
|
|
34065
|
+
lockHosts(pending);
|
|
33788
34066
|
listControls.setBusy(pending, pending);
|
|
33789
34067
|
for (const button2 of sourceButtons) button2.disabled = pending;
|
|
33790
34068
|
retry.disabled = pending;
|
|
@@ -33799,12 +34077,12 @@ ${detail}` : ""}`
|
|
|
33799
34077
|
retry.addEventListener("click", () => {
|
|
33800
34078
|
if (retry.disabled) return;
|
|
33801
34079
|
setRetrying(true);
|
|
33802
|
-
void context.runLatest((signal) => openImportedThread(threadId, signal), {
|
|
34080
|
+
void context.runLatest((signal) => openImportedThread(threadId, signal, hostId2), {
|
|
33803
34081
|
success() {
|
|
33804
34082
|
setRetrying(false);
|
|
33805
34083
|
},
|
|
33806
34084
|
failure() {
|
|
33807
|
-
renderOpenRecovery(candidate, threadId);
|
|
34085
|
+
renderOpenRecovery(candidate, threadId, hostId2);
|
|
33808
34086
|
}
|
|
33809
34087
|
});
|
|
33810
34088
|
});
|
|
@@ -33881,7 +34159,7 @@ ${detail}` : ""}`
|
|
|
33881
34159
|
if (candidate.running === true || importingId !== null || selectedHarness === null)
|
|
33882
34160
|
return;
|
|
33883
34161
|
const harnessId = selectedHarness;
|
|
33884
|
-
const client =
|
|
34162
|
+
const client = loadedClient;
|
|
33885
34163
|
if (!client) {
|
|
33886
34164
|
renderUnavailable(true);
|
|
33887
34165
|
return;
|
|
@@ -33899,7 +34177,7 @@ ${detail}` : ""}`
|
|
|
33899
34177
|
});
|
|
33900
34178
|
committedThreadId = result.threadId;
|
|
33901
34179
|
if (!signal.aborted && openImportedThread)
|
|
33902
|
-
await openImportedThread(result.threadId, signal);
|
|
34180
|
+
await openImportedThread(result.threadId, signal, client.hostId);
|
|
33903
34181
|
},
|
|
33904
34182
|
{
|
|
33905
34183
|
success() {
|
|
@@ -33917,7 +34195,7 @@ ${detail}` : ""}`
|
|
|
33917
34195
|
updateImportActions();
|
|
33918
34196
|
refresh.disabled = false;
|
|
33919
34197
|
if (committedThreadId) {
|
|
33920
|
-
renderOpenRecovery(candidate, committedThreadId);
|
|
34198
|
+
renderOpenRecovery(candidate, committedThreadId, client.hostId);
|
|
33921
34199
|
} else {
|
|
33922
34200
|
renderFailure(error51, "import");
|
|
33923
34201
|
}
|
|
@@ -33935,23 +34213,22 @@ ${detail}` : ""}`
|
|
|
33935
34213
|
};
|
|
33936
34214
|
const load = () => {
|
|
33937
34215
|
if (importingId !== null || context.signal.aborted) return;
|
|
33938
|
-
|
|
33939
|
-
|
|
33940
|
-
|
|
33941
|
-
|
|
33942
|
-
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
|
|
33946
|
-
|
|
33947
|
-
setRefreshLabel(true);
|
|
33948
|
-
content.replaceChildren(createStatus(document2, messages.sessionImportRefreshing));
|
|
34216
|
+
loadedClient = null;
|
|
34217
|
+
const client = getClient(selectedHostId);
|
|
34218
|
+
renderHosts(client);
|
|
34219
|
+
listControls.setBusy(client !== null);
|
|
34220
|
+
refresh.disabled = client !== null;
|
|
34221
|
+
setRefreshLabel(client !== null);
|
|
34222
|
+
if (client)
|
|
34223
|
+
content.replaceChildren(createStatus(document2, messages.sessionImportRefreshing));
|
|
34224
|
+
else renderUnavailable();
|
|
33949
34225
|
const requestedHarness = selectedHarness;
|
|
33950
34226
|
const pageParams = listControls.params();
|
|
33951
34227
|
void context.runLatest(
|
|
33952
34228
|
async (signal) => {
|
|
34229
|
+
if (!client) throw new RendererSessionImportUnavailableError();
|
|
33953
34230
|
const missing = new Set(
|
|
33954
|
-
getDiagnostics()?.snapshot().hosts.find(({ hostId: hostId2 }) => hostId2 === "local")?.agents.filter(({ availability: availability2 }) => availability2 === "notInstalled").map(({ agent }) => agent)
|
|
34231
|
+
getDiagnostics()?.snapshot().hosts.find(({ hostId: hostId2 }) => hostId2 === (client.hostId ?? "local"))?.agents.filter(({ availability: availability2 }) => availability2 === "notInstalled").map(({ agent }) => agent)
|
|
33955
34232
|
);
|
|
33956
34233
|
const harnesses = (await client.listSessionImportSources()).harnesses.filter(
|
|
33957
34234
|
({ harnessId }) => !missing.has(harnessId)
|
|
@@ -33969,6 +34246,7 @@ ${detail}` : ""}`
|
|
|
33969
34246
|
},
|
|
33970
34247
|
{
|
|
33971
34248
|
success(result) {
|
|
34249
|
+
loadedClient = client;
|
|
33972
34250
|
listControls.setBusy(false);
|
|
33973
34251
|
if (listControls.setTotal(result.total)) {
|
|
33974
34252
|
load();
|
|
@@ -33981,6 +34259,7 @@ ${detail}` : ""}`
|
|
|
33981
34259
|
else renderCandidates();
|
|
33982
34260
|
},
|
|
33983
34261
|
failure(error51) {
|
|
34262
|
+
loadedClient = null;
|
|
33984
34263
|
listControls.setBusy(false);
|
|
33985
34264
|
candidates = [];
|
|
33986
34265
|
refresh.disabled = false;
|
|
@@ -33990,6 +34269,19 @@ ${detail}` : ""}`
|
|
|
33990
34269
|
}
|
|
33991
34270
|
);
|
|
33992
34271
|
};
|
|
34272
|
+
const selectHost = (hostId2) => {
|
|
34273
|
+
if (hostsLocked || !availableHostIds.includes(hostId2) || hostId2 === selectedHostId) return;
|
|
34274
|
+
selectedHostId = hostId2;
|
|
34275
|
+
selectedHarness = null;
|
|
34276
|
+
sources = [];
|
|
34277
|
+
candidates = [];
|
|
34278
|
+
actions = [];
|
|
34279
|
+
importStatus.replaceChildren();
|
|
34280
|
+
listControls.reset();
|
|
34281
|
+
renderHarnessOptions();
|
|
34282
|
+
load();
|
|
34283
|
+
hostButtons.find((button2) => button2.dataset.sessionImportHost === hostId2)?.focus();
|
|
34284
|
+
};
|
|
33993
34285
|
refresh.addEventListener("click", load);
|
|
33994
34286
|
load();
|
|
33995
34287
|
return void 0;
|
|
@@ -37174,6 +37466,41 @@ ${detail}` : ""}`
|
|
|
37174
37466
|
margin-top: 0;
|
|
37175
37467
|
}
|
|
37176
37468
|
|
|
37469
|
+
.settings-session-import-host {
|
|
37470
|
+
display: flex;
|
|
37471
|
+
align-items: center;
|
|
37472
|
+
min-width: 0;
|
|
37473
|
+
gap: 12px;
|
|
37474
|
+
margin: -12px 0 12px;
|
|
37475
|
+
color: var(--settings-muted);
|
|
37476
|
+
font-size: 13px;
|
|
37477
|
+
}
|
|
37478
|
+
|
|
37479
|
+
.settings-session-import-host > span,
|
|
37480
|
+
.settings-session-import-host + .settings-session-import-harness > span {
|
|
37481
|
+
flex: none;
|
|
37482
|
+
min-width: 60px;
|
|
37483
|
+
}
|
|
37484
|
+
|
|
37485
|
+
.settings-session-import-host > .settings-connection-host-tabs {
|
|
37486
|
+
flex: 1;
|
|
37487
|
+
}
|
|
37488
|
+
|
|
37489
|
+
.settings-session-import-host .settings-connection-host-tab {
|
|
37490
|
+
height: 34px;
|
|
37491
|
+
padding: 0 12px;
|
|
37492
|
+
font-size: 13px;
|
|
37493
|
+
}
|
|
37494
|
+
|
|
37495
|
+
.settings-session-import-host .settings-connection-host-tab:disabled {
|
|
37496
|
+
opacity: 0.38;
|
|
37497
|
+
cursor: not-allowed;
|
|
37498
|
+
}
|
|
37499
|
+
|
|
37500
|
+
.settings-session-import-host + .settings-session-import-harness {
|
|
37501
|
+
margin-top: 0;
|
|
37502
|
+
}
|
|
37503
|
+
|
|
37177
37504
|
.settings-session-import-search,
|
|
37178
37505
|
.settings-session-import-pagination {
|
|
37179
37506
|
display: flex;
|
|
@@ -37530,7 +37857,8 @@ ${detail}` : ""}`
|
|
|
37530
37857
|
background: var(--settings-hover);
|
|
37531
37858
|
}
|
|
37532
37859
|
|
|
37533
|
-
.settings-connection-host-tab[aria-selected="true"]
|
|
37860
|
+
.settings-connection-host-tab[aria-selected="true"],
|
|
37861
|
+
.settings-connection-host-tab[aria-pressed="true"] {
|
|
37534
37862
|
color: var(--settings-text);
|
|
37535
37863
|
font-weight: 600;
|
|
37536
37864
|
background: var(--settings-active);
|
|
@@ -42104,11 +42432,11 @@ ${usage_default}`;
|
|
|
42104
42432
|
options.getConnectionDiagnostics ?? (() => null),
|
|
42105
42433
|
options.getAccountClient ?? (() => null),
|
|
42106
42434
|
options.getSessionImportClient ?? (() => null),
|
|
42107
|
-
async (threadId, signal) => {
|
|
42435
|
+
async (threadId, signal, hostId2) => {
|
|
42108
42436
|
if (!options.openImportedThread) {
|
|
42109
42437
|
throw new Error("Imported Thread navigation is unavailable");
|
|
42110
42438
|
}
|
|
42111
|
-
await options.openImportedThread(threadId, signal);
|
|
42439
|
+
await options.openImportedThread(threadId, signal, hostId2);
|
|
42112
42440
|
if (!disposed && !signal.aborted) shell?.close();
|
|
42113
42441
|
},
|
|
42114
42442
|
options.getLoadedSessionsClient ?? (() => null),
|
|
@@ -43123,9 +43451,13 @@ ${usage_default}`;
|
|
|
43123
43451
|
function mutationMayAffectComposer(mutation) {
|
|
43124
43452
|
const target = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
|
|
43125
43453
|
if (!target) return true;
|
|
43126
|
-
if (mutation.type === "attributes" && mutation.attributeName === "data-codex-composer-root")
|
|
43454
|
+
if (mutation.type === "attributes" && (mutation.attributeName === "data-codex-composer-root" || NATIVE_COMPOSER_REQUEST_ATTRIBUTES.some((attribute) => attribute === mutation.attributeName)))
|
|
43127
43455
|
return true;
|
|
43128
|
-
if (mutation.type !== "attributes" && editorForElement(target))
|
|
43456
|
+
if (mutation.type !== "attributes" && editorForElement(target)) {
|
|
43457
|
+
return mutation.type === "childList" && [...mutation.addedNodes, ...mutation.removedNodes].some(
|
|
43458
|
+
(node) => node instanceof Element && hasNativeComposerRequest(node)
|
|
43459
|
+
);
|
|
43460
|
+
}
|
|
43129
43461
|
if (target.closest(CODEX_COMPOSER_SELECTOR)) return true;
|
|
43130
43462
|
if (mutation.type === "characterData") return false;
|
|
43131
43463
|
if (!target.closest(
|
|
@@ -43236,19 +43568,22 @@ ${usage_default}`;
|
|
|
43236
43568
|
getLoadedSessionsClient: () => modelClientForHost("local"),
|
|
43237
43569
|
requestUsageStatistics: usageStatistics.request,
|
|
43238
43570
|
usageStatisticsHosts: usageStatistics.hosts,
|
|
43239
|
-
getSessionImportClient: () => {
|
|
43240
|
-
const
|
|
43571
|
+
getSessionImportClient: (requestedHostId) => {
|
|
43572
|
+
const hostId2 = requestedHostId ?? activeModelHostId();
|
|
43573
|
+
if (!hostId2) return null;
|
|
43574
|
+
const client = modelClientForHost(hostId2);
|
|
43241
43575
|
const sources = client?.listSessionImportSources;
|
|
43242
43576
|
const list = client?.listHarnessSessions;
|
|
43243
43577
|
const importSession = client?.importHarnessSession;
|
|
43244
43578
|
if (!sources || !list || !importSession) return null;
|
|
43245
43579
|
return {
|
|
43580
|
+
hostId: hostId2,
|
|
43246
43581
|
listSessionImportSources: () => sources(),
|
|
43247
43582
|
listHarnessSessions: (input) => list(input),
|
|
43248
43583
|
importHarnessSession: (input) => importSession(input)
|
|
43249
43584
|
};
|
|
43250
43585
|
},
|
|
43251
|
-
openImportedThread: (threadId, signal) => openRendererThread(threadId, { hostId: "local", signal }),
|
|
43586
|
+
openImportedThread: (threadId, signal, hostId2) => openRendererThread(threadId, { hostId: hostId2 ?? "local", signal }),
|
|
43252
43587
|
onLocaleChange() {
|
|
43253
43588
|
for (const mounted of mountedByComposer.values()) renderMounted(mounted);
|
|
43254
43589
|
}
|
|
@@ -44730,7 +45065,7 @@ ${usage_default}`;
|
|
|
44730
45065
|
return;
|
|
44731
45066
|
}
|
|
44732
45067
|
const allButtons = composerButtonsWithin(composer);
|
|
44733
|
-
const sendButton =
|
|
45068
|
+
const sendButton = sendButtonWithin(composer) ?? allButtons.at(-1) ?? null;
|
|
44734
45069
|
if (!sendButton) return;
|
|
44735
45070
|
const modelTarget = findComposerModelTarget(composer);
|
|
44736
45071
|
const hostId2 = activeModelHostId(composer);
|
|
@@ -44824,7 +45159,7 @@ ${usage_default}`;
|
|
|
44824
45159
|
const sourceState = controller.get(replacement.source.composer);
|
|
44825
45160
|
const replacementTarget = findComposerModelTarget(target);
|
|
44826
45161
|
const replacementHostId = activeModelHostId(target);
|
|
44827
|
-
if (orbitComposerKind(target) !== "codex" || !shouldTransferComposerState(
|
|
45162
|
+
if (hasNativeComposerRequest(target) || orbitComposerKind(target) !== "codex" || !shouldTransferComposerState(
|
|
44828
45163
|
replacement.sourceModelTarget,
|
|
44829
45164
|
replacementTarget,
|
|
44830
45165
|
sourceState.phase,
|
|
@@ -44890,7 +45225,7 @@ ${usage_default}`;
|
|
|
44890
45225
|
void refreshHarnessAvailability();
|
|
44891
45226
|
}
|
|
44892
45227
|
pendingReplacements.clear();
|
|
44893
|
-
|
|
45228
|
+
questions.refreshContext();
|
|
44894
45229
|
};
|
|
44895
45230
|
const scheduleScan = (refreshTargets = false) => {
|
|
44896
45231
|
refreshTargetsOnNextScan ||= refreshTargets;
|
|
@@ -45192,18 +45527,13 @@ ${usage_default}`;
|
|
|
45192
45527
|
);
|
|
45193
45528
|
const questions = installRendererQuestions(window, () => {
|
|
45194
45529
|
const visible = connectedComposers().filter(
|
|
45195
|
-
(mounted2) => mounted2.composer.getClientRects().length > 0 && controller.get(mounted2.composer).agent !== "codex"
|
|
45530
|
+
(mounted2) => mounted2.composer.getClientRects().length > 0 && window.getComputedStyle(mounted2.composer).visibility === "visible" && !mounted2.composer.closest('[hidden], [inert], [aria-hidden="true"]') && controller.get(mounted2.composer).agent !== "codex"
|
|
45196
45531
|
);
|
|
45197
45532
|
const mounted = visible.length === 1 ? visible[0] : void 0;
|
|
45198
45533
|
const threadId = mounted ? threadIdFromComposerModelTarget(findComposerModelTarget(mounted.composer)) : null;
|
|
45199
45534
|
const hostId2 = mounted?.hostId;
|
|
45200
45535
|
const route = hostId2 ? window.__codexhostHostRoutingV1?.forHost(hostId2) : null;
|
|
45201
|
-
return mounted && threadId && hostId2 && route ? {
|
|
45202
|
-
hostId: hostId2,
|
|
45203
|
-
threadId,
|
|
45204
|
-
composer: mounted.composer,
|
|
45205
|
-
route: route.manager
|
|
45206
|
-
} : null;
|
|
45536
|
+
return mounted && threadId && hostId2 && route ? { hostId: hostId2, threadId, composer: mounted.composer, route: route.manager } : null;
|
|
45207
45537
|
});
|
|
45208
45538
|
const api = {
|
|
45209
45539
|
remoteConnections: (request) => handleRemoteConnectionsRequest(remoteConnections, request),
|
|
@@ -46232,7 +46562,10 @@ ${usage_default}`;
|
|
|
46232
46562
|
const config2 = readCpaLiveVoiceHookConfig(target);
|
|
46233
46563
|
if (!config2) return { dispose() {
|
|
46234
46564
|
} };
|
|
46235
|
-
if (
|
|
46565
|
+
if (!supportsVoiceVersion(
|
|
46566
|
+
NATIVE_CHAT_VOICE_ASSETS.filter((profile) => !!profile.settings),
|
|
46567
|
+
config2.desktopVersion
|
|
46568
|
+
))
|
|
46236
46569
|
return { dispose() {
|
|
46237
46570
|
} };
|
|
46238
46571
|
let disposed = false;
|
|
@@ -46292,16 +46625,18 @@ ${usage_default}`;
|
|
|
46292
46625
|
)
|
|
46293
46626
|
);
|
|
46294
46627
|
if (disposed) return;
|
|
46295
|
-
|
|
46628
|
+
const latest = assets.version === NATIVE_CHAT_VOICE_VERSION;
|
|
46629
|
+
const initialize = latest ? initial.N4n : initial.l0n;
|
|
46630
|
+
if (typeof initialize !== "function" || typeof settings.VoiceSettings !== "function")
|
|
46296
46631
|
return;
|
|
46297
|
-
|
|
46298
|
-
const dictationMode = initial.mW;
|
|
46632
|
+
initialize();
|
|
46633
|
+
const dictationMode = latest ? initial.KG : initial.mW;
|
|
46299
46634
|
modules = {
|
|
46300
|
-
appScope: shared.Bst,
|
|
46635
|
+
appScope: latest ? shared.uct : shared.Bst,
|
|
46301
46636
|
page: settings.VoiceSettings,
|
|
46302
|
-
access: initial.k5n,
|
|
46303
|
-
capability: initial.c0n,
|
|
46304
|
-
gates: initial.Cnr,
|
|
46637
|
+
access: latest ? initial.yer : initial.k5n,
|
|
46638
|
+
capability: latest ? initial.M4n : initial.c0n,
|
|
46639
|
+
gates: latest ? initial.Par : initial.Cnr,
|
|
46305
46640
|
...dictationMode ? { dictationMode } : {}
|
|
46306
46641
|
};
|
|
46307
46642
|
}
|
|
@@ -46381,6 +46716,7 @@ lucide/dist/esm/icons/circle-question-mark.mjs:
|
|
|
46381
46716
|
lucide/dist/esm/icons/users.mjs:
|
|
46382
46717
|
lucide/dist/esm/icons/plus.mjs:
|
|
46383
46718
|
lucide/dist/esm/icons/circle-alert.mjs:
|
|
46719
|
+
lucide/dist/esm/icons/activity.mjs:
|
|
46384
46720
|
lucide/dist/esm/icons/lock.mjs:
|
|
46385
46721
|
lucide/dist/esm/icons/shield.mjs:
|
|
46386
46722
|
lucide/dist/esm/icons/shield-alert.mjs:
|