johns-harness 2026.11.13 → 2026.11.18

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/auth-profiles-5CHn7vq1.js +1 -1
  3. package/dist/channels/plugins/actions/telegram.js +1 -1
  4. package/dist/compact-B247y5Qt.js +9 -1
  5. package/dist/config-koj5M_EO.js +1 -1
  6. package/dist/daemon-cli.js +1 -1
  7. package/dist/model-selection-BGlGpPgM.js +1 -1
  8. package/dist/model-selection-BU6wl1le.js +1 -1
  9. package/dist/model-selection-L7RMwsG-.js +1 -1
  10. package/dist/pi-embedded-C6ITuRXf.js +9 -1
  11. package/dist/pi-embedded-DoQsYfIY.js +9 -1
  12. package/dist/plugin-sdk/config-4Fgm-yEH.js +1 -1
  13. package/dist/plugin-sdk/config-Di-lyCdh.js +1 -1
  14. package/dist/plugin-sdk/discord.js +1 -1
  15. package/dist/plugin-sdk/dispatch-BP0viZiL.js +9 -1
  16. package/dist/plugin-sdk/dispatch-CQsjmw7g.js +9 -1
  17. package/dist/plugin-sdk/dispatch-Cerq29sy.js +9 -1
  18. package/dist/plugin-sdk/dispatch-Cndjtt0g.js +9 -1
  19. package/dist/plugin-sdk/dispatch-UogiJYul.js +9 -1
  20. package/dist/plugin-sdk/mattermost.js +1 -1
  21. package/dist/plugin-sdk/model-auth-CX9cPHdC.js +1 -1
  22. package/dist/plugin-sdk/model-auth-Ciehz0x5.js +1 -1
  23. package/dist/plugin-sdk/model-auth-DVyo6JSX.js +1 -1
  24. package/dist/plugin-sdk/model-auth-kiHYHGrs.js +1 -1
  25. package/dist/plugin-sdk/model-selection-Dbj4jDYM.js +1 -1
  26. package/dist/plugin-sdk/reply-DbZnH8-h.js +9 -1
  27. package/dist/plugin-sdk/thinking-B-rIrY_n.js +1 -1
  28. package/dist/plugin-sdk/thinking-CopbP_Cn.js +1 -1
  29. package/dist/plugin-sdk/thinking-WQ4Zq8Nl.js +1 -1
  30. package/dist/plugin-sdk/thinking-WXqkGljb.js +1 -1
  31. package/dist/plugin-sdk/thinking-_uXqFaFO.js +1 -1
  32. package/dist/plugin-sdk/thinking-pTdxk2dr.js +1 -1
  33. package/dist/reply-C5LKjXcC.js +9 -1
  34. package/dist/subscription-call-auth.js +193 -0
  35. package/dist/thinking-B5B36ffe.js +1 -1
  36. package/dist/thinking-BYwvlJ3S.js +1 -1
  37. package/dist/thinking-CAzdgmNV.js +1 -1
  38. package/dist/thinking-DykY2Fzj.js +1 -1
  39. package/docs/MODELS.md +18 -1
  40. package/docs/PATCHES.md +34 -0
  41. package/models/models.json +7 -1
  42. package/node_modules/@mariozechner/pi-ai/dist/models.generated.js +5 -1
  43. package/node_modules/@mariozechner/pi-ai/dist/models.js +13 -0
  44. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js +7 -2
  45. package/node_modules/@mariozechner/pi-ai/dist/providers/openai-responses.js +7 -2
  46. package/package.json +1 -1
  47. package/scripts/models-sync.mjs +27 -3
  48. package/vendor/patched-deps/@mariozechner/pi-ai/dist/models.generated.js +5 -1
  49. package/vendor/patched-deps/@mariozechner/pi-ai/dist/models.js +13 -0
  50. package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js +7 -2
  51. package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/openai-responses.js +7 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.11.18
