@karlorz/codexhost-cli-win32-x64 0.14.0-3 → 0.14.0-5

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.
@@ -3035,10 +3035,10 @@
3035
3035
  const shape = def.shape;
3036
3036
  const propValues = {};
3037
3037
  for (const key in shape) {
3038
- const field = shape[key]._zod;
3039
- if (field.values) {
3038
+ const field2 = shape[key]._zod;
3039
+ if (field2.values) {
3040
3040
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3041
- for (const v of field.values)
3041
+ for (const v of field2.values)
3042
3042
  propValues[key].add(v);
3043
3043
  }
3044
3044
  }
@@ -14928,6 +14928,65 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14928
14928
  // ../shared-contracts/dist/version.js
14929
14929
  var WORKSPACE_CONTRACT_VERSION = 1;
14930
14930
 
14931
+ // ../shared-contracts/dist/thread-questions.js
14932
+ var THREAD_QUESTIONS_LIST_METHOD = "codexhost/thread/questions/list";
14933
+ var THREAD_QUESTION_RESPOND_METHOD = "codexhost/thread/question/respond";
14934
+ var THREAD_QUESTION_ACTIVITY_METHOD = "codexhost/thread/question/activity";
14935
+ var threadQuestionsParamsSchema = external_exports.strictObject({ threadId: hostThreadIdSchema });
14936
+ var field = { id: external_exports.string().min(1), prompt: external_exports.string(), optional: external_exports.boolean() };
14937
+ var questionAutoResolutionSchema = external_exports.strictObject({
14938
+ deadlineUnixMs: external_exports.number().int().min(0).max(864e13),
14939
+ action: external_exports.enum(["recommended", "decline"]),
14940
+ resetOnActivity: external_exports.boolean().optional()
14941
+ });
14942
+ var threadQuestionSchema = external_exports.strictObject({
14943
+ interactionId: hostInteractionIdSchema,
14944
+ turnId: hostTurnIdSchema,
14945
+ title: external_exports.string().optional(),
14946
+ expiresAt: external_exports.string().optional(),
14947
+ autoResolution: questionAutoResolutionSchema.optional(),
14948
+ questions: external_exports.array(external_exports.discriminatedUnion("type", [
14949
+ external_exports.strictObject({
14950
+ ...field,
14951
+ type: external_exports.literal("choice"),
14952
+ multiple: external_exports.boolean(),
14953
+ allowOther: external_exports.boolean(),
14954
+ options: external_exports.array(external_exports.strictObject({
14955
+ value: external_exports.string().min(1),
14956
+ label: external_exports.string(),
14957
+ description: external_exports.string().optional()
14958
+ })).min(1)
14959
+ }),
14960
+ external_exports.strictObject({
14961
+ ...field,
14962
+ type: external_exports.literal("text"),
14963
+ multiline: external_exports.boolean(),
14964
+ secret: external_exports.literal(false),
14965
+ placeholder: external_exports.string().optional(),
14966
+ prefill: external_exports.string().optional()
14967
+ })
14968
+ ])).min(1)
14969
+ });
14970
+ var threadQuestionsResultSchema = external_exports.strictObject({
14971
+ questions: external_exports.array(threadQuestionSchema)
14972
+ });
14973
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
14974
+ threadId: hostThreadIdSchema,
14975
+ interactionId: hostInteractionIdSchema,
14976
+ turnId: hostTurnIdSchema,
14977
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
14978
+ cancelled: external_exports.boolean().optional()
14979
+ });
14980
+ var threadQuestionRespondResultSchema = external_exports.strictObject({ accepted: external_exports.literal(true) });
14981
+ var threadQuestionActivityParamsSchema = external_exports.strictObject({
14982
+ threadId: hostThreadIdSchema,
14983
+ interactionId: hostInteractionIdSchema,
14984
+ turnId: hostTurnIdSchema
14985
+ });
14986
+ var threadQuestionActivityResultSchema = external_exports.strictObject({
14987
+ autoResolution: questionAutoResolutionSchema.nullable()
14988
+ });
14989
+
14931
14990
  // ../shared-contracts/dist/idle-release.js
14932
14991
  var IDLE_RELEASE_SETTINGS_METHOD = "codexhost/settings/idle-release/set";
14933
14992
  var IDLE_RELEASE_TIMEOUT_MINUTES_MIN = 5;
@@ -17832,6 +17891,645 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17832
17891
  };
17833
17892
  }
17834
17893
 
