@liberseek/boft-cli-win32-arm64 0.6.3 → 0.6.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.
@@ -20663,29 +20663,19 @@ ${error51.stderrTail}`] : []
20663
20663
  document.body.append(popover);
20664
20664
  return control;
20665
20665
  }
20666
+ function composerCreditsChipVisible(accountCredits) {
20667
+ return accountCredits !== null && accountCredits.usedPercent !== void 0;
20668
+ }
20669
+ function composerAccountCredits(accountCredits) {
20670
+ const credits = accountCredits ?? null;
20671
+ return composerCreditsChipVisible(credits) ? credits : null;
20672
+ }
20666
20673
  function renderRendererCreditsControl(control, accountCredits, locale = "en") {
20667
- if (accountCredits === null) {
20674
+ if (!composerCreditsChipVisible(accountCredits)) {
20668
20675
  control.root.style.display = "none";
20669
20676
  closePopover2(control);
20670
20677
  return false;
20671
20678
  }
20672
- if (accountCredits.usedPercent === void 0) {
20673
- const amount = accountCredits.remaining === void 0 || !accountCredits.unit ? null : formatAccountCreditsBalance(accountCredits.remaining, accountCredits.unit);
20674
- if (!amount) {
20675
- control.root.style.display = "none";
20676
- closePopover2(control);
20677
- return false;
20678
- }
20679
- const ringSlot2 = control.trigger.querySelector("[data-codexhost-credits-ring]");
20680
- const label2 = control.trigger.querySelector("[data-codexhost-credits-label]");
20681
- ringSlot2?.replaceChildren();
20682
- if (label2) label2.textContent = amount;
20683
- control.root.style.display = "inline-flex";
20684
- control.trigger.setAttribute("aria-label", amount);
20685
- control.trigger.title = amount;
20686
- renderDetails2(control.popover, accountCredits, locale);
20687
- return true;
20688
- }
20689
20679
  const remaining = remainingPercent(accountCredits.usedPercent);
20690
20680
  const percent = formatRendererCreditsPercent(remaining);
20691
20681
  const title = `${creditsPeriodLabel(accountCredits.periodType)} ${percent}`;
@@ -21508,7 +21498,11 @@ ${error51.stderrTail}`] : []
21508
21498
  control.harnessCommands.root.hidden = state.agent === "codex";
21509
21499
  control.harnessCommands.root.style.display = state.agent === "codex" ? "none" : "inline-flex";
21510
21500
  if (state.agent === "codex") control.harnessCommands.close();
21511
- renderRendererCreditsControl(control.credits, accountCredits, locale);
21501
+ renderRendererCreditsControl(
21502
+ control.credits,
21503
+ selectedCodexAccount && codexAccountAuthKind(selectedCodexAccount) === "api" ? null : composerAccountCredits(accountCredits),
21504
+ locale
21505
+ );
21512
21506
  }