4
+
5
+ ### GPT-6.2 Astra and Sol, with serving-provider-specific Responses rules
6
+
7
+ - Add `gpt-6.2-astra` and `gpt-6.2-sol` to both OpenAI API and Codex subscription catalogs. Both accept text/image input and text output, with **1,050,000 API context / 128,000 max output** (922,000 max input). Independently verified Codex default windows are **272,000 for Astra and 500,000 for Sol**, not the optional872K maximum. Cutoffs: Astra2026-05-18, Sol2026-06-01.
8
+ - **`astra` → GPT-6.2 Astra; `gpt` and `sol` → GPT-6.2 Sol.** Added `astra6` and `sol61` for the prior versions. All old IDs, other aliases, Claude caps, DeepSeek Flash alias and subscription-only image defaults remain unchanged. No live default-model/config/auth edits, install, restart or fleet changes.
9
+ - Extend the existing master generator with opt-in reusable Responses rules: stable Codex system instructions become the first developer input, with an empty required top-level instructions string; both transports request encrypted reasoning even with omitted effort, omit unsupported sampling/logprob fields and remove the logprob include. Efforts low/medium/high/xhigh/max; none/minimal map low. API uses `prompt_cache_options.ttl="30m"` instead of the old retention parameter. Codex **omits** the new cache field, which its backend rejects, while preserving the prompt-cache/session key and backend-controlled lifetime. Unruled models retain historical behavior.
10
+ - Standard API USD/MTok input/output/cache read/30m write: **Astra8/40/0.40/10; Sol2/10/0.10/2.50**. Codex marginal token prices0. Above272K input, input/cache prices2x and output1.5x; 12h writes2.5x ordinary input versus30m1.25x, not additive. Batch0.5x; Fast2x; Ultrafast3x throughFeb28,2027, then6x fromMar1 Pacific. Eligible background2h/8h discounts30%/40% are documented, not implemented. Other pricing remains unchanged. Catalog estimates are flat and existing Responses usage does not break out cache-write tokens or automatically price long-context tiers.
11
+ - Prefix edits (system/tool changes, truncation, custom compaction) may cause the server to discard later reasoning. This release does not claim append-only transcripts, native compaction, configuration-update items, ultra delegation, background or a new speed-tier transport.
12
+ - **Live validation:** an initial subscription-only call for each ID rejected `prompt_cache_options` with400. After provider-specific correction, both real repository adapters performed a minimal ordinary function call followed by a real tool-result replay returning `OK` (**four HTTP200 responses**, no paid API inference, fallback or auth refresh). Classic tools work despite native client's Responses-lite/code-mode preference flags. Signed reasoning replay is additionally covered offline; these tiny live calls emitted no reasoning item. Successful probes were not repeated.
13
+ - **Sources checked2026-11-18:** [Astra card](https://developers.openai.com/api/docs/models/gpt-6.2-astra), [Sol card](https://developers.openai.com/api/docs/models/gpt-6.2-sol), [pricing](https://developers.openai.com/api/docs/pricing), [migration](https://developers.openai.com/api/docs/guides/latest-model), [cache rules](https://developers.openai.com/api/docs/guides/prompt-caching), [prefix preservation](https://developers.openai.com/api/docs/guides/keep-prefix-unchanged), [pinned Codex metadata](https://raw.githubusercontent.com/openai/codex/4389a526d51a5a7600e0648436a7142a304f0188/codex-rs/models-manager/models.json), and authenticated Codex metadata for client0.166.0.
14
+ - **Gates:** master815cards/zero problems; sync0 stale; verifier597pass/0fail; full suite1,404pass/0fail/5skip (1,409tests). Packed-artifact model/loader/secret guards are required before publication.
15
+ - **Rollback:** `npm i -g johns-harness@2026.11.14`.
16
+
17
+ ## 2026.11.14
18
+
19
+ ### Sub-agents and swarms return to the subscription mid-run; status names the profile that served each call
20
+
21
+ - **Cause:** a run chose its auth profile once, at start, and never moved back. A sub-agent or swarm member is one run of hundreds of model calls, so one that started while the Claude subscription was cooling after a rate limit stayed on the paid API key until it ended (seven hours and 470 calls in the reported case). The main session re-picked every turn, which is why it looked fine. Sub-agents that started on a healthy subscription were already served by it.
22
+ - **Fix (Family 98):** the profile is chosen before every model call. A run on the API key moves back to the subscription on the first call after it is usable again. Leaving the subscription is still only the existing failure-driven fallback, and a run holds off 1, 5, 25 then 60 minutes before returning after the subscription fails inside it. User-locked profiles and other providers are unchanged.
23
+ - **Status:** every assistant record in the transcript now carries the profile that served it (`authProfileId`, `authMode`, and the fallback reason when a paid key served). `/status` reads that record, so a card for a run still in flight shows what its last call used, for example `api-key (anthropic:default) [API fallback: subscription in cooldown]`, and adds per-profile call counts when a run used both.
24
+ - The stamp is transcript metadata only. It is never sent to a provider and adds nothing to the context.
25
+ - **Not changed:** calls made while the subscription is rate limited or cooling still go to the API key.
26
+ - **Validation:** isolated gateway with a real spawned sub-agent and a two-member swarm against a mock Anthropic endpoint with fixture credentials: the unpatched tree stays on `x-api-key` for every call; this release goes `x-api-key, x-api-key, Bearer, Bearer` per run once the cooldown ends, and Bearer from the first call when spawned healthy. No live Anthropic call was made with the real subscription credential.
27
+ - **Gates:** verifier **597 pass, 0 fail**; full suite **1,398 pass, 0 fail, 5 skip** (1,403 tests); packed-artifact check passed.
28
+ - **Rollback:** `npm i -g johns-harness@2026.11.13`.
29
+
3
30
  ## 2026.11.13
4
31
 
5
32
  ### Gemini 4 Hydrogen native chat and xhigh
@@ -5162,7 +5162,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
5162
5162
  grok46: "xai/grok-4.6"
5163
5163
  });