17894
+ // ../../node_modules/lucide/dist/esm/defaultAttributes.mjs
17895
+ var defaultAttributes = {
17896
+ xmlns: "http://www.w3.org/2000/svg",
17897
+ width: 24,
17898
+ height: 24,
17899
+ viewBox: "0 0 24 24",
17900
+ fill: "none",
17901
+ stroke: "currentColor",
17902
+ "stroke-width": 2,
17903
+ "stroke-linecap": "round",
17904
+ "stroke-linejoin": "round"
17905
+ };
17906
+
17907
+ // ../../node_modules/lucide/dist/esm/createElement.mjs
17908
+ var createSVGElement = ([tag, attrs, children]) => {
17909
+ const element = document.createElementNS("http://www.w3.org/2000/svg", tag);
17910
+ Object.keys(attrs).forEach((name) => {
17911
+ element.setAttribute(name, String(attrs[name]));
17912
+ });
17913
+ if (children?.length) {
17914
+ children.forEach((child) => {
17915
+ const childElement = createSVGElement(child);
17916
+ element.appendChild(childElement);
17917
+ });
17918
+ }
17919
+ return element;
17920
+ };
17921
+ var createElement = (iconNode, customAttrs = {}) => {
17922
+ const tag = "svg";
17923
+ const attrs = {
17924
+ ...defaultAttributes,
17925
+ ...customAttrs
17926
+ };
17927
+ return createSVGElement([tag, attrs, iconNode]);
17928
+ };
17929
+
17930
+ // ../../node_modules/lucide/dist/esm/icons/check.mjs
17931
+ var Check = [["path", { d: "M20 6 9 17l-5-5" }]];
17932
+
17933
+ // ../../node_modules/lucide/dist/esm/icons/message-circle-question-mark.mjs
17934
+ var MessageCircleQuestionMark = [
17935
+ [
17936
+ "path",
17937
+ {
17938
+ d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"
17939
+ }
17940
+ ],
17941
+ ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }],
17942
+ ["path", { d: "M12 17h.01" }]
17943
+ ];
17944
+
17945
+ // ../../node_modules/lucide/dist/esm/icons/pencil.mjs
17946
+ var Pencil = [
17947
+ [
17948
+ "path",
17949
+ {
17950
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
17951
+ }
17952
+ ],
17953
+ ["path", { d: "m15 5 4 4" }]
17954
+ ];
17955
+
17956
+ // ../../node_modules/lucide/dist/esm/icons/x.mjs
17957
+ var X = [
17958
+ ["path", { d: "M18 6 6 18" }],
17959
+ ["path", { d: "m6 6 12 12" }]
17960
+ ];
17961
+
17962
+ // src/renderer-question-card-style.ts
17963
+ var QUESTION_CARD_CSS = `
17964
+ :host {
17965
+ display: block;
17966
+ min-width: 0;
17967
+ margin: 8px 0;
17968
+ color-scheme: inherit;
17969
+ --question-text: light-dark(#171717, #ececec);
17970
+ --question-muted: light-dark(#737373, #a3a3a3);
17971
+ --question-border: light-dark(rgb(0 0 0 / 8%), rgb(255 255 255 / 8%));
17972
+ --question-selected: light-dark(#e9e9e9, #333333);
17973
+ --question-primary: light-dark(#202020, #ececec);
17974
+ --question-primary-text: light-dark(#fff, #171717);
17975
+ }
17976
+ *, ::before, ::after { box-sizing: border-box; }
17977
+ .card {
17978
+ display: flex;
17979
+ flex-direction: column;
17980
+ max-height: min(60vh, 560px);
17981
+ overflow: hidden;
17982
+ padding: 16px 12px 12px;
17983
+ border: 1px solid var(--question-border);
17984
+ border-radius: 24px;
17985
+ background: light-dark(#f7f7f7, #262626);
17986
+ color: var(--question-text);
17987
+ font: 13px/1.5 system-ui, sans-serif;
17988
+ }
17989
+ .title { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin: 0 6px 14px; color: var(--question-muted); font-weight: 400; }
17990
+ .question-icon { display: inline-flex; justify-content: center; align-items: center; width: 16px; height: 16px; flex-shrink: 0; }
17991
+ .countdown { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
17992
+ .countdown[hidden] { display: none; }
17993
+ .countdown:not([hidden]) + .dismiss { margin-left: 0; }
17994
+ svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
17995
+ .body { min-height: 0; overflow: auto; }
17996
+ fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 14px; }
17997
+ fieldset:last-child { margin-bottom: 0; }
17998
+ legend { width: 100%; padding: 0 6px; margin-bottom: 14px; font: inherit; }
17999
+ .hint { color: var(--question-muted); font-size: 12px; margin: -10px 6px 10px; }
18000
+ .option {
18001
+ position: relative;
18002
+ display: flex;
18003
+ align-items: flex-start;
18004
+ gap: 10px;
18005
+ min-height: 34px;
18006
+ padding: 6px;
18007
+ margin: 2px 0;
18008
+ border-radius: 12px;
18009
+ cursor: pointer;
18010
+ background: transparent;
18011
+ overflow-wrap: anywhere;
18012
+ }
18013
+ .option:hover, .option:has(:checked) { background: var(--question-selected); }
18014
+ input[type=checkbox], input[type=radio] {
18015
+ appearance: none;
18016
+ display: block;
18017
+ flex: 0 0 21px;
18018
+ width: 21px;
18019
+ height: 21px;
18020
+ margin: 0;
18021
+ padding: 0;
18022
+ border: 1px solid var(--question-border);
18023
+ border-radius: 5px;
18024
+ background: light-dark(#ededed, #303030);
18025
+ cursor: pointer;
18026
+ }
18027
+ .shortcut { position: absolute; top: 6px; left: 6px; width: 21px; height: 21px; text-align: center; line-height: 21px; color: var(--question-muted); pointer-events: none; font-size: 12px; }
18028
+ .option-copy { flex: 1; min-width: 0; white-space: pre-wrap; }
18029
+ .option-name { display: block; font-weight: 400; }
18030
+ .description { display: block; color: var(--question-muted); font-size: 12px; margin-top: 1px; }
18031
+ .selected-indicator { align-self: center; visibility: hidden; color: var(--question-muted); padding-right: 4px; }
18032
+ :checked ~ .selected-indicator { visibility: visible; }
18033
+ .other { align-items: center; flex: 1; min-width: 0; margin: 0; }
18034
+ .other input[type=checkbox], .other input[type=radio] { background: transparent; border-color: transparent; }
18035
+ .other:has(:checked), .other:focus-within { background: var(--question-selected); }
18036
+ .other:has(:checked) .pencil { color: var(--question-text); }
18037
+ .pencil { display: flex; align-items: center; justify-content: center; }
18038
+ .other-copy { display: flex; flex: 1; min-width: 0; }
18039
+ input:not([type=checkbox]):not([type=radio]), textarea {
18040
+ appearance: none;
18041
+ display: block;
18042
+ min-width: 0;
18043
+ width: 100%;
18044
+ padding: 6px;
18045
+ border: 1px solid var(--question-border);
18046
+ border-radius: 8px;
18047
+ background: transparent;
18048
+ color: var(--question-text);
18049
+ font: inherit;
18050
+ }
18051
+ .other-copy input:not([type=checkbox]):not([type=radio]) { border: 0; padding: 0; }
18052
+ textarea { min-height: 60px; resize: vertical; }
18053
+ input::placeholder, textarea::placeholder { color: var(--question-muted); opacity: .65; }
18054
+ input:focus-visible, textarea:focus-visible, button:focus-visible {
18055
+ outline: 2px solid var(--question-muted);
18056
+ outline-offset: 2px;
18057
+ }
18058
+ .other-copy input:focus-visible { outline: none; }
18059
+ .other:has(input:focus-visible) { outline: 2px solid var(--question-muted); outline-offset: -2px; }
18060
+ .error { flex-shrink: 0; color: light-dark(#b42318, #ffaaa3); font-size: 12px; }
18061
+ .error:not(:empty) { margin: 8px 6px 0; }
18062
+ .footer { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-top: 8px; }
18063
+ .actions { display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; flex-shrink: 0; }
18064
+ button {
18065
+ appearance: none;
18066
+ min-height: 28px;
18067
+ padding: 3px 10px;
18068
+ border: 1px solid var(--question-border);
18069
+ border-radius: 999px;
18070
+ background: transparent;
18071
+ color: var(--question-text);
18072
+ font: inherit;
18073
+ font-weight: 400;
18074
+ cursor: pointer;
18075
+ }
18076
+ button:hover { background: var(--question-selected); }
18077
+ button.primary { background: var(--question-primary); color: var(--question-primary-text); border-color: transparent; }
18078
+ button.primary:hover { opacity: .85; }
18079
+ button.dismiss { display: flex; align-items: center; justify-content: center; border: 0; padding: 0; min-height: 24px; width: 24px; margin-left: auto; color: var(--question-muted); }
18080
+ :disabled { cursor: wait; opacity: .5; }
18081
+ @media (max-width: 420px) { .footer { flex-wrap: wrap; } .footer > .other { flex-basis: 100%; } }
18082
+ @media (forced-colors: active) {
18083
+ .card, input, textarea { background: Canvas; color: CanvasText; }
18084
+ button, .card, input[type=checkbox], input[type=radio] { border-color: ButtonBorder; }
18085
+ .option:has(:checked) { outline: 1px solid Highlight; outline-offset: -1px; }
18086
+ button.primary { background: Highlight; color: HighlightText; }
18087
+ }
18088
+ `;
18089
+
18090
+ // src/renderer-question-card.ts
18091
+ function createQuestionCard(document2, question, submit, initial = {}) {
18092
+ const icon2 = (node) => document2.adoptNode(
18093
+ createElement(node, {
18094
+ width: 16,
18095
+ height: 16,
18096
+ "aria-hidden": "true",
18097
+ focusable: "false"
18098
+ })
18099
+ );
18100
+ const selectedIndicator = () => {
18101
+ const selected = document2.createElement("span");
18102
+ selected.className = "selected-indicator";
18103
+ selected.setAttribute("aria-hidden", "true");
18104
+ selected.append(icon2(Check));
18105
+ return selected;
18106
+ };
18107
+ const root = document2.createElement("section");
18108
+ root.dataset.codexhostQuestion = question.interactionId;
18109
+ root.setAttribute("aria-label", question.title ?? "Question");
18110
+ root.addEventListener("keydown", (event) => {
18111
+ event.stopPropagation();
18112
+ if (event.key === "Enter" && event.composedPath()[0] instanceof HTMLInputElement)
18113
+ event.preventDefault();
18114
+ });
18115
+ const shadow = root.attachShadow({ mode: "open" });
18116
+ const style = document2.createElement("style");
18117
+ style.textContent = QUESTION_CARD_CSS;
18118
+ const surface = document2.createElement("div");
18119
+ surface.className = "card";
18120
+ shadow.append(style, surface);
18121
+ const title = document2.createElement("div");
18122
+ title.className = "title";
18123
+ const titleIcon = document2.createElement("span");
18124
+ titleIcon.className = "question-icon";
18125
+ titleIcon.append(icon2(MessageCircleQuestionMark));
18126
+ titleIcon.setAttribute("aria-hidden", "true");
18127
+ const titleText = document2.createElement("span");
18128
+ titleText.textContent = "Question";
18129
+ const countdown = document2.createElement("span");
18130
+ countdown.className = "countdown";
18131
+ countdown.setAttribute("role", "timer");
18132
+ countdown.title = "The Harness owns this timeout and its result.";
18133
+ let autoResolution = question.autoResolution;
18134
+ const updateCountdown2 = () => {
18135
+ const timeout = autoResolution;
18136
+ countdown.hidden = !timeout;
18137
+ if (!timeout) return;
18138
+ const remaining = Math.max(0, Math.ceil((timeout.deadlineUnixMs - Date.now()) / 1e3));
18139
+ const clock = `${Math.floor(remaining / 60)}:${String(remaining % 60).padStart(2, "0")}`;
18140
+ const action = timeout.action === "recommended" ? "Auto-select recommended" : "Question timeout";
18141
+ const text = remaining ? `${action} in ${clock}` : "Waiting for Harness\u2026";
18142
+ if (countdown.textContent !== text) countdown.textContent = text;
18143
+ };
18144
+ updateCountdown2();
18145
+ let countdownTimer = autoResolution ? document2.defaultView?.setInterval(updateCountdown2, 250) : void 0;
18146
+ const dismiss = document2.createElement("button");
18147
+ dismiss.type = "button";
18148
+ dismiss.className = "dismiss";
18149
+ dismiss.append(icon2(X));
18150
+ dismiss.setAttribute("aria-label", "Dismiss question");
18151
+ title.append(titleIcon, titleText, countdown, dismiss);
18152
+ const body = document2.createElement("div");
18153
+ body.className = "body";
18154
+ surface.append(title, body);
18155
+ const footer = document2.createElement("div");
18156
+ footer.className = "footer";
18157
+ const readers = /* @__PURE__ */ new Map();
18158
+ const controls = [dismiss];
18159
+ const validOther = [];
18160
+ for (const [index, field2] of question.questions.entries()) {
18161
+ const group = document2.createElement("fieldset");
18162
+ const legend = document2.createElement("legend");
18163
+ legend.textContent = field2.prompt;
18164
+ group.append(legend);
18165
+ const saved = initial[field2.id] ?? [];
18166
+ if (field2.type === "text") {
18167
+ const input = document2.createElement(field2.multiline ? "textarea" : "input");
18168
+ input.value = saved[0] ?? field2.prefill ?? "";
18169
+ input.placeholder = field2.placeholder ?? "Your answer";
18170
+ input.setAttribute("aria-label", field2.prompt);
18171
+ controls.push(input);
18172
+ group.append(input);
18173
+ readers.set(field2.id, () => input.value.trim() ? [input.value] : []);
18174
+ } else {
18175
+ const hint = document2.createElement("div");
18176
+ hint.className = "hint";
18177
+ hint.textContent = "Select all that apply";
18178
+ if (field2.multiple) group.append(hint);
18179
+ const inputs = [];
18180
+ const name = `codexhost-${question.interactionId}-${index}`;
18181
+ for (const [optionIndex, option] of field2.options.entries()) {
18182
+ const label = document2.createElement("label");
18183
+ label.className = "option";
18184
+ const input = document2.createElement("input");
18185
+ input.type = field2.multiple ? "checkbox" : "radio";
18186
+ input.name = name;
18187
+ input.value = option.value;
18188
+ input.checked = saved.includes(option.value);
18189
+ const shortcut = document2.createElement("span");
18190
+ shortcut.className = "shortcut";
18191
+ shortcut.setAttribute("aria-hidden", "true");
18192
+ shortcut.textContent = String(optionIndex + 1);
18193
+ const selected = selectedIndicator();
18194
+ const text = document2.createElement("span");
18195
+ text.className = "option-copy";
18196
+ const optionName = document2.createElement("span");
18197
+ optionName.className = "option-name";
18198
+ optionName.textContent = option.label;
18199
+ text.append(optionName);
18200
+ if (option.description) {
18201
+ const description = document2.createElement("span");
18202
+ description.className = "description";
18203
+ description.textContent = option.description;
18204
+ text.append(description);
18205
+ }
18206
+ label.append(input, shortcut, text, selected);
18207
+ group.append(label);
18208
+ inputs.push(input);
18209
+ controls.push(input);
18210
+ }
18211
+ let other;
18212
+ let notes;
18213
+ if (field2.allowOther) {
18214
+ const label = document2.createElement("label");
18215
+ label.className = "option other";
18216
+ other = document2.createElement("input");
18217
+ other.type = field2.multiple ? "checkbox" : "radio";
18218
+ other.name = name;
18219
+ other.setAttribute("aria-label", `Other: ${field2.prompt}`);
18220
+ const unknown2 = saved.find(
18221
+ (value) => !field2.options.some((option) => option.value === value)
18222
+ );
18223
+ other.checked = unknown2 !== void 0;
18224
+ notes = document2.createElement("input");
18225
+ notes.value = unknown2 ?? "";
18226
+ notes.placeholder = "Or write your own response";
18227
+ notes.setAttribute("aria-label", `${field2.prompt}: Other`);
18228
+ const checkbox = other;
18229
+ const otherText = notes;
18230
+ validOther.push(() => !checkbox.checked || otherText.value.trim().length > 0);
18231
+ notes.addEventListener("input", () => {
18232
+ checkbox.checked = true;
18233
+ });
18234
+ const copy = document2.createElement("span");
18235
+ copy.className = "other-copy";
18236
+ copy.append(notes);
18237
+ const pencil = document2.createElement("span");
18238
+ pencil.className = "shortcut pencil";
18239
+ pencil.append(icon2(Pencil));
18240
+ pencil.setAttribute("aria-hidden", "true");
18241
+ const selected = selectedIndicator();
18242
+ label.append(other, pencil, copy, selected);
18243
+ if (question.questions.length === 1) footer.append(label);
18244
+ else group.append(label);
18245
+ controls.push(other, notes);
18246
+ }
18247
+ readers.set(field2.id, () => [
18248
+ ...inputs.filter((input) => input.checked).map((input) => input.value),
18249
+ ...other?.checked && notes?.value.trim() ? [notes.value] : []
18250
+ ]);
18251
+ }
18252
+ body.append(group);
18253
+ }
18254
+ const error51 = document2.createElement("div");
18255
+ error51.setAttribute("role", "alert");
18256
+ error51.className = "error";
18257
+ const actions = document2.createElement("div");
18258
+ actions.className = "actions";
18259
+ const readAnswers = () => Object.fromEntries([...readers].map(([id, read]) => [id, read()]));
18260
+ let busy = false;
18261
+ const send = async (cancelled) => {
18262
+ if (busy) return;
18263
+ const answers = cancelled ? {} : readAnswers();
18264
+ if (!cancelled && validOther.some((valid) => !valid())) {
18265
+ error51.textContent = "Type an answer for each selected Other option.";
18266
+ return;
18267
+ }
18268
+ if (!cancelled && question.questions.some((field2) => !field2.optional && !answers[field2.id]?.length)) {
18269
+ error51.textContent = "Answer each required question before submitting.";
18270
+ return;
18271
+ }
18272
+ busy = true;
18273
+ error51.textContent = "";
18274
+ for (const control of controls) control.disabled = true;
18275
+ try {
18276
+ await submit(answers, cancelled);
18277
+ } catch {
18278
+ error51.textContent = "Could not submit. The question may have closed. Try again if it is still available.";
18279
+ } finally {
18280
+ busy = false;
18281
+ for (const control of controls) control.disabled = false;
18282
+ }
18283
+ };
18284
+ for (const [label, cancelled] of [
18285
+ ["Skip", true],
18286
+ ["Send", false]
18287
+ ]) {
18288
+ const button2 = document2.createElement("button");
18289
+ button2.type = "button";
18290
+ button2.textContent = label;
18291
+ if (!cancelled) button2.className = "primary";
18292
+ button2.addEventListener("click", () => {
18293
+ void send(cancelled);
18294
+ });
18295
+ controls.push(button2);
18296
+ actions.append(button2);
18297
+ }
18298
+ dismiss.addEventListener("click", () => {
18299
+ void send(true);
18300
+ });
18301
+ footer.append(actions);
18302
+ surface.append(error51, footer);
18303
+ return {
18304
+ root,
18305
+ readAnswers,
18306
+ get autoResolution() {
18307
+ return autoResolution;
18308
+ },
18309
+ updateAutoResolution(next) {
18310
+ if (autoResolution && (!next || next.deadlineUnixMs < autoResolution.deadlineUnixMs)) return;
18311
+ autoResolution = next;
18312
+ if (next && countdownTimer === void 0)
18313
+ countdownTimer = document2.defaultView?.setInterval(updateCountdown2, 250);
18314
+ updateCountdown2();
18315
+ },
18316
+ dispose() {
18317
+ if (countdownTimer !== void 0) document2.defaultView?.clearInterval(countdownTimer);
18318
+ root.remove();
18319
+ }
18320
+ };
18321
+ }
18322
+
18323
+ // src/renderer-question-activity.ts
18324
+ function installQuestionActivity(window2, root, enabled, reset) {
18325
+ let disposed = false;
18326
+ let inFlight = false;
18327
+ let queued = false;
18328
+ let blurred = false;
18329
+ let timer;
18330
+ const available = () => !disposed && root.isConnected && enabled();
18331
+ const schedule = () => {
18332
+ if (timer !== void 0 || inFlight || !queued || !available()) return;
18333
+ timer = window2.setTimeout(() => {
18334
+ void flush();
18335
+ }, 250);
18336
+ };
18337
+ const flush = async () => {
18338
+ timer = void 0;
18339
+ if (!available()) {
18340
+ queued = false;
18341
+ return;
18342
+ }
18343
+ queued = false;
18344
+ inFlight = true;
18345
+ try {
18346
+ await reset();
18347
+ } catch {
18348
+ } finally {
18349
+ inFlight = false;
18350
+ schedule();
18351
+ }
18352
+ };
18353
+ const activity = (event) => {
18354
+ if (!event.isTrusted || !available()) return;
18355
+ queued = true;
18356
+ schedule();
18357
+ };
18358
+ const blur = (event) => {
18359
+ if (event.isTrusted) blurred = true;
18360
+ };
18361
+ const focus = (event) => {
18362
+ if (!blurred) return;
18363
+ blurred = false;
18364
+ activity(event);
18365
+ };
18366
+ const events = ["pointerdown", "keydown", "input", "wheel"];
18367
+ for (const event of events) root.addEventListener(event, activity, { passive: true });
18368
+ window2.addEventListener("blur", blur);
18369
+ window2.addEventListener("focus", focus);
18370
+ return () => {
18371
+ disposed = true;
18372
+ queued = false;
18373
+ if (timer !== void 0) window2.clearTimeout(timer);
18374
+ for (const event of events) root.removeEventListener(event, activity);
18375
+ window2.removeEventListener("blur", blur);
18376
+ window2.removeEventListener("focus", focus);
18377
+ };
18378
+ }
18379
+
18380
+ // src/renderer-request-sender.ts
18381
+ var RendererMethodUnavailableError = class extends Error {
18382
+ constructor(method, cause) {
18383
+ super(`${method} is unsupported on this Host connection`, { cause });
18384
+ this.method = method;
18385
+ this.name = "RendererMethodUnavailableError";
18386
+ }
18387
+ method;
18388
+ code = -32601;
18389
+ };
18390
+ function isUnsupportedMethod(error51, method) {
18391
+ if (typeof error51 !== "object" || error51 === null) return false;
18392
+ const code = "code" in error51 ? error51.code : void 0;
18393
+ const message2 = "message" in error51 ? error51.message : void 0;
18394
+ return code === -32601 || code === -32600 && typeof message2 === "string" && message2.startsWith(`Invalid request: unknown variant \`${method}\``);
18395
+ }
18396
+ function createRendererRequestSender(send) {
18397
+ const unsupported = /* @__PURE__ */ new Map();
18398
+ return async (method, params, options) => {
18399
+ const known = unsupported.get(method);
18400
+ if (known) throw known;
18401
+ try {
18402
+ return await (options === void 0 ? send(method, params) : send(method, params, options));
18403
+ } catch (error51) {
18404
+ if (!method.startsWith("codexhost/") || !isUnsupportedMethod(error51, method)) throw error51;
18405
+ const unavailable = new RendererMethodUnavailableError(method, error51);
18406
+ unsupported.set(method, unavailable);
18407
+ throw unavailable;
18408
+ }
18409
+ };
18410
+ }
18411
+
18412
+ // src/renderer-questions.ts
18413
+ function same(a, b) {
18414
+ return a?.hostId === b?.hostId && a?.threadId === b?.threadId && a?.composer === b?.composer && a?.route === b?.route;
18415
+ }
18416
+ function installRendererQuestions(window2, readContext) {
18417
+ let disposed = false;
18418
+ let inFlight = false;
18419
+ let context = null;
18420
+ let card = null;
18421
+ let cardId = null;
18422
+ let stopActivity;
18423
+ const unsupported = /* @__PURE__ */ new WeakSet();
18424
+ const drafts = /* @__PURE__ */ new Map();
18425
+ const key = (id) => JSON.stringify([context?.hostId, context?.threadId, id]);
18426
+ const clear = (retain = true) => {
18427
+ stopActivity?.();
18428
+ stopActivity = void 0;
18429
+ if (retain && card && cardId) {
18430
+ drafts.set(key(cardId), card.readAnswers());
18431
+ const oldest = drafts.keys().next().value;
18432
+ if (drafts.size > 50 && oldest !== void 0) drafts.delete(oldest);
18433
+ }
18434
+ card?.dispose();
18435
+ card = null;
18436
+ cardId = null;
18437
+ };
18438
+ const refresh = async () => {
18439
+ if (disposed) return;
18440
+ const next = readContext();
18441
+ if (!same(context, next)) {
18442
+ clear();
18443
+ context = next;
18444
+ }
18445
+ const current = context;
18446
+ if (!current || inFlight || unsupported.has(current.route)) return;
18447
+ inFlight = true;
18448
+ try {
18449
+ const raw = await current.route.sendRequest(
18450
+ THREAD_QUESTIONS_LIST_METHOD,
18451
+ { threadId: current.threadId },
18452
+ { priority: "background", timeoutMs: 5e3 }
18453
+ );
18454
+ if (disposed || !same(current, readContext())) return;
18455
+ const question = threadQuestionsResultSchema.parse(raw).questions[0];
18456
+ if (!question) {
18457
+ if (cardId) drafts.delete(key(cardId));
18458
+ clear(false);
18459
+ return;
18460
+ }
18461
+ if (cardId === question.interactionId && card?.root.isConnected) {
18462
+ card.updateAutoResolution(question.autoResolution);
18463
+ return;
18464
+ }
18465
+ clear(cardId === question.interactionId);
18466
+ cardId = question.interactionId;
18467
+ card = createQuestionCard(
18468
+ current.composer.ownerDocument,
18469
+ question,
18470
+ async (answers, cancelled) => {
18471
+ if (disposed || !same(current, readContext()) || cardId !== question.interactionId)
18472
+ throw new Error("Question owner changed");
18473
+ const result = await current.route.sendRequest(
18474
+ THREAD_QUESTION_RESPOND_METHOD,
18475
+ {
18476
+ threadId: current.threadId,
18477
+ turnId: question.turnId,
18478
+ interactionId: question.interactionId,
18479
+ answers,
18480
+ cancelled
18481
+ },
18482
+ { priority: "interactive", timeoutMs: 1e4 }
18483
+ );
18484
+ threadQuestionRespondResultSchema.parse(result);
18485
+ drafts.delete(JSON.stringify([current.hostId, current.threadId, question.interactionId]));
18486
+ if (same(current, context) && cardId === question.interactionId) clear(false);
18487
+ },
18488
+ drafts.get(key(question.interactionId))
18489
+ );
18490
+ current.composer.before(card.root);
18491
+ const mounted = card;
18492
+ stopActivity = installQuestionActivity(
18493
+ window2,
18494
+ card.root,
18495
+ () => same(current, readContext()) && card === mounted && mounted.autoResolution?.resetOnActivity === true,
18496
+ async () => {
18497
+ const raw2 = await current.route.sendRequest(
18498
+ THREAD_QUESTION_ACTIVITY_METHOD,
18499
+ {
18500
+ threadId: current.threadId,
18501
+ turnId: question.turnId,
18502
+ interactionId: question.interactionId
18503
+ },
18504
+ { priority: "background", timeoutMs: 4e3 }
18505
+ );
18506
+ if (disposed || card !== mounted || !same(current, readContext())) return;
18507
+ const ack = threadQuestionActivityResultSchema.parse(raw2).autoResolution;
18508
+ if (ack) mounted.updateAutoResolution(ack);
18509
+ }
18510
+ );
18511
+ } catch (error51) {
18512
+ if (isUnsupportedMethod(error51, THREAD_QUESTIONS_LIST_METHOD)) unsupported.add(current.route);
18513
+ if (same(current, context)) clear();
18514
+ } finally {
18515
+ inFlight = false;
18516
+ }
18517
+ };
18518
+ const timer = window2.setInterval(() => {
18519
+ void refresh();
18520
+ }, 750);
18521
+ void refresh();
18522
+ return {
18523
+ refresh,
18524
+ dispose() {
18525
+ disposed = true;
18526
+ window2.clearInterval(timer);
18527
+ clear(false);
18528
+ drafts.clear();
18529
+ }
18530
+ };
18531
+ }
18532
+
17835
18533
  // src/codex-native-services.ts