21513
21507
  function disposeComposerAgentControl(control) {
21514
21508
  if (control.sendDisabledBeforeSwitch !== null) {
@@ -23538,6 +23532,640 @@ ${error51.stderrTail}`] : []
23538
23532
  return () => style.remove();
23539
23533
  }
23540
23534
 
23535
+ // src/renderer-subagent-thread-model.ts
23536
+ function isRecord7(value) {
23537
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23538
+ }
23539
+ function nonBlank(value) {
23540
+ return typeof value === "string" && value.trim().length > 0;
23541
+ }
23542
+ function threadFromReadResult(value, expectedThreadId) {
23543
+ if (!isRecord7(value)) return null;
23544
+ const directThread = isRecord7(value.thread) ? value.thread : null;
23545
+ const nestedThread = isRecord7(value.result) && isRecord7(value.result.thread) ? value.result.thread : null;
23546
+ const thread = directThread ?? nestedThread;
23547
+ if (!thread) return null;
23548
+ if (expectedThreadId && (!nonBlank(thread.id) || thread.id.trim() !== expectedThreadId)) {
23549
+ return null;
23550
+ }
23551
+ return thread;
23552
+ }
23553
+ function rendererThreadRequestTarget() {
23554
+ if (typeof window === "undefined") return null;
23555
+ const policy = window.__codexhostDraftPrewarmPolicyV1;
23556
+ if (typeof policy?.requestTarget !== "function") return null;
23557
+ try {
23558
+ const target = policy.requestTarget();
23559
+ return isRecord7(target) && typeof target.sendRequest === "function" ? target : null;
23560
+ } catch {
23561
+ return null;
23562
+ }
23563
+ }
23564
+ function isParentComposerModelLabel(model) {
23565
+ const head = model.includes(" \xB7 ") ? model.split(" \xB7 ")[0]?.trim() ?? "" : model;
23566
+ if (!head) return false;
23567
+ if (/^(grok|gpt|o\d|claude|codex)/i.test(head)) return false;
23568
+ return model.includes(" \xB7 ");
23569
+ }
23570
+ function usableThreadModel(value) {
23571
+ if (!nonBlank(value) || isParentComposerModelLabel(value)) return void 0;
23572
+ return value.trim();
23573
+ }
23574
+ function subagentThreadModelFromReadResult(value, expectedThreadId) {
23575
+ const thread = threadFromReadResult(value, expectedThreadId);
23576
+ if (!thread) return null;
23577
+ const model = usableThreadModel(thread.model) ?? usableThreadModel(thread.latestModel) ?? usableThreadModel(thread.resolvedModelLabel);
23578
+ const reasoningEffort = usableThreadModel(thread.reasoningEffort) ?? usableThreadModel(thread.latestReasoningEffort);
23579
+ if (!model && !reasoningEffort) return null;
23580
+ return {
23581
+ ...model ? { model } : {},
23582
+ ...reasoningEffort ? { reasoningEffort } : {}
23583
+ };
23584
+ }
23585
+ async function readSubagentThreadModelFromTarget(target, threadId) {
23586
+ const result = await target.sendRequest("thread/read", {
23587
+ threadId,
23588
+ includeTurns: false
23589
+ });
23590
+ return subagentThreadModelFromReadResult(result, threadId);
23591
+ }
23592
+ async function readRendererSubagentThreadModel(threadId) {
23593
+ const target = rendererThreadRequestTarget();
23594
+ if (!target) return null;
23595
+ return readSubagentThreadModelFromTarget(target, threadId);
23596
+ }
23597
+ function subagentStatusFromReadResult(value, expectedThreadId) {
23598
+ const thread = threadFromReadResult(value, expectedThreadId);
23599
+ if (!thread) return null;
23600
+ const threadStatus = isRecord7(thread.status) && nonBlank(thread.status.type) ? thread.status.type : void 0;
23601
+ if (threadStatus === "systemError") return "failed";
23602
+ const turns = Array.isArray(thread.turns) ? thread.turns : [];
23603
+ const lastTurn = [...turns].reverse().find(isRecord7);
23604
+ const turnStatus = lastTurn && nonBlank(lastTurn.status) ? lastTurn.status : void 0;
23605
+ if (turnStatus === "completed") return "completed";
23606
+ if (turnStatus === "failed") return "failed";
23607
+ if (turnStatus === "interrupted" || turnStatus === "cancelled") return "interrupted";
23608
+ if (turnStatus === "inProgress" || turnStatus === "running") return "running";
23609
+ if (turnStatus === "pending" || turnStatus === "queued") return "waiting";
23610
+ if (threadStatus === "active") return "running";
23611
+ return null;
23612
+ }
23613
+ async function readRendererSubagentStatus(threadId) {
23614
+ const target = rendererThreadRequestTarget();
23615
+ if (!target) return null;
23616
+ const result = await target.sendRequest("thread/read", {
23617
+ threadId,
23618
+ includeTurns: true
23619
+ });
23620
+ return subagentStatusFromReadResult(result, threadId);
23621
+ }
23622
+ function createSubagentThreadModelResolver(options) {
23623
+ const models = /* @__PURE__ */ new Map();
23624
+ const pending = /* @__PURE__ */ new Set();
23625
+ const attempts = /* @__PURE__ */ new Map();
23626
+ const retryTimers = /* @__PURE__ */ new Map();
23627
+ const maxAttempts = options.maxAttempts ?? 3;
23628
+ const retryDelayMs = options.retryDelayMs ?? 1e3;
23629
+ let disposed = false;
23630
+ const ensure = (threadId) => {
23631
+ if (disposed || !threadId || models.has(threadId) || pending.has(threadId)) return;
23632
+ const attempt = (attempts.get(threadId) ?? 0) + 1;
23633
+ if (attempt > maxAttempts) return;
23634
+ attempts.set(threadId, attempt);
23635
+ pending.add(threadId);
23636
+ void options.read(threadId).then(
23637
+ (snapshot) => {
23638
+ if (disposed) return;
23639
+ if (snapshot) {
23640
+ models.set(threadId, snapshot);
23641
+ attempts.delete(threadId);
23642
+ options.onUpdate();
23643
+ return;
23644
+ }
23645
+ if (attempt >= maxAttempts || retryTimers.has(threadId)) return;
23646
+ retryTimers.set(
23647
+ threadId,
23648
+ setTimeout(() => {
23649
+ retryTimers.delete(threadId);
23650
+ ensure(threadId);
23651
+ }, retryDelayMs)
23652
+ );
23653
+ },
23654
+ () => {
23655
+ if (disposed || attempt >= maxAttempts || retryTimers.has(threadId)) return;
23656
+ retryTimers.set(
23657
+ threadId,
23658
+ setTimeout(() => {
23659
+ retryTimers.delete(threadId);
23660
+ ensure(threadId);
23661
+ }, retryDelayMs)
23662
+ );
23663
+ }
23664
+ ).finally(() => {
23665
+ pending.delete(threadId);
23666
+ });
23667
+ };
23668
+ return {
23669
+ get(threadId) {
23670
+ return models.get(threadId);
23671
+ },
23672
+ ensure,
23673
+ refresh() {
23674
+ if (disposed) return;
23675
+ for (const threadId of [...attempts.keys()]) {
23676
+ if (pending.has(threadId) || retryTimers.has(threadId)) continue;
23677
+ attempts.delete(threadId);
23678
+ ensure(threadId);
23679
+ }
23680
+ },
23681
+ dispose() {
23682
+ if (disposed) return;
23683
+ disposed = true;
23684
+ for (const timer of retryTimers.values()) clearTimeout(timer);
23685
+ retryTimers.clear();
23686
+ pending.clear();
23687
+ attempts.clear();
23688
+ models.clear();
23689
+ }
23690
+ };
23691
+ }
23692
+ function createSubagentThreadStatusResolver(options) {
23693
+ const statuses = /* @__PURE__ */ new Map();
23694
+ const pending = /* @__PURE__ */ new Set();
23695
+ const attempts = /* @__PURE__ */ new Map();
23696
+ const maxAttempts = options.maxAttempts ?? 3;
23697
+ let disposed = false;
23698
+ const ensure = (threadId) => {
23699
+ const current = statuses.get(threadId);
23700
+ if (disposed || !threadId || pending.has(threadId) || current === "completed" || current === "failed" || current === "interrupted") {
23701
+ return;
23702
+ }
23703
+ const attempt = (attempts.get(threadId) ?? 0) + 1;
23704
+ if (attempt > maxAttempts) return;
23705
+ attempts.set(threadId, attempt);
23706
+ pending.add(threadId);
23707
+ void options.read(threadId).then((status) => {
23708
+ if (disposed || !status) return;
23709
+ statuses.set(threadId, status);
23710
+ if (status === "completed" || status === "failed" || status === "interrupted") {
23711
+ attempts.delete(threadId);
23712
+ }
23713
+ options.onUpdate();
23714
+ }).catch(() => {
23715
+ }).finally(() => {
23716
+ pending.delete(threadId);
23717
+ });
23718
+ };
23719
+ return {
23720
+ get(threadId) {
23721
+ return statuses.get(threadId);
23722
+ },
23723
+ ensure,
23724
+ refresh() {
23725
+ if (disposed) return;
23726
+ for (const threadId of /* @__PURE__ */ new Set([...statuses.keys(), ...attempts.keys()])) {
23727
+ const status = statuses.get(threadId);
23728
+ if (status === "completed" || status === "failed" || status === "interrupted") continue;
23729
+ attempts.delete(threadId);
23730
+ ensure(threadId);
23731
+ }
23732
+ },
23733
+ dispose() {
23734
+ disposed = true;
23735
+ statuses.clear();
23736
+ attempts.clear();
23737
+ pending.clear();
23738
+ }
23739
+ };
23740
+ }
23741
+
23742
+ // src/renderer-subagent-row-meta.ts
23743
+ var SUBAGENT_ROW_META_ATTRIBUTE = "data-codexhost-subagent-meta";
23744
+ var SUBAGENT_ROW_COPY_ATTRIBUTE = "data-codexhost-subagent-copy";
23745
+ var SUBAGENT_ITEM_BUTTON_SELECTOR = 'button[data-slot="thread-summary-panel-item-button"]';
23746
+ var SUBAGENT_ITEM_LABEL_SELECTOR = '[data-slot="thread-summary-panel-item-label"]';
23747
+ function isRecord8(value) {
23748
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23749
+ }
23750
+ function nonBlank2(value) {
23751
+ return typeof value === "string" && value.trim().length > 0;
23752
+ }
23753
+ function isDomElement(value) {
23754
+ return typeof Element !== "undefined" && value instanceof Element;
23755
+ }
23756
+ function isHtmlElement(value) {
23757
+ return typeof HTMLElement !== "undefined" && value instanceof HTMLElement;
23758
+ }
23759
+ function isParentComposerModelLabel2(model) {
23760
+ const trimmed = model?.trim();
23761
+ if (!trimmed) return false;
23762
+ const head = trimmed.includes(" \xB7 ") ? trimmed.split(" \xB7 ")[0]?.trim() ?? "" : trimmed;
23763
+ if (!head) return false;
23764
+ if (/^(grok|gpt|o\d|claude|codex)/i.test(head)) return false;
23765
+ return trimmed.includes(" \xB7 ");
23766
+ }
23767
+ function usableModel(value) {
23768
+ if (!nonBlank2(value) || isParentComposerModelLabel2(value)) return void 0;
23769
+ return value.trim();
23770
+ }
23771
+ function prettySubagentStatus(status) {
23772
+ switch (status) {
23773
+ case "active":
23774
+ case "running":
23775
+ case "working":
23776
+ return "\u8FDB\u884C\u4E2D";
23777
+ case "waiting":
23778
+ case "pending":
23779
+ case "pendingInit":
23780
+ return "\u7B49\u5F85\u4E2D";
23781
+ case "done":
23782
+ case "completed":
23783
+ return "\u5DF2\u5B8C\u6210";
23784
+ case "failed":
23785
+ case "errored":
23786
+ return "\u5931\u8D25";
23787
+ case "interrupted":
23788
+ return "\u5DF2\u4E2D\u65AD";
23789
+ default:
23790
+ return void 0;
23791
+ }
23792
+ }
23793
+ function prettySubagentEffort(value) {
23794
+ const trimmed = value?.trim();
23795
+ if (!trimmed) return void 0;
23796
+ const lower = trimmed.toLowerCase();
23797
+ if (lower === "xhigh") return "xHigh";
23798
+ if (lower === "ultra") return "\u8D85\u9AD8";
23799
+ return trimmed.charAt(0).toUpperCase() + trimmed.slice(1);
23800
+ }
23801
+ function prettySubagentModel(model) {
23802
+ const trimmed = model.trim();
23803
+ if (!trimmed || isParentComposerModelLabel2(trimmed)) return "";
23804
+ if (trimmed.includes(" \xB7 ")) return trimmed;
23805
+ const slash = trimmed.lastIndexOf("/");
23806
+ const id = slash >= 0 ? trimmed.slice(slash + 1) : trimmed;
23807
+ if (id.toLowerCase().startsWith("grok")) {
23808
+ return id.replace(/^grok[-_]?/iu, "Grok ").replace(/\s+/gu, " ").trim();
23809
+ }
23810
+ if (!id.trimStart().toLowerCase().startsWith("gpt")) return trimmed;
23811
+ const joiner = /^gpt-\d/iu.test(id.trimStart()) ? " " : "-";
23812
+ return id.split(/(\s+)/u).map((part) => {
23813
+ if (part.trim().length === 0) return part;
23814
+ return part.split("-").map((token, index) => {
23815
+ if (token.toLowerCase() === "gpt") return "GPT";
23816
+ if (token.toLowerCase() === "oai") return "OAI";
23817
+ if (index > 0 && token.length > 0) {
23818
+ return `${token[0]?.toUpperCase() ?? ""}${token.slice(1)}`;
23819
+ }
23820
+ return token;
23821
+ }).join(joiner).replace(/^GPT (?=\d)/u, "GPT-");
23822
+ }).join("");
23823
+ }
23824
+ function includesEffort(label, effort) {
23825
+ return new RegExp(`(?:^|\xB7\\s*)${effort.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}$`, "iu").test(
23826
+ label
23827
+ );
23828
+ }
23829
+ function formatSubagentRowMeta(row) {
23830
+ const raw = usableModel(row.spawnModel) ?? usableModel(row.model) ?? "";
23831
+ const model = raw ? prettySubagentModel(raw) : "";
23832
+ const effort = prettySubagentEffort(row.reasoningEffort);
23833
+ const modelLine = model && effort && !includesEffort(model, effort) ? `${model} \xB7 ${effort}` : model || effort;
23834
+ const parts = [prettySubagentStatus(row.status), modelLine].filter(
23835
+ (value) => typeof value === "string" && value.length > 0
23836
+ );
23837
+ return parts.length > 0 ? parts.join(" \xB7 ") : void 0;
23838
+ }
23839
+ function contribute(target, source, allowUnscopedModel = false) {
23840
+ const sourceId = nonBlank2(source.conversationId) ? source.conversationId.trim() : Array.isArray(source.receiverThreadIds) && nonBlank2(source.receiverThreadIds[0]) ? source.receiverThreadIds[0].trim() : void 0;
23841
+ if (target.conversationId && sourceId && sourceId !== target.conversationId) return;
23842
+ if (nonBlank2(source.displayName) && !target.displayName) {
23843
+ target.displayName = source.displayName.trim();
23844
+ }
23845
+ if (sourceId && !target.conversationId) target.conversationId = sourceId;
23846
+ const childModelSource = allowUnscopedModel || source.type === "collabAgentToolCall" || target.conversationId && nonBlank2(source.id) && source.id.trim() === target.conversationId;
23847
+ if (childModelSource) {
23848
+ const spawn = usableModel(source.spawnModel);
23849
+ const model = usableModel(source.model) ?? usableModel(source.modelLabel) ?? usableModel(source.latestModel);
23850
+ if (spawn && !target.spawnModel) target.spawnModel = spawn;
23851
+ if (model && !usableModel(target.model)) target.model = model;
23852
+ if (nonBlank2(source.reasoningEffort) && !target.reasoningEffort) {
23853
+ target.reasoningEffort = source.reasoningEffort.trim();
23854
+ }
23855
+ if (nonBlank2(source.latestReasoningEffort) && !target.reasoningEffort) {
23856
+ target.reasoningEffort = source.latestReasoningEffort.trim();
23857
+ }
23858
+ }
23859
+ if (nonBlank2(source.agentRole) && !target.agentRole) {
23860
+ target.agentRole = source.agentRole.trim();
23861
+ }
23862
+ if (nonBlank2(source.status) && !target.status) {
23863
+ target.status = source.status.trim();
23864
+ }
23865
+ if (isRecord8(source.agentState) && nonBlank2(source.agentState.status) && !target.status) {
23866
+ target.status = source.agentState.status.trim();
23867
+ }
23868
+ if (isRecord8(source.agentsStates) && target.conversationId) {
23869
+ const state = source.agentsStates[target.conversationId];
23870
+ if (isRecord8(state) && nonBlank2(state.status) && !target.status) {
23871
+ target.status = state.status.trim();
23872
+ }
23873
+ }
23874
+ }
23875
+ function collabMatches(item, conversationId) {
23876
+ if (item.type !== "collabAgentToolCall" || item.tool !== "spawnAgent") return false;
23877
+ if (!conversationId) return true;
23878
+ if (Array.isArray(item.receiverThreadIds) && item.receiverThreadIds.includes(conversationId)) {
23879
+ return true;
23880
+ }
23881
+ return isRecord8(item.agentsStates) && conversationId in item.agentsStates;
23882
+ }
23883
+ function harvestFromValue(value, target) {
23884
+ if (!isRecord8(value)) return;
23885
+ contribute(target, value);
23886
+ const nested = [
23887
+ isRecord8(value.row) ? value.row : null,
23888
+ isRecord8(value.backgroundAgent) ? value.backgroundAgent : null,
23889
+ isRecord8(value.item) ? value.item : null,
23890
+ isRecord8(value.item) && isRecord8(value.item.backgroundAgent) ? value.item.backgroundAgent : null,
23891
+ isRecord8(value.thread) && (!target.conversationId || nonBlank2(value.thread.id) && value.thread.id.trim() === target.conversationId) ? value.thread : null,
23892
+ isRecord8(value.childConversation) ? value.childConversation : null
23893
+ ];
23894
+ for (const source of nested) {
23895
+ if (source) contribute(target, source);
23896
+ }
23897
+ if (!target.conversationId) return;
23898
+ const items = Array.isArray(value.items) ? value.items : Array.isArray(value.turns) ? value.turns.flatMap(
23899
+ (turn) => isRecord8(turn) && Array.isArray(turn.items) ? turn.items : []
23900
+ ) : [];
23901
+ for (const item of items) {
23902
+ if (!isRecord8(item)) continue;
23903
+ if (collabMatches(item, target.conversationId)) contribute(target, item, true);
23904
+ }
23905
+ }
23906
+ function finalizeRow(target) {
23907
+ if (!nonBlank2(target.displayName)) return null;
23908
+ if (!nonBlank2(target.conversationId) && !nonBlank2(target.spawnModel) && !nonBlank2(target.model) && !nonBlank2(target.status)) {
23909
+ return null;
23910
+ }
23911
+ const spawnModel = usableModel(target.spawnModel);
23912
+ const model = usableModel(target.model);
23913
+ return {
23914
+ displayName: target.displayName.trim(),
23915
+ ...spawnModel ? { spawnModel } : {},
23916
+ ...model ? { model } : {},
23917
+ ...nonBlank2(target.reasoningEffort) ? { reasoningEffort: target.reasoningEffort.trim() } : {},
23918
+ ...nonBlank2(target.agentRole) ? { agentRole: target.agentRole.trim() } : {},
23919
+ ...nonBlank2(target.status) ? { status: target.status.trim() } : {},
23920
+ ...nonBlank2(target.conversationId) ? { conversationId: target.conversationId.trim() } : {}
23921
+ };
23922
+ }
23923
+ function withResolvedThreadModel(row, thread) {
23924
+ const spawn = usableModel(row.spawnModel);
23925
+ const model = spawn ?? usableModel(row.model) ?? usableModel(thread.model);
23926
+ const reasoningEffort = row.reasoningEffort ?? (nonBlank2(thread.reasoningEffort) ? thread.reasoningEffort.trim() : void 0);
23927
+ return {
23928
+ displayName: row.displayName,
23929
+ ...row.conversationId ? { conversationId: row.conversationId } : {},
23930
+ ...row.status ? { status: row.status } : {},
23931
+ ...row.agentRole ? { agentRole: row.agentRole } : {},
23932
+ ...spawn ? { spawnModel: spawn } : {},
23933
+ ...model ? { model } : {},
23934
+ ...reasoningEffort ? { reasoningEffort } : {}
23935
+ };
23936
+ }
23937
+ function withResolvedThreadStatus(row, status) {
23938
+ return { ...row, status };
23939
+ }
23940
+ function resolveSubagentRow(row, modelResolver, statusResolver) {
23941
+ if (!row.conversationId) return row;
23942
+ const resolvedStatus = statusResolver?.get(row.conversationId);
23943
+ let enriched = resolvedStatus ? withResolvedThreadStatus(row, resolvedStatus) : row;
23944
+ const visibleStatus = prettySubagentStatus(enriched.status);
23945
+ if (!visibleStatus || visibleStatus === "\u8FDB\u884C\u4E2D" || visibleStatus === "\u7B49\u5F85\u4E2D") {
23946
+ statusResolver?.ensure(row.conversationId);
23947
+ }
23948
+ const resolvedModel = modelResolver?.get(row.conversationId);
23949
+ if (resolvedModel) enriched = withResolvedThreadModel(enriched, resolvedModel);
23950
+ const currentModel = usableModel(enriched.spawnModel) ?? usableModel(enriched.model);
23951
+ const modelIncludesEffort = Boolean(currentModel?.includes(" \xB7 "));
23952
+ if (!currentModel || !enriched.reasoningEffort && !modelIncludesEffort) {
23953
+ modelResolver?.ensure(row.conversationId);
23954
+ }
23955
+ return enriched;
23956
+ }
23957
+ function subagentRowMetaFromProps(value) {
23958
+ const target = {};
23959
+ harvestFromValue(value, target);
23960
+ return finalizeRow(target);
23961
+ }
23962
+ function fiberFromElement(element) {
23963
+ const names = Object.getOwnPropertyNames(element).filter(
23964
+ (name2) => name2.startsWith("__reactFiber$")
23965
+ );
23966
+ const name = names[0];
23967
+ if (!name) return null;
23968
+ const fiber = Object.getOwnPropertyDescriptor(element, name)?.value ?? element[name];
23969
+ return isRecord8(fiber) ? fiber : null;
23970
+ }
23971
+ function metaFromFiberProps(fiber) {
23972
+ if (!fiber) return null;
23973
+ return subagentRowMetaFromProps(fiber.memoizedProps) ?? subagentRowMetaFromProps(fiber.pendingProps);
23974
+ }
23975
+ function mergeRow(base, next) {
23976
+ if (!base) return next;
23977
+ if (!next) return base;
23978
+ if (base.conversationId && next.conversationId && base.conversationId !== next.conversationId) {
23979
+ return base;
23980
+ }
23981
+ const spawnModel = usableModel(base.spawnModel) ?? usableModel(next.spawnModel);
23982
+ const model = usableModel(base.model) ?? usableModel(next.model);
23983
+ const reasoningEffort = base.reasoningEffort ?? next.reasoningEffort;
23984
+ const agentRole = base.agentRole ?? next.agentRole;
23985
+ const status = base.status ?? next.status;
23986
+ const conversationId = base.conversationId ?? next.conversationId;
23987
+ return {
23988
+ displayName: base.displayName || next.displayName,
23989
+ ...spawnModel ? { spawnModel } : {},
23990
+ ...model ? { model } : {},
23991
+ ...reasoningEffort ? { reasoningEffort } : {},
23992
+ ...agentRole ? { agentRole } : {},
23993
+ ...status ? { status } : {},
23994
+ ...conversationId ? { conversationId } : {}
23995
+ };
23996
+ }
23997
+ function metaFromDescendants(start) {
23998
+ if (!start || !isRecord8(start.child)) return null;
23999
+ const stack = [start.child];
24000
+ const seen = /* @__PURE__ */ new Set();
24001
+ let found = null;
24002
+ let steps = 0;
24003
+ while (stack.length > 0 && steps < 40) {
24004
+ const fiber = stack.pop();
24005
+ if (!fiber || seen.has(fiber)) continue;
24006
+ seen.add(fiber);
24007
+ steps += 1;
24008
+ found = mergeRow(found, metaFromFiberProps(fiber));
24009
+ if (isRecord8(fiber.child)) stack.push(fiber.child);
24010
+ if (isRecord8(fiber.sibling)) stack.push(fiber.sibling);
24011
+ }
24012
+ return found;
24013
+ }
24014
+ function subagentRowMetaFromElement(element) {
24015
+ let fiber = fiberFromElement(element);
24016
+ let found = metaFromDescendants(fiber);
24017
+ for (let depth = 0; fiber && depth < 12; depth += 1) {
24018
+ found = mergeRow(found, metaFromFiberProps(fiber));
24019
+ fiber = isRecord8(fiber.return) ? fiber.return : null;
24020
+ }
24021
+ return found;
24022
+ }
24023
+ function findNameNode(element) {
24024
+ const label = element.querySelector(SUBAGENT_ITEM_LABEL_SELECTOR);
24025
+ return label ?? element;
24026
+ }
24027
+ function createMetaNode(ownerDocument) {
24028
+ const meta3 = ownerDocument.createElement("span");
24029
+ meta3.setAttribute(SUBAGENT_ROW_META_ATTRIBUTE, "true");
24030
+ meta3.style.display = "block";
24031
+ meta3.style.maxWidth = "100%";
24032
+ meta3.style.fontSize = "11px";
24033
+ meta3.style.lineHeight = "1.35";
24034
+ meta3.style.color = "var(--text-tertiary, #8a8a8a)";
24035
+ meta3.style.whiteSpace = "normal";
24036
+ return meta3;
24037
+ }
24038
+ function ensureColumnCopy(nameNode) {
24039
+ const parent = nameNode.parentElement;
24040
+ if (parent?.getAttribute(SUBAGENT_ROW_COPY_ATTRIBUTE) === "true") {
24041
+ const existing = parent.querySelector(`[${SUBAGENT_ROW_META_ATTRIBUTE}]`);
24042
+ if (existing) return { copy: parent, meta: existing };
24043
+ const meta4 = createMetaNode(nameNode.ownerDocument);
24044
+ parent.append(meta4);
24045
+ return { copy: parent, meta: meta4 };
24046
+ }
24047
+ const copy = nameNode.ownerDocument.createElement("span");
24048
+ copy.setAttribute(SUBAGENT_ROW_COPY_ATTRIBUTE, "true");
24049
+ copy.style.display = "flex";
24050
+ copy.style.flexDirection = "column";
24051
+ copy.style.alignItems = "flex-start";
24052
+ copy.style.justifyContent = "center";
24053
+ copy.style.minWidth = "0";
24054
+ copy.style.flex = "1";
24055
+ copy.style.overflow = "hidden";
24056
+ nameNode.style.maxWidth = "100%";
24057
+ nameNode.style.minWidth = "0";
24058
+ nameNode.replaceWith(copy);
24059
+ copy.append(nameNode);
24060
+ const meta3 = createMetaNode(nameNode.ownerDocument);
24061
+ copy.append(meta3);
24062
+ return { copy, meta: meta3 };
24063
+ }
24064
+ function decorateSubagentRow(element, resolver, statusResolver) {
24065
+ const label = element.querySelector(SUBAGENT_ITEM_LABEL_SELECTOR);
24066
+ const harvested = subagentRowMetaFromElement(element) ?? (label ? subagentRowMetaFromElement(label) : null);
24067
+ if (!harvested) return false;
24068
+ const row = resolveSubagentRow(harvested, resolver, statusResolver);
24069
+ const text = formatSubagentRowMeta(row);
24070
+ const nameNode = findNameNode(element);
24071
+ if (!nameNode || !text) {
24072
+ element.querySelector(`[${SUBAGENT_ROW_META_ATTRIBUTE}]`)?.remove();
24073
+ return false;
24074
+ }
24075
+ const { meta: meta3 } = ensureColumnCopy(nameNode);
24076
+ if (meta3.textContent !== text) meta3.textContent = text;
24077
+ return true;
24078
+ }
24079
+ function decorateSubagentRows(root, resolver, statusResolver) {
24080
+ if (typeof root.querySelectorAll !== "function") return 0;
24081
+ const buttons = root.querySelectorAll(SUBAGENT_ITEM_BUTTON_SELECTOR);
24082
+ let decorated = 0;
24083
+ for (const element of buttons) {
24084
+ if (!isHtmlElement(element)) continue;
24085
+ if (decorateSubagentRow(element, resolver, statusResolver)) decorated += 1;
24086
+ }
24087
+ return decorated;
24088
+ }
24089
+ function isOwnMetaMutation(mutations) {
24090
+ return mutations.every((mutation) => {
24091
+ const nodes = [...mutation.addedNodes, ...mutation.removedNodes, mutation.target];
24092
+ return nodes.every((node) => {
24093
+ if (!isDomElement(node)) return mutation.type === "characterData";
24094
+ return node.getAttribute?.(SUBAGENT_ROW_META_ATTRIBUTE) === "true" || node.getAttribute?.(SUBAGENT_ROW_COPY_ATTRIBUTE) === "true" || Boolean(node.closest?.(`[${SUBAGENT_ROW_META_ATTRIBUTE}]`)) || Boolean(node.closest?.(`[${SUBAGENT_ROW_COPY_ATTRIBUTE}]`));
24095
+ });
24096
+ });
24097
+ }
24098
+ function installRendererSubagentRowMeta(root) {
24099
+ const owner = root ?? (typeof document !== "undefined" && typeof Element !== "undefined" ? document : void 0);
24100
+ if (!owner || typeof MutationObserver === "undefined" || typeof Element === "undefined" || typeof document === "undefined") {
24101
+ return { refresh() {
24102
+ }, dispose() {
24103
+ } };
24104
+ }
24105
+ let disposed = false;
24106
+ let scanScheduled = false;
24107
+ let mutating = false;
24108
+ let debounce;
24109
+ const scan = () => {
24110
+ scanScheduled = false;
24111
+ if (disposed) return;
24112
+ mutating = true;
24113
+ try {
24114
+ decorateSubagentRows(owner, resolver, statusResolver);
24115
+ } finally {
24116
+ mutating = false;
24117
+ }
24118
+ };
24119
+ const schedule = () => {
24120
+ if (disposed || mutating || scanScheduled) return;
24121
+ scanScheduled = true;
24122
+ if (debounce !== void 0) clearTimeout(debounce);
24123
+ debounce = setTimeout(() => {
24124
+ debounce = void 0;
24125
+ scan();
24126
+ }, 250);
24127
+ };
24128
+ const resolver = createSubagentThreadModelResolver({
24129
+ read: readRendererSubagentThreadModel,
24130
+ onUpdate: schedule
24131
+ });
24132
+ const statusResolver = createSubagentThreadStatusResolver({
24133
+ read: readRendererSubagentStatus,
24134
+ onUpdate: schedule
24135
+ });
24136
+ const observer = new MutationObserver((mutations) => {
24137
+ if (mutating || isOwnMetaMutation(mutations)) return;
24138
+ schedule();
24139
+ });
24140
+ observer.observe(owner, { childList: true, subtree: true });
24141
+ schedule();
24142
+ return {
24143
+ refresh() {
24144
+ resolver.refresh();
24145
+ statusResolver.refresh();
24146
+ schedule();
24147
+ },
24148
+ dispose() {
24149
+ if (disposed) return;
24150
+ disposed = true;
24151
+ if (debounce !== void 0) clearTimeout(debounce);
24152
+ observer.disconnect();
24153
+ resolver.dispose();
24154
+ statusResolver.dispose();
24155
+ if (isDomElement(owner) || typeof Document !== "undefined" && owner instanceof Document) {
24156
+ for (const copy of owner.querySelectorAll(`[${SUBAGENT_ROW_COPY_ATTRIBUTE}]`)) {
24157
+ const label = copy.querySelector(SUBAGENT_ITEM_LABEL_SELECTOR);
24158
+ if (label && copy.parentElement) copy.replaceWith(label);
24159
+ else copy.remove();
24160
+ }
24161
+ for (const meta3 of owner.querySelectorAll(`[${SUBAGENT_ROW_META_ATTRIBUTE}]`)) {
24162
+ meta3.remove();
24163
+ }
24164
+ }
24165
+ }
24166
+ };
24167
+ }
24168
+
23541
24169
  // src/renderer-permission-mode-preference.ts
23542
24170
  var CLAUDE_PERMISSION_MODE_PREFERENCE_KEY = "codexhost.claude-code.permission-mode.v1";
23543
24171
  function rendererStorage() {
@@ -23575,11 +24203,11 @@ ${error51.stderrTail}`] : []
23575
24203
  return null;
23576
24204
  }