5164
5164
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
5165
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
5165
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
5166
5166
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
5167
5167
  /* JOHNNESS_MODELS_MASTER:END */
5168
5168
  const DEFAULT_MODEL_COST = {
@@ -2132,7 +2132,7 @@ const XHIGH_MODEL_REFS = [
2132
2132
  "github-copilot/gpt-5.2"
2133
2133
  ];
2134
2134
  /* JOHNNESS_MODELS_MASTER:BEGIN xhigh refs (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
2135
- XHIGH_MODEL_REFS.splice(0, XHIGH_MODEL_REFS.length, ...['deepseek/deepseek-flash','deepseek/deepseek-v4-pro','meta/muse-spark-1.3','meta/muse-spark-1.2','anthropic/claude-fable-5-2','anthropic/claude-fable-5-1','anthropic/claude-sonnet-5-5','anthropic/claude-opus-5-5','anthropic/claude-haiku-5-5','anthropic/claude-opus-5','anthropic/claude-sonnet-5','anthropic/claude-fable-5','anthropic/claude-opus-4-6','azure-openai-responses/gpt-5.2','azure-openai-responses/gpt-5.2-chat-latest','azure-openai-responses/gpt-5.2-codex','azure-openai-responses/gpt-5.2-pro','azure-openai-responses/gpt-5.3-codex','azure-openai-responses/gpt-5.3-codex-spark','github-copilot/claude-opus-4.6','github-copilot/gpt-5.2','github-copilot/gpt-5.2-codex','google/gemini-4-hydrogen','openai/gpt-5.2','openai/gpt-5.2-chat-latest','openai/gpt-5.2-codex','openai/gpt-5.2-pro','openai/gpt-5.3-codex','openai/gpt-5.3-codex-spark','openai/gpt-6-astra','openai/gpt-6.1-sol','openai/gpt-6-sol','openai/gpt-6-luna','openai/gpt-5.6-sol','openai/gpt-5.6-terra','openai/gpt-5.6-luna','openai/gpt-6.1-terra','openai-codex/gpt-5.2','openai-codex/gpt-5.2-codex','openai-codex/gpt-5.3-codex','openai-codex/gpt-5.3-codex-spark','openai-codex/gpt-6.1-sol','openai-codex/gpt-6-sol','openai-codex/gpt-6-luna','openai-codex/gpt-6-astra','openai-codex/gpt-5.6-sol','openai-codex/gpt-5.6-terra','openai-codex/gpt-5.6-luna','openai-codex/gpt-6.1-terra','opencode/claude-opus-4-6','opencode/gpt-5.2','opencode/gpt-5.2-codex','opencode/gpt-5.3-codex','openrouter/openai/gpt-5.2','openrouter/openai/gpt-5.2-chat','openrouter/openai/gpt-5.2-codex','openrouter/openai/gpt-5.2-pro','openrouter/openai/gpt-5.3-codex','vercel-ai-gateway/anthropic/claude-opus-4.6','vercel-ai-gateway/openai/gpt-5.2','vercel-ai-gateway/openai/gpt-5.2-chat','vercel-ai-gateway/openai/gpt-5.2-codex','vercel-ai-gateway/openai/gpt-5.2-pro','vercel-ai-gateway/openai/gpt-5.3-codex','xai/grok-4.7','xai/grok-4.6','openai/gpt-5.4','openai/gpt-5.4-pro','openai/gpt-5.6','openai-codex/gpt-5.6','openai-codex/gpt-5.4','openai-codex/gpt-5.1-codex']);
2135
+ XHIGH_MODEL_REFS.splice(0, XHIGH_MODEL_REFS.length, ...['deepseek/deepseek-flash','deepseek/deepseek-v4-pro','meta/muse-spark-1.3','meta/muse-spark-1.2','anthropic/claude-fable-5-2','anthropic/claude-fable-5-1','anthropic/claude-sonnet-5-5','anthropic/claude-opus-5-5','anthropic/claude-haiku-5-5','anthropic/claude-opus-5','anthropic/claude-sonnet-5','anthropic/claude-fable-5','anthropic/claude-opus-4-6','azure-openai-responses/gpt-5.2','azure-openai-responses/gpt-5.2-chat-latest','azure-openai-responses/gpt-5.2-codex','azure-openai-responses/gpt-5.2-pro','azure-openai-responses/gpt-5.3-codex','azure-openai-responses/gpt-5.3-codex-spark','github-copilot/claude-opus-4.6','github-copilot/gpt-5.2','github-copilot/gpt-5.2-codex','google/gemini-4-hydrogen','openai/gpt-5.2','openai/gpt-5.2-chat-latest','openai/gpt-5.2-codex','openai/gpt-5.2-pro','openai/gpt-5.3-codex','openai/gpt-5.3-codex-spark','openai/gpt-6.2-astra','openai/gpt-6.2-sol','openai/gpt-6-astra','openai/gpt-6.1-sol','openai/gpt-6-sol','openai/gpt-6-luna','openai/gpt-5.6-sol','openai/gpt-5.6-terra','openai/gpt-5.6-luna','openai/gpt-6.1-terra','openai-codex/gpt-5.2','openai-codex/gpt-5.2-codex','openai-codex/gpt-5.3-codex','openai-codex/gpt-5.3-codex-spark','openai-codex/gpt-6.1-sol','openai-codex/gpt-6-sol','openai-codex/gpt-6-luna','openai-codex/gpt-6.2-astra','openai-codex/gpt-6.2-sol','openai-codex/gpt-6-astra','openai-codex/gpt-5.6-sol','openai-codex/gpt-5.6-terra','openai-codex/gpt-5.6-luna','openai-codex/gpt-6.1-terra','opencode/claude-opus-4-6','opencode/gpt-5.2','opencode/gpt-5.2-codex','opencode/gpt-5.3-codex','openrouter/openai/gpt-5.2','openrouter/openai/gpt-5.2-chat','openrouter/openai/gpt-5.2-codex','openrouter/openai/gpt-5.2-pro','openrouter/openai/gpt-5.3-codex','vercel-ai-gateway/anthropic/claude-opus-4.6','vercel-ai-gateway/openai/gpt-5.2','vercel-ai-gateway/openai/gpt-5.2-chat','vercel-ai-gateway/openai/gpt-5.2-codex','vercel-ai-gateway/openai/gpt-5.2-pro','vercel-ai-gateway/openai/gpt-5.3-codex','xai/grok-4.7','xai/grok-4.6','openai/gpt-5.4','openai/gpt-5.4-pro','openai/gpt-5.6','openai-codex/gpt-5.6','openai-codex/gpt-5.4','openai-codex/gpt-5.1-codex']);
2136
2136
  /* JOHNNESS_MODELS_MASTER:END */
2137
2137
  new Set(XHIGH_MODEL_REFS.map((entry) => entry.toLowerCase()));
2138
2138
  new Set(XHIGH_MODEL_REFS.map((entry) => entry.split("/")[1]?.toLowerCase()).filter((entry) => Boolean(entry)));
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "./subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/compact-B247y5Qt.js
2
3
  import { loadSubscriptionStatus } from "./subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -17531,6 +17532,7 @@ async function runEmbeddedAttempt(params) {
17531
17532
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
17532
17533
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
17533
17534
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
17535
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
17534
17536
  try {
17535
17537
  const prior = await sanitizeSessionHistory({
17536
17538
  messages: activeSession.messages,
@@ -18638,6 +18640,7 @@ async function runEmbeddedPiAgent(params) {
18638
18640
  }
18639
18641
  };
18640
18642
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
18643
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$16.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
18641
18644
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
18642
18645
  let overflowCompactionAttempts = 0;
18643
18646
  let toolResultTruncationAttempted = false;
@@ -18755,6 +18758,7 @@ async function runEmbeddedPiAgent(params) {
18755
18758
  authProfileId: lastProfileId,
18756
18759
  authProfileIdSource: lockedProfileId ? "user" : "auto",
18757
18760
  authStorage,
18761
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
18758
18762
  modelRegistry,
18759
18763
  agentId: workspaceResolution.agentId,
18760
18764
  legacyBeforeAgentStartResult,
@@ -35857,7 +35861,11 @@ async function buildExportSessionReply(params) {
35857
35861
  }
35858
35862
  //#endregion
35859
35863
  //#region src/agents/model-auth-label.ts
35860
- function resolveModelAuthLabel(params) {
35864
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
35865
+ params = withServedAuthProfile(params);
35866
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
35867
+ }
35868
+ function resolveStoredModelAuthLabel(params) {
35861
35869
  const resolvedProvider = params.provider?.trim();
35862
35870
  if (!resolvedProvider) return;
35863
35871
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -1852,7 +1852,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
1852
1852
  grok46: "xai/grok-4.6"
1853
1853
  });
1854
1854
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
1855
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1855
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1856
1856
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
1857
1857
  /* JOHNNESS_MODELS_MASTER:END */
1858
1858
  const DEFAULT_MODEL_COST = {
@@ -5004,7 +5004,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
5004
5004
  grok46: "xai/grok-4.6"
5005
5005
  });
5006
5006
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
5007
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
5007
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
5008
5008
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
5009
5009
  /* JOHNNESS_MODELS_MASTER:END */
5010
5010
  const DEFAULT_MODEL_COST = {
@@ -1714,7 +1714,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
1714
1714
  grok46: "xai/grok-4.6"
1715
1715
  });
1716
1716
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
1717
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1717
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1718
1718
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
1719
1719
  /* JOHNNESS_MODELS_MASTER:END */
1720
1720
  const DEFAULT_MODEL_COST = {
@@ -1689,7 +1689,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
1689
1689
  grok46: "xai/grok-4.6"
1690
1690
  });