17836
18534
  async function loadCodexNativeServices(ownerWindow, matchesServices, importModule = (url2) => import(url2)) {
17837
18535
  if (!ownerWindow.document || !ownerWindow.location) return null;
@@ -18372,42 +19070,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18372
19070
  return fallback;
18373
19071
  }
18374
19072
 
18375
- // ../../node_modules/lucide/dist/esm/defaultAttributes.mjs
18376
- var defaultAttributes = {
18377
- xmlns: "http://www.w3.org/2000/svg",
18378
- width: 24,
18379
- height: 24,
18380
- viewBox: "0 0 24 24",
18381
- fill: "none",
18382
- stroke: "currentColor",
18383
- "stroke-width": 2,
18384
- "stroke-linecap": "round",
18385
- "stroke-linejoin": "round"
18386
- };
18387
-
18388
- // ../../node_modules/lucide/dist/esm/createElement.mjs
18389
- var createSVGElement = ([tag, attrs, children]) => {
18390
- const element = document.createElementNS("http://www.w3.org/2000/svg", tag);
18391
- Object.keys(attrs).forEach((name) => {
18392
- element.setAttribute(name, String(attrs[name]));
18393
- });
18394
- if (children?.length) {
18395
- children.forEach((child) => {
18396
- const childElement = createSVGElement(child);
18397
- element.appendChild(childElement);
18398
- });
18399
- }
18400
- return element;
18401
- };
18402
- var createElement = (iconNode, customAttrs = {}) => {
18403
- const tag = "svg";
18404
- const attrs = {
18405
- ...defaultAttributes,
18406
- ...customAttrs
18407
- };
18408
- return createSVGElement([tag, attrs, iconNode]);
18409
- };
18410
-
18411
19073
  // ../../node_modules/lucide/dist/esm/icons/boxes.mjs