23577
24205
  }
23578
- function isRecord7(value) {
24206
+ function isRecord9(value) {
23579
24207
  return typeof value === "object" && value !== null && !Array.isArray(value);
23580
24208
  }
23581
24209
  function parseExternalConfiguration(value) {
23582
- if (!isRecord7(value)) return void 0;
24210
+ if (!isRecord9(value)) return void 0;
23583
24211
  const model = harnessModelRefSchema.safeParse(value.model);
23584
24212
  if (!model.success) return void 0;
23585
24213
  const thinkingOptionId = harnessThinkingOptionIdSchema.safeParse(value.thinkingOptionId);
@@ -23596,9 +24224,9 @@ ${error51.stderrTail}`] : []
23596
24224
  const raw = storage.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY);
23597
24225
  if (!raw) return void 0;
23598
24226
  const parsed = JSON.parse(raw);
23599
- if (!isRecord7(parsed) || parsed.version !== 1) return void 0;
24227
+ if (!isRecord9(parsed) || parsed.version !== 1) return void 0;
23600
24228
  if (!KNOWN_RENDERER_AGENTS.some((agent) => agent === parsed.lastAgent)) return void 0;
23601
- const externalByAgent = isRecord7(parsed.externalByAgent) ? parsed.externalByAgent : {};
24229
+ const externalByAgent = isRecord9(parsed.externalByAgent) ? parsed.externalByAgent : {};
23602
24230
  const parsedExternal = Object.fromEntries(
23603
24231
  KNOWN_RENDERER_AGENTS.filter(
23604
24232
  (agent) => agent !== "codex"
@@ -23674,7 +24302,7 @@ ${error51.stderrTail}`] : []
23674
24302
  var GET_LOCALE_OVERRIDE_URL = "vscode://codex/get-setting";
23675
24303
  var GET_LOCALE_INFO_URL = "vscode://codex/locale-info";
23676
24304
  var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
23677
- function isRecord8(value) {
24305
+ function isRecord10(value) {
23678
24306
  return typeof value === "object" && value !== null && !Array.isArray(value);
23679
24307
  }
23680
24308
  function canonicalLocale(value) {
@@ -23696,7 +24324,7 @@ ${error51.stderrTail}`] : []
23696
24324
  return new DOMException("The operation was aborted", "AbortError");
23697
24325
  }
23698
24326
  function parseLocaleOverride(value) {
23699
- if (!isRecord8(value) || !("value" in value)) {
24327
+ if (!isRecord10(value) || !("value" in value)) {
23700
24328
  throw new Error("Codex locale override response is malformed");
23701
24329
  }
23702
24330
  if (value.value === null) return { value: null };
@@ -23711,7 +24339,7 @@ ${error51.stderrTail}`] : []
23711
24339
  return locale;
23712
24340
  }
23713
24341
  function parseLocaleInfo(value) {
23714
- if (!isRecord8(value)) throw new Error("Codex locale info response is malformed");
24342
+ if (!isRecord10(value)) throw new Error("Codex locale info response is malformed");
23715
24343
  return {
23716
24344
  ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
23717
24345
  systemLocale: optionalLocale(value.systemLocale, "system locale")
@@ -23740,7 +24368,7 @@ ${error51.stderrTail}`] : []
23740
24368
  const onAbort = () => settle(() => reject(abortError2()));
23741
24369
  const onMessage = (event) => {
23742
24370
  const message2 = event.data;
23743
- if (!isRecord8(message2) || message2.type !== "fetch-response") return;
24371
+ if (!isRecord10(message2) || message2.type !== "fetch-response") return;
23744
24372
  if (message2.requestId !== requestId) return;
23745
24373
  if (message2.responseType !== "success" || typeof message2.status !== "number" || message2.status < 200 || message2.status >= 300 || typeof message2.bodyJsonString !== "string") {
23746
24374
  settle(() => reject(new Error("Codex locale request failed")));
@@ -27393,6 +28021,7 @@ ${accounts_default}`;
27393
28021
  const existing = window.__codexhostRendererBindingProbeV1;
27394
28022
  if (existing) return existing;
27395
28023
  const disposeApprovalStyle = installRendererApprovalStyle(document);
28024
+ const subagentRowMeta = installRendererSubagentRowMeta();
27396
28025
  const enabledAgents = [...new Set(options.enabledAgents ?? DEFAULT_RENDERER_AGENTS)];
27397
28026
  const enabledAgentSet = new Set(enabledAgents);
27398
28027
  const controller = new DraftAgentController({
@@ -27637,7 +28266,7 @@ ${accounts_default}`;
27637
28266
  if (threadIdFromComposerModelTarget(mounted.modelTarget) !== update.threadId) continue;
27638
28267
  mounted.usageRequestGeneration += 1;
27639
28268
  mounted.usage = update.usage;
27640
- mounted.accountCredits = update.accountCredits ?? null;
28269
+ mounted.accountCredits = composerAccountCredits(update.accountCredits);
27641
28270
  usageRefreshAttempts.delete(mounted.composer);
27642
28271
  renderMounted(mounted);
27643
28272
  }
@@ -27660,7 +28289,7 @@ ${accounts_default}`;
27660
28289
  if (disposed || mounted.hostId !== hostId || composerCodexAccounts(mounted.composer) !== accounts || !mounted.composer.isConnected || mountedByComposer.get(mounted.composer) !== mounted || mounted.usageRequestGeneration !== generation || controller.get(mounted.composer).agent !== "codex" || controller.get(mounted.composer).phase !== "draft" || controller.isSubmissionPending(mounted.composer) || threadIdFromComposerModelTarget(mounted.modelTarget) || accounts.selection.selectedAccountId !== accountId || result.accountId !== accountId)
27661
28290
  return;
27662
28291
  mounted.usage = result.usage;
27663
- mounted.accountCredits = result.accountCredits ?? null;
28292
+ mounted.accountCredits = composerAccountCredits(result.accountCredits);
27664
28293
  renderMounted(mounted);
27665
28294
  } catch {
27666
28295
  }
@@ -27688,7 +28317,7 @@ ${accounts_default}`;
27688
28317
  return;
27689
28318
  }
27690
28319
  mounted.usage = result.usage;
27691
- mounted.accountCredits = result.accountCredits ?? null;
28320
+ mounted.accountCredits = composerAccountCredits(result.accountCredits);
27692
28321
  const agent = controller.get(mounted.composer).agent;
27693
28322
  if (result.usage !== null && (!externalAgentHasAccountCredits(agent) || result.accountCredits)) {
27694
28323
  usageRefreshAttempts.delete(mounted.composer);
@@ -28821,7 +29450,7 @@ ${accounts_default}`;
28821
29450
  ownershipStatus: threadIdFromComposerModelTarget(modelTarget) ? inherited ? "ready" : "loading" : "not-required",
28822
29451
  threadConfiguration: inherited?.threadConfiguration,
28823
29452
  usage: inherited?.usage ?? null,
28824
- accountCredits: inherited?.accountCredits ?? null,
29453
+ accountCredits: composerAccountCredits(inherited?.accountCredits),
28825
29454
  hostId: inherited?.hostId ?? hostId,
28826
29455
  usageRequestGeneration: 0,
28827
29456
  commandRequestGeneration: 0
@@ -29227,6 +29856,7 @@ ${accounts_default}`;
29227
29856
  if (disposed) return;
29228
29857
  disposed = true;
29229
29858
  disposeApprovalStyle();
29859
+ subagentRowMeta.dispose();
29230
29860
  usageNotificationDispose?.();
29231
29861
  usageNotificationDispose = null;
29232
29862
  adapterDispose?.();