1691
1691
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
1692
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1692
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1693
1693
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
1694
1694
  /* JOHNNESS_MODELS_MASTER:END */
1695
1695
  const DEFAULT_MODEL_COST = {
@@ -1620,7 +1620,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
1620
1620
  grok46: "xai/grok-4.6"
1621
1621
  });
1622
1622
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
1623
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1623
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
1624
1624
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
1625
1625
  /* JOHNNESS_MODELS_MASTER:END */
1626
1626
  const DEFAULT_MODEL_COST = {
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "./subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/pi-embedded-C6ITuRXf.js
2
3
  import { loadSubscriptionStatus } from "./subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -27893,7 +27894,11 @@ async function buildExportSessionReply(params) {
27893
27894
  }
27894
27895
  //#endregion
27895
27896
  //#region src/agents/model-auth-label.ts
27896
- function resolveModelAuthLabel(params) {
27897
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
27898
+ params = withServedAuthProfile(params);
27899
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
27900
+ }
27901
+ function resolveStoredModelAuthLabel(params) {
27897
27902
  const resolvedProvider = params.provider?.trim();
27898
27903
  if (!resolvedProvider) return;
27899
27904
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -103143,6 +103148,7 @@ async function runEmbeddedAttempt(params) {
103143
103148
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
103144
103149
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
103145
103150
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
103151
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
103146
103152
  try {
103147
103153
  const prior = await sanitizeSessionHistory({
103148
103154
  messages: activeSession.messages,
@@ -104250,6 +104256,7 @@ async function runEmbeddedPiAgent(params) {
104250
104256
  }
104251
104257
  };
104252
104258
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
104259
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$3.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
104253
104260
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
104254
104261
  let overflowCompactionAttempts = 0;
104255
104262
  let toolResultTruncationAttempted = false;
@@ -104374,6 +104381,7 @@ async function runEmbeddedPiAgent(params) {
104374
104381
  authProfileId: lastProfileId,
104375
104382
  authProfileIdSource: lockedProfileId ? "user" : "auto",
104376
104383
  authStorage,
104384
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
104377
104385
  modelRegistry,
104378
104386
  agentId: workspaceResolution.agentId,
104379
104387
  legacyBeforeAgentStartResult,
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "./subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/pi-embedded-DoQsYfIY.js
2
3
  import { loadSubscriptionStatus } from "./subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -27889,7 +27890,11 @@ async function buildExportSessionReply(params) {
27889
27890
  }
27890
27891
  //#endregion
27891
27892
  //#region src/agents/model-auth-label.ts
27892
- function resolveModelAuthLabel(params) {
27893
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
27894
+ params = withServedAuthProfile(params);
27895
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
27896
+ }
27897
+ function resolveStoredModelAuthLabel(params) {
27893
27898
  const resolvedProvider = params.provider?.trim();
27894
27899
  if (!resolvedProvider) return;
27895
27900
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -103133,6 +103138,7 @@ async function runEmbeddedAttempt(params) {
103133
103138
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
103134
103139
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
103135
103140
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
103141
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
103136
103142
  try {
103137
103143
  const prior = await sanitizeSessionHistory({
103138
103144
  messages: activeSession.messages,
@@ -104240,6 +104246,7 @@ async function runEmbeddedPiAgent(params) {
104240
104246
  }
104241
104247
  };
104242
104248
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
104249
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$3.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
104243
104250
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
104244
104251
  let overflowCompactionAttempts = 0;
104245
104252
  let toolResultTruncationAttempted = false;
@@ -104357,6 +104364,7 @@ async function runEmbeddedPiAgent(params) {
104357
104364
  authProfileId: lastProfileId,
104358
104365
  authProfileIdSource: lockedProfileId ? "user" : "auto",
104359
104366
  authStorage,
104367
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
104360
104368
  modelRegistry,
104361
104369
  agentId: workspaceResolution.agentId,
104362
104370
  legacyBeforeAgentStartResult,
@@ -7123,7 +7123,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
7123
7123
  grok46: "xai/grok-4.6"
7124
7124
  });
7125
7125
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
7126
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
7126
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
7127
7127
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
7128
7128
  /* JOHNNESS_MODELS_MASTER:END */
7129
7129
  const DEFAULT_MODEL_COST = {
@@ -8124,7 +8124,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
8124
8124
  grok46: "xai/grok-4.6"
8125
8125
  });
8126
8126
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
8127
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
8127
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
8128
8128
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
8129
8129
  /* JOHNNESS_MODELS_MASTER:END */
8130
8130
  const DEFAULT_MODEL_COST = {
@@ -5232,7 +5232,7 @@ Object.assign(DEFAULT_MODEL_ALIASES, {
5232
5232
  grok46: "xai/grok-4.6"
5233
5233
  });
5234
5234
  /* JOHNNESS_MODELS_MASTER:BEGIN aliases (generated from models/models.json by scripts/models-sync.mjs; edit the master, not this block) */
5235
- const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.1-sol","sol":"openai-codex/gpt-6.1-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
5235
+ const JOHNNESS_MASTER_ALIASES = {"deepseek":"deepseek/deepseek-flash","deepseek-pro":"deepseek/deepseek-v4-pro","gemini-lite":"google/gemini-3.5-flash-lite","muse":"meta/muse-spark-1.3","muse-spark":"meta/muse-spark-1.3","opus46":"anthropic/claude-opus-4-6","sonnet46":"anthropic/claude-sonnet-4-6","gpt-mini":"openai/gpt-5-mini","gemini":"google/gemini-4-hydrogen","gemini4-argon":"google/gemini-4-argon","gemini31":"google/gemini-3.1-pro-preview","gemini-flash":"google/gemini-4-hydrogen","gemini-flash-lite":"google/gemini-2.5-flash-lite","flash":"google/gemini-4-hydrogen","banana":"google/gemini-nano-banana-2.1","nano-banana":"google/gemini-nano-banana-2.1","nano-banana-pro":"google/gemini-3-pro-image","nano-banana-pro-preview":"google/gemini-3-pro-image-preview","nano-banana-lite":"google/gemini-3.1-flash-lite-image","grok-image":"xai/grok-imagine-image-2.0","image-sunburst25":"openai-codex/gpt-image-2.5-sunburst","image-flare25":"openai-codex/gpt-image-2.5-flare","image2":"openai-codex/gpt-image-2","sonnet5":"anthropic/claude-sonnet-5","opus5":"anthropic/claude-opus-5","fable51":"anthropic/claude-fable-5-1","haiku45":"anthropic/claude-haiku-4-5","astra6":"openai-codex/gpt-6-astra","sol61":"openai-codex/gpt-6.1-sol","sol6":"openai-codex/gpt-6-sol","sol56":"openai-codex/gpt-5.6-sol","luna56":"openai-codex/gpt-5.6-luna","grok46":"xai/grok-4.6","terra56":"openai-codex/gpt-5.6-terra","gemini4-carbon":"google/gemini-4-carbon","flash38":"google/gemini-3.8-flash","image":"openai-codex/gpt-image-2.6-sunburst","image-sunburst":"openai-codex/gpt-image-2.6-sunburst","image-flare":"openai-codex/gpt-image-2.6-flare","opus":"anthropic/claude-opus-5-5","sonnet":"anthropic/claude-sonnet-5-5","fable":"anthropic/claude-fable-5-2","haiku":"anthropic/claude-haiku-5-5","gpt":"openai-codex/gpt-6.2-sol","sol":"openai-codex/gpt-6.2-sol","luna":"openai-codex/gpt-6-luna","astra":"openai-codex/gpt-6.2-astra","terra":"openai-codex/gpt-6.1-terra","grok":"xai/grok-4.7"};
5236
5236
  for (const [alias, ref] of Object.entries(JOHNNESS_MASTER_ALIASES)) DEFAULT_MODEL_ALIASES[alias] = ref;
5237
5237
  /* JOHNNESS_MODELS_MASTER:END */
5238
5238
  const DEFAULT_MODEL_COST = {
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "../subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/plugin-sdk/dispatch-BP0viZiL.js
2
3
  import { loadSubscriptionStatus } from "../subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -24290,7 +24291,11 @@ async function recordDiscordModelPickerRecentModel(params) {
24290
24291
  }
24291
24292
  //#endregion
24292
24293
  //#region src/agents/model-auth-label.ts
24293
- function resolveModelAuthLabel(params) {
24294
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
24295
+ params = withServedAuthProfile(params);
24296
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
24297
+ }
24298
+ function resolveStoredModelAuthLabel(params) {
24294
24299
  const resolvedProvider = params.provider?.trim();
24295
24300
  if (!resolvedProvider) return;
24296
24301
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -87392,6 +87397,7 @@ async function runEmbeddedAttempt(params) {
87392
87397
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
87393
87398
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
87394
87399
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
87400
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
87395
87401
  try {
87396
87402
  const prior = await sanitizeSessionHistory({
87397
87403
  messages: activeSession.messages,
@@ -88481,6 +88487,7 @@ async function runEmbeddedPiAgent(params) {
88481
88487
  }
88482
88488
  };
88483
88489
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
88490
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$7.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
88484
88491
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
88485
88492
  let overflowCompactionAttempts = 0;
88486
88493
  let toolResultTruncationAttempted = false;
@@ -88597,6 +88604,7 @@ async function runEmbeddedPiAgent(params) {
88597
88604
  authProfileId: lastProfileId,
88598
88605
  authProfileIdSource: lockedProfileId ? "user" : "auto",
88599
88606
  authStorage,
88607
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
88600
88608
  modelRegistry,
88601
88609
  agentId: workspaceResolution.agentId,
88602
88610
  legacyBeforeAgentStartResult,
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "../subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/plugin-sdk/dispatch-CQsjmw7g.js
2
3
  import { loadSubscriptionStatus } from "../subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -24399,7 +24400,11 @@ async function recordDiscordModelPickerRecentModel(params) {
24399
24400
  }
24400
24401
  //#endregion
24401
24402
  //#region src/agents/model-auth-label.ts
24402
- function resolveModelAuthLabel(params) {
24403
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
24404
+ params = withServedAuthProfile(params);
24405
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
24406
+ }
24407
+ function resolveStoredModelAuthLabel(params) {
24403
24408
  const resolvedProvider = params.provider?.trim();
24404
24409
  if (!resolvedProvider) return;
24405
24410
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -87392,6 +87397,7 @@ async function runEmbeddedAttempt(params) {
87392
87397
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
87393
87398
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
87394
87399
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
87400
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
87395
87401
  try {
87396
87402
  const prior = await sanitizeSessionHistory({
87397
87403
  messages: activeSession.messages,
@@ -88481,6 +88487,7 @@ async function runEmbeddedPiAgent(params) {
88481
88487
  }
88482
88488
  };
88483
88489
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
88490
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$7.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
88484
88491
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
88485
88492
  let overflowCompactionAttempts = 0;
88486
88493
  let toolResultTruncationAttempted = false;
@@ -88597,6 +88604,7 @@ async function runEmbeddedPiAgent(params) {
88597
88604
  authProfileId: lastProfileId,
88598
88605
  authProfileIdSource: lockedProfileId ? "user" : "auto",
88599
88606
  authStorage,
88607
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
88600
88608
  modelRegistry,
88601
88609
  agentId: workspaceResolution.agentId,
88602
88610
  legacyBeforeAgentStartResult,
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "../subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/plugin-sdk/dispatch-Cerq29sy.js
2
3
  import { loadSubscriptionStatus } from "../subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -24983,7 +24984,11 @@ async function recordDiscordModelPickerRecentModel(params) {
24983
24984
  }
24984
24985
  //#endregion
24985
24986
  //#region src/agents/model-auth-label.ts
24986
- function resolveModelAuthLabel(params) {
24987
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
24988
+ params = withServedAuthProfile(params);
24989
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
24990
+ }
24991
+ function resolveStoredModelAuthLabel(params) {
24987
24992
  const resolvedProvider = params.provider?.trim();
24988
24993
  if (!resolvedProvider) return;
24989
24994
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -87706,6 +87711,7 @@ async function runEmbeddedAttempt(params) {
87706
87711
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
87707
87712
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
87708
87713
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
87714
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
87709
87715
  try {
87710
87716
  const prior = await sanitizeSessionHistory({
87711
87717
  messages: activeSession.messages,
@@ -88795,6 +88801,7 @@ async function runEmbeddedPiAgent(params) {
88795
88801
  }
88796
88802
  };
88797
88803
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
88804
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$7.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
88798
88805
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
88799
88806
  let overflowCompactionAttempts = 0;
88800
88807
  let toolResultTruncationAttempted = false;
@@ -88911,6 +88918,7 @@ async function runEmbeddedPiAgent(params) {
88911
88918
  authProfileId: lastProfileId,
88912
88919
  authProfileIdSource: lockedProfileId ? "user" : "auto",
88913
88920
  authStorage,
88921
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
88914
88922
  modelRegistry,
88915
88923
  agentId: workspaceResolution.agentId,
88916
88924
  legacyBeforeAgentStartResult,
@@ -1,3 +1,4 @@
1
+ import { createCallAuth, withServedAuthProfile, formatServedAuthLabel } from "../subscription-call-auth.js"; // JOHNNESS_PATCH_CALL_AUTH_98
1
2
  // JOHNNESS_PATCH_SUBSCRIPTION_USAGE_93 dist/plugin-sdk/dispatch-Cndjtt0g.js
2
3
  import { loadSubscriptionStatus } from "../subscription-usage.js";
3
4
  import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
@@ -24664,7 +24665,11 @@ async function recordDiscordModelPickerRecentModel(params) {
24664
24665
  }
24665
24666
  //#endregion
24666
24667
  //#region src/agents/model-auth-label.ts
24667
- function resolveModelAuthLabel(params) {
24668
+ function resolveModelAuthLabel(params) { // JOHNNESS_PATCH_CALL_AUTH_98: the transcript names the profile that served the latest model call
24669
+ params = withServedAuthProfile(params);
24670
+ return formatServedAuthLabel(resolveStoredModelAuthLabel(params), params);
24671
+ }
24672
+ function resolveStoredModelAuthLabel(params) {
24668
24673
  const resolvedProvider = params.provider?.trim();
24669
24674
  if (!resolvedProvider) return;
24670
24675
  const providerKey = normalizeProviderId(resolvedProvider);
@@ -87433,6 +87438,7 @@ async function runEmbeddedAttempt(params) {
87433
87438
  activeSession.agent.streamFn = wrapStreamFnTrimToolCallNames(activeSession.agent.streamFn, allowedToolNames);
87434
87439
  if (isXaiProvider(params.provider, params.modelId)) activeSession.agent.streamFn = wrapStreamFnDecodeXaiToolCallArguments(activeSession.agent.streamFn);
87435
87440
  if (anthropicPayloadLogger) activeSession.agent.streamFn = anthropicPayloadLogger.wrapStreamFn(activeSession.agent.streamFn);
87441
+ if (params.callAuth) activeSession.agent.streamFn = params.callAuth.wrapStreamFn(activeSession.agent.streamFn); // JOHNNESS_PATCH_CALL_AUTH_98: outermost, every model call picks its credential
87436
87442
  try {
87437
87443
  const prior = await sanitizeSessionHistory({
87438
87444
  messages: activeSession.messages,
@@ -88522,6 +88528,7 @@ async function runEmbeddedPiAgent(params) {
88522
88528
  }
88523
88529
  };
88524
88530
  const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
88531
+ const callAuth = createCallAuth({ provider, store: authStore, candidates: profileCandidates, lockedProfileId, getIndex: () => profileIndex, setIndex: (index) => { profileIndex = index; }, getProfileId: () => lastProfileId, getKey: () => apiKeyInfo?.apiKey, apply: (candidate) => applyApiKeyInfo(candidate), freshStore: () => ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false }), resolveOrder: () => resolveAuthProfileOrder({ cfg: params.config, store: authStore, provider, preferredProfile: preferredProfileId }), inCooldown: isProfileInCooldown, tracker: subscriptionAuth, warn: (message) => log$7.warn(message) }); // JOHNNESS_PATCH_CALL_AUTH_98: a run is many model calls, not one credential
88525
88532
  const MAX_RUN_LOOP_ITERATIONS = resolveMaxRunRetryIterations(profileCandidates.length);
88526
88533
  let overflowCompactionAttempts = 0;
88527
88534
  let toolResultTruncationAttempted = false;
@@ -88638,6 +88645,7 @@ async function runEmbeddedPiAgent(params) {
88638
88645
  authProfileId: lastProfileId,
88639
88646
  authProfileIdSource: lockedProfileId ? "user" : "auto",
88640
88647
  authStorage,
88648
+ callAuth, // JOHNNESS_PATCH_CALL_AUTH_98
88641
88649
  modelRegistry,
88642
88650
  agentId: workspaceResolution.agentId,
88643
88651
  legacyBeforeAgentStartResult,