18412
19074
  var Boxes = [
18413
19075
  [
@@ -18712,12 +19374,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18712
19374
  ["path", { d: "M12 17h.01" }]
18713
19375
  ];
18714
19376
 
18715
- // ../../node_modules/lucide/dist/esm/icons/x.mjs
18716
- var X = [
18717
- ["path", { d: "M18 6 6 18" }],
18718
- ["path", { d: "m6 6 12 12" }]
18719
- ];
18720
-
18721
19377
  // ../../node_modules/lucide/dist/esm/icons/users.mjs
18722
19378
  var Users = [
18723
19379
  ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }],
@@ -19039,8 +19695,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19039
19695
  return input;
19040
19696
  }
19041
19697
  function createNumberField(document2, input) {
19042
- const field = document2.createElement("div");
19043
- field.className = "flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-settings-border bg-settings-surface px-2.5 transition-colors focus-within:border-settings-focus data-[invalid=true]:border-settings-danger";
19698
+ const field2 = document2.createElement("div");
19699
+ field2.className = "flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-settings-border bg-settings-surface px-2.5 transition-colors focus-within:border-settings-focus data-[invalid=true]:border-settings-danger";
19044
19700
  const control = document2.createElement("input");
19045
19701
  control.type = "number";
19046
19702
  control.id = input.id;
@@ -19053,8 +19709,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19053
19709
  unit.className = "text-xs text-settings-muted";
19054
19710
  unit.setAttribute("aria-hidden", "true");
19055
19711
  unit.textContent = input.unit;
19056
- field.append(control, unit);
19057
- return { field, control };
19712
+ field2.append(control, unit);
19713
+ return { field: field2, control };
19058
19714
  }
