@codexhost/cli-darwin-x64 0.3.2 → 0.3.4
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 +3 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/desktop-controller.mjs +468 -16
- package/app/host-runtime.mjs +8806 -1613
- package/app/renderer-extension.js +570 -289
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"pi",
|
|
13
13
|
"claude-code",
|
|
14
14
|
"deepseek-harness",
|
|
15
|
-
"grok"
|
|
15
|
+
"grok",
|
|
16
|
+
"omp"
|
|
16
17
|
];
|
|
17
18
|
var DEFAULT_RENDERER_AGENTS = KNOWN_RENDERER_AGENTS;
|
|
18
19
|
function defaultIdFactory(sequence) {
|
|
@@ -123,6 +124,7 @@
|
|
|
123
124
|
if (agent === "claude-code" && model) state.claudeModel = model;
|
|
124
125
|
if (agent === "deepseek-harness" && model) state.deepSeekHarnessModel = model;
|
|
125
126
|
if (agent === "grok" && model) state.grokModel = model;
|
|
127
|
+
if (agent === "omp" && model) state.ompModel = model;
|
|
126
128
|
if (agent === "pi" && thinkingOptionId) state.piThinkingOptionId = thinkingOptionId;
|
|
127
129
|
else if (agent === "pi") delete state.piThinkingOptionId;
|
|
128
130
|
if (agent === "claude-code" && thinkingOptionId) {
|
|
@@ -130,9 +132,11 @@
|
|
|
130
132
|
} else if (agent === "claude-code") delete state.claudeThinkingOptionId;
|
|
131
133
|
if (agent === "grok" && thinkingOptionId) state.grokThinkingOptionId = thinkingOptionId;
|
|
132
134
|
else if (agent === "grok") delete state.grokThinkingOptionId;
|
|
135
|
+
if (agent === "omp" && thinkingOptionId) state.ompThinkingOptionId = thinkingOptionId;
|
|
136
|
+
else if (agent === "omp") delete state.ompThinkingOptionId;
|
|
133
137
|
if (agent !== "codex") {
|
|
134
138
|
const permissionModeByAgent = {};
|
|
135
|
-
for (const candidate of ["pi", "claude-code", "deepseek-harness", "grok"]) {
|
|
139
|
+
for (const candidate of ["pi", "claude-code", "deepseek-harness", "grok", "omp"]) {
|
|
136
140
|
const current = state.permissionModeByAgent?.[candidate];
|
|
137
141
|
if (candidate !== agent && current) permissionModeByAgent[candidate] = current;
|
|
138
142
|
}
|
|
@@ -150,13 +154,15 @@
|
|
|
150
154
|
if (agent === "pi") return state.piModel;
|
|
151
155
|
if (agent === "claude-code") return state.claudeModel;
|
|
152
156
|
if (agent === "deepseek-harness") return state.deepSeekHarnessModel;
|
|
153
|
-
|
|
157
|
+
if (agent === "grok") return state.grokModel;
|
|
158
|
+
return state.ompModel;
|
|
154
159
|
}
|
|
155
160
|
thinkingOptionForAgent(composer, agent) {
|
|
156
161
|
const state = this.#state(composer);
|
|
157
162
|
if (agent === "pi") return state.piThinkingOptionId;
|
|
158
163
|
if (agent === "claude-code") return state.claudeThinkingOptionId;
|
|
159
|
-
|
|
164
|
+
if (agent === "grok") return state.grokThinkingOptionId;
|
|
165
|
+
return state.ompThinkingOptionId;
|
|
160
166
|
}
|
|
161
167
|
permissionModeForAgent(composer, agent) {
|
|
162
168
|
return this.#state(composer).permissionModeByAgent?.[agent];
|
|
@@ -174,7 +180,8 @@
|
|
|
174
180
|
if (agent === "pi") state.piModel = model;
|
|
175
181
|
else if (agent === "claude-code") state.claudeModel = model;
|
|
176
182
|
else if (agent === "deepseek-harness") state.deepSeekHarnessModel = model;
|
|
177
|
-
else state.grokModel = model;
|
|
183
|
+
else if (agent === "grok") state.grokModel = model;
|
|
184
|
+
else state.ompModel = model;
|
|
178
185
|
return state;
|
|
179
186
|
}
|
|
180
187
|
setPiConfiguration(composer, model, thinkingOptionId) {
|
|
@@ -199,6 +206,10 @@
|
|
|
199
206
|
state.grokThinkingOptionId = thinkingOptionId;
|
|
200
207
|
} else if (agent === "grok") {
|
|
201
208
|
delete state.grokThinkingOptionId;
|
|
209
|
+
} else if (agent === "omp" && thinkingOptionId) {
|
|
210
|
+
state.ompThinkingOptionId = thinkingOptionId;
|
|
211
|
+
} else if (agent === "omp") {
|
|
212
|
+
delete state.ompThinkingOptionId;
|
|
202
213
|
}
|
|
203
214
|
return state;
|
|
204
215
|
}
|
|
@@ -14950,7 +14961,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14950
14961
|
totalCostUsd: finiteNonNegativeNumberSchema.optional(),
|
|
14951
14962
|
cacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
14952
14963
|
contextWindowTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14953
|
-
contextUsedTokens: nonNegativeSafeIntegerSchema.optional()
|
|
14964
|
+
contextUsedTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14965
|
+
planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
14966
|
+
planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
14967
|
+
planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
14968
|
+
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
|
|
14954
14969
|
}).strict().superRefine((usage, context) => {
|
|
14955
14970
|
if (Object.keys(usage).length === 0) {
|
|
14956
14971
|
context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
@@ -14971,16 +14986,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14971
14986
|
path: ["contextWindowTokens"]
|
|
14972
14987
|
});
|
|
14973
14988
|
}
|
|
14989
|
+
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
14990
|
+
context.addIssue({
|
|
14991
|
+
code: "custom",
|
|
14992
|
+
message: "Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent",
|
|
14993
|
+
path: ["planFiveHourResetsAtUnix"]
|
|
14994
|
+
});
|
|
14995
|
+
}
|
|
14996
|
+
if (usage.planSevenDayResetsAtUnix !== void 0 && usage.planSevenDayUsedPercent === void 0) {
|
|
14997
|
+
context.addIssue({
|
|
14998
|
+
code: "custom",
|
|
14999
|
+
message: "Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent",
|
|
15000
|
+
path: ["planSevenDayResetsAtUnix"]
|
|
15001
|
+
});
|
|
15002
|
+
}
|
|
14974
15003
|
});
|
|
14975
15004
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14976
15005
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
14977
15006
|
product: external_exports.string().min(1),
|
|
14978
|
-
usagePercent: usagePercentSchema
|
|
15007
|
+
usagePercent: usagePercentSchema,
|
|
15008
|
+
resetsAt: external_exports.string().min(1).optional()
|
|
14979
15009
|
}).strict();
|
|
14980
15010
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
14981
15011
|
usedPercent: usagePercentSchema,
|
|
14982
15012
|
resetsAt: external_exports.string().min(1).optional(),
|
|
14983
|
-
periodType: external_exports.enum(["weekly", "monthly", "unknown"]),
|
|
15013
|
+
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
14984
15014
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional()
|
|
14985
15015
|
}).strict();
|
|
14986
15016
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
@@ -15094,7 +15124,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15094
15124
|
selectThinkingOption: external_exports.boolean(),
|
|
15095
15125
|
selectPermissionMode: external_exports.boolean()
|
|
15096
15126
|
}).strict(),
|
|
15097
|
-
history: harnessHistoryCapabilitiesSchema
|
|
15127
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
15128
|
+
subagents: external_exports.object({
|
|
15129
|
+
observe: external_exports.boolean(),
|
|
15130
|
+
readTranscript: external_exports.boolean()
|
|
15131
|
+
}).strict().optional(),
|
|
15132
|
+
autonomousTurns: external_exports.object({
|
|
15133
|
+
observe: external_exports.boolean()
|
|
15134
|
+
}).strict().optional()
|
|
15098
15135
|
}).strict();
|
|
15099
15136
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15100
15137
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15390,13 +15427,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15390
15427
|
// src/assets/grok-agent.png
|
|
15391
15428
|
var grok_agent_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAEk9JREFUeNrtnQdsHEUXx5fee40xnQiQ6b23IAiJAWHACV10AQHRRG8GDJgSOggEGAEBg6gGhAIBQknoppjeezGE3kybb3+je6f1fVdm93Z2Zy870iPmfN67mffmzSv/98bzLIxZZpml2ad2n7p86vWp36cBnwZ9UjlVpcHCWvUX1q6rsJbNnsvD/4ItPnX41Jcz0Rr1Fda4xSXGt/k0MWdO4sSat6XJ+FafpuaMSJ3gQWuSjG/yaUK+8M4RPGmyzfyxPk3LF9tZgjdjbTG/M1/gzFBn3Mzvzhc1c9QdF/N78sXMLPXkO386o5lnnllT3ZogP/OzRzPNNJOac8451bBhw0qFoDOKtZ8vasZ2Pv/uuOOOaoklltDCUPKesWH8/NzVyxjzfdapcePGqa222kr/XMFFbDIRgDzIkzGC4Yceeqg6/fTTKzG/GCwyCe/mi5ox5u+3337q4YcfVvPNN1851V9KrdUEII/tZ4z5e++9t/rmm2/UeuutV2v3F3MH1bJ6+cJmiPnt7e3q77//VieccIIp84XayglAntLNEPO33XZb9dtvv2nVP9tss5mo/iGp5HJgjnxxM8L8TTbZRKv9adOmqVVWWSXs7hdqCQpAR7642WD+hhtuqD777DPFOProo6MyH+oICkAO48oY8ydNmqTmmmuusKp/CLwsCOCcbgImLBg044wz6kUtpRlmmKH4npJwaqrMX3PNNdXHH3+smf/zzz+HsfqrUbNXQJw2dIQsyFx2zSKLLKKWWWYZtfrqq+uFFFpttdXUsssuqxZeeGE199xz6/cH/z4NgeBzV1hhBfX2228rGeecc04czIfavQLsuKESIsIwmI2RNGbMGHX++eere++9V73wwgvq888/Vz/88IP69ddf1e+//16kX375Rb+Omn3xxRf1+y+44AK1++67q1VXXVU/T55dh+oNxfyll15avfzyy0XmIwiLLbaY1mAxfEaXV8CeN8QZCS244IJq9OjR6tJLL1V9fX2aqeXGf//9p+nff/8tkrxWbvCcV155RV1++eVq1KhR+nPkM23NZ6mlllLPPfec/nz5fvvvv3+cn9nrFQoQMq3iUdXrrLOOuuiii9S77747hIn8/M8//9RNpc9855139Oet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";
|
|
15392
15429
|
|
|
15430
|
+
// src/assets/omp-agent.svg
|
|
15431
|
+
var omp_agent_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">%0A <defs>%0A <linearGradient id="omp-gradient" x1="0" y1="0" x2="1" y2="1">%0A <stop offset="0" stop-color="%23ed4abf" />%0A <stop offset=".5" stop-color="%239b4dff" />%0A <stop offset="1" stop-color="%235ad8e6" />%0A </linearGradient>%0A </defs>%0A <path%0A fill="url(%23omp-gradient)"%0A transform="translate(-14.4 -20.2) scale(1.45)"%0A d="M14 16h36v8H40v32h-8V24h-6v22h-8V24h-4z"%0A />%0A</svg>%0A';
|
|
15432
|
+
|
|
15393
15433
|
// src/renderer-agent-icon.ts
|
|
15394
15434
|
var RENDERER_AGENT_LABELS = {
|
|
15395
15435
|
codex: "Codex",
|
|
15396
15436
|
pi: "Pi",
|
|
15397
15437
|
"claude-code": "Claude Code",
|
|
15398
15438
|
"deepseek-harness": "DeepSeek Harness",
|
|
15399
|
-
grok: "Grok"
|
|
15439
|
+
grok: "Grok",
|
|
15440
|
+
omp: "Oh My Pi"
|
|
15400
15441
|
};
|
|
15401
15442
|
var PI_PATHS = [
|
|
15402
15443
|
{
|
|
@@ -15448,6 +15489,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15448
15489
|
"0 0 23.16 17.04"
|
|
15449
15490
|
);
|
|
15450
15491
|
}
|
|
15492
|
+
if (agent === "omp") {
|
|
15493
|
+
const image = ownerDocument.createElement("img");
|
|
15494
|
+
image.src = omp_agent_default;
|
|
15495
|
+
image.alt = "";
|
|
15496
|
+
image.draggable = false;
|
|
15497
|
+
image.style.width = `${size}px`;
|
|
15498
|
+
image.style.height = `${size}px`;
|
|
15499
|
+
image.style.objectFit = "contain";
|
|
15500
|
+
image.style.borderRadius = "22.37%";
|
|
15501
|
+
image.style.flex = "none";
|
|
15502
|
+
return image;
|
|
15503
|
+
}
|
|
15451
15504
|
const mark = ownerDocument.createElement("img");
|
|
15452
15505
|
mark.src = grok_agent_default;
|
|
15453
15506
|
mark.alt = "";
|
|
@@ -15465,7 +15518,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15465
15518
|
pi: "https://pi.dev/",
|
|
15466
15519
|
"claude-code": "https://code.claude.com/docs/en/quickstart",
|
|
15467
15520
|
"deepseek-harness": "https://github.com/deepseek-ai/deepseek-harness",
|
|
15468
|
-
grok: "https://grok.com/"
|
|
15521
|
+
grok: "https://grok.com/",
|
|
15522
|
+
omp: "https://github.com/can1357/oh-my-pi"
|
|
15469
15523
|
};
|
|
15470
15524
|
var CONTROL_ATTRIBUTE = "data-codexhost-agent-control";
|
|
15471
15525
|
var AGENT_MENU_WIDTH = 200;
|
|
@@ -15506,6 +15560,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15506
15560
|
root.setAttribute(CONTROL_ATTRIBUTE, composerId);
|
|
15507
15561
|
root.style.display = "inline-flex";
|
|
15508
15562
|
root.style.alignItems = "center";
|
|
15563
|
+
root.style.alignSelf = "center";
|
|
15564
|
+
root.style.verticalAlign = "middle";
|
|
15509
15565
|
root.style.width = "30px";
|
|
15510
15566
|
root.style.height = "28px";
|
|
15511
15567
|
root.style.marginInline = "4px";
|
|
@@ -15877,8 +15933,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15877
15933
|
};
|
|
15878
15934
|
}
|
|
15879
15935
|
|
|
15936
|
+
// src/renderer-trigger-chip-style.ts
|
|
15937
|
+
var STYLE_ATTRIBUTE = "data-codexhost-trigger-chip-style";
|
|
15938
|
+
var TRIGGER_CHIP_CLASS = "codexhost-trigger-chip";
|
|
15939
|
+
function ensureRendererTriggerChipStyle(ownerDocument) {
|
|
15940
|
+
if (ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE}]`)) return;
|
|
15941
|
+
const style = ownerDocument.createElement("style");
|
|
15942
|
+
style.setAttribute(STYLE_ATTRIBUTE, "true");
|
|
15943
|
+
style.textContent = `
|
|
15944
|
+
.${TRIGGER_CHIP_CLASS} {
|
|
15945
|
+
display: inline-flex;
|
|
15946
|
+
align-items: center;
|
|
15947
|
+
justify-content: center;
|
|
15948
|
+
box-sizing: border-box;
|
|
15949
|
+
border: 0;
|
|
15950
|
+
border-radius: 9999px;
|
|
15951
|
+
background: transparent;
|
|
15952
|
+
color: inherit;
|
|
15953
|
+
white-space: nowrap;
|
|
15954
|
+
cursor: pointer;
|
|
15955
|
+
}
|
|
15956
|
+
.${TRIGGER_CHIP_CLASS}:hover:not(:disabled) {
|
|
15957
|
+
background: rgba(127, 127, 127, 0.08);
|
|
15958
|
+
}
|
|
15959
|
+
.${TRIGGER_CHIP_CLASS}:active:not(:disabled) {
|
|
15960
|
+
background: rgba(127, 127, 127, 0.16);
|
|
15961
|
+
}
|
|
15962
|
+
.${TRIGGER_CHIP_CLASS}[data-state="open"] {
|
|
15963
|
+
background: rgba(127, 127, 127, 0.08);
|
|
15964
|
+
}
|
|
15965
|
+
.${TRIGGER_CHIP_CLASS}:disabled {
|
|
15966
|
+
cursor: not-allowed;
|
|
15967
|
+
opacity: 0.4;
|
|
15968
|
+
}
|
|
15969
|
+
`;
|
|
15970
|
+
(ownerDocument.head ?? ownerDocument.documentElement).append(style);
|
|
15971
|
+
}
|
|
15972
|
+
|
|
15880
15973
|
// src/renderer-model-picker.ts
|
|
15881
|
-
var RENDERER_MODEL_TRIGGER_FALLBACK_CLASSES = "border-token-border no-drag cursor-interaction items-center gap-1 border whitespace-nowrap select-none focus:outline-none disabled:cursor-not-allowed disabled:opacity-40 flex rounded-full text-token-text-tertiary enabled:hover:bg-token-list-hover-background enabled:active:bg-token-foreground/15 data-[state=open]:bg-token-list-hover-background border-transparent h-token-button-composer px-2 py-0 text-sm leading-[18px] min-w-0";
|
|
15882
15974
|
var MENU_CLASSES = "fixed z-50 overflow-hidden rounded-xl bg-token-dropdown-background/90 text-token-foreground shadow-lg backdrop-blur-xl";
|
|
15883
15975
|
var SEARCH_INPUT_CLASSES = "mb-1 w-full shrink-0 rounded-lg border border-token-border bg-token-dropdown-background/95 px-2 py-1.5 text-sm text-token-foreground outline-none placeholder:text-token-text-tertiary disabled:cursor-not-allowed disabled:opacity-40";
|
|
15884
15976
|
var OPTION_CLASSES = "flex w-full cursor-interaction items-center gap-2 rounded-lg px-2 py-2 text-left text-sm text-token-foreground outline-none enabled:hover:bg-token-list-hover-background enabled:active:bg-token-foreground/15 disabled:cursor-not-allowed disabled:opacity-40";
|
|
@@ -15996,8 +16088,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15996
16088
|
control.modelMenu.style.top = placement.top === void 0 ? "auto" : `${placement.top}px`;
|
|
15997
16089
|
control.modelMenu.style.bottom = placement.bottom === void 0 ? "auto" : `${placement.bottom}px`;
|
|
15998
16090
|
}
|
|
15999
|
-
function syncRendererModelTriggerClass(control
|
|
16000
|
-
control.trigger.className =
|
|
16091
|
+
function syncRendererModelTriggerClass(control) {
|
|
16092
|
+
control.trigger.className = TRIGGER_CHIP_CLASS;
|
|
16001
16093
|
control.trigger.style.width = "fit-content";
|
|
16002
16094
|
control.trigger.style.maxWidth = MODEL_TRIGGER_MAX_WIDTH;
|
|
16003
16095
|
}
|
|
@@ -16032,7 +16124,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16032
16124
|
}
|
|
16033
16125
|
control.searchEmpty.hidden = query.length === 0 || visibleCount > 0;
|
|
16034
16126
|
}
|
|
16035
|
-
function mountRendererModelPicker(composerId,
|
|
16127
|
+
function mountRendererModelPicker(composerId, onSelectModel, onSelectThinking) {
|
|
16128
|
+
ensureRendererTriggerChipStyle(document);
|
|
16036
16129
|
const root = document.createElement("div");
|
|
16037
16130
|
root.setAttribute("data-codexhost-model-control", composerId);
|
|
16038
16131
|
root.className = "relative min-w-0";
|
|
@@ -16042,14 +16135,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16042
16135
|
trigger.setAttribute("aria-haspopup", "menu");
|
|
16043
16136
|
trigger.setAttribute("aria-expanded", "false");
|
|
16044
16137
|
trigger.setAttribute("data-state", "closed");
|
|
16138
|
+
trigger.style.height = "28px";
|
|
16139
|
+
trigger.style.padding = "0 8px";
|
|
16140
|
+
trigger.style.gap = "4px";
|
|
16141
|
+
trigger.style.font = "400 13px/18px system-ui, sans-serif";
|
|
16142
|
+
trigger.style.letterSpacing = "0";
|
|
16045
16143
|
const label = document.createElement("span");
|
|
16046
|
-
label.
|
|
16144
|
+
label.style.color = "inherit";
|
|
16047
16145
|
label.style.minWidth = "0";
|
|
16048
16146
|
label.style.overflow = "hidden";
|
|
16049
16147
|
label.style.textOverflow = "ellipsis";
|
|
16050
16148
|
label.style.whiteSpace = "nowrap";
|
|
16051
16149
|
const thinkingLabel = document.createElement("span");
|
|
16052
|
-
thinkingLabel.
|
|
16150
|
+
thinkingLabel.style.color = "var(--color-text-tertiary, #8f8f8f)";
|
|
16053
16151
|
thinkingLabel.style.flex = "none";
|
|
16054
16152
|
thinkingLabel.style.maxWidth = "96px";
|
|
16055
16153
|
thinkingLabel.style.overflow = "hidden";
|
|
@@ -16276,7 +16374,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16276
16374
|
root.remove();
|
|
16277
16375
|
}
|
|
16278
16376
|
};
|
|
16279
|
-
syncRendererModelTriggerClass(control
|
|
16377
|
+
syncRendererModelTriggerClass(control);
|
|
16280
16378
|
return control;
|
|
16281
16379
|
}
|
|
16282
16380
|
function rebuildOptions(control, view) {
|
|
@@ -16343,7 +16441,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16343
16441
|
if (popoverOpen2(control.modelMenu)) control.searchInput.focus();
|
|
16344
16442
|
}
|
|
16345
16443
|
function renderRendererModelPicker(control, view, visible) {
|
|
16346
|
-
control.root.style.display = visible ? "
|
|
16444
|
+
control.root.style.display = visible ? "inline-flex" : "none";
|
|
16445
|
+
control.root.style.alignItems = "center";
|
|
16446
|
+
control.root.style.alignSelf = "center";
|
|
16447
|
+
control.root.style.height = "28px";
|
|
16448
|
+
control.root.style.flex = "0 0 auto";
|
|
16449
|
+
control.root.style.verticalAlign = "middle";
|
|
16347
16450
|
if (!visible) {
|
|
16348
16451
|
control.close();
|
|
16349
16452
|
return;
|
|
@@ -16456,7 +16559,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16456
16559
|
];
|
|
16457
16560
|
|
|
16458
16561
|
// src/renderer-permission-mode-picker.ts
|
|
16459
|
-
var FALLBACK_TRIGGER_CLASSES = "no-drag cursor-interaction items-center gap-1 border whitespace-nowrap select-none focus:outline-none disabled:cursor-not-allowed disabled:opacity-40 flex rounded-full text-token-text-tertiary enabled:hover:bg-token-list-hover-background enabled:active:bg-token-foreground/15 data-[state=open]:bg-token-list-hover-background border-transparent h-token-button-composer-sm px-1.5 py-0 text-sm leading-[18px] outline-hidden min-w-0";
|
|
16460
16562
|
var MENU_CLASSES2 = "fixed z-50 overflow-hidden rounded-lg bg-token-dropdown-background/95 text-token-foreground shadow-lg ring-[0.5px] ring-token-border backdrop-blur-xl";
|
|
16461
16563
|
var OPTION_CLASSES2 = "flex w-full cursor-interaction items-start gap-2 rounded-md px-2 py-2 text-left text-sm text-token-foreground outline-none enabled:hover:bg-token-list-hover-background enabled:active:bg-token-foreground/15 disabled:cursor-not-allowed disabled:opacity-40";
|
|
16462
16564
|
function icon(node, size) {
|
|
@@ -16498,12 +16600,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16498
16600
|
control.menu.style.left = `${left}px`;
|
|
16499
16601
|
control.menu.style.bottom = `${Math.max(8, window.innerHeight - rect.top + 6)}px`;
|
|
16500
16602
|
}
|
|
16501
|
-
function syncRendererPermissionModeTriggerClass(control
|
|
16502
|
-
control.trigger.className =
|
|
16603
|
+
function syncRendererPermissionModeTriggerClass(control) {
|
|
16604
|
+
control.trigger.className = TRIGGER_CHIP_CLASS;
|
|
16503
16605
|
control.trigger.style.maxWidth = "min(220px, 34vw)";
|
|
16504
16606
|
control.trigger.style.letterSpacing = "0";
|
|
16505
16607
|
}
|
|
16506
|
-
function mountRendererPermissionModePicker(composerId,
|
|
16608
|
+
function mountRendererPermissionModePicker(composerId, onSelect) {
|
|
16609
|
+
ensureRendererTriggerChipStyle(document);
|
|
16507
16610
|
const root = document.createElement("div");
|
|
16508
16611
|
root.setAttribute("data-codexhost-permission-mode-control", composerId);
|
|
16509
16612
|
root.className = "relative min-w-0";
|
|
@@ -16513,6 +16616,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16513
16616
|
trigger.setAttribute("aria-haspopup", "menu");
|
|
16514
16617
|
trigger.setAttribute("aria-expanded", "false");
|
|
16515
16618
|
trigger.setAttribute("data-state", "closed");
|
|
16619
|
+
trigger.style.height = "28px";
|
|
16620
|
+
trigger.style.padding = "0 6px";
|
|
16621
|
+
trigger.style.gap = "4px";
|
|
16622
|
+
trigger.style.font = "400 13px/18px system-ui, sans-serif";
|
|
16516
16623
|
const shield = document.createElement("span");
|
|
16517
16624
|
shield.className = "inline-flex shrink-0 items-center";
|
|
16518
16625
|
shield.append(icon(Shield, 15));
|
|
@@ -16523,7 +16630,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16523
16630
|
label.style.textOverflow = "ellipsis";
|
|
16524
16631
|
label.style.whiteSpace = "nowrap";
|
|
16525
16632
|
const chevron = document.createElement("span");
|
|
16526
|
-
chevron.className = "inline-flex shrink-0 items-center
|
|
16633
|
+
chevron.className = "inline-flex shrink-0 items-center";
|
|
16634
|
+
chevron.style.color = "var(--color-text-tertiary, #8f8f8f)";
|
|
16527
16635
|
chevron.append(icon(ChevronDown, 14));
|
|
16528
16636
|
trigger.append(shield, label, chevron);
|
|
16529
16637
|
const menu = document.createElement("div");
|
|
@@ -16632,7 +16740,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16632
16740
|
root.remove();
|
|
16633
16741
|
}
|
|
16634
16742
|
};
|
|
16635
|
-
syncRendererPermissionModeTriggerClass(control
|
|
16743
|
+
syncRendererPermissionModeTriggerClass(control);
|
|
16636
16744
|
return control;
|
|
16637
16745
|
}
|
|
16638
16746
|
function rebuildOptions2(control, catalog) {
|
|
@@ -16674,7 +16782,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16674
16782
|
}
|
|
16675
16783
|
}
|
|
16676
16784
|
function renderRendererPermissionModePicker(control, view, visible) {
|
|
16677
|
-
control.root.style.display = visible ? "
|
|
16785
|
+
control.root.style.display = visible ? "inline-flex" : "none";
|
|
16786
|
+
control.root.style.alignItems = "center";
|
|
16787
|
+
control.root.style.alignSelf = "center";
|
|
16788
|
+
control.root.style.height = "28px";
|
|
16789
|
+
control.root.style.flex = "0 0 auto";
|
|
16790
|
+
control.root.style.verticalAlign = "middle";
|
|
16678
16791
|
if (!visible) {
|
|
16679
16792
|
control.close();
|
|
16680
16793
|
return;
|
|
@@ -16721,9 +16834,72 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16721
16834
|
function formatRendererCreditsPercent(value) {
|
|
16722
16835
|
return `${decimal(value, 1)}%`;
|
|
16723
16836
|
}
|
|
16837
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
16838
|
+
function createRendererUsageRing(percent, options) {
|
|
16839
|
+
const { size, strokeWidth, color } = options;
|
|
16840
|
+
const trackColor = options.trackColor ?? "color-mix(in srgb, currentColor 18%, transparent)";
|
|
16841
|
+
const radius = (size - strokeWidth) / 2;
|
|
16842
|
+
const circumference = 2 * Math.PI * radius;
|
|
16843
|
+
const clamped = Math.min(100, Math.max(0, percent));
|
|
16844
|
+
const offset = circumference * (1 - clamped / 100);
|
|
16845
|
+
const center = size / 2;
|
|
16846
|
+
const svg = document.createElementNS(SVG_NS, "svg");
|
|
16847
|
+
svg.setAttribute("width", String(size));
|
|
16848
|
+
svg.setAttribute("height", String(size));
|
|
16849
|
+
svg.setAttribute("viewBox", `0 0 ${size} ${size}`);
|
|
16850
|
+
svg.setAttribute("aria-hidden", "true");
|
|
16851
|
+
svg.style.display = "block";
|
|
16852
|
+
svg.style.flex = "0 0 auto";
|
|
16853
|
+
svg.style.transform = "rotate(-90deg)";
|
|
16854
|
+
const track = document.createElementNS(SVG_NS, "circle");
|
|
16855
|
+
track.setAttribute("cx", String(center));
|
|
16856
|
+
track.setAttribute("cy", String(center));
|
|
16857
|
+
track.setAttribute("r", String(radius));
|
|
16858
|
+
track.setAttribute("fill", "none");
|
|
16859
|
+
track.setAttribute("stroke", trackColor);
|
|
16860
|
+
track.setAttribute("stroke-width", String(strokeWidth));
|
|
16861
|
+
const fill = document.createElementNS(SVG_NS, "circle");
|
|
16862
|
+
fill.setAttribute("cx", String(center));
|
|
16863
|
+
fill.setAttribute("cy", String(center));
|
|
16864
|
+
fill.setAttribute("r", String(radius));
|
|
16865
|
+
fill.setAttribute("fill", "none");
|
|
16866
|
+
fill.setAttribute("stroke", color);
|
|
16867
|
+
fill.setAttribute("stroke-width", String(strokeWidth));
|
|
16868
|
+
fill.setAttribute("stroke-linecap", "round");
|
|
16869
|
+
fill.setAttribute("stroke-dasharray", String(circumference));
|
|
16870
|
+
fill.setAttribute("stroke-dashoffset", String(offset));
|
|
16871
|
+
svg.append(track, fill);
|
|
16872
|
+
return svg;
|
|
16873
|
+
}
|
|
16874
|
+
function formatRendererPlanReset(unixSeconds) {
|
|
16875
|
+
const date5 = new Date(unixSeconds * 1e3);
|
|
16876
|
+
if (Number.isNaN(date5.getTime())) return "";
|
|
16877
|
+
return date5.toLocaleString(void 0, {
|
|
16878
|
+
month: "long",
|
|
16879
|
+
day: "numeric",
|
|
16880
|
+
hour: "numeric",
|
|
16881
|
+
minute: "2-digit"
|
|
16882
|
+
});
|
|
16883
|
+
}
|
|
16884
|
+
function formatRendererPlanWindow(usedPercent, resetsAtUnix) {
|
|
16885
|
+
const percent = formatRendererCreditsPercent(usedPercent);
|
|
16886
|
+
if (resetsAtUnix === void 0) return percent;
|
|
16887
|
+
const reset = formatRendererPlanReset(resetsAtUnix);
|
|
16888
|
+
return reset.length > 0 ? `${percent} \xB7 ${reset}` : percent;
|
|
16889
|
+
}
|
|
16724
16890
|
function rendererUsageTriggerMaxWidth() {
|
|
16725
16891
|
return "min(180px, 30vw)";
|
|
16726
16892
|
}
|
|
16893
|
+
function rendererUsageHasDisplayData(usage) {
|
|
16894
|
+
return usage?.cacheHitRatePercent !== void 0 || usage?.outputTokensPerSecond !== void 0 || usage?.totalCostUsd !== void 0 || usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0 || usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0 || usage?.reasoningOutputTokens !== void 0 || usage?.planFiveHourUsedPercent !== void 0 || usage?.planSevenDayUsedPercent !== void 0;
|
|
16895
|
+
}
|
|
16896
|
+
function applyRendererPopoverChrome(popover) {
|
|
16897
|
+
popover.style.border = "1px solid light-dark(rgba(15, 23, 42, 0.10), color-mix(in srgb, CanvasText 16%, transparent))";
|
|
16898
|
+
popover.style.borderRadius = "14px";
|
|
16899
|
+
popover.style.backgroundColor = "light-dark(Canvas, color-mix(in srgb, Canvas 88%, white 12%))";
|
|
16900
|
+
popover.style.color = "CanvasText";
|
|
16901
|
+
popover.style.boxShadow = "light-dark(0 10px 24px rgba(15, 23, 42, 0.12), 0 20px 45px rgba(0, 0, 0, 0.42)), 0 2px 8px light-dark(rgba(15, 23, 42, 0.06), rgba(0, 0, 0, 0.28))";
|
|
16902
|
+
}
|
|
16727
16903
|
function addDetailRow(parent, label, value) {
|
|
16728
16904
|
const row = document.createElement("div");
|
|
16729
16905
|
row.style.display = "grid";
|
|
@@ -16774,6 +16950,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16774
16950
|
if (usage?.reasoningOutputTokens !== void 0) {
|
|
16775
16951
|
addDetailRow(popover, "Reasoning", formatRendererTokenCount(usage.reasoningOutputTokens));
|
|
16776
16952
|
}
|
|
16953
|
+
if (usage?.totalTokens !== void 0) {
|
|
16954
|
+
addDetailRow(popover, "Total tokens", formatRendererTokenCount(usage.totalTokens));
|
|
16955
|
+
}
|
|
16777
16956
|
if (usage?.inputTokens !== void 0 || usage?.outputTokens !== void 0) {
|
|
16778
16957
|
addDetailRow(
|
|
16779
16958
|
popover,
|
|
@@ -16781,6 +16960,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16781
16960
|
`${formatRendererTokenCount(usage.inputTokens ?? 0)} / ${formatRendererTokenCount(usage.outputTokens ?? 0)}`
|
|
16782
16961
|
);
|
|
16783
16962
|
}
|
|
16963
|
+
if (usage?.planFiveHourUsedPercent !== void 0) {
|
|
16964
|
+
addDetailRow(
|
|
16965
|
+
popover,
|
|
16966
|
+
"5-hour limit",
|
|
16967
|
+
formatRendererPlanWindow(usage.planFiveHourUsedPercent, usage.planFiveHourResetsAtUnix)
|
|
16968
|
+
);
|
|
16969
|
+
}
|
|
16970
|
+
if (usage?.planSevenDayUsedPercent !== void 0) {
|
|
16971
|
+
addDetailRow(
|
|
16972
|
+
popover,
|
|
16973
|
+
"7-day limit",
|
|
16974
|
+
formatRendererPlanWindow(usage.planSevenDayUsedPercent, usage.planSevenDayResetsAtUnix)
|
|
16975
|
+
);
|
|
16976
|
+
}
|
|
16784
16977
|
if (usage?.totalCostUsd !== void 0) {
|
|
16785
16978
|
addDetailRow(popover, "Session cost estimate", formatRendererCost(usage.totalCostUsd));
|
|
16786
16979
|
}
|
|
@@ -16821,34 +17014,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16821
17014
|
if (control.trigger.getAttribute("aria-expanded") === "true") closePopover(control);
|
|
16822
17015
|
else openPopover(control);
|
|
16823
17016
|
}
|
|
16824
|
-
function mountRendererUsageControl(composerId
|
|
17017
|
+
function mountRendererUsageControl(composerId) {
|
|
17018
|
+
ensureRendererTriggerChipStyle(document);
|
|
16825
17019
|
const root = document.createElement("div");
|
|
16826
17020
|
root.dataset.codexhostUsageControl = composerId;
|
|
16827
17021
|
root.className = "relative min-w-0";
|
|
16828
17022
|
root.style.display = "none";
|
|
17023
|
+
root.style.alignItems = "center";
|
|
17024
|
+
root.style.alignSelf = "center";
|
|
17025
|
+
root.style.height = "28px";
|
|
17026
|
+
root.style.flex = "0 0 auto";
|
|
17027
|
+
root.style.verticalAlign = "middle";
|
|
16829
17028
|
const trigger = document.createElement("button");
|
|
16830
|
-
|
|
16831
|
-
trigger.className = className?.trim() || RENDERER_MODEL_TRIGGER_FALLBACK_CLASSES;
|
|
16832
|
-
};
|
|
16833
|
-
syncNativeModelClassName(nativeModelClassName);
|
|
17029
|
+
trigger.className = TRIGGER_CHIP_CLASS;
|
|
16834
17030
|
trigger.type = "button";
|
|
16835
17031
|
trigger.setAttribute("aria-haspopup", "dialog");
|
|
16836
17032
|
trigger.setAttribute("aria-expanded", "false");
|
|
16837
17033
|
trigger.setAttribute("aria-label", "Thread Usage");
|
|
16838
17034
|
trigger.title = "Thread Usage";
|
|
16839
|
-
trigger.style.
|
|
16840
|
-
trigger.style.
|
|
17035
|
+
trigger.style.color = "var(--color-text-tertiary, #8f8f8f)";
|
|
17036
|
+
trigger.style.gap = "4px";
|
|
16841
17037
|
trigger.style.width = "fit-content";
|
|
16842
17038
|
trigger.style.maxWidth = rendererUsageTriggerMaxWidth();
|
|
16843
|
-
trigger.style.height = "
|
|
16844
|
-
trigger.style.padding = "0
|
|
16845
|
-
trigger.style.
|
|
17039
|
+
trigger.style.height = "28px";
|
|
17040
|
+
trigger.style.padding = "0 8px";
|
|
17041
|
+
trigger.style.verticalAlign = "middle";
|
|
16846
17042
|
trigger.style.fontSize = "12px";
|
|
16847
17043
|
trigger.style.lineHeight = "16px";
|
|
16848
17044
|
trigger.style.fontVariantNumeric = "tabular-nums";
|
|
16849
17045
|
trigger.style.letterSpacing = "0";
|
|
16850
|
-
trigger.style.whiteSpace = "nowrap";
|
|
16851
|
-
trigger.style.cursor = "pointer";
|
|
16852
17046
|
const label = document.createElement("span");
|
|
16853
17047
|
label.style.display = "inline-block";
|
|
16854
17048
|
label.style.maxWidth = "100%";
|
|
@@ -16867,11 +17061,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16867
17061
|
popover.style.width = "260px";
|
|
16868
17062
|
popover.style.maxWidth = "min(320px, calc(100vw - 24px))";
|
|
16869
17063
|
popover.style.padding = "10px 12px";
|
|
16870
|
-
popover
|
|
16871
|
-
popover.style.borderRadius = "6px";
|
|
16872
|
-
popover.style.background = "Canvas";
|
|
16873
|
-
popover.style.color = "CanvasText";
|
|
16874
|
-
popover.style.boxShadow = "0 8px 24px rgba(0, 0, 0, 0.28)";
|
|
17064
|
+
applyRendererPopoverChrome(popover);
|
|
16875
17065
|
popover.style.font = "13px/1.35 system-ui, sans-serif";
|
|
16876
17066
|
popover.style.letterSpacing = "0";
|
|
16877
17067
|
popover.style.zIndex = "2147483647";
|
|
@@ -16883,7 +17073,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16883
17073
|
popover,
|
|
16884
17074
|
anchor: null,
|
|
16885
17075
|
label,
|
|
16886
|
-
syncNativeModelClassName,
|
|
16887
17076
|
dispose() {
|
|
16888
17077
|
closePopover(control);
|
|
16889
17078
|
if (closeTimer !== null) window.clearTimeout(closeTimer);
|
|
@@ -16893,18 +17082,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16893
17082
|
},
|
|
16894
17083
|
place(anchor) {
|
|
16895
17084
|
if (!anchor?.parentElement) return false;
|
|
16896
|
-
|
|
16897
|
-
|
|
16898
|
-
while (container.parentElement && (getComputedStyle(container).display === "inline" || container.tagName === "SPAN" && container.attributes.length === 0)) {
|
|
16899
|
-
reference = container;
|
|
16900
|
-
container = container.parentElement;
|
|
16901
|
-
}
|
|
16902
|
-
if (control.anchor === anchor && placementReference === reference && root.parentElement === container && root.nextElementSibling === reference) {
|
|
17085
|
+
const container = anchor.parentElement;
|
|
17086
|
+
if (control.anchor === anchor && placementReference === anchor && root.parentElement === container && root.nextElementSibling === anchor) {
|
|
16903
17087
|
return true;
|
|
16904
17088
|
}
|
|
16905
17089
|
control.anchor = anchor;
|
|
16906
|
-
placementReference =
|
|
16907
|
-
container.insertBefore(root,
|
|
17090
|
+
placementReference = anchor;
|
|
17091
|
+
container.insertBefore(root, anchor);
|
|
16908
17092
|
return true;
|
|
16909
17093
|
}
|
|
16910
17094
|
};
|
|
@@ -16946,10 +17130,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16946
17130
|
const cacheHitRatePercent = usage?.cacheHitRatePercent;
|
|
16947
17131
|
const outputTokensPerSecond = usage?.outputTokensPerSecond;
|
|
16948
17132
|
const totalCostUsd = usage?.totalCostUsd;
|
|
16949
|
-
const
|
|
16950
|
-
const
|
|
16951
|
-
const
|
|
16952
|
-
const visible =
|
|
17133
|
+
const hasContext = usage?.contextUsedTokens !== void 0 && usage.contextWindowTokens !== void 0;
|
|
17134
|
+
const hasTokenUsage = usage?.totalTokens !== void 0 || usage?.inputTokens !== void 0 || usage?.cachedInputTokens !== void 0 || usage?.cacheWriteInputTokens !== void 0 || usage?.outputTokens !== void 0 || usage?.reasoningOutputTokens !== void 0;
|
|
17135
|
+
const hasPlanLimit = usage?.planFiveHourUsedPercent !== void 0 || usage?.planSevenDayUsedPercent !== void 0;
|
|
17136
|
+
const visible = rendererUsageHasDisplayData(usage);
|
|
16953
17137
|
control.root.style.display = visible ? "inline-flex" : "none";
|
|
16954
17138
|
if (!visible) {
|
|
16955
17139
|
closePopover(control);
|
|
@@ -16960,6 +17144,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16960
17144
|
outputTokensPerSecond !== void 0 ? formatRendererTokenRate(outputTokensPerSecond) : null,
|
|
16961
17145
|
totalCostUsd !== void 0 ? formatRendererCost(totalCostUsd) : null
|
|
16962
17146
|
].filter((value) => value !== null);
|
|
17147
|
+
if (summary.length === 0 && hasContext && usage?.contextWindowTokens !== void 0 && usage.contextWindowTokens > 0) {
|
|
17148
|
+
summary.push(
|
|
17149
|
+
`${decimal((usage.contextUsedTokens ?? 0) / usage.contextWindowTokens * 100, 1)}% context`
|
|
17150
|
+
);
|
|
17151
|
+
}
|
|
17152
|
+
if (summary.length === 0 && usage?.totalTokens !== void 0) {
|
|
17153
|
+
summary.push(`${formatRendererTokenCount(usage.totalTokens)} tokens`);
|
|
17154
|
+
}
|
|
17155
|
+
if (summary.length === 0 && hasTokenUsage) {
|
|
17156
|
+
summary.push(
|
|
17157
|
+
`${formatRendererTokenCount((usage?.inputTokens ?? 0) + (usage?.outputTokens ?? 0))} tokens`
|
|
17158
|
+
);
|
|
17159
|
+
}
|
|
17160
|
+
if (summary.length === 0 && hasPlanLimit) {
|
|
17161
|
+
summary.push(
|
|
17162
|
+
usage?.planFiveHourUsedPercent !== void 0 ? `5h ${formatRendererCreditsPercent(usage.planFiveHourUsedPercent)}` : `7d ${formatRendererCreditsPercent(usage?.planSevenDayUsedPercent ?? 0)}`
|
|
17163
|
+
);
|
|
17164
|
+
}
|
|
16963
17165
|
const compactSummary = summary.join(" \xB7 ");
|
|
16964
17166
|
const accessibleSummary = `Thread Usage: ${compactSummary}`;
|
|
16965
17167
|
control.trigger.style.maxWidth = rendererUsageTriggerMaxWidth();
|
|
@@ -16976,11 +17178,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16976
17178
|
if (usedPercent >= 70) return "warn";
|
|
16977
17179
|
return "ok";
|
|
16978
17180
|
}
|
|
16979
|
-
function formatRendererCreditsReset(value) {
|
|
17181
|
+
function formatRendererCreditsReset(value, now = /* @__PURE__ */ new Date()) {
|
|
16980
17182
|
const date5 = new Date(value);
|
|
16981
17183
|
if (Number.isNaN(date5.getTime())) return value;
|
|
17184
|
+
const isToday = date5.getFullYear() === now.getFullYear() && date5.getMonth() === now.getMonth() && date5.getDate() === now.getDate();
|
|
17185
|
+
if (isToday) {
|
|
17186
|
+
return `${date5.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" })} today`;
|
|
17187
|
+
}
|
|
16982
17188
|
return date5.toLocaleString(void 0, {
|
|
16983
|
-
month: "
|
|
17189
|
+
month: "short",
|
|
16984
17190
|
day: "numeric",
|
|
16985
17191
|
hour: "numeric",
|
|
16986
17192
|
minute: "2-digit"
|
|
@@ -16989,6 +17195,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16989
17195
|
function creditsPeriodLabel(periodType) {
|
|
16990
17196
|
if (periodType === "weekly") return "Weekly limit";
|
|
16991
17197
|
if (periodType === "monthly") return "Monthly limit";
|
|
17198
|
+
if (periodType === "five_hour") return "5-hour limit";
|
|
17199
|
+
if (periodType === "seven_day") return "7-day limit";
|
|
16992
17200
|
return "Account limit";
|
|
16993
17201
|
}
|
|
16994
17202
|
function productLabel(product) {
|
|
@@ -17003,40 +17211,97 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17003
17211
|
if (tone === "warn") return "#c9a227";
|
|
17004
17212
|
return "#3d9a64";
|
|
17005
17213
|
}
|
|
17006
|
-
function
|
|
17007
|
-
const
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17020
|
-
|
|
17214
|
+
function renderCreditsBar(usagePercent, color) {
|
|
17215
|
+
const track = document.createElement("div");
|
|
17216
|
+
track.dataset.codexhostCreditsBar = "";
|
|
17217
|
+
track.style.height = "6px";
|
|
17218
|
+
track.style.borderRadius = "9999px";
|
|
17219
|
+
track.style.background = "color-mix(in srgb, currentColor 16%, transparent)";
|
|
17220
|
+
track.style.overflow = "hidden";
|
|
17221
|
+
const fill = document.createElement("span");
|
|
17222
|
+
fill.style.display = "block";
|
|
17223
|
+
fill.style.height = "100%";
|
|
17224
|
+
fill.style.borderRadius = "9999px";
|
|
17225
|
+
fill.style.width = `${Math.min(100, Math.max(0, usagePercent))}%`;
|
|
17226
|
+
fill.style.background = color;
|
|
17227
|
+
track.append(fill);
|
|
17228
|
+
return track;
|
|
17229
|
+
}
|
|
17230
|
+
function renderCreditsHeader(credits) {
|
|
17231
|
+
const wrapper = document.createElement("div");
|
|
17232
|
+
wrapper.style.marginBottom = "11px";
|
|
17233
|
+
const top = document.createElement("div");
|
|
17234
|
+
top.style.display = "flex";
|
|
17235
|
+
top.style.alignItems = "flex-start";
|
|
17236
|
+
top.style.justifyContent = "space-between";
|
|
17237
|
+
top.style.gap = "12px";
|
|
17238
|
+
top.style.marginBottom = "5px";
|
|
17239
|
+
const left = document.createElement("div");
|
|
17240
|
+
const label = document.createElement("div");
|
|
17241
|
+
label.textContent = creditsPeriodLabel(credits.periodType);
|
|
17242
|
+
label.style.fontSize = "12.5px";
|
|
17243
|
+
label.style.fontWeight = "600";
|
|
17244
|
+
left.append(label);
|
|
17245
|
+
if (credits.resetsAt) {
|
|
17246
|
+
const reset = document.createElement("div");
|
|
17247
|
+
reset.textContent = `resets ${formatRendererCreditsReset(credits.resetsAt)}`;
|
|
17248
|
+
reset.style.fontSize = "11px";
|
|
17249
|
+
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
17250
|
+
left.append(reset);
|
|
17251
|
+
}
|
|
17252
|
+
const color = toneColor(rendererCreditsTone(credits.usedPercent));
|
|
17253
|
+
const percent = document.createElement("span");
|
|
17254
|
+
percent.textContent = formatRendererCreditsPercent(credits.usedPercent);
|
|
17255
|
+
percent.style.fontSize = "26px";
|
|
17256
|
+
percent.style.fontWeight = "700";
|
|
17257
|
+
percent.style.fontVariantNumeric = "tabular-nums";
|
|
17258
|
+
percent.style.color = color;
|
|
17259
|
+
top.append(left, percent);
|
|
17260
|
+
wrapper.append(top, renderCreditsBar(credits.usedPercent, color));
|
|
17261
|
+
return wrapper;
|
|
17262
|
+
}
|
|
17263
|
+
function renderCreditsTile(label, usagePercent, resetsAt) {
|
|
17264
|
+
const color = toneColor(rendererCreditsTone(usagePercent));
|
|
17265
|
+
const tile = document.createElement("div");
|
|
17266
|
+
tile.style.marginBottom = "11px";
|
|
17267
|
+
const top = document.createElement("div");
|
|
17268
|
+
top.style.display = "flex";
|
|
17269
|
+
top.style.alignItems = "flex-start";
|
|
17270
|
+
top.style.justifyContent = "space-between";
|
|
17271
|
+
top.style.gap = "12px";
|
|
17272
|
+
top.style.marginBottom = "5px";
|
|
17273
|
+
const left = document.createElement("div");
|
|
17274
|
+
const name = document.createElement("span");
|
|
17275
|
+
name.textContent = label;
|
|
17276
|
+
name.style.fontSize = "12px";
|
|
17277
|
+
left.append(name);
|
|
17278
|
+
if (resetsAt) {
|
|
17279
|
+
const reset = document.createElement("div");
|
|
17280
|
+
reset.textContent = `resets ${formatRendererCreditsReset(resetsAt)}`;
|
|
17281
|
+
reset.style.fontSize = "10.5px";
|
|
17282
|
+
reset.style.color = "color-mix(in srgb, currentColor 62%, transparent)";
|
|
17283
|
+
left.append(reset);
|
|
17284
|
+
}
|
|
17285
|
+
const percent = document.createElement("span");
|
|
17286
|
+
percent.textContent = formatRendererCreditsPercent(usagePercent);
|
|
17287
|
+
percent.style.fontSize = "12px";
|
|
17288
|
+
percent.style.fontVariantNumeric = "tabular-nums";
|
|
17289
|
+
percent.style.color = color;
|
|
17290
|
+
top.append(left, percent);
|
|
17291
|
+
tile.append(top, renderCreditsBar(usagePercent, color));
|
|
17292
|
+
return tile;
|
|
17021
17293
|
}
|
|
17022
17294
|
function renderDetails2(popover, credits) {
|
|
17295
|
+
const glowColor = toneColor(rendererCreditsTone(credits.usedPercent));
|
|
17296
|
+
popover.style.backgroundImage = `radial-gradient(160px 100px at 18% -10%, color-mix(in srgb, ${glowColor} 20%, transparent), transparent 70%)`;
|
|
17023
17297
|
popover.replaceChildren();
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
|
|
17028
|
-
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
addDetailRow2(popover, "Resets", formatRendererCreditsReset(credits.resetsAt));
|
|
17032
|
-
}
|
|
17033
|
-
for (const product of credits.productUsage ?? []) {
|
|
17034
|
-
addDetailRow2(
|
|
17035
|
-
popover,
|
|
17036
|
-
productLabel(product.product),
|
|
17037
|
-
formatRendererCreditsPercent(product.usagePercent)
|
|
17038
|
-
);
|
|
17039
|
-
}
|
|
17298
|
+
popover.append(renderCreditsHeader(credits));
|
|
17299
|
+
const tiles = (credits.productUsage ?? []).map(
|
|
17300
|
+
(product) => renderCreditsTile(productLabel(product.product), product.usagePercent, product.resetsAt)
|
|
17301
|
+
);
|
|
17302
|
+
const lastTile = tiles.at(-1);
|
|
17303
|
+
if (lastTile) lastTile.style.marginBottom = "0";
|
|
17304
|
+
popover.append(...tiles);
|
|
17040
17305
|
}
|
|
17041
17306
|
function popoverIsOpen2(popover) {
|
|
17042
17307
|
try {
|
|
@@ -17074,43 +17339,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17074
17339
|
if (control.trigger.getAttribute("aria-expanded") === "true") closePopover2(control);
|
|
17075
17340
|
else openPopover2(control);
|
|
17076
17341
|
}
|
|
17077
|
-
function mountRendererCreditsControl(composerId
|
|
17342
|
+
function mountRendererCreditsControl(composerId) {
|
|
17343
|
+
ensureRendererTriggerChipStyle(document);
|
|
17078
17344
|
const root = document.createElement("div");
|
|
17079
17345
|
root.dataset.codexhostCreditsControl = composerId;
|
|
17080
17346
|
root.className = "relative min-w-0";
|
|
17081
17347
|
root.style.display = "none";
|
|
17348
|
+
root.style.alignItems = "center";
|
|
17349
|
+
root.style.alignSelf = "center";
|
|
17350
|
+
root.style.height = "28px";
|
|
17351
|
+
root.style.flex = "0 0 auto";
|
|
17352
|
+
root.style.verticalAlign = "middle";
|
|
17082
17353
|
const trigger = document.createElement("button");
|
|
17083
|
-
|
|
17084
|
-
trigger.className = className?.trim() || RENDERER_MODEL_TRIGGER_FALLBACK_CLASSES;
|
|
17085
|
-
};
|
|
17086
|
-
syncNativeModelClassName(nativeModelClassName);
|
|
17354
|
+
trigger.className = TRIGGER_CHIP_CLASS;
|
|
17087
17355
|
trigger.type = "button";
|
|
17088
17356
|
trigger.setAttribute("aria-haspopup", "dialog");
|
|
17089
17357
|
trigger.setAttribute("aria-expanded", "false");
|
|
17090
17358
|
trigger.setAttribute("aria-label", "Account limit");
|
|
17091
17359
|
trigger.title = "Account limit";
|
|
17092
|
-
trigger.style.display = "inline-flex";
|
|
17093
|
-
trigger.style.alignItems = "center";
|
|
17094
17360
|
trigger.style.gap = "5px";
|
|
17095
17361
|
trigger.style.width = "fit-content";
|
|
17096
17362
|
trigger.style.maxWidth = "min(72px, 18vw)";
|
|
17097
|
-
trigger.style.height = "
|
|
17098
|
-
trigger.style.padding = "0
|
|
17099
|
-
trigger.style.
|
|
17363
|
+
trigger.style.height = "28px";
|
|
17364
|
+
trigger.style.padding = "0 8px";
|
|
17365
|
+
trigger.style.verticalAlign = "middle";
|
|
17100
17366
|
trigger.style.fontSize = "12px";
|
|
17101
17367
|
trigger.style.lineHeight = "16px";
|
|
17102
17368
|
trigger.style.fontVariantNumeric = "tabular-nums";
|
|
17103
17369
|
trigger.style.letterSpacing = "0";
|
|
17104
|
-
|
|
17105
|
-
|
|
17106
|
-
|
|
17107
|
-
|
|
17108
|
-
dot.setAttribute("aria-hidden", "true");
|
|
17109
|
-
dot.style.display = "inline-block";
|
|
17110
|
-
dot.style.width = "7px";
|
|
17111
|
-
dot.style.height = "7px";
|
|
17112
|
-
dot.style.borderRadius = "9999px";
|
|
17113
|
-
dot.style.flex = "0 0 auto";
|
|
17370
|
+
const ringSlot = document.createElement("span");
|
|
17371
|
+
ringSlot.dataset.codexhostCreditsRing = "";
|
|
17372
|
+
ringSlot.style.display = "inline-flex";
|
|
17373
|
+
ringSlot.style.flex = "0 0 auto";
|
|
17114
17374
|
const label = document.createElement("span");
|
|
17115
17375
|
label.dataset.codexhostCreditsLabel = "";
|
|
17116
17376
|
label.style.display = "inline-block";
|
|
@@ -17118,7 +17378,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17118
17378
|
label.style.overflow = "hidden";
|
|
17119
17379
|
label.style.textOverflow = "ellipsis";
|
|
17120
17380
|
label.style.whiteSpace = "nowrap";
|
|
17121
|
-
trigger.append(
|
|
17381
|
+
trigger.append(ringSlot, label);
|
|
17122
17382
|
const popover = document.createElement("div");
|
|
17123
17383
|
popover.id = `${composerId}-credits-popover`;
|
|
17124
17384
|
popover.setAttribute("role", "dialog");
|
|
@@ -17130,11 +17390,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17130
17390
|
popover.style.width = "240px";
|
|
17131
17391
|
popover.style.maxWidth = "min(280px, calc(100vw - 24px))";
|
|
17132
17392
|
popover.style.padding = "10px 12px";
|
|
17133
|
-
popover
|
|
17134
|
-
popover.style.borderRadius = "6px";
|
|
17135
|
-
popover.style.background = "Canvas";
|
|
17136
|
-
popover.style.color = "CanvasText";
|
|
17137
|
-
popover.style.boxShadow = "0 8px 24px rgba(0, 0, 0, 0.28)";
|
|
17393
|
+
applyRendererPopoverChrome(popover);
|
|
17138
17394
|
popover.style.font = "13px/1.35 system-ui, sans-serif";
|
|
17139
17395
|
popover.style.letterSpacing = "0";
|
|
17140
17396
|
popover.style.zIndex = "2147483647";
|
|
@@ -17145,7 +17401,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17145
17401
|
trigger,
|
|
17146
17402
|
popover,
|
|
17147
17403
|
anchor: null,
|
|
17148
|
-
syncNativeModelClassName,
|
|
17149
17404
|
dispose() {
|
|
17150
17405
|
closePopover2(control);
|
|
17151
17406
|
if (closeTimer !== null) window.clearTimeout(closeTimer);
|
|
@@ -17156,14 +17411,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17156
17411
|
place(anchor) {
|
|
17157
17412
|
if (!anchor?.parentElement) return false;
|
|
17158
17413
|
const parent = anchor.parentElement;
|
|
17159
|
-
|
|
17160
|
-
if (control.anchor === anchor && placementReference === anchor && root.parentElement === parent && root.previousElementSibling === anchor) {
|
|
17414
|
+
if (control.anchor === anchor && placementReference === anchor && root.parentElement === parent && root.nextElementSibling === anchor) {
|
|
17161
17415
|
return true;
|
|
17162
17416
|
}
|
|
17163
17417
|
control.anchor = anchor;
|
|
17164
17418
|
placementReference = anchor;
|
|
17165
|
-
if (
|
|
17166
|
-
else if (next !== root) parent.append(root);
|
|
17419
|
+
if (root !== anchor) parent.insertBefore(root, anchor);
|
|
17167
17420
|
return true;
|
|
17168
17421
|
}
|
|
17169
17422
|
};
|
|
@@ -17209,9 +17462,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17209
17462
|
const percent = formatRendererCreditsPercent(accountCredits.usedPercent);
|
|
17210
17463
|
const title = `${creditsPeriodLabel(accountCredits.periodType)} ${percent}`;
|
|
17211
17464
|
const tone = rendererCreditsTone(accountCredits.usedPercent);
|
|
17212
|
-
const
|
|
17465
|
+
const ringSlot = control.trigger.querySelector("[data-codexhost-credits-ring]");
|
|
17213
17466
|
const label = control.trigger.querySelector("[data-codexhost-credits-label]");
|
|
17214
|
-
if (
|
|
17467
|
+
if (ringSlot) {
|
|
17468
|
+
ringSlot.replaceChildren(
|
|
17469
|
+
createRendererUsageRing(accountCredits.usedPercent, {
|
|
17470
|
+
size: 14,
|
|
17471
|
+
strokeWidth: 2.4,
|
|
17472
|
+
color: toneColor(tone)
|
|
17473
|
+
})
|
|
17474
|
+
);
|
|
17475
|
+
}
|
|
17215
17476
|
if (label) label.textContent = percent;
|
|
17216
17477
|
control.root.style.display = "inline-flex";
|
|
17217
17478
|
control.trigger.setAttribute("aria-label", title);
|
|
@@ -17226,21 +17487,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17226
17487
|
var MENU_WIDTH = 320;
|
|
17227
17488
|
var VIEWPORT_MARGIN = 8;
|
|
17228
17489
|
var MENU_GAP2 = 8;
|
|
17229
|
-
var
|
|
17490
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
17230
17491
|
var COMMAND_ICON_PATHS = [
|
|
17231
17492
|
"M409.6 377.6h204.8a32 32 0 0 1 32 32v204.8a32 32 0 0 1-32 32H409.6a32 32 0 0 1-32-32V409.6a32 32 0 0 1 32-32z m172.8 64h-140.8v140.8h140.8z",
|
|
17232
17493
|
"M332.8 800a108.8 108.8 0 0 1 0-217.6h76.8a32 32 0 0 1 32 32v76.8a108.928 108.928 0 0 1-108.8 108.8z m0-153.6a44.8 44.8 0 1 0 44.8 44.8v-44.8zM409.6 441.6H332.8a108.8 108.8 0 1 1 108.8-108.8v76.8a32 32 0 0 1-32 32z m-76.8-153.6a44.8 44.8 0 0 0 0 89.6h44.8V332.8A44.842667 44.842667 0 0 0 332.8 288zM691.2 441.6h-76.8a32 32 0 0 1-32-32V332.8a108.8 108.8 0 1 1 108.8 108.8z m-44.8-64h44.8a44.8 44.8 0 1 0-44.8-44.8zM691.2 800a108.928 108.928 0 0 1-108.8-108.8v-76.8a32 32 0 0 1 32-32h76.8a108.8 108.8 0 0 1 0 217.6z m-44.8-153.6v44.8a44.8 44.8 0 1 0 44.8-44.8z",
|
|
17233
17494
|
"M640 970.666667H384c-118.186667 0-198.272-25.002667-251.946667-78.72S53.333333 758.186667 53.333333 640V384c0-118.186667 25.002667-198.272 78.72-251.946667S265.813333 53.333333 384 53.333333h256c118.186667 0 198.272 25.002667 251.946667 78.72S970.666667 265.813333 970.666667 384v256c0 118.186667-25.002667 198.272-78.72 251.946667S758.186667 970.666667 640 970.666667z m-256-853.333334c-100.096 0-165.802667 19.2-206.72 59.946667S117.333333 283.904 117.333333 384v256c0 100.096 19.072 165.802667 59.946667 206.72S283.904 906.666667 384 906.666667h256c100.096 0 165.802667-19.072 206.72-59.946667S906.666667 740.096 906.666667 640V384c0-100.096-19.072-165.802667-59.946667-206.72S740.096 117.333333 640 117.333333z"
|
|
17234
17495
|
];
|
|
17235
17496
|
function commandIcon(ownerDocument) {
|
|
17236
|
-
const svg = ownerDocument.createElementNS(
|
|
17497
|
+
const svg = ownerDocument.createElementNS(SVG_NS2, "svg");
|
|
17237
17498
|
svg.setAttribute("viewBox", "0 0 1024 1024");
|
|
17238
17499
|
svg.setAttribute("width", "15");
|
|
17239
17500
|
svg.setAttribute("height", "15");
|
|
17240
17501
|
svg.setAttribute("fill", "currentColor");
|
|
17241
17502
|
svg.setAttribute("aria-hidden", "true");
|
|
17242
17503
|
for (const path of COMMAND_ICON_PATHS) {
|
|
17243
|
-
const element = ownerDocument.createElementNS(
|
|
17504
|
+
const element = ownerDocument.createElementNS(SVG_NS2, "path");
|
|
17244
17505
|
element.setAttribute("d", path);
|
|
17245
17506
|
svg.append(element);
|
|
17246
17507
|
}
|
|
@@ -17560,7 +17821,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17560
17821
|
}
|
|
17561
17822
|
var VOICE_CONTROL_PATTERN = /(dictat|microphone|speech(?:[-_\s]?to[-_\s]?text)?|voice[-_\s]?input|(^|\s)voice(\s|$)|composer[-_](?:speech|dictat|mic)|语音|听写|麦克风|pause|暂停|stop recording|stop dictation|停止录音|停止听写|(^|\s)stop(\s|$))/iu;
|
|
17562
17823
|
var CANCEL_CONTROL_PATTERN = /(cancel|discard|close|dismiss|取消|关闭|丢弃)/iu;
|
|
17563
|
-
var ATTACH_CONTROL_PATTERN = /(add files|attach files|attach file|attachment|composer[-_]attach|添加文件|附件)/iu;
|
|
17564
17824
|
var TRAILING_ACTION_WALK_DEPTH = 3;
|
|
17565
17825
|
function isComposerCancelButton(element) {
|
|
17566
17826
|
if (isOwnedRendererControl(element)) return false;
|
|
@@ -17572,10 +17832,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17572
17832
|
if (/(^|\s)(send|submit|发送|提交)(\s|$)/u.test(description)) return false;
|
|
17573
17833
|
return VOICE_CONTROL_PATTERN.test(description);
|
|
17574
17834
|
}
|
|
17575
|
-
function isComposerAttachButton(element) {
|
|
17576
|
-
if (isOwnedRendererControl(element)) return false;
|
|
17577
|
-
return ATTACH_CONTROL_PATTERN.test(controlDescription(element));
|
|
17578
|
-
}
|
|
17579
17835
|
function isComposerTrailingActionButton(element) {
|
|
17580
17836
|
return isComposerVoiceButton(element) || isComposerSubmitButton(element);
|
|
17581
17837
|
}
|
|
@@ -17586,14 +17842,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17586
17842
|
const buttons = [...element.querySelectorAll("button")];
|
|
17587
17843
|
return buttons.length > 0 && buttons.every((button) => isComposerTrailingActionButton(button));
|
|
17588
17844
|
}
|
|
17589
|
-
function attachControlWithin(root) {
|
|
17590
|
-
if (isComposerAttachButton(root)) return root;
|
|
17591
|
-
if (typeof root.querySelectorAll !== "function") return null;
|
|
17592
|
-
const matches = [
|
|
17593
|
-
...root.querySelectorAll("button, [aria-label], [title], [data-testid]")
|
|
17594
|
-
].filter(isComposerAttachButton);
|
|
17595
|
-
return matches.length === 1 ? matches[0] ?? null : null;
|
|
17596
|
-
}
|
|
17597
17845
|
function sendButtonWithin(root) {
|
|
17598
17846
|
return [...root.querySelectorAll("button")].find(
|
|
17599
17847
|
(button) => isComposerSubmitButton(button)
|
|
@@ -17708,23 +17956,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17708
17956
|
].filter((element) => isNativeModelControlCandidate(element));
|
|
17709
17957
|
return candidates.length === 1 ? candidates[0] ?? null : null;
|
|
17710
17958
|
}
|
|
17711
|
-
var contextUsageDescriptionPattern = /(context|token|上下文|令牌)/iu;
|
|
17712
17959
|
function isNativeContextUsageControlCandidate(element) {
|
|
17713
17960
|
if (element.hasAttribute("data-codexhost-usage-control") || element.hasAttribute("data-codexhost-credits-control")) {
|
|
17714
17961
|
return false;
|
|
17715
17962
|
}
|
|
17716
|
-
|
|
17717
|
-
element.getAttribute("aria-label"),
|
|
17718
|
-
element.getAttribute("title"),
|
|
17719
|
-
element.getAttribute("data-testid")
|
|
17720
|
-
].filter((value) => value !== null).join(" ");
|
|
17721
|
-
return contextUsageDescriptionPattern.test(description);
|
|
17963
|
+
return element.matches('span[role="img"][aria-label]') && element.querySelectorAll("svg > circle").length === 2;
|
|
17722
17964
|
}
|
|
17723
17965
|
function nativeContextUsageControlForComposer(composer) {
|
|
17724
17966
|
const candidates = [
|
|
17725
|
-
...composer.querySelectorAll(
|
|
17726
|
-
'button, [role="button"], [aria-label], [title], [data-testid]'
|
|
17727
|
-
)
|
|
17967
|
+
...composer.querySelectorAll('span[role="img"][aria-label]')
|
|
17728
17968
|
].filter(isNativeContextUsageControlCandidate);
|
|
17729
17969
|
return candidates.length === 1 ? candidates[0] ?? null : null;
|
|
17730
17970
|
}
|
|
@@ -17741,53 +17981,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17741
17981
|
if (state.ariaHidden === null) state.element.removeAttribute("aria-hidden");
|
|
17742
17982
|
else state.element.setAttribute("aria-hidden", state.ariaHidden);
|
|
17743
17983
|
}
|
|
17984
|
+
function refreshNativeContextUsageControl(control) {
|
|
17985
|
+
const candidate = nativeContextUsageControlForComposer(control.composer);
|
|
17986
|
+
if (candidate === control.nativeContextUsageControl?.element) return;
|
|
17987
|
+
restoreNativeControl(control.nativeContextUsageControl);
|
|
17988
|
+
control.nativeContextUsageControl = captureNativeControl(candidate);
|
|
17989
|
+
}
|
|
17744
17990
|
function refreshNativeModelControl(control) {
|
|
17745
17991
|
const candidate = nativeModelControlForComposer(control.composer);
|
|
17746
|
-
if (!candidate)
|
|
17747
|
-
control.usage.syncNativeModelClassName();
|
|
17748
|
-
control.credits.syncNativeModelClassName();
|
|
17749
|
-
return;
|
|
17750
|
-
}
|
|
17992
|
+
if (!candidate) return;
|
|
17751
17993
|
if (candidate !== control.nativeModelControl?.element) {
|
|
17752
17994
|
restoreNativeControl(control.nativeModelControl);
|
|
17753
17995
|
control.nativeModelControl = captureNativeControl(candidate);
|
|
17754
|
-
syncRendererModelTriggerClass(control.modelPicker
|
|
17996
|
+
syncRendererModelTriggerClass(control.modelPicker);
|
|
17755
17997
|
}
|
|
17756
|
-
control.usage.syncNativeModelClassName(candidate.className);
|
|
17757
|
-
control.credits.syncNativeModelClassName(candidate.className);
|
|
17758
17998
|
}
|
|
17759
17999
|
function usagePlacementAnchor(control) {
|
|
17760
|
-
const context =
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
return native?.parentElement ? native : null;
|
|
17766
|
-
}
|
|
17767
|
-
function firstMaterialChild(parent) {
|
|
17768
|
-
for (const child of parent.children) {
|
|
17769
|
-
if (typeof child.hasAttribute !== "function") continue;
|
|
17770
|
-
const element = child;
|
|
17771
|
-
if (element.hasAttribute("data-codexhost-credits-control") || element.hasAttribute("data-codexhost-harness-command-control") || isTrailingActionNode(element)) {
|
|
17772
|
-
continue;
|
|
17773
|
-
}
|
|
17774
|
-
return element;
|
|
17775
|
-
}
|
|
17776
|
-
return null;
|
|
18000
|
+
const context = control.nativeContextUsageControl?.element;
|
|
18001
|
+
const contextWrapper = context?.parentElement;
|
|
18002
|
+
if (contextWrapper?.parentElement) return contextWrapper;
|
|
18003
|
+
const modelRoot = control.modelPicker?.root;
|
|
18004
|
+
return modelRoot?.parentElement ? modelRoot : null;
|
|
17777
18005
|
}
|
|
17778
|
-
function creditsPlacementAnchor(
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
const parent = current.parentElement;
|
|
17782
|
-
if (!parent) break;
|
|
17783
|
-
const first = firstMaterialChild(parent);
|
|
17784
|
-
if (first && first !== current && !first.contains(usageRoot)) {
|
|
17785
|
-
return attachControlWithin(first) ?? first;
|
|
17786
|
-
}
|
|
17787
|
-
if (parent === composer) break;
|
|
17788
|
-
current = parent;
|
|
17789
|
-
}
|
|
17790
|
-
return null;
|
|
18006
|
+
function creditsPlacementAnchor(control) {
|
|
18007
|
+
const root = control.permissionModePicker?.root;
|
|
18008
|
+
return root?.parentElement ? root : null;
|
|
17791
18009
|
}
|
|
17792
18010
|
function refreshTrailingClusterPlacement(control) {
|
|
17793
18011
|
const sendButton = control.sendButton;
|
|
@@ -17805,11 +18023,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17805
18023
|
}
|
|
17806
18024
|
function refreshUsagePlacement(control) {
|
|
17807
18025
|
const anchor = usagePlacementAnchor(control);
|
|
17808
|
-
if (!anchor) {
|
|
17809
|
-
if (control.usage
|
|
17810
|
-
control.usage.anchor = null;
|
|
17811
|
-
if (control.credits.anchor) control.credits.root.remove();
|
|
17812
|
-
control.credits.anchor = null;
|
|
18026
|
+
if (!anchor || !control.usage) {
|
|
18027
|
+
if (control.usage?.anchor) control.usage.root.remove();
|
|
18028
|
+
if (control.usage) control.usage.anchor = null;
|
|
17813
18029
|
return;
|
|
17814
18030
|
}
|
|
17815
18031
|
const previousUsageParent = control.usage.root.parentElement;
|
|
@@ -17817,13 +18033,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17817
18033
|
control.usage.place(anchor);
|
|
17818
18034
|
const usagePositionChanged = previousUsageParent !== control.usage.root.parentElement || previousUsageNextSibling !== control.usage.root.nextElementSibling;
|
|
17819
18035
|
if (usagePositionChanged) control.harnessCommands?.placeBefore(control.usage.root);
|
|
17820
|
-
|
|
17821
|
-
|
|
18036
|
+
}
|
|
18037
|
+
function refreshCreditsPlacement(control) {
|
|
18038
|
+
const anchor = creditsPlacementAnchor(control);
|
|
18039
|
+
if (!anchor) {
|
|
17822
18040
|
if (control.credits.anchor) control.credits.root.remove();
|
|
17823
18041
|
control.credits.anchor = null;
|
|
17824
18042
|
return;
|
|
17825
18043
|
}
|
|
17826
|
-
control.credits.place(
|
|
18044
|
+
control.credits.place(anchor);
|
|
17827
18045
|
}
|
|
17828
18046
|
function refreshNativePermissionModeControl(control) {
|
|
17829
18047
|
const semanticCandidate = semanticNativePermissionModeControlForComposer(control.composer);
|
|
@@ -17834,7 +18052,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17834
18052
|
const candidate = nativePermissionModeControlForComposer(control.composer);
|
|
17835
18053
|
control.nativePermissionModeControlVerified = candidate === semanticCandidate && candidate !== null;
|
|
17836
18054
|
if (!candidate) return;
|
|
17837
|
-
syncRendererPermissionModeTriggerClass(control.permissionModePicker
|
|
18055
|
+
syncRendererPermissionModeTriggerClass(control.permissionModePicker);
|
|
17838
18056
|
const parent = candidate.parentElement;
|
|
17839
18057
|
if (parent && (control.permissionModePicker.root.parentElement !== parent || control.permissionModePicker.root.nextElementSibling !== candidate)) {
|
|
17840
18058
|
parent.insertBefore(control.permissionModePicker.root, candidate);
|
|
@@ -17847,39 +18065,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17847
18065
|
return;
|
|
17848
18066
|
}
|
|
17849
18067
|
if (state.element.hidden && state.element.getAttribute("aria-hidden") === "true") return;
|
|
17850
|
-
const active = document.activeElement;
|
|
17851
|
-
if (active
|
|
18068
|
+
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
18069
|
+
if (active && typeof active.blur === "function" && state.element.contains(active)) {
|
|
18070
|
+
active.blur();
|
|
18071
|
+
}
|
|
17852
18072
|
if (state.element.getAttribute("aria-expanded") === "true") state.element.click();
|
|
17853
18073
|
state.element.hidden = true;
|
|
17854
18074
|
state.element.setAttribute("aria-hidden", "true");
|
|
17855
18075
|
}
|
|
17856
18076
|
function reconcileComposerNativeControls(control, hideModel, hidePermissionMode) {
|
|
18077
|
+
refreshNativeContextUsageControl(control);
|
|
17857
18078
|
refreshNativeModelControl(control);
|
|
18079
|
+
refreshNativePermissionModeControl(control);
|
|
17858
18080
|
refreshTrailingClusterPlacement(control);
|
|
17859
18081
|
refreshUsagePlacement(control);
|
|
17860
|
-
|
|
18082
|
+
refreshCreditsPlacement(control);
|
|
17861
18083
|
setNativeControlHidden(control.nativeModelControl, hideModel);
|
|
18084
|
+
setNativeControlHidden(control.nativeContextUsageControl, false);
|
|
17862
18085
|
setNativeControlHidden(control.nativePermissionModeControl, hidePermissionMode);
|
|
17863
18086
|
}
|
|
17864
18087
|
function mountComposerAgentControl(composer, composerId, sendButton, enabledAgents, onSelect, onDownload, onSelectModel, onSelectThinking, onSelectPermissionMode, onSelectCommand) {
|
|
17865
18088
|
const nativeModelControl = captureNativeControl(nativeModelControlForComposer(composer));
|
|
18089
|
+
const nativeContextUsageControl = captureNativeControl(
|
|
18090
|
+
nativeContextUsageControlForComposer(composer)
|
|
18091
|
+
);
|
|
17866
18092
|
const semanticNativePermissionModeControl = semanticNativePermissionModeControlForComposer(composer);
|
|
17867
18093
|
const nativePermissionModeControl = captureNativeControl(semanticNativePermissionModeControl);
|
|
17868
18094
|
const nativePermissionModeControlVerified = semanticNativePermissionModeControl !== null && nativePermissionModeControlForComposer(composer) === semanticNativePermissionModeControl;
|
|
17869
18095
|
const picker = mountRendererAgentPicker(composerId, enabledAgents, onSelect, onDownload);
|
|
17870
|
-
const modelPicker = mountRendererModelPicker(
|
|
17871
|
-
composerId,
|
|
17872
|
-
nativeModelControl?.element.className,
|
|
17873
|
-
onSelectModel,
|
|
17874
|
-
onSelectThinking
|
|
17875
|
-
);
|
|
18096
|
+
const modelPicker = mountRendererModelPicker(composerId, onSelectModel, onSelectThinking);
|
|
17876
18097
|
const permissionModePicker = mountRendererPermissionModePicker(
|
|
17877
18098
|
composerId,
|
|
17878
|
-
nativePermissionModeControl?.element.className,
|
|
17879
18099
|
onSelectPermissionMode
|
|
17880
18100
|
);
|
|
17881
|
-
const
|
|
17882
|
-
const credits = mountRendererCreditsControl(composerId, nativeModelControl?.element.className);
|
|
18101
|
+
const credits = mountRendererCreditsControl(composerId);
|
|
17883
18102
|
const toolbar = sendButton.parentElement;
|
|
17884
18103
|
const harnessCommands = mountRendererHarnessCommandControl(
|
|
17885
18104
|
toolbar ?? composer,
|
|
@@ -17895,24 +18114,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17895
18114
|
if (!toolbar) composer.append(modelPicker.root, picker.root);
|
|
17896
18115
|
const control = {
|
|
17897
18116
|
composer,
|
|
18117
|
+
composerId,
|
|
17898
18118
|
root: picker.root,
|
|
17899
18119
|
picker,
|
|
17900
18120
|
modelPicker,
|
|
17901
18121
|
permissionModePicker,
|
|
17902
18122
|
nativeModelControl,
|
|
17903
18123
|
nativePermissionModeControl,
|
|
18124
|
+
nativeContextUsageControl,
|
|
17904
18125
|
nativePermissionModeControlVerified,
|
|
17905
18126
|
credits,
|
|
17906
|
-
usage,
|
|
18127
|
+
usage: null,
|
|
17907
18128
|
harnessCommands,
|
|
17908
18129
|
sendButton,
|
|
17909
18130
|
sendDisabledBeforeSwitch: null
|
|
17910
18131
|
};
|
|
17911
18132
|
refreshTrailingClusterPlacement(control);
|
|
17912
18133
|
refreshUsagePlacement(control);
|
|
18134
|
+
refreshCreditsPlacement(control);
|
|
17913
18135
|
return control;
|
|
17914
18136
|
}
|
|
17915
18137
|
function renderComposerAgentControl(control, state, adapterState, switching, availability = {}, modelView = { status: "idle" }, permissionModeView = { status: "idle" }, usage = null, accountCredits = null) {
|
|
18138
|
+
if (control.usage === null) {
|
|
18139
|
+
control.usage = mountRendererUsageControl(control.composerId);
|
|
18140
|
+
}
|
|
17916
18141
|
const selectedModel = modelView.selected;
|
|
17917
18142
|
const selectedCatalogModel = modelView.catalog?.models.find(
|
|
17918
18143
|
(model) => model.ref.id === selectedModel?.id
|
|
@@ -17949,7 +18174,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17949
18174
|
permissionModeView,
|
|
17950
18175
|
permissionModeVisible
|
|
17951
18176
|
);
|
|
17952
|
-
renderRendererUsageControl(control.usage, usage);
|
|
18177
|
+
if (control.usage) renderRendererUsageControl(control.usage, usage);
|
|
17953
18178
|
renderRendererCreditsControl(control.credits, accountCredits);
|
|
17954
18179
|
}
|
|
17955
18180
|
function disposeComposerAgentControl(control) {
|
|
@@ -17957,9 +18182,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17957
18182
|
control.sendButton.disabled = control.sendDisabledBeforeSwitch;
|
|
17958
18183
|
}
|
|
17959
18184
|
restoreNativeControl(control.nativeModelControl);
|
|
18185
|
+
restoreNativeControl(control.nativeContextUsageControl);
|
|
17960
18186
|
restoreNativeControl(control.nativePermissionModeControl);
|
|
17961
18187
|
control.credits.dispose();
|
|
17962
|
-
control.usage
|
|
18188
|
+
control.usage?.dispose();
|
|
18189
|
+
control.usage = null;
|
|
17963
18190
|
control.harnessCommands.dispose();
|
|
17964
18191
|
control.permissionModePicker.dispose();
|
|
17965
18192
|
control.modelPicker.dispose();
|
|
@@ -18022,6 +18249,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18022
18249
|
if (ownership.harnessId === "claude-code") return "claude-code";
|
|
18023
18250
|
if (ownership.harnessId === "deepseek-harness") return "deepseek-harness";
|
|
18024
18251
|
if (ownership.harnessId === "grok") return "grok";
|
|
18252
|
+
if (ownership.harnessId === "omp") return "omp";
|
|
18025
18253
|
return null;
|
|
18026
18254
|
}
|
|
18027
18255
|
var BrowserSidebarAgentIconRow = class {
|
|
@@ -18397,7 +18625,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18397
18625
|
pending.add(key);
|
|
18398
18626
|
void client.inspectThread({ threadId: target.threadId }).then(async (inspection) => {
|
|
18399
18627
|
if (disposed) return;
|
|
18400
|
-
if (inspection.owner === "codex" || !inspection.history.fork || !target.isProjectlessConversation
|
|
18628
|
+
if (inspection.owner === "codex" || !inspection.history.fork || !target.isProjectlessConversation) {
|
|
18401
18629
|
dom.replay(target);
|
|
18402
18630
|
return;
|
|
18403
18631
|
}
|
|
@@ -18430,6 +18658,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18430
18658
|
var THREAD_PERMISSION_MODE_SELECT_METHOD = "codexhost/thread/permission-mode/select";
|
|
18431
18659
|
var THREAD_OWNERSHIP_LIST_METHOD = "codexhost/thread/ownership/list";
|
|
18432
18660
|
var THREAD_USAGE_INSPECT_METHOD = "codexhost/thread/usage/inspect";
|
|
18661
|
+
var THREAD_USAGE_UPDATED_METHOD = "codexhost/thread/usage/updated";
|
|
18433
18662
|
var THREAD_TOKEN_USAGE_UPDATED_METHOD = "thread/tokenUsage/updated";
|
|
18434
18663
|
var UPDATE_CHECK_METHOD = "codexhost/update/check";
|
|
18435
18664
|
var UPDATE_START_METHOD = "codexhost/update/start";
|
|
@@ -18438,7 +18667,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18438
18667
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18439
18668
|
}
|
|
18440
18669
|
function notifiedThreadId(notification) {
|
|
18441
|
-
if (!isRecord4(notification) || notification.method !== THREAD_TOKEN_USAGE_UPDATED_METHOD) {
|
|
18670
|
+
if (!isRecord4(notification) || notification.method !== THREAD_TOKEN_USAGE_UPDATED_METHOD && notification.method !== THREAD_USAGE_UPDATED_METHOD) {
|
|
18442
18671
|
return null;
|
|
18443
18672
|
}
|
|
18444
18673
|
const params = notification.params;
|
|
@@ -18554,7 +18783,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18554
18783
|
let disposed = false;
|
|
18555
18784
|
const generations = /* @__PURE__ */ new Map();
|
|
18556
18785
|
const removeNotificationCallback = notifications.addNotificationCallback(
|
|
18557
|
-
THREAD_TOKEN_USAGE_UPDATED_METHOD,
|
|
18786
|
+
[THREAD_TOKEN_USAGE_UPDATED_METHOD, THREAD_USAGE_UPDATED_METHOD],
|
|
18558
18787
|
(notification) => {
|
|
18559
18788
|
const threadId = notifiedThreadId(notification);
|
|
18560
18789
|
if (!threadId) return;
|
|
@@ -18608,6 +18837,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18608
18837
|
var DEEPSEEK_HARNESS_TRANSPORT_MODEL_PREFIX = `${DEEPSEEK_HARNESS_TRANSPORT_MODEL_ID}@`;
|
|
18609
18838
|
var GROK_TRANSPORT_MODEL_ID = "codexhost/grok-native";
|
|
18610
18839
|
var GROK_TRANSPORT_MODEL_PREFIX = `${GROK_TRANSPORT_MODEL_ID}@`;
|
|
18840
|
+
var OMP_TRANSPORT_MODEL_ID = "codexhost/omp-native";
|
|
18841
|
+
var OMP_TRANSPORT_MODEL_PREFIX = `${OMP_TRANSPORT_MODEL_ID}@`;
|
|
18611
18842
|
function transitionRendererAdapterStatus(current, next, publish) {
|
|
18612
18843
|
if (current.state === next.state && current.reason === next.reason && current.hook === next.hook) {
|
|
18613
18844
|
return false;
|
|
@@ -18625,6 +18856,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18625
18856
|
if (agent === "claude-code") return CLAUDE_CODE_TRANSPORT_MODEL_ID;
|
|
18626
18857
|
if (agent === "deepseek-harness") return DEEPSEEK_HARNESS_TRANSPORT_MODEL_ID;
|
|
18627
18858
|
if (agent === "grok") return GROK_TRANSPORT_MODEL_ID;
|
|
18859
|
+
if (agent === "omp") return OMP_TRANSPORT_MODEL_ID;
|
|
18628
18860
|
return null;
|
|
18629
18861
|
}
|
|
18630
18862
|
function isRecord5(value) {
|
|
@@ -18639,6 +18871,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18639
18871
|
const parsedThinking = thinkingOptionId ? harnessThinkingOptionIdSchema.parse(thinkingOptionId) : void 0;
|
|
18640
18872
|
return `${PI_TRANSPORT_MODEL_PREFIX}${parsedModel.id}${parsedThinking ? `@${parsedThinking}` : ""}`;
|
|
18641
18873
|
}
|
|
18874
|
+
function ompTransportModelId(model, thinkingOptionId) {
|
|
18875
|
+
if (!model) {
|
|
18876
|
+
if (thinkingOptionId) throw new Error("OMP transport Thinking requires a Model Ref");
|
|
18877
|
+
return OMP_TRANSPORT_MODEL_ID;
|
|
18878
|
+
}
|
|
18879
|
+
const parsedModel = harnessModelRefSchema.parse(model);
|
|
18880
|
+
const parsedThinking = thinkingOptionId ? harnessThinkingOptionIdSchema.parse(thinkingOptionId) : void 0;
|
|
18881
|
+
return `${OMP_TRANSPORT_MODEL_PREFIX}${parsedModel.id}${parsedThinking ? `@${parsedThinking}` : ""}`;
|
|
18882
|
+
}
|
|
18642
18883
|
function claudeTransportModelId(model, permissionModeId, thinkingOptionId) {
|
|
18643
18884
|
if (!model) {
|
|
18644
18885
|
if (permissionModeId || thinkingOptionId) {
|
|
@@ -18741,6 +18982,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18741
18982
|
...thinking?.success ? { thinkingOptionId: thinking.data } : {}
|
|
18742
18983
|
};
|
|
18743
18984
|
}
|
|
18985
|
+
function decodeOmpTransportModelId(value) {
|
|
18986
|
+
if (value === OMP_TRANSPORT_MODEL_ID) return {};
|
|
18987
|
+
if (typeof value !== "string" || !value.startsWith(OMP_TRANSPORT_MODEL_PREFIX)) return null;
|
|
18988
|
+
const components = value.slice(OMP_TRANSPORT_MODEL_PREFIX.length).split("@");
|
|
18989
|
+
if (components.length < 1 || components.length > 2) return null;
|
|
18990
|
+
const [modelId, thinkingOptionId] = components;
|
|
18991
|
+
if (components.length === 2 && !thinkingOptionId) return null;
|
|
18992
|
+
const model = harnessModelRefSchema.safeParse({ id: modelId });
|
|
18993
|
+
if (!model.success) return null;
|
|
18994
|
+
const thinking = thinkingOptionId ? harnessThinkingOptionIdSchema.safeParse(thinkingOptionId) : null;
|
|
18995
|
+
if (thinking && !thinking.success) return null;
|
|
18996
|
+
return { model: model.data, ...thinking?.success ? { thinkingOptionId: thinking.data } : {} };
|
|
18997
|
+
}
|
|
18744
18998
|
function threadIdFromComposerModelTarget(target) {
|
|
18745
18999
|
if (target?.[0] !== "conversation" || typeof target[1] !== "string" || target[1].trim().length === 0) {
|
|
18746
19000
|
return null;
|
|
@@ -18927,7 +19181,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18927
19181
|
}
|
|
18928
19182
|
}
|
|
18929
19183
|
function modelSelectionForAgent(officialSelection, reasoningEffort, agent, model, thinkingOptionId, permissionModeId) {
|
|
18930
|
-
const transportModelId = agent === "pi" ? piTransportModelId(model, thinkingOptionId) : agent === "claude-code" ? claudeTransportModelId(model, permissionModeId, thinkingOptionId) : agent === "deepseek-harness" ? deepSeekHarnessTransportModelId(model) : agent === "grok" ? grokTransportModelId(model, permissionModeId, thinkingOptionId) : transportModelIdForAgent(agent);
|
|
19184
|
+
const transportModelId = agent === "pi" ? piTransportModelId(model, thinkingOptionId) : agent === "claude-code" ? claudeTransportModelId(model, permissionModeId, thinkingOptionId) : agent === "deepseek-harness" ? deepSeekHarnessTransportModelId(model) : agent === "grok" ? grokTransportModelId(model, permissionModeId, thinkingOptionId) : agent === "omp" ? ompTransportModelId(model, thinkingOptionId) : transportModelIdForAgent(agent);
|
|
18931
19185
|
return transportModelId ? { model: transportModelId, reasoningEffort } : officialSelection;
|
|
18932
19186
|
}
|
|
18933
19187
|
function installCurrentRendererAdapter() {
|
|
@@ -20950,7 +21204,8 @@ ${error51.stderrTail}`] : []
|
|
|
20950
21204
|
|
|
20951
21205
|
// src/settings/trigger.ts
|
|
20952
21206
|
var SETTINGS_TRIGGER_ATTRIBUTE = "data-codexhost-settings-trigger";
|
|
20953
|
-
var
|
|
21207
|
+
var SETTINGS_APPLICATION_HEADER_SELECTOR = 'header[data-pip-obstacle="app-shell-header"]';
|
|
21208
|
+
var SETTINGS_HEADER_SLOT_SELECTOR = ':scope > [data-test-id="header-shell-slot"]';
|
|
20954
21209
|
function measuredBounds(element) {
|
|
20955
21210
|
const bounds = element.getBoundingClientRect();
|
|
20956
21211
|
return {
|
|
@@ -20962,38 +21217,16 @@ ${error51.stderrTail}`] : []
|
|
|
20962
21217
|
height: bounds.height
|
|
20963
21218
|
};
|
|
20964
21219
|
}
|
|
20965
|
-
function isVisibleButton(button) {
|
|
20966
|
-
const bounds = button.getBoundingClientRect();
|
|
20967
|
-
return bounds.width > 0 && bounds.height > 0;
|
|
20968
|
-
}
|
|
20969
|
-
function selectRendererSettingsHeaderSlot(header, candidates) {
|
|
20970
|
-
const midpoint = header.left + header.width / 2;
|
|
20971
|
-
const maximumWidth = Math.min(320, header.width / 2);
|
|
20972
|
-
const eligible = candidates.filter(
|
|
20973
|
-
({ bounds, visibleButtonCount, structuralActionGroup }) => (visibleButtonCount > 1 || structuralActionGroup === true) && bounds.width >= 0 && bounds.height >= 0 && bounds.width <= maximumWidth && bounds.left >= midpoint && bounds.right <= header.right + 1 && bounds.top >= header.top - 1 && bounds.bottom <= header.bottom + 1
|
|
20974
|
-
);
|
|
20975
|
-
eligible.sort(
|
|
20976
|
-
(left, right) => Math.abs(header.right - left.bounds.right) - Math.abs(header.right - right.bounds.right) || right.visibleButtonCount - left.visibleButtonCount || left.bounds.left - right.bounds.left
|
|
20977
|
-
);
|
|
20978
|
-
return eligible[0]?.value ?? null;
|
|
20979
|
-
}
|
|
20980
21220
|
function findRendererSettingsHeaderInsertionPoint(ownerDocument) {
|
|
20981
|
-
const
|
|
20982
|
-
if (!
|
|
20983
|
-
const
|
|
20984
|
-
|
|
20985
|
-
const
|
|
20986
|
-
(slot)
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
isVisibleButton
|
|
20991
|
-
).length,
|
|
20992
|
-
structuralActionGroup: slot.parentElement?.lastElementChild === slot && view?.getComputedStyle(slot.parentElement).display === "grid"
|
|
20993
|
-
})
|
|
20994
|
-
);
|
|
20995
|
-
const actionGroup = selectRendererSettingsHeaderSlot(surfaceBounds, measuredSlots);
|
|
20996
|
-
return actionGroup ? { parent: actionGroup, before: actionGroup.firstChild } : null;
|
|
21221
|
+
const header = ownerDocument.querySelector(SETTINGS_APPLICATION_HEADER_SELECTOR);
|
|
21222
|
+
if (!header) return null;
|
|
21223
|
+
const headerBounds = measuredBounds(header);
|
|
21224
|
+
if (headerBounds.width <= 0 || headerBounds.height <= 0) return null;
|
|
21225
|
+
const endSlot = [...header.querySelectorAll(SETTINGS_HEADER_SLOT_SELECTOR)].filter((slot) => {
|
|
21226
|
+
const bounds = measuredBounds(slot);
|
|
21227
|
+
return bounds.width > 0 && bounds.height > 0;
|
|
21228
|
+
}).toSorted((left, right) => measuredBounds(right).left - measuredBounds(left).left)[0];
|
|
21229
|
+
return endSlot ? { parent: header, before: endSlot } : null;
|
|
20997
21230
|
}
|
|
20998
21231
|
function mountRendererSettingsTrigger(triggerId, available, onOpen, ownerDocument = document, messages = DEFAULT_RENDERER_SETTINGS_MESSAGES) {
|
|
20999
21232
|
const root = ownerDocument.createElement("div");
|
|
@@ -21121,23 +21354,27 @@ ${error51.stderrTail}`] : []
|
|
|
21121
21354
|
let disposed = false;
|
|
21122
21355
|
const refresh = () => {
|
|
21123
21356
|
if (disposed) return false;
|
|
21124
|
-
if (trigger?.root.isConnected) return true;
|
|
21125
|
-
trigger?.dispose();
|
|
21126
|
-
trigger = null;
|
|
21127
|
-
for (const duplicate of ownerDocument.querySelectorAll(`[${SETTINGS_TRIGGER_ATTRIBUTE}]`)) {
|
|
21128
|
-
duplicate.remove();
|
|
21129
|
-
}
|
|
21130
21357
|
const insertionPoint = findRendererSettingsHeaderInsertionPoint(ownerDocument);
|
|
21131
|
-
if (!insertionPoint)
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
ownerDocument
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
21358
|
+
if (!insertionPoint) {
|
|
21359
|
+
trigger?.root.remove();
|
|
21360
|
+
return false;
|
|
21361
|
+
}
|
|
21362
|
+
if (!trigger) {
|
|
21363
|
+
for (const duplicate of ownerDocument.querySelectorAll(`[${SETTINGS_TRIGGER_ATTRIBUTE}]`)) {
|
|
21364
|
+
duplicate.remove();
|
|
21365
|
+
}
|
|
21366
|
+
trigger = mountRendererSettingsTrigger(
|
|
21367
|
+
"application-header",
|
|
21368
|
+
options.available,
|
|
21369
|
+
options.onOpen,
|
|
21370
|
+
ownerDocument,
|
|
21371
|
+
options.messages
|
|
21372
|
+
);
|
|
21373
|
+
trigger.setUpdateAvailable(updateAvailable);
|
|
21374
|
+
}
|
|
21375
|
+
if (trigger.root.parentElement !== insertionPoint.parent || trigger.root.nextSibling !== insertionPoint.before) {
|
|
21376
|
+
insertionPoint.parent.insertBefore(trigger.root, insertionPoint.before);
|
|
21377
|
+
}
|
|
21141
21378
|
return true;
|
|
21142
21379
|
};
|
|
21143
21380
|
refresh();
|
|
@@ -21274,6 +21511,8 @@ ${error51.stderrTail}`] : []
|
|
|
21274
21511
|
clearUpdateRetry();
|
|
21275
21512
|
retryUpdateClient = client;
|
|
21276
21513
|
updateRetryAttempt = 0;
|
|
21514
|
+
} else if (updateRetryTimer !== null) {
|
|
21515
|
+
return;
|
|
21277
21516
|
}
|
|
21278
21517
|
checkedUpdateClient = client;
|
|
21279
21518
|
const generation = ++updateCheckGeneration;
|
|
@@ -21345,23 +21584,43 @@ ${error51.stderrTail}`] : []
|
|
|
21345
21584
|
pi: harnessIdSchema.parse("pi"),
|
|
21346
21585
|
"claude-code": harnessIdSchema.parse("claude-code"),
|
|
21347
21586
|
"deepseek-harness": harnessIdSchema.parse("deepseek-harness"),
|
|
21348
|
-
grok: harnessIdSchema.parse("grok")
|
|
21587
|
+
grok: harnessIdSchema.parse("grok"),
|
|
21588
|
+
omp: harnessIdSchema.parse("omp")
|
|
21349
21589
|
};
|
|
21350
21590
|
var externalAgents = [
|
|
21351
21591
|
"pi",
|
|
21352
21592
|
"claude-code",
|
|
21353
21593
|
"deepseek-harness",
|
|
21354
|
-
"grok"
|
|
21594
|
+
"grok",
|
|
21595
|
+
"omp"
|
|
21355
21596
|
];
|
|
21597
|
+
function isRetryableHarnessAvailability(availability, error51) {
|
|
21598
|
+
return availability !== void 0 && availability !== "ready" && availability !== "notInstalled" && error51?.retryable === true;
|
|
21599
|
+
}
|
|
21600
|
+
function retryableHarnessAvailabilityAgents(availability, errors) {
|
|
21601
|
+
return externalAgents.filter(
|
|
21602
|
+
(agent) => isRetryableHarnessAvailability(availability[agent], errors[agent])
|
|
21603
|
+
);
|
|
21604
|
+
}
|
|
21605
|
+
function passiveHarnessAvailabilityAgents(availability, errors) {
|
|
21606
|
+
return externalAgents.filter(
|
|
21607
|
+
(agent) => availability[agent] === "checking" || isRetryableHarnessAvailability(availability[agent], errors[agent])
|
|
21608
|
+
);
|
|
21609
|
+
}
|
|
21356
21610
|
var rendererUsageRefreshDelays = [250, 500, 1e3, 2e3, 4e3, 8e3];
|
|
21357
21611
|
function rendererUsageRefreshDelay(attempt) {
|
|
21358
21612
|
const index = Math.max(0, Math.min(Math.trunc(attempt), rendererUsageRefreshDelays.length - 1));
|
|
21359
21613
|
return rendererUsageRefreshDelays[index] ?? rendererUsageRefreshDelays[0];
|
|
21360
21614
|
}
|
|
21615
|
+
function externalAgentHasAccountCredits(agent) {
|
|
21616
|
+
return agent === "codex" || agent === "grok" || agent === "claude-code";
|
|
21617
|
+
}
|
|
21361
21618
|
function shouldRetryExternalThreadUsage(agent, usage, accountCredits = null) {
|
|
21362
|
-
if (agent === "codex") return false;
|
|
21363
21619
|
if (usage === null) return true;
|
|
21364
|
-
return agent
|
|
21620
|
+
return externalAgentHasAccountCredits(agent) && accountCredits === null;
|
|
21621
|
+
}
|
|
21622
|
+
function shouldReloadExternalCatalogAfterAvailabilityRefresh(previous, next, configurationReady) {
|
|
21623
|
+
return previous !== next || !configurationReady;
|
|
21365
21624
|
}
|
|
21366
21625
|
function selectableThinkingOptionId(state) {
|
|
21367
21626
|
return state.effectiveThinkingOptionId && state.availableThinkingOptions?.some(({ id }) => id === state.effectiveThinkingOptionId) ? state.effectiveThinkingOptionId : void 0;
|
|
@@ -21407,6 +21666,17 @@ ${error51.stderrTail}`] : []
|
|
|
21407
21666
|
...permissionModeId ? { permissionModeId } : {}
|
|
21408
21667
|
};
|
|
21409
21668
|
}
|
|
21669
|
+
if (inspection.harnessId === "omp") {
|
|
21670
|
+
const transportSelection = decodeOmpTransportModelId(inspection.transportModelId);
|
|
21671
|
+
if (!transportSelection) throw new Error("OMP Thread reported an incompatible transport Model");
|
|
21672
|
+
const model = inspection.effectiveModel ?? transportSelection.model;
|
|
21673
|
+
const thinkingOptionId = selectableThinkingOptionId(inspection) ?? transportSelection.thinkingOptionId;
|
|
21674
|
+
return {
|
|
21675
|
+
agent: "omp",
|
|
21676
|
+
...model ? { model } : {},
|
|
21677
|
+
...thinkingOptionId ? { thinkingOptionId } : {}
|
|
21678
|
+
};
|
|
21679
|
+
}
|
|
21410
21680
|
if (inspection.harnessId === "claude-code") {
|
|
21411
21681
|
const transportSelection = decodeClaudeTransportModelId(inspection.transportModelId);
|
|
21412
21682
|
if (!transportSelection) {
|
|
@@ -21551,7 +21821,8 @@ ${error51.stderrTail}`] : []
|
|
|
21551
21821
|
pi: void 0,
|
|
21552
21822
|
"claude-code": void 0,
|
|
21553
21823
|
"deepseek-harness": void 0,
|
|
21554
|
-
grok: void 0
|
|
21824
|
+
grok: void 0,
|
|
21825
|
+
omp: void 0
|
|
21555
21826
|
},
|
|
21556
21827
|
requestGeneration: 0,
|
|
21557
21828
|
request: null,
|
|
@@ -21662,7 +21933,7 @@ ${error51.stderrTail}`] : []
|
|
|
21662
21933
|
};
|
|
21663
21934
|
const refreshThreadUsage = async (mounted) => {
|
|
21664
21935
|
const threadId = threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
21665
|
-
if (!threadId || !modelControl
|
|
21936
|
+
if (!threadId || !modelControl) {
|
|
21666
21937
|
mounted.usage = null;
|
|
21667
21938
|
mounted.accountCredits = null;
|
|
21668
21939
|
usageRefreshAttempts.delete(mounted.composer);
|
|
@@ -21678,7 +21949,7 @@ ${error51.stderrTail}`] : []
|
|
|
21678
21949
|
mounted.usage = result.usage;
|
|
21679
21950
|
mounted.accountCredits = result.accountCredits ?? null;
|
|
21680
21951
|
const agent = controller.get(mounted.composer).agent;
|
|
21681
|
-
if (result.usage !== null && (agent
|
|
21952
|
+
if (result.usage !== null && (!externalAgentHasAccountCredits(agent) || result.accountCredits)) {
|
|
21682
21953
|
usageRefreshAttempts.delete(mounted.composer);
|
|
21683
21954
|
}
|
|
21684
21955
|
renderMounted(mounted);
|
|
@@ -21787,12 +22058,13 @@ ${error51.stderrTail}`] : []
|
|
|
21787
22058
|
renderMounted(mounted);
|
|
21788
22059
|
if (mounted.ownershipStatus !== "error") void refreshCommands(mounted);
|
|
21789
22060
|
sidebarAgentIcons.refresh();
|
|
21790
|
-
if (mounted.ownershipStatus !== "error"
|
|
21791
|
-
controller.get(mounted.composer).agent
|
|
21792
|
-
mounted.usage
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
22061
|
+
if (mounted.ownershipStatus !== "error") {
|
|
22062
|
+
const agent = controller.get(mounted.composer).agent;
|
|
22063
|
+
if (agent === "codex" && mounted.usage === null) {
|
|
22064
|
+
void refreshThreadUsage(mounted);
|
|
22065
|
+
} else if (shouldRetryExternalThreadUsage(agent, mounted.usage, mounted.accountCredits)) {
|
|
22066
|
+
scheduleThreadUsageRefresh(mounted);
|
|
22067
|
+
}
|
|
21796
22068
|
}
|
|
21797
22069
|
}
|
|
21798
22070
|
}
|
|
@@ -22432,7 +22704,7 @@ ${error51.stderrTail}`] : []
|
|
|
22432
22704
|
const currentHostId = modelControl.currentHostId?.() ?? "local";
|
|
22433
22705
|
return currentHostId === hostId ? modelControl : null;
|
|
22434
22706
|
}
|
|
22435
|
-
function refreshHarnessAvailabilityForHost(hostId, refresh = false, retry = false) {
|
|
22707
|
+
function refreshHarnessAvailabilityForHost(hostId, refresh = false, retry = false, force = false) {
|
|
22436
22708
|
const state = hostHarnessAvailabilityState(hostId);
|
|
22437
22709
|
if (!retry) resetHarnessAvailabilityRetry(hostId);
|
|
22438
22710
|
const client = modelClientForHost(hostId);
|
|
@@ -22441,12 +22713,16 @@ ${error51.stderrTail}`] : []
|
|
|
22441
22713
|
return Promise.resolve();
|
|
22442
22714
|
}
|
|
22443
22715
|
if (state.request?.client === client) return state.request.promise;
|
|
22444
|
-
state.availability
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22448
|
-
|
|
22449
|
-
|
|
22716
|
+
const agentsToInspect = force ? externalAgents : passiveHarnessAvailabilityAgents(state.availability, state.errors);
|
|
22717
|
+
if (agentsToInspect.length === 0) {
|
|
22718
|
+
resetHarnessAvailabilityRetry(hostId);
|
|
22719
|
+
return Promise.resolve();
|
|
22720
|
+
}
|
|
22721
|
+
const nextAvailability = { ...state.availability };
|
|
22722
|
+
for (const agent of agentsToInspect) {
|
|
22723
|
+
if (nextAvailability[agent] !== "ready") nextAvailability[agent] = "checking";
|
|
22724
|
+
}
|
|
22725
|
+
state.availability = nextAvailability;
|
|
22450
22726
|
if (hostId === activeAvailabilityHostId) {
|
|
22451
22727
|
publishConnectionStatus();
|
|
22452
22728
|
for (const mounted of mountedByComposer.values()) renderMounted(mounted);
|
|
@@ -22454,7 +22730,7 @@ ${error51.stderrTail}`] : []
|
|
|
22454
22730
|
const generation = ++state.requestGeneration;
|
|
22455
22731
|
const promise2 = (async () => {
|
|
22456
22732
|
await Promise.all(
|
|
22457
|
-
|
|
22733
|
+
agentsToInspect.map(async (agent) => {
|
|
22458
22734
|
let status = "error";
|
|
22459
22735
|
let nextError;
|
|
22460
22736
|
try {
|
|
@@ -22485,6 +22761,7 @@ ${error51.stderrTail}`] : []
|
|
|
22485
22761
|
};
|
|
22486
22762
|
}
|
|
22487
22763
|
if (generation !== state.requestGeneration || disposed) return;
|
|
22764
|
+
const previousStatus = state.availability[agent];
|
|
22488
22765
|
state.errors[agent] = nextError;
|
|
22489
22766
|
state.availability = { ...state.availability, [agent]: status };
|
|
22490
22767
|
if (hostId !== activeAvailabilityHostId) {
|
|
@@ -22499,7 +22776,11 @@ ${error51.stderrTail}`] : []
|
|
|
22499
22776
|
}
|
|
22500
22777
|
for (const mounted of mountedByComposer.values()) {
|
|
22501
22778
|
const composerState = controller.get(mounted.composer);
|
|
22502
|
-
if (composerState.agent === agent
|
|
22779
|
+
if (composerState.agent === agent && shouldReloadExternalCatalogAfterAvailabilityRefresh(
|
|
22780
|
+
previousStatus,
|
|
22781
|
+
status,
|
|
22782
|
+
isExternalConfigurationReady(mounted)
|
|
22783
|
+
)) {
|
|
22503
22784
|
void loadExternalCatalog(mounted);
|
|
22504
22785
|
}
|
|
22505
22786
|
renderMounted(mounted);
|
|
@@ -22508,7 +22789,7 @@ ${error51.stderrTail}`] : []
|
|
|
22508
22789
|
})
|
|
22509
22790
|
);
|
|
22510
22791
|
if (generation !== state.requestGeneration || disposed) return;
|
|
22511
|
-
if (
|
|
22792
|
+
if (retryableHarnessAvailabilityAgents(state.availability, state.errors).length === 0) {
|
|
22512
22793
|
resetHarnessAvailabilityRetry(hostId);
|
|
22513
22794
|
} else {
|
|
22514
22795
|
scheduleHarnessAvailabilityRetry(hostId);
|
|
@@ -22595,7 +22876,7 @@ ${error51.stderrTail}`] : []
|
|
|
22595
22876
|
},
|
|
22596
22877
|
refresh() {
|
|
22597
22878
|
for (const hostId of harnessAvailabilityByHost.keys()) {
|
|
22598
|
-
void refreshHarnessAvailabilityForHost(hostId, true);
|
|
22879
|
+
void refreshHarnessAvailabilityForHost(hostId, true, false, true);
|
|
22599
22880
|
}
|
|
22600
22881
|
return Promise.resolve();
|
|
22601
22882
|
},
|
|
@@ -22727,8 +23008,8 @@ ${error51.stderrTail}`] : []
|
|
|
22727
23008
|
continue;
|
|
22728
23009
|
}
|
|
22729
23010
|
const state = controller.get(composer);
|
|
22730
|
-
const
|
|
22731
|
-
reconcileComposerNativeControls(mounted.control,
|
|
23011
|
+
const hideCodexControls = controller.isSwitching(composer) || state.agent !== "codex";
|
|
23012
|
+
reconcileComposerNativeControls(mounted.control, hideCodexControls, hideCodexControls);
|
|
22732
23013
|
if (refreshTargets) refreshMountedConversationTarget(mounted);
|
|
22733
23014
|
}
|
|
22734
23015
|
for (const editor of document.querySelectorAll(EDITOR_SELECTOR)) {
|