19059
19715
 
19060
19716
  // src/settings/grok-computer-use-controls.ts
@@ -23587,9 +24243,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
23587
24243
  syncModelSelectionNotice(control, view, locale);
23588
24244
  }
23589
24245
 
23590
- // ../../node_modules/lucide/dist/esm/icons/check.mjs
23591
- var Check = [["path", { d: "M20 6 9 17l-5-5" }]];
23592
-
23593
24246
  // ../../node_modules/lucide/dist/esm/icons/lock.mjs
23594
24247
  var Lock = [
23595
24248
  ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }],
@@ -24429,6 +25082,21 @@ Codex Fast mode prioritizes requests and may increase usage.`
24429
25082
  };
24430
25083
  }
24431
25084
 
25085
+ // src/renderer-composer-request.ts
25086
+ var NATIVE_COMPOSER_REQUEST_ATTRIBUTES = [
25087
+ "data-codex-composer-request-navigation",
25088
+ "data-codex-composer-request"
25089
+ ];
25090
+ var NATIVE_REQUEST_SELECTOR = NATIVE_COMPOSER_REQUEST_ATTRIBUTES.map(
25091
+ (attribute) => `[${attribute}]`
25092
+ ).join(", ");
25093
+ function isNativeComposerRequest(element) {
25094
+ return element.closest(NATIVE_REQUEST_SELECTOR) !== null;
25095
+ }
25096
+ function hasNativeComposerRequest(composer) {
25097
+ return isNativeComposerRequest(composer) || composer.querySelector(NATIVE_REQUEST_SELECTOR) !== null;
25098
+ }
25099
+
24432
25100
  // src/renderer-harness-command-control.ts
24433
25101
  var CONTROL_ATTRIBUTE2 = "data-codexhost-harness-command-control";
24434
25102
  var SVG_NS2 = "http://www.w3.org/2000/svg";
@@ -24612,9 +25280,12 @@ Codex Fast mode prioritizes requests and may increase usage.`
24612
25280
  return buttons.length > 0 && buttons.every((button2) => isComposerTrailingActionButton(button2));
24613
25281
  }
24614
25282
  function sendButtonWithin(root) {
24615
- return [...root.querySelectorAll("button")].find(
24616
- (button2) => isComposerSubmitButton(button2)
24617
- ) ?? null;
25283
+ return composerButtonsWithin(root).find((button2) => isComposerSubmitButton(button2)) ?? null;
25284
+ }
25285
+ function composerButtonsWithin(root) {
25286
+ return [...root.querySelectorAll("button")].filter(
25287
+ (button2) => !isNativeComposerRequest(button2)
25288
+ );
24618
25289
  }
24619
25290
  function leftmostTrailingSibling(container, before) {
24620
25291
  for (const child of container.children) {
@@ -24656,6 +25327,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24656
25327
  return composerForElement(editor);
24657
25328
  }
24658
25329
  function composerForElement(element) {
25330
+ if (isNativeComposerRequest(element)) return null;
24659
25331
  const composer = element.closest(CODEX_COMPOSER_SELECTOR);
24660
25332
  return composer && !isOrbitComposer(composer) ? composer : null;
24661
25333
  }
@@ -24798,7 +25470,7 @@ Codex Fast mode prioritizes requests and may increase usage.`
24798
25470
  return root?.parentElement ? root : null;
24799
25471
  }
24800
25472
  function lastNativeButtonWithin(composer) {
24801
- const buttons = [...composer.querySelectorAll("button")];
25473
+ const buttons = composerButtonsWithin(composer);
24802
25474
  for (let index = buttons.length - 1; index >= 0; index -= 1) {
24803
25475
  const button2 = buttons[index];
24804
25476
  if (button2 && !isInsideOwnedRendererControl(button2, composer)) return button2;
@@ -24813,7 +25485,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
24813
25485
  }
24814
25486
  function refreshSendButton(control) {
24815
25487
  const current = control.sendButton;
24816
- if (current?.isConnected && control.composer.contains(current)) return current;
25488
+ if (current?.isConnected && control.composer.contains(current) && !isNativeComposerRequest(current))
25489
+ return current;
24817
25490
  const replacement = sendButtonWithin(control.composer) ?? (current && !isComposerSubmitButton(current) ? lastNativeButtonWithin(control.composer) : null);
24818
25491
  if (!replacement) return null;
24819
25492
  if (control.sendDisabledBeforeSwitch !== null) {
@@ -25650,38 +26323,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
25650
26323
  return task.result;
25651
26324
  }
25652
26325
 
25653
- // src/renderer-request-sender.ts
25654
- var RendererMethodUnavailableError = class extends Error {
25655
- constructor(method, cause) {
25656
- super(`${method} is unsupported on this Host connection`, { cause });
25657
- this.method = method;
25658
- this.name = "RendererMethodUnavailableError";
25659
- }
25660
- method;
25661
- code = -32601;
25662
- };
25663
- function isUnsupportedMethod(error51, method) {
25664
- if (typeof error51 !== "object" || error51 === null) return false;
25665
- const code = "code" in error51 ? error51.code : void 0;
25666
- const message2 = "message" in error51 ? error51.message : void 0;
25667
- return code === -32601 || code === -32600 && typeof message2 === "string" && message2.startsWith(`Invalid request: unknown variant \`${method}\``);
25668
- }
25669
- function createRendererRequestSender(send) {
25670
- const unsupported = /* @__PURE__ */ new Map();
25671
- return async (method, params, options) => {
25672
- const known = unsupported.get(method);
25673
- if (known) throw known;
25674
- try {
25675
- return await (options === void 0 ? send(method, params) : send(method, params, options));
25676
- } catch (error51) {
25677
- if (!method.startsWith("codexhost/") || !isUnsupportedMethod(error51, method)) throw error51;
25678
- const unavailable = new RendererMethodUnavailableError(method, error51);
25679
- unsupported.set(method, unavailable);
25680
- throw unavailable;
25681
- }
25682
- };
25683
- }
25684
-
25685
26326
  // src/renderer-native-thread.ts
25686
26327
  function isRecord6(value) {
25687
26328
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -26124,12 +26765,46 @@ Codex Fast mode prioritizes requests and may increase usage.`
26124
26765
  function isRecord8(value) {
26125
26766
  return value !== null && typeof value === "object" && !Array.isArray(value);
26126
26767
  }
26127
- function installRendererExternalQueue(target) {
26128
- if (!isRecord8(target) || typeof target.getTurnCoordinator !== "function" || typeof target.getConversation !== "function") {
26129
- return null;
26768
+ function notificationTarget2(manager) {
26769
+ if (typeof manager.addNotificationCallback === "function") {
26770
+ return manager;
26130
26771
  }
26131
- if (typeof target.getStreamRole === "function") return null;
26132
- const coordinator = target.getTurnCoordinator();
26772
+ const nested = manager.requestClient;
26773
+ return isRecord8(nested) && typeof nested.addNotificationCallback === "function" ? nested : null;
26774
+ }
26775
+ function notificationParams(notification) {
26776
+ if (!isRecord8(notification)) return null;
26777
+ return isRecord8(notification.params) ? notification.params : notification;
26778
+ }
26779
+ function notificationThreadId(notification) {
26780
+ const params = notificationParams(notification);
26781
+ if (!params) return null;
26782
+ if (typeof params.threadId === "string" && params.threadId) return params.threadId;
26783
+ if (typeof params.conversationId === "string" && params.conversationId)
26784
+ return params.conversationId;
26785
+ return null;
26786
+ }
26787
+ function turnStatus(notification) {
26788
+ const params = notificationParams(notification);
26789
+ if (!params) return null;
26790
+ if (typeof params.status === "string") return params.status;
26791
+ const turn = params.turn;
26792
+ return isRecord8(turn) && typeof turn.status === "string" ? turn.status : null;
26793
+ }
26794
+ function isExternalConversation(conversation, threadId) {
26795
+ return isRecord8(conversation) && conversation.id === threadId && conversation.modelProvider === "codexhost";
26796
+ }
26797
+ function firstQueuedItemId(items) {
26798
+ if (!Array.isArray(items)) return null;
26799
+ for (const item of items) {
26800
+ if (!isRecord8(item) || item.pausedReason != null) continue;
26801
+ if (typeof item.id === "string" && item.id) return item.id;
26802
+ }
26803
+ return null;
26804
+ }
26805
+ function installLocalQueueGate(target) {
26806
+ const getTurnCoordinator = target.getTurnCoordinator;
26807
+ const coordinator = getTurnCoordinator.call(target);
26133
26808
  const queue = isRecord8(coordinator) ? coordinator.serverQueue : null;
26134
26809
  if (!isRecord8(queue) || typeof queue.isEnabled !== "function") return null;
26135
26810
  const descriptor = Object.getOwnPropertyDescriptor(queue, "isEnabled");
@@ -26138,13 +26813,8 @@ Codex Fast mode prioritizes requests and may increase usage.`
26138
26813
  const getConversation = target.getConversation;
26139
26814
  const isEnabled = (...args) => {
26140
26815
  const threadId = args[0];
26141
- if (typeof threadId === "string") {
26142
- const conversation = getConversation.call(target, threadId);
26143
- if (isRecord8(conversation) && conversation.id === threadId && // Reserved transport marker from externalThreadValue, retained by
26144
- // Desktop in both newly created and hydrated conversation metadata.
26145
- conversation.modelProvider === "codexhost") {
26146
- return false;
26147
- }
26816
+ if (typeof threadId === "string" && isExternalConversation(getConversation.call(target, threadId), threadId)) {
26817
+ return false;
26148
26818
  }
26149
26819
  return original.apply(queue, args);
26150
26820
  };
@@ -26153,6 +26823,90 @@ Codex Fast mode prioritizes requests and may increase usage.`
26153
26823
  if (queue.isEnabled === isEnabled) Object.defineProperty(queue, "isEnabled", descriptor);
26154
26824
  };
26155
26825
  }
26826
+ function installServerQueueDrain(target) {
26827
+ if (typeof target.sendRequest !== "function") return null;
26828
+ const notifications = notificationTarget2(target);
26829
+ if (!notifications) return null;
26830
+ const getConversation = target.getConversation;
26831
+ const getTurnCoordinator = target.getTurnCoordinator;
26832
+ const getStreamRole = target.getStreamRole;
26833
+ const sendRequest = target.sendRequest;
26834
+ const draining = /* @__PURE__ */ new Set();
26835
+ let disposed = false;
26836
+ const isExternalOwner = (threadId) => {
26837
+ if (!isExternalConversation(getConversation.call(target, threadId), threadId)) return false;
26838
+ const role = getStreamRole.call(target, threadId);
26839
+ return !(isRecord8(role) && role.role === "follower");
26840
+ };
26841
+ const isIdle = (threadId, coordinator) => {
26842
+ const options = isRecord8(coordinator) ? coordinator.options : null;
26843
+ const host = isRecord8(options) ? options.submissionHost : null;
26844
+ if (isRecord8(host) && typeof host.getActiveTurnId === "function" && typeof host.hasPendingTurnStart === "function") {
26845
+ return host.getActiveTurnId.call(host, threadId) == null && host.hasPendingTurnStart.call(host, threadId) !== true;
26846
+ }
26847
+ const conversation = getConversation.call(target, threadId);
26848
+ return isRecord8(conversation) && isRecord8(conversation.threadRuntimeStatus) && conversation.threadRuntimeStatus.type === "idle";
26849
+ };
26850
+ const queuedSubmissionId = (coordinator, threadId) => {
26851
+ if (isRecord8(coordinator) && typeof coordinator.readMessages === "function") {
26852
+ const messages = coordinator.readMessages.call(coordinator, threadId);
26853
+ if (Array.isArray(messages)) return firstQueuedItemId(messages);
26854
+ }
26855
+ const queue = isRecord8(coordinator) ? coordinator.serverQueue : null;
26856
+ if (isRecord8(queue) && typeof queue.read === "function") {
26857
+ return firstQueuedItemId(queue.read.call(queue, threadId));
26858
+ }
26859
+ return null;
26860
+ };
26861
+ const drain = (threadId) => {
26862
+ if (disposed || draining.has(threadId) || !isExternalOwner(threadId)) return;
26863
+ const coordinator = getTurnCoordinator.call(target);
26864
+ if (!isIdle(threadId, coordinator)) return;
26865
+ const queuedSubmissionIdValue = queuedSubmissionId(coordinator, threadId);
26866
+ if (!queuedSubmissionIdValue) return;
26867
+ draining.add(threadId);
26868
+ Promise.resolve(
26869
+ sendRequest.call(target, "thread/queue/start", {
26870
+ threadId,
26871
+ queuedSubmissionId: queuedSubmissionIdValue
26872
+ })
26873
+ ).catch((error51) => {
26874
+ const message2 = error51 instanceof Error ? error51.message : String(error51);
26875
+ if (message2.includes("Queued follow-up was not found")) return;
26876
+ console.error("codexhost could not start the queued follow-up", error51);
26877
+ }).finally(() => {
26878
+ draining.delete(threadId);
26879
+ });
26880
+ };
26881
+ const onNotification = (notification) => {
26882
+ if (disposed) return;
26883
+ const method = isRecord8(notification) && typeof notification.method === "string" ? notification.method : null;
26884
+ const threadId = notificationThreadId(notification);
26885
+ if (!threadId) return;
26886
+ if (method === "turn/completed") {
26887
+ if (turnStatus(notification) === "interrupted") return;
26888
+ drain(threadId);
26889
+ return;
26890
+ }
26891
+ if (method === "thread/queue/changed") drain(threadId);
26892
+ };
26893
+ const unsubscribe = notifications.addNotificationCallback(
26894
+ ["turn/completed", "thread/queue/changed"],
26895
+ onNotification
26896
+ );
26897
+ return () => {
26898
+ disposed = true;
26899
+ draining.clear();
26900
+ if (typeof unsubscribe === "function") unsubscribe();
26901
+ };
26902
+ }
26903
+ function installRendererExternalQueue(target) {
26904
+ if (!isRecord8(target) || typeof target.getTurnCoordinator !== "function" || typeof target.getConversation !== "function") {
26905
+ return null;
26906
+ }
26907
+ if (typeof target.getStreamRole === "function") return installServerQueueDrain(target);
26908
+ return installLocalQueueGate(target);
26909
+ }
26156
26910
 
26157
26911
  // src/renderer-external-steering.ts
26158
26912
  var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
@@ -28143,10 +28897,10 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
28143
28897
  if (!locale) throw new Error("Codex locale override is invalid");
28144
28898
  return { value: locale };
28145
28899
  }
28146
- function optionalLocale(value, field) {
28900
+ function optionalLocale(value, field2) {
28147
28901
  if (value === void 0 || value === null) return void 0;
28148
28902
  const locale = canonicalLocale(value);
28149
- if (!locale) throw new Error(`Codex ${field} is invalid`);
28903
+ if (!locale) throw new Error(`Codex ${field2} is invalid`);
28150
28904
  return locale;
28151
28905
  }
28152
28906
  function parseLocaleInfo(value) {
@@ -29056,7 +29810,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
29056
29810
  var DECIMAL = /^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu;
29057
29811
  function modelPriceDraft(key, price) {
29058
29812
  const prices = Object.fromEntries(
29059
- MODEL_PRICE_FIELDS.map((field) => [field, price?.[field]?.toString() ?? ""])
29813
+ MODEL_PRICE_FIELDS.map((field2) => [field2, price?.[field2]?.toString() ?? ""])
29060
29814
  );
29061
29815
  return { model: key, prices };
29062
29816
  }
@@ -29067,18 +29821,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
29067
29821
  return { error: { kind: "duplicate", key } };
29068
29822
  }
29069
29823
  const price = {};
29070
- for (const field of MODEL_PRICE_FIELDS) {
29071
- const text = draft.prices[field].trim();
29824
+ for (const field2 of MODEL_PRICE_FIELDS) {
29825
+ const text = draft.prices[field2].trim();
29072
29826
  if (text === "") {
29073
- if (field === "input" || field === "output")
29074
- return { error: { kind: "priceRequired", field } };
29827
+ if (field2 === "input" || field2 === "output")
29828
+ return { error: { kind: "priceRequired", field: field2 } };
29075
29829
  continue;
29076
29830
  }
29077
29831
  const value = Number(text);
29078
29832
  if (!DECIMAL.test(text) || !Number.isFinite(value)) {
29079
- return { error: { kind: "priceInvalid", field } };
29833
+ return { error: { kind: "priceInvalid", field: field2 } };
29080
29834
  }
29081
- price[field] = value;
29835
+ price[field2] = value;
29082
29836
  }
29083
29837
  return {
29084
29838
  change: {
@@ -29098,7 +29852,7 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
29098
29852
  }
29099
29853
  function formatPrice(messages, price) {
29100
29854
  return MODEL_PRICE_FIELDS.map(
29101
- (field) => `${messages.fields[field]} ${price[field] ?? messages.unset}`
29855
+ (field2) => `${messages.fields[field2]} ${price[field2] ?? messages.unset}`
29102
29856
  ).join(" \xB7 ");
29103
29857
  }
29104
29858
  function draftErrorText(messages, error51) {
@@ -29166,18 +29920,18 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
29166
29920
  function renderEditor(modelId, view, isCurrent) {
29167
29921
  const existing = view.entries.find((entry) => entry.key === modelId);
29168
29922
  const draft = modelPriceDraft(modelId, existing?.price ?? null);
29169
- const field = (label, value, placeholder = "") => h(document2, "input", {
29923
+ const field2 = (label, value, placeholder = "") => h(document2, "input", {
29170
29924
  type: "text",
29171
29925
  className: "console-input",
29172
29926
  value,
29173
29927
  placeholder,
29174
29928
  "aria-label": label
29175
29929
  });
29176
- const model2 = field(messages.model, modelId);
29930
+ const model2 = field2(messages.model, modelId);
29177
29931
  model2.readOnly = true;
29178
29932
  const prices = Object.fromEntries(
29179
29933
  MODEL_PRICE_FIELDS.map((name) => {
29180
- const input = field(
29934
+ const input = field2(
29181
29935
  messages.fields[name],
29182
29936
  draft.prices[name],
29183
29937
  name === "input" || name === "output" ? messages.required : messages.notSet
@@ -29989,8 +30743,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
29989
30743
  for (const cell of options.cells) {
29990
30744
  const key = options.singleDay ? cell.hour : cell.weekday * 24 + cell.hour;
29991
30745
  const totals2 = byHour.get(key) ?? emptyTotals();
29992
- for (const field of Object.keys(totals2))
29993
- totals2[field] += cell.totals[field];
30746
+ for (const field2 of Object.keys(totals2))
30747
+ totals2[field2] += cell.totals[field2];
29994
30748
  byHour.set(key, totals2);
29995
30749
  }
29996
30750
  const max = Math.max(0, ...[...byHour.values()].map((totals2) => measured(totals2, measure)));
@@ -30353,8 +31107,8 @@ ${text.includes("## My request:") ? "" : "\n## My request:\n"}`,
30353
31107
  save();
30354
31108
  load();
30355
31109
  }
30356
- function toggleFilter(field, key) {
30357
- view[field] = view[field] === key ? "" : key;
31110
+ function toggleFilter(field2, key) {
31111
+ view[field2] = view[field2] === key ? "" : key;
30358
31112
  changed();
30359
31113
  }
30360
31114
  function selectDate(next) {
@@ -30770,8 +31524,8 @@ ${messages.creditsCoverage}: ${value.reportedRequests} / ${row.requests}` : void
30770
31524
  }
30771
31525
  ];
30772
31526
  }
30773
- function rowFilter(field, key, label, detail) {
30774
- const selected = view[field] === key;
31527
+ function rowFilter(field2, key, label, detail) {
31528
+ const selected = view[field2] === key;
30775
31529
  const button2 = focusKey(
30776
31530
  h(
30777
31531
  document2,
@@ -30785,9 +31539,9 @@ ${detail}` : ""}`
30785
31539
  },
30786
31540
  label
30787
31541
  ),
30788
- `${field}:row:${key}`
31542
+ `${field2}:row:${key}`
30789
31543
  );
30790
- button2.addEventListener("click", () => toggleFilter(field, key));
31544
+ button2.addEventListener("click", () => toggleFilter(field2, key));
30791
31545
  return button2;
30792
31546
  }
30793
31547
  function panel(title, content, extra = null, wide = false) {
@@ -32013,7 +32767,7 @@ ${detail}` : ""}`
32013
32767
  );
32014
32768
  if (!dialog) return;
32015
32769
  const document2 = options.container.ownerDocument;
32016
- const field = (label, value, placeholder = "", hint = "") => {
32770
+ const field2 = (label, value, placeholder = "", hint = "") => {
32017
32771
  const wrapper = remoteElement(document2, "div", "settings-credential-dialog__field");
32018
32772
  const input = remoteElement(document2, "input");
32019
32773
  input.id = preferenceId("remote-field");
@@ -32033,13 +32787,13 @@ ${detail}` : ""}`
32033
32787
  dialog.body.append(wrapper);
32034
32788
  return input;
32035
32789
  };
32036
- const name = field(t("\u540D\u79F0", "Name"), previous?.displayName ?? "");
32790
+ const name = field2(t("\u540D\u79F0", "Name"), previous?.displayName ?? "");
32037
32791
  name.required = true;
32038
32792
  const addressHint = t(
32039
32793
  "user@hostname\uFF0C\u6216 ~/.ssh/config \u4E2D\u7684\u4E3B\u673A\u522B\u540D",
32040
32794
  "user@hostname, or a host alias from ~/.ssh/config"
32041
32795
  );
32042
- const hostname3 = field(
32796
+ const hostname3 = field2(
32043
32797
  t("SSH \u5730\u5740", "SSH address"),
32044
32798
  previous?.sshHost ?? "",
32045
32799
  "user@hostname",
@@ -32048,7 +32802,7 @@ ${detail}` : ""}`
32048
32802
  hostname3.required = true;
32049
32803
  hostname3.pattern = "[^\\s\\-]\\S*";
32050
32804
  hostname3.title = addressHint;
32051
- const port = field(
32805
+ const port = field2(
32052
32806
  t("\u7AEF\u53E3\uFF08\u53EF\u9009\uFF09", "Port (optional)"),
32053
32807
  previous?.sshPort?.toString() ?? "",
32054
32808
  "22"
@@ -32057,7 +32811,7 @@ ${detail}` : ""}`
32057
32811
  port.min = "1";
32058
32812
  port.max = "65535";
32059
32813
  port.step = "1";
32060
- const identity = field(
32814
+ const identity = field2(
32061
32815
  t("\u79C1\u94A5\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09", "Identity file (optional)"),
32062
32816
  previous?.identity ?? "",
32063
32817
  "~/.ssh/id_ed25519"
@@ -33489,14 +34243,14 @@ ${detail}` : ""}`
33489
34243
  description: messages.idleReleaseTimeoutDescription,
33490
34244
  controlId: minutesId
33491
34245
  });
33492
- const { field, control: minutes } = createNumberField(document2, {
34246
+ const { field: field2, control: minutes } = createNumberField(document2, {
33493
34247
  id: minutesId,
33494
34248
  describedBy: timeout.description.id,
33495
34249
  unit: messages.idleReleaseMinutes,
33496
34250
  min: IDLE_RELEASE_TIMEOUT_MINUTES_MIN,
33497
34251
  max: IDLE_RELEASE_TIMEOUT_MINUTES_MAX
33498
34252
  });
33499
- timeout.item.append(field);
34253
+ timeout.item.append(field2);
33500
34254
  timeout.item.id = preferenceId("idle-release-timeout");
33501
34255
  enabled.setAttribute("aria-controls", timeout.item.id);
33502
34256
  card.append(toggle.item, timeout.item);
@@ -33517,7 +34271,7 @@ ${detail}` : ""}`
33517
34271
  statusText.textContent = value === "applied" ? "" : statusMessages[value];
33518
34272
  };
33519
34273
  const setInvalid = (invalid) => {
33520
- field.dataset.invalid = String(invalid);
34274
+ field2.dataset.invalid = String(invalid);
33521
34275
  timeout.description.dataset.invalid = String(invalid);
33522
34276
  timeout.description.textContent = invalid ? messages.idleReleaseInvalid : messages.idleReleaseTimeoutDescription;
33523
34277
  minutes.setAttribute("aria-invalid", String(invalid));
@@ -42678,7 +43432,7 @@ ${usage_default}`;
42678
43432
  const ownershipRecovery = /* @__PURE__ */ new WeakMap();
42679
43433
  const modelRecovery = /* @__PURE__ */ new WeakMap();
42680
43434
  const isRetainedComposer = (mounted) => mounted.composer.isConnected && mounted.composer.matches(CODEX_COMPOSER_SELECTOR) && mountedByComposer.get(mounted.composer) === mounted;
42681
- const isMountedComposer = (composer) => composer.isConnected && composer.matches(CODEX_COMPOSER_SELECTOR) && orbitComposerKind(composer) === "codex" && mountedByComposer.has(composer);
43435
+ const isMountedComposer = (composer) => composer.isConnected && composer.matches(CODEX_COMPOSER_SELECTOR) && !hasNativeComposerRequest(composer) && orbitComposerKind(composer) === "codex" && mountedByComposer.has(composer);
42682
43436
  const isCurrentModelRequest = (mounted, generation) => isMountedComposer(mounted.composer) && mountedByComposer.get(mounted.composer) === mounted && controller.isCurrentModelRequest(mounted.composer, generation);
42683
43437
  const isCurrentOwnershipRequest = (mounted, generation) => isMountedComposer(mounted.composer) && mountedByComposer.get(mounted.composer) === mounted && controller.isCurrentOwnershipRequest(mounted.composer, generation);
42684
43438
  const finishModelRequest = (mounted, generation) => {
@@ -44085,11 +44839,11 @@ ${usage_default}`;
44085
44839
  }
44086
44840
  };
44087
44841
  const mount = (composer) => {
44088
- if (mountedByComposer.has(composer) || !composer.isConnected || orbitComposerKind(composer) !== "codex" || !composer.matches(CODEX_COMPOSER_SELECTOR)) {
44842
+ if (mountedByComposer.has(composer) || !composer.isConnected || hasNativeComposerRequest(composer) || orbitComposerKind(composer) !== "codex" || !composer.matches(CODEX_COMPOSER_SELECTOR)) {
44089
44843
  return;
44090
44844
  }
44091
- const allButtons = [...composer.querySelectorAll("button")];
44092
- const sendButton = sendButtonWithin(composer) ?? allButtons.at(-1) ?? null;
44845
+ const allButtons = composerButtonsWithin(composer);
44846
+ const sendButton = allButtons.find(isComposerSubmitButton) ?? allButtons.at(-1) ?? null;
44093
44847
  if (!sendButton) return;
44094
44848
  const modelTarget = findComposerModelTarget(composer);
44095
44849
  const hostId2 = activeModelHostId(composer);
@@ -44200,7 +44954,7 @@ ${usage_default}`;
44200
44954
  }
44201
44955
  for (const [composer, mounted] of mountedByComposer) {
44202
44956
  const kind = orbitComposerKind(composer);
44203
- if (!composer.isConnected || kind === "orbit" || !composer.matches(CODEX_COMPOSER_SELECTOR) || !mounted.control.root.isConnected) {
44957
+ if (!composer.isConnected || hasNativeComposerRequest(composer) || kind === "orbit" || !composer.matches(CODEX_COMPOSER_SELECTOR) || !mounted.control.root.isConnected) {
44204
44958
  mounted.usageRequestGeneration += 1;
44205
44959
  usageRefreshAttempts.delete(composer);
44206
44960
  const timer = usageRefreshTimers.get(composer);
@@ -44249,6 +45003,7 @@ ${usage_default}`;
44249
45003
  void refreshHarnessAvailability();
44250
45004
  }
44251
45005
  pendingReplacements.clear();
45006
+ void questions.refresh();
44252
45007
  };
44253
45008
  const scheduleScan = (refreshTargets = false) => {
44254
45009
  refreshTargetsOnNextScan ||= refreshTargets;
@@ -44432,7 +45187,12 @@ ${usage_default}`;
44432
45187
  };
44433
45188
  mutationObserver.observe(document.documentElement, {
44434
45189
  attributes: true,
44435
- attributeFilter: ["hidden", "aria-hidden", "data-codex-composer-root"],
45190
+ attributeFilter: [
45191
+ "hidden",
45192
+ "aria-hidden",
45193
+ "data-codex-composer-root",
45194
+ ...NATIVE_COMPOSER_REQUEST_ATTRIBUTES
45195
+ ],
44436
45196
  characterData: true,
44437
45197
  childList: true,
44438
45198
  subtree: true
@@ -44543,6 +45303,21 @@ ${usage_default}`;
44543
45303
  const connectedComposers = () => [...mountedByComposer.values()].filter(
44544
45304
  (mounted) => isMountedComposer(mounted.composer) && mounted.control.root.isConnected
44545
45305
  );
45306
+ const questions = installRendererQuestions(window, () => {
45307
+ const visible = connectedComposers().filter(
45308
+ (mounted2) => mounted2.composer.getClientRects().length > 0 && controller.get(mounted2.composer).agent !== "codex"
45309
+ );
45310
+ const mounted = visible.length === 1 ? visible[0] : void 0;
45311
+ const threadId = mounted ? threadIdFromComposerModelTarget(findComposerModelTarget(mounted.composer)) : null;
45312
+ const hostId2 = mounted?.hostId;
45313
+ const route = hostId2 ? window.__codexhostHostRoutingV1?.forHost(hostId2) : null;
45314
+ return mounted && threadId && hostId2 && route ? {
45315
+ hostId: hostId2,
45316
+ threadId,
45317
+ composer: mounted.composer,
45318
+ route: route.manager
45319
+ } : null;
45320
+ });
44546
45321
  const api = {
44547
45322
  remoteConnections: (request) => handleRemoteConnectionsRequest(remoteConnections, request),
44548
45323
  currentThreadId() {
@@ -44634,6 +45409,7 @@ ${usage_default}`;
44634
45409
  dispose() {
44635
45410
  if (disposed) return;
44636
45411
  disposed = true;
45412
+ questions.dispose();
44637
45413
  usageNotificationDispose();
44638
45414
  adapterDispose?.();
44639
45415
  adapterDispose = null;
@@ -45676,6 +46452,10 @@ ${usage_default}`;
45676
46452
 
45677
46453
  lucide/dist/esm/defaultAttributes.mjs:
45678
46454
  lucide/dist/esm/createElement.mjs:
46455
+ lucide/dist/esm/icons/check.mjs:
46456
+ lucide/dist/esm/icons/message-circle-question-mark.mjs:
46457
+ lucide/dist/esm/icons/pencil.mjs:
46458
+ lucide/dist/esm/icons/x.mjs:
45679
46459
  lucide/dist/esm/icons/boxes.mjs:
45680
46460
  lucide/dist/esm/icons/circle-check.mjs:
45681
46461
  lucide/dist/esm/icons/chevron-down.mjs:
@@ -45711,11 +46491,9 @@ lucide/dist/esm/icons/terminal.mjs:
45711
46491
  lucide/dist/esm/icons/scroll-text.mjs:
45712
46492
  lucide/dist/esm/icons/search.mjs:
45713
46493
  lucide/dist/esm/icons/circle-question-mark.mjs:
45714
- lucide/dist/esm/icons/x.mjs:
45715
46494
  lucide/dist/esm/icons/users.mjs:
45716
46495
  lucide/dist/esm/icons/plus.mjs:
45717
46496
  lucide/dist/esm/icons/circle-alert.mjs:
45718
- lucide/dist/esm/icons/check.mjs:
45719
46497
  lucide/dist/esm/icons/lock.mjs:
45720
46498
  lucide/dist/esm/icons/shield.mjs:
45721
46499
  lucide/dist/esm/icons/shield-alert.mjs: