drizzy-agent 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -16658,320 +16658,234 @@ function getAgentConfigKey(agentName) {
16658
16658
  return lower;
16659
16659
  }
16660
16660
 
16661
- // src/shared/model-requirements.ts
16662
- var AGENT_MODEL_REQUIREMENTS = {
16661
+ // src/shared/agent-model-defaults.ts
16662
+ var CLAUDE_PROVIDERS = ["anthropic", "github-copilot", "opencode"];
16663
+ var OPENAI_PROVIDERS = ["openai", "github-copilot", "opencode"];
16664
+ var OPENAI_NATIVE_PROVIDERS = ["openai", "opencode"];
16665
+ var GEMINI_PROVIDERS = ["google", "github-copilot", "opencode"];
16666
+ var KIMI_K25_PROVIDERS = ["opencode", "moonshotai", "moonshotai-cn", "firmware", "ollama-cloud", "aihubmix"];
16667
+ var AGENT_MODEL_DEFAULTS = {
16663
16668
  coder: {
16664
- fallbackChain: [
16665
- {
16666
- providers: ["anthropic", "github-copilot", "opencode"],
16667
- model: "claude-opus-4-6",
16668
- variant: "max"
16669
- },
16669
+ chain: [
16670
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16670
16671
  { providers: ["kimi-for-coding"], model: "k2p5" },
16671
- {
16672
- providers: [
16673
- "opencode",
16674
- "moonshotai",
16675
- "moonshotai-cn",
16676
- "firmware",
16677
- "ollama-cloud",
16678
- "aihubmix"
16679
- ],
16680
- model: "kimi-k2.5"
16681
- },
16682
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
16672
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16673
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "medium" },
16683
16674
  { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
16684
- { providers: ["opencode"], model: "big-pickle" }
16675
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
16685
16676
  ],
16686
- requiresAnyModel: true
16677
+ includeInInstall: true,
16678
+ requiresAnyProvider: [
16679
+ "anthropic",
16680
+ "github-copilot",
16681
+ "opencode",
16682
+ "kimi-for-coding",
16683
+ "moonshotai",
16684
+ "moonshotai-cn",
16685
+ "firmware",
16686
+ "ollama-cloud",
16687
+ "aihubmix",
16688
+ "openai",
16689
+ "zai-coding-plan"
16690
+ ]
16687
16691
  },
16688
16692
  gptcoder: {
16689
- fallbackChain: [
16690
- {
16691
- providers: ["openai", "venice", "opencode"],
16692
- model: "gpt-5.4",
16693
- variant: "medium"
16694
- },
16693
+ chain: [
16694
+ { providers: ["openai", "venice", "opencode"], model: "gpt-5.4", variant: "medium" },
16695
16695
  { providers: ["github-copilot"], model: "gpt-5.4", variant: "medium" }
16696
16696
  ],
16697
- requiresProvider: ["openai", "github-copilot", "venice", "opencode"]
16697
+ includeInInstall: true,
16698
+ requiresAnyProvider: ["openai", "github-copilot", "venice", "opencode"]
16699
+ },
16700
+ planner: {
16701
+ chain: [
16702
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16703
+ { providers: ["kimi-for-coding"], model: "k2p5" },
16704
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "high" },
16705
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro" }
16706
+ ],
16707
+ includeInInstall: true
16698
16708
  },
16699
16709
  oracle: {
16700
- fallbackChain: [
16701
- {
16702
- providers: ["openai", "github-copilot", "opencode"],
16703
- model: "gpt-5.4",
16704
- variant: "high"
16705
- },
16706
- {
16707
- providers: ["google", "github-copilot", "opencode"],
16708
- model: "gemini-3.1-pro",
16709
- variant: "high"
16710
- },
16711
- {
16712
- providers: ["anthropic", "github-copilot", "opencode"],
16713
- model: "claude-opus-4-6",
16714
- variant: "max"
16715
- }
16716
- ]
16710
+ chain: [
16711
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "high" },
16712
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16713
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
16714
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16715
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
16716
+ ],
16717
+ includeInInstall: true
16717
16718
  },
16718
16719
  librarian: {
16719
- fallbackChain: [
16720
- {
16721
- providers: ["google", "github-copilot", "opencode"],
16722
- model: "gemini-3-flash"
16723
- },
16724
- { providers: ["opencode"], model: "minimax-m2.5-free" },
16725
- { providers: ["opencode"], model: "big-pickle" }
16726
- ]
16720
+ chain: [
16721
+ { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" },
16722
+ { providers: ["opencode"], model: "glm-4.7" },
16723
+ { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-5" },
16724
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true },
16725
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true },
16726
+ { providers: ["opencode"], model: "glm-4.7-free", alwaysAvailable: true }
16727
+ ],
16728
+ includeInInstall: true,
16729
+ specialCases: { zaiOverride: { model: "zai-coding-plan/glm-4.7" }, openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "medium" } }
16727
16730
  },
16728
16731
  explore: {
16729
- fallbackChain: [
16732
+ chain: [
16730
16733
  { providers: ["github-copilot"], model: "grok-code-fast-1" },
16731
- { providers: ["opencode"], model: "minimax-m2.5-free" },
16734
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true },
16732
16735
  { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
16733
- { providers: ["opencode"], model: "gpt-5-nano" }
16734
- ]
16736
+ { providers: ["opencode"], model: "gpt-5-nano", alwaysAvailable: true }
16737
+ ],
16738
+ includeInInstall: true,
16739
+ specialCases: { customResolver: "explore-agent", openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "medium" } }
16735
16740
  },
16736
16741
  "multimodal-looker": {
16737
- fallbackChain: [
16738
- {
16739
- providers: ["openai", "opencode"],
16740
- model: "gpt-5.4",
16741
- variant: "medium"
16742
- },
16743
- { providers: ["kimi-for-coding"], model: "k2p5" },
16744
- {
16745
- providers: ["google", "github-copilot", "opencode"],
16746
- model: "gemini-3-flash"
16747
- },
16748
- { providers: ["zai-coding-plan"], model: "glm-4.6v" },
16749
- {
16750
- providers: ["openai", "github-copilot", "opencode"],
16751
- model: "gpt-5-nano"
16752
- }
16753
- ]
16754
- },
16755
- planner: {
16756
- fallbackChain: [
16757
- {
16758
- providers: ["anthropic", "github-copilot", "opencode"],
16759
- model: "claude-opus-4-6",
16760
- variant: "max"
16761
- },
16762
- {
16763
- providers: ["openai", "github-copilot", "opencode"],
16764
- model: "gpt-5.4",
16765
- variant: "high"
16766
- },
16767
- {
16768
- providers: ["google", "github-copilot", "opencode"],
16769
- model: "gemini-3.1-pro"
16770
- }
16771
- ]
16742
+ chain: [{ providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "medium" }, { providers: ["kimi-for-coding"], model: "k2p5" }, { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" }, { providers: ["zai-coding-plan"], model: "glm-4.6v" }, { providers: OPENAI_PROVIDERS, model: "gpt-5-nano" }],
16743
+ includeInInstall: true
16772
16744
  },
16773
16745
  planConsultant: {
16774
- fallbackChain: [
16775
- {
16776
- providers: ["anthropic", "github-copilot", "opencode"],
16777
- model: "claude-opus-4-6",
16778
- variant: "max"
16779
- },
16780
- {
16781
- providers: ["openai", "github-copilot", "opencode"],
16782
- model: "gpt-5.4",
16783
- variant: "high"
16784
- },
16785
- {
16786
- providers: ["google", "github-copilot", "opencode"],
16787
- model: "gemini-3.1-pro",
16788
- variant: "high"
16789
- }
16790
- ]
16746
+ chain: [{ providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" }, { providers: ["kimi-for-coding"], model: "k2p5" }, { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "high" }, { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" }],
16747
+ includeInInstall: true
16791
16748
  },
16792
16749
  planReviewer: {
16793
- fallbackChain: [
16794
- {
16795
- providers: ["openai", "github-copilot", "opencode"],
16796
- model: "gpt-5.4",
16797
- variant: "xhigh"
16798
- },
16799
- {
16800
- providers: ["anthropic", "github-copilot", "opencode"],
16801
- model: "claude-opus-4-6",
16802
- variant: "max"
16803
- },
16804
- {
16805
- providers: ["google", "github-copilot", "opencode"],
16806
- model: "gemini-3.1-pro",
16807
- variant: "high"
16808
- }
16809
- ]
16750
+ chain: [
16751
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "xhigh" },
16752
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16753
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16754
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
16755
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
16756
+ ],
16757
+ includeInInstall: true
16810
16758
  },
16811
16759
  atlas: {
16812
- fallbackChain: [
16813
- {
16814
- providers: ["anthropic", "github-copilot", "opencode"],
16815
- model: "claude-sonnet-4-6"
16816
- },
16817
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" }
16818
- ]
16760
+ chain: [{ providers: ["kimi-for-coding"], model: "k2p5" }, { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-6" }, { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-5" }, { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "medium" }, { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro" }],
16761
+ includeInInstall: true
16819
16762
  },
16820
16763
  "coder-junior": {
16821
- fallbackChain: [
16822
- {
16823
- providers: ["anthropic", "github-copilot", "opencode"],
16824
- model: "claude-sonnet-4-6"
16825
- },
16826
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
16827
- {
16828
- providers: ["google", "github-copilot", "opencode"],
16829
- model: "gemini-3-flash"
16830
- }
16831
- ]
16764
+ chain: [{ providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-6" }, { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "medium" }, { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" }],
16765
+ includeInInstall: false
16832
16766
  }
16833
16767
  };
16834
- var CATEGORY_MODEL_REQUIREMENTS = {
16768
+ var CATEGORY_MODEL_DEFAULTS = {
16835
16769
  "visual-engineering": {
16836
- fallbackChain: [
16837
- {
16838
- providers: ["google", "github-copilot", "opencode"],
16839
- model: "gemini-3.1-pro",
16840
- variant: "high"
16841
- },
16770
+ chain: [
16771
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
16842
16772
  { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
16843
- {
16844
- providers: ["anthropic", "github-copilot", "opencode"],
16845
- model: "claude-opus-4-6",
16846
- variant: "max"
16847
- }
16848
- ]
16773
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16774
+ { providers: ["kimi-for-coding"], model: "k2p5" }
16775
+ ],
16776
+ includeInInstall: true,
16777
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "high" } }
16849
16778
  },
16850
16779
  ultrabrain: {
16851
- fallbackChain: [
16852
- {
16853
- providers: ["openai", "opencode"],
16854
- model: "gpt-5.4",
16855
- variant: "xhigh"
16856
- },
16857
- {
16858
- providers: ["google", "github-copilot", "opencode"],
16859
- model: "gemini-3.1-pro",
16860
- variant: "high"
16861
- },
16862
- {
16863
- providers: ["anthropic", "github-copilot", "opencode"],
16864
- model: "claude-opus-4-6",
16865
- variant: "max"
16866
- }
16867
- ]
16780
+ chain: [
16781
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "xhigh" },
16782
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
16783
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16784
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16785
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
16786
+ ],
16787
+ includeInInstall: true
16868
16788
  },
16869
16789
  deep: {
16870
- fallbackChain: [
16871
- {
16872
- providers: ["openai", "opencode"],
16873
- model: "gpt-5.4",
16874
- variant: "medium"
16875
- },
16876
- {
16877
- providers: ["anthropic", "github-copilot", "opencode"],
16878
- model: "claude-opus-4-6",
16879
- variant: "max"
16880
- },
16881
- {
16882
- providers: ["google", "github-copilot", "opencode"],
16883
- model: "gemini-3.1-pro",
16884
- variant: "high"
16885
- }
16790
+ chain: [
16791
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "medium" },
16792
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16793
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
16794
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16795
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
16886
16796
  ],
16887
- requiresModel: "gpt-5.4"
16797
+ includeInInstall: true
16888
16798
  },
16889
16799
  artistry: {
16890
- fallbackChain: [
16891
- {
16892
- providers: ["google", "github-copilot", "opencode"],
16893
- model: "gemini-3.1-pro",
16894
- variant: "high"
16895
- },
16896
- {
16897
- providers: ["anthropic", "github-copilot", "opencode"],
16898
- model: "claude-opus-4-6",
16899
- variant: "max"
16900
- },
16901
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" }
16800
+ chain: [
16801
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
16802
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
16803
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4" },
16804
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16805
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true }
16902
16806
  ],
16903
- requiresModel: "gemini-3.1-pro"
16807
+ includeInInstall: true,
16808
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "xhigh" } }
16904
16809
  },
16905
16810
  quick: {
16906
- fallbackChain: [
16907
- {
16908
- providers: ["anthropic", "github-copilot", "opencode"],
16909
- model: "claude-haiku-4-5"
16910
- },
16911
- {
16912
- providers: ["google", "github-copilot", "opencode"],
16913
- model: "gemini-3-flash"
16914
- },
16915
- { providers: ["opencode"], model: "gpt-5-nano" }
16916
- ]
16811
+ chain: [
16812
+ { providers: CLAUDE_PROVIDERS, model: "claude-haiku-4-5" },
16813
+ { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" },
16814
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.1-codex-mini", variant: "low" },
16815
+ { providers: ["opencode"], model: "gpt-5-nano", alwaysAvailable: true }
16816
+ ],
16817
+ includeInInstall: true,
16818
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "low" } }
16917
16819
  },
16918
16820
  "unspecified-low": {
16919
- fallbackChain: [
16920
- {
16921
- providers: ["anthropic", "github-copilot", "opencode"],
16922
- model: "claude-sonnet-4-6"
16923
- },
16924
- {
16925
- providers: ["openai", "opencode"],
16926
- model: "gpt-5.4",
16927
- variant: "medium"
16928
- },
16929
- {
16930
- providers: ["google", "github-copilot", "opencode"],
16931
- model: "gemini-3-flash"
16932
- }
16933
- ]
16821
+ chain: [
16822
+ { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-6" },
16823
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
16824
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "medium" },
16825
+ { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" },
16826
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true }
16827
+ ],
16828
+ includeInInstall: true
16934
16829
  },
16935
16830
  "unspecified-high": {
16936
- fallbackChain: [
16937
- {
16938
- providers: ["anthropic", "github-copilot", "opencode"],
16939
- model: "claude-opus-4-6",
16940
- variant: "max"
16941
- },
16942
- {
16943
- providers: ["openai", "github-copilot", "opencode"],
16944
- model: "gpt-5.4",
16945
- variant: "high"
16946
- },
16947
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
16948
- { providers: ["kimi-for-coding"], model: "k2p5" },
16949
- {
16950
- providers: [
16951
- "opencode",
16952
- "moonshotai",
16953
- "moonshotai-cn",
16954
- "firmware",
16955
- "ollama-cloud",
16956
- "aihubmix"
16957
- ],
16958
- model: "kimi-k2.5"
16959
- }
16960
- ]
16831
+ chain: [{ providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" }, { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "high" }, { providers: ["zai-coding-plan", "opencode"], model: "glm-5" }, { providers: ["kimi-for-coding"], model: "k2p5" }, { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" }],
16832
+ includeInInstall: true
16961
16833
  },
16962
16834
  writing: {
16963
- fallbackChain: [
16964
- {
16965
- providers: ["google", "github-copilot", "opencode"],
16966
- model: "gemini-3-flash"
16967
- },
16968
- {
16969
- providers: ["anthropic", "github-copilot", "opencode"],
16970
- model: "claude-sonnet-4-6"
16971
- }
16972
- ]
16835
+ chain: [{ providers: GEMINI_PROVIDERS, model: "gemini-3-flash" }, { providers: ["kimi-for-coding"], model: "k2p5" }, { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-6" }],
16836
+ includeInInstall: true,
16837
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "medium" } }
16973
16838
  }
16974
16839
  };
16840
+
16841
+ // src/shared/model-requirements.ts
16842
+ var LEGACY_AGENT_REQUIREMENT_OVERRIDES = {
16843
+ coder: {
16844
+ requiresAnyModel: true
16845
+ },
16846
+ gptcoder: {
16847
+ requiresProvider: AGENT_MODEL_DEFAULTS.gptcoder.requiresAnyProvider
16848
+ },
16849
+ atlas: {
16850
+ fallbackChain: pickFallbackEntries(AGENT_MODEL_DEFAULTS.atlas.chain, ["claude-sonnet-4-6", "gpt-5.4"])
16851
+ }
16852
+ };
16853
+ var LEGACY_CATEGORY_REQUIREMENT_OVERRIDES = {
16854
+ "visual-engineering": {
16855
+ fallbackChain: excludeFallbackEntries(CATEGORY_MODEL_DEFAULTS["visual-engineering"].chain, ["k2p5"])
16856
+ },
16857
+ deep: {
16858
+ requiresModel: "gpt-5.4"
16859
+ },
16860
+ artistry: {
16861
+ requiresModel: "gemini-3.1-pro"
16862
+ },
16863
+ writing: {
16864
+ fallbackChain: excludeFallbackEntries(CATEGORY_MODEL_DEFAULTS.writing.chain, ["k2p5"])
16865
+ }
16866
+ };
16867
+ var AGENT_MODEL_REQUIREMENTS = toModelRequirements(AGENT_MODEL_DEFAULTS, LEGACY_AGENT_REQUIREMENT_OVERRIDES);
16868
+ var CATEGORY_MODEL_REQUIREMENTS = toModelRequirements(CATEGORY_MODEL_DEFAULTS, LEGACY_CATEGORY_REQUIREMENT_OVERRIDES);
16869
+ function toModelRequirements(defaults, overrides) {
16870
+ return Object.fromEntries(Object.entries(defaults).map(([name, def]) => {
16871
+ const override = overrides[name];
16872
+ return [
16873
+ name,
16874
+ {
16875
+ fallbackChain: def.chain,
16876
+ ...override
16877
+ }
16878
+ ];
16879
+ }));
16880
+ }
16881
+ function pickFallbackEntries(chain, models) {
16882
+ const allowedModels = new Set(models);
16883
+ return chain.filter((entry) => allowedModels.has(entry.model));
16884
+ }
16885
+ function excludeFallbackEntries(chain, models) {
16886
+ const excludedModels = new Set(models);
16887
+ return chain.filter((entry) => !excludedModels.has(entry.model));
16888
+ }
16975
16889
  // src/shared/session-cursor.ts
16976
16890
  var sessionCursors = new Map;
16977
16891
  function buildMessageKey(message, index) {
@@ -18855,7 +18769,7 @@ function resolveInheritedPromptTools(sessionID, fallbackTools) {
18855
18769
  return normalizePromptTools(fallbackTools);
18856
18770
  }
18857
18771
  // src/shared/internal-initiator-marker.ts
18858
- var OMO_INTERNAL_INITIATOR_MARKER = "<!-- OMO_INTERNAL_INITIATOR -->";
18772
+ var OMO_INTERNAL_INITIATOR_MARKER = "<!-- Drizzy Agent Internal Initiator -->";
18859
18773
  function createInternalAgentTextPart(text) {
18860
18774
  return {
18861
18775
  type: "text",
@@ -19405,291 +19319,18 @@ function discoverPluginCommandDefinitions(options) {
19405
19319
  // src/shared/install-defaults-contract.ts
19406
19320
  var INSTALL_DEFAULTS_SNAPSHOT_VERSION = 1;
19407
19321
  // src/cli/model-fallback-requirements.ts
19408
- var CLI_AGENT_MODEL_REQUIREMENTS = {
19409
- coder: {
19410
- fallbackChain: [
19411
- {
19412
- providers: ["anthropic", "github-copilot", "opencode"],
19413
- model: "claude-opus-4-6",
19414
- variant: "max"
19415
- },
19416
- { providers: ["kimi-for-coding"], model: "k2p5" },
19417
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
19418
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" }
19419
- ],
19420
- requiresAnyModel: true
19421
- },
19422
- gptcoder: {
19423
- fallbackChain: [
19424
- {
19425
- providers: ["openai", "opencode"],
19426
- model: "gpt-5.4",
19427
- variant: "medium"
19428
- }
19429
- ],
19430
- requiresProvider: ["openai", "opencode"]
19431
- },
19432
- oracle: {
19433
- fallbackChain: [
19434
- {
19435
- providers: ["openai", "github-copilot", "opencode"],
19436
- model: "gpt-5.4",
19437
- variant: "high"
19438
- },
19439
- {
19440
- providers: ["google", "github-copilot", "opencode"],
19441
- model: "gemini-3.1-pro",
19442
- variant: "high"
19443
- },
19444
- {
19445
- providers: ["anthropic", "github-copilot", "opencode"],
19446
- model: "claude-opus-4-6",
19447
- variant: "max"
19448
- }
19449
- ]
19450
- },
19451
- librarian: {
19452
- fallbackChain: [
19453
- { providers: ["zai-coding-plan"], model: "glm-4.7" },
19454
- { providers: ["opencode"], model: "glm-4.7-free" },
19455
- {
19456
- providers: ["anthropic", "github-copilot", "opencode"],
19457
- model: "claude-sonnet-4-5"
19458
- }
19459
- ]
19460
- },
19461
- explore: {
19462
- fallbackChain: [
19463
- { providers: ["github-copilot"], model: "grok-code-fast-1" },
19464
- { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
19465
- { providers: ["opencode"], model: "gpt-5-nano" }
19466
- ]
19467
- },
19468
- "multimodal-looker": {
19469
- fallbackChain: [
19470
- {
19471
- providers: ["openai", "opencode"],
19472
- model: "gpt-5.4",
19473
- variant: "medium"
19474
- },
19475
- { providers: ["kimi-for-coding"], model: "k2p5" },
19476
- {
19477
- providers: ["google", "github-copilot", "opencode"],
19478
- model: "gemini-3-flash"
19479
- },
19480
- { providers: ["zai-coding-plan"], model: "glm-4.6v" },
19481
- { providers: ["opencode"], model: "gpt-5-nano" }
19482
- ]
19483
- },
19484
- planner: {
19485
- fallbackChain: [
19486
- {
19487
- providers: ["anthropic", "github-copilot", "opencode"],
19488
- model: "claude-opus-4-6",
19489
- variant: "max"
19490
- },
19491
- { providers: ["kimi-for-coding"], model: "k2p5" },
19492
- {
19493
- providers: ["openai", "github-copilot", "opencode"],
19494
- model: "gpt-5.4",
19495
- variant: "high"
19496
- },
19497
- {
19498
- providers: ["google", "github-copilot", "opencode"],
19499
- model: "gemini-3.1-pro"
19500
- }
19501
- ]
19502
- },
19503
- planConsultant: {
19504
- fallbackChain: [
19505
- {
19506
- providers: ["anthropic", "github-copilot", "opencode"],
19507
- model: "claude-opus-4-6",
19508
- variant: "max"
19509
- },
19510
- { providers: ["kimi-for-coding"], model: "k2p5" },
19511
- {
19512
- providers: ["openai", "github-copilot", "opencode"],
19513
- model: "gpt-5.4",
19514
- variant: "high"
19515
- },
19516
- {
19517
- providers: ["google", "github-copilot", "opencode"],
19518
- model: "gemini-3.1-pro",
19519
- variant: "high"
19520
- }
19521
- ]
19522
- },
19523
- planReviewer: {
19524
- fallbackChain: [
19525
- {
19526
- providers: ["openai", "github-copilot", "opencode"],
19527
- model: "gpt-5.4",
19528
- variant: "xhigh"
19529
- },
19530
- {
19531
- providers: ["anthropic", "github-copilot", "opencode"],
19532
- model: "claude-opus-4-6",
19533
- variant: "max"
19534
- },
19535
- {
19536
- providers: ["google", "github-copilot", "opencode"],
19537
- model: "gemini-3.1-pro",
19538
- variant: "high"
19539
- }
19540
- ]
19541
- },
19542
- atlas: {
19543
- fallbackChain: [
19544
- { providers: ["kimi-for-coding"], model: "k2p5" },
19545
- {
19546
- providers: ["anthropic", "github-copilot", "opencode"],
19547
- model: "claude-sonnet-4-5"
19548
- },
19549
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
19550
- {
19551
- providers: ["google", "github-copilot", "opencode"],
19552
- model: "gemini-3.1-pro"
19553
- }
19554
- ]
19555
- }
19556
- };
19557
- var CLI_CATEGORY_MODEL_REQUIREMENTS = {
19558
- "visual-engineering": {
19559
- fallbackChain: [
19560
- {
19561
- providers: ["google", "github-copilot", "opencode"],
19562
- model: "gemini-3.1-pro",
19563
- variant: "high"
19564
- },
19565
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
19566
- {
19567
- providers: ["anthropic", "github-copilot", "opencode"],
19568
- model: "claude-opus-4-6",
19569
- variant: "max"
19570
- },
19571
- { providers: ["kimi-for-coding"], model: "k2p5" }
19572
- ]
19573
- },
19574
- ultrabrain: {
19575
- fallbackChain: [
19576
- {
19577
- providers: ["openai", "opencode"],
19578
- model: "gpt-5.4",
19579
- variant: "xhigh"
19580
- },
19581
- {
19582
- providers: ["google", "github-copilot", "opencode"],
19583
- model: "gemini-3.1-pro",
19584
- variant: "high"
19585
- },
19586
- {
19587
- providers: ["anthropic", "github-copilot", "opencode"],
19588
- model: "claude-opus-4-6",
19589
- variant: "max"
19590
- }
19591
- ]
19592
- },
19593
- deep: {
19594
- fallbackChain: [
19595
- {
19596
- providers: ["openai", "opencode"],
19597
- model: "gpt-5.4",
19598
- variant: "medium"
19599
- },
19600
- {
19601
- providers: ["anthropic", "github-copilot", "opencode"],
19602
- model: "claude-opus-4-6",
19603
- variant: "max"
19604
- },
19605
- {
19606
- providers: ["google", "github-copilot", "opencode"],
19607
- model: "gemini-3.1-pro",
19608
- variant: "high"
19609
- }
19610
- ],
19611
- requiresModel: "gpt-5.4"
19612
- },
19613
- artistry: {
19614
- fallbackChain: [
19615
- {
19616
- providers: ["google", "github-copilot", "opencode"],
19617
- model: "gemini-3.1-pro",
19618
- variant: "high"
19619
- },
19620
- {
19621
- providers: ["anthropic", "github-copilot", "opencode"],
19622
- model: "claude-opus-4-6",
19623
- variant: "max"
19624
- },
19625
- {
19626
- providers: ["openai", "github-copilot", "opencode"],
19627
- model: "gpt-5.4"
19628
- }
19629
- ],
19630
- requiresModel: "gemini-3.1-pro"
19631
- },
19632
- quick: {
19633
- fallbackChain: [
19634
- {
19635
- providers: ["anthropic", "github-copilot", "opencode"],
19636
- model: "claude-haiku-4-5"
19637
- },
19638
- {
19639
- providers: ["google", "github-copilot", "opencode"],
19640
- model: "gemini-3-flash"
19641
- },
19642
- { providers: ["opencode"], model: "gpt-5-nano" }
19643
- ]
19644
- },
19645
- "unspecified-low": {
19646
- fallbackChain: [
19647
- {
19648
- providers: ["anthropic", "github-copilot", "opencode"],
19649
- model: "claude-sonnet-4-5"
19650
- },
19651
- {
19652
- providers: ["openai", "opencode"],
19653
- model: "gpt-5.4",
19654
- variant: "medium"
19655
- },
19656
- {
19657
- providers: ["google", "github-copilot", "opencode"],
19658
- model: "gemini-3-flash"
19659
- }
19660
- ]
19661
- },
19662
- "unspecified-high": {
19663
- fallbackChain: [
19664
- {
19665
- providers: ["openai", "github-copilot", "opencode"],
19666
- model: "gpt-5.4",
19667
- variant: "high"
19668
- },
19669
- {
19670
- providers: ["anthropic", "github-copilot", "opencode"],
19671
- model: "claude-opus-4-6",
19672
- variant: "max"
19673
- },
19674
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
19675
- { providers: ["kimi-for-coding"], model: "k2p5" },
19676
- { providers: ["opencode"], model: "kimi-k2.5" }
19677
- ]
19678
- },
19679
- writing: {
19680
- fallbackChain: [
19681
- { providers: ["kimi-for-coding"], model: "k2p5" },
19682
- {
19683
- providers: ["google", "github-copilot", "opencode"],
19684
- model: "gemini-3-flash"
19685
- },
19686
- {
19687
- providers: ["anthropic", "github-copilot", "opencode"],
19688
- model: "claude-sonnet-4-5"
19689
- }
19690
- ]
19691
- }
19692
- };
19322
+ var CLI_AGENT_MODEL_REQUIREMENTS = toCliModelRequirements(AGENT_MODEL_DEFAULTS, { includeProviderRequirements: true });
19323
+ var CLI_CATEGORY_MODEL_REQUIREMENTS = toCliModelRequirements(CATEGORY_MODEL_DEFAULTS);
19324
+ function toCliModelRequirements(defaults, options = {}) {
19325
+ return Object.fromEntries(Object.entries(defaults).filter(([, def]) => def.includeInInstall).map(([name, def]) => [
19326
+ name,
19327
+ {
19328
+ fallbackChain: def.chain,
19329
+ requiresAnyModel: options.includeProviderRequirements && def.requiresAnyProvider?.length ? true : undefined,
19330
+ requiresProvider: options.includeProviderRequirements ? def.requiresAnyProvider : undefined
19331
+ }
19332
+ ]));
19333
+ }
19693
19334
 
19694
19335
  // src/cli/provider-availability.ts
19695
19336
  function toInstallDefaultsProviders(config) {
@@ -19718,6 +19359,14 @@ function isProviderAvailable(provider, availability) {
19718
19359
  // src/cli/fallback-chain-resolution.ts
19719
19360
  function resolveModelFromChain(fallbackChain, availability) {
19720
19361
  for (const entry of fallbackChain) {
19362
+ if (entry.alwaysAvailable) {
19363
+ const provider = entry.providers[0];
19364
+ const transformedModel = transformModelForProvider(provider, entry.model);
19365
+ return {
19366
+ model: `${provider}/${transformedModel}`,
19367
+ variant: entry.variant
19368
+ };
19369
+ }
19721
19370
  for (const provider of entry.providers) {
19722
19371
  if (isProviderAvailable(provider, availability)) {
19723
19372
  const transformedModel = transformModelForProvider(provider, entry.model);
@@ -19733,13 +19382,12 @@ function resolveModelFromChain(fallbackChain, availability) {
19733
19382
  function getCoderFallbackChain() {
19734
19383
  return CLI_AGENT_MODEL_REQUIREMENTS.coder.fallbackChain;
19735
19384
  }
19736
- function isAnyFallbackEntryAvailable(fallbackChain, availability) {
19737
- return fallbackChain.some((entry) => entry.providers.some((provider) => isProviderAvailable(provider, availability)));
19738
- }
19739
19385
  function isRequiredModelAvailable(requiresModel, fallbackChain, availability) {
19740
19386
  const matchingEntry = fallbackChain.find((entry) => entry.model === requiresModel);
19741
19387
  if (!matchingEntry)
19742
19388
  return false;
19389
+ if (matchingEntry.alwaysAvailable)
19390
+ return true;
19743
19391
  return matchingEntry.providers.some((provider) => isProviderAvailable(provider, availability));
19744
19392
  }
19745
19393
  function isRequiredProviderAvailable(requiredProviders, availability) {
@@ -19747,8 +19395,8 @@ function isRequiredProviderAvailable(requiredProviders, availability) {
19747
19395
  }
19748
19396
 
19749
19397
  // src/shared/computed-install-defaults.ts
19750
- var ZAI_MODEL = "zai-coding-plan/glm-4.7";
19751
- var ULTIMATE_FALLBACK = "opencode/glm-4.7-free";
19398
+ var ZAI_MODEL = AGENT_MODEL_DEFAULTS.librarian.specialCases?.zaiOverride?.model ?? "zai-coding-plan/glm-4.7";
19399
+ var GLOBAL_ULTIMATE_FALLBACK = getFallbackModelFromChain(AGENT_MODEL_DEFAULTS.librarian.chain) ?? "opencode/glm-4.7-free";
19752
19400
  function toComputedProviderAvailability(providers, options) {
19753
19401
  return {
19754
19402
  native: {
@@ -19765,26 +19413,22 @@ function toComputedProviderAvailability(providers, options) {
19765
19413
  }
19766
19414
  function computeDefaultsFromProviders(providers, options) {
19767
19415
  const availability = toComputedProviderAvailability(providers, options);
19768
- if (!hasAnyProvider(availability)) {
19769
- return {
19770
- agents: Object.fromEntries(Object.entries(CLI_AGENT_MODEL_REQUIREMENTS).filter(([role, requirement]) => !(role === "coder" && requirement.requiresAnyModel)).map(([role]) => [role, { model: ULTIMATE_FALLBACK }])),
19771
- categories: Object.fromEntries(Object.keys(CLI_CATEGORY_MODEL_REQUIREMENTS).map((category) => [category, { model: ULTIMATE_FALLBACK }]))
19772
- };
19773
- }
19416
+ const hasAnyUsableFallback = (chain) => chain?.some((entry) => entry.alwaysAvailable || entry.providers.some((p) => isProviderAvailable(p, availability)));
19417
+ const canUseCoder = !CLI_AGENT_MODEL_REQUIREMENTS.coder.requiresAnyModel || hasAnyUsableFallback(getCoderFallbackChain());
19774
19418
  const agents = {};
19775
19419
  const categories = {};
19776
19420
  for (const [role, requirement] of Object.entries(CLI_AGENT_MODEL_REQUIREMENTS)) {
19777
- if (role === "librarian" && availability.zai) {
19421
+ if (role === "librarian" && availability.zai && AGENT_MODEL_DEFAULTS.librarian.specialCases?.zaiOverride) {
19778
19422
  agents[role] = { model: ZAI_MODEL };
19779
19423
  continue;
19780
19424
  }
19781
- if (role === "explore") {
19425
+ if (role === "explore" && AGENT_MODEL_DEFAULTS.explore.specialCases?.customResolver === "explore-agent") {
19782
19426
  agents[role] = resolveExploreAgent(availability);
19783
19427
  continue;
19784
19428
  }
19785
19429
  if (role === "coder") {
19786
19430
  const fallbackChain = getCoderFallbackChain();
19787
- if (requirement.requiresAnyModel && !isAnyFallbackEntryAvailable(fallbackChain, availability)) {
19431
+ if (requirement.requiresAnyModel && !canUseCoder) {
19788
19432
  continue;
19789
19433
  }
19790
19434
  const resolvedCoder = resolveModelFromChain(fallbackChain, availability);
@@ -19793,23 +19437,20 @@ function computeDefaultsFromProviders(providers, options) {
19793
19437
  }
19794
19438
  continue;
19795
19439
  }
19796
- const resolved = resolveRequirementDefault(requirement, availability);
19440
+ const resolved = resolveRequirementDefault(requirement, availability, requirement.fallbackChain, getUltimateFallback(role));
19797
19441
  if (resolved) {
19798
19442
  agents[role] = resolved;
19799
19443
  }
19800
19444
  }
19801
19445
  for (const [category, requirement] of Object.entries(CLI_CATEGORY_MODEL_REQUIREMENTS)) {
19802
19446
  const fallbackChain = category === "unspecified-high" && !availability.isMaxPlan ? CLI_CATEGORY_MODEL_REQUIREMENTS["unspecified-low"].fallbackChain : requirement.fallbackChain;
19803
- const resolved = resolveRequirementDefault(requirement, availability, fallbackChain);
19447
+ const resolved = resolveRequirementDefault(requirement, availability, fallbackChain, getCategoryUltimateFallback(category));
19804
19448
  if (resolved) {
19805
19449
  categories[category] = resolved;
19806
19450
  }
19807
19451
  }
19808
19452
  return { agents, categories };
19809
19453
  }
19810
- function hasAnyProvider(availability) {
19811
- return availability.native.claude || availability.native.openai || availability.native.gemini || availability.opencodeZen || availability.copilot || availability.zai || availability.kimiForCoding;
19812
- }
19813
19454
  function resolveExploreAgent(availability) {
19814
19455
  if (availability.native.claude) {
19815
19456
  return { model: "anthropic/claude-haiku-4-5" };
@@ -19822,7 +19463,7 @@ function resolveExploreAgent(availability) {
19822
19463
  }
19823
19464
  return { model: "opencode/gpt-5-nano" };
19824
19465
  }
19825
- function resolveRequirementDefault(requirement, availability, fallbackChain = requirement.fallbackChain) {
19466
+ function resolveRequirementDefault(requirement, availability, fallbackChain = requirement.fallbackChain, ultimateFallback = GLOBAL_ULTIMATE_FALLBACK) {
19826
19467
  if (requirement.requiresModel && !isRequiredModelAvailable(requirement.requiresModel, requirement.fallbackChain, availability)) {
19827
19468
  return;
19828
19469
  }
@@ -19831,10 +19472,24 @@ function resolveRequirementDefault(requirement, availability, fallbackChain = re
19831
19472
  }
19832
19473
  const resolved = resolveModelFromChain(fallbackChain, availability);
19833
19474
  if (!resolved) {
19834
- return { model: ULTIMATE_FALLBACK };
19475
+ return { model: ultimateFallback };
19835
19476
  }
19836
19477
  return withVariant(resolved.model, resolved.variant ?? requirement.variant);
19837
19478
  }
19479
+ function getUltimateFallback(agentName) {
19480
+ return getFallbackModelFromChain(AGENT_MODEL_DEFAULTS[agentName]?.chain) ?? GLOBAL_ULTIMATE_FALLBACK;
19481
+ }
19482
+ function getCategoryUltimateFallback(categoryName) {
19483
+ return getFallbackModelFromChain(CATEGORY_MODEL_DEFAULTS[categoryName]?.chain) ?? GLOBAL_ULTIMATE_FALLBACK;
19484
+ }
19485
+ function getFallbackModelFromChain(fallbackChain) {
19486
+ const lastEntry = fallbackChain?.[fallbackChain.length - 1];
19487
+ const provider = lastEntry?.providers[0];
19488
+ if (!provider) {
19489
+ return;
19490
+ }
19491
+ return `${provider}/${lastEntry.model}`;
19492
+ }
19838
19493
  function withVariant(model, variant) {
19839
19494
  return variant ? { model, variant } : { model };
19840
19495
  }
@@ -41330,9 +40985,9 @@ function isGpt5_3CodexModel(model) {
41330
40985
  const modelName = extractModelName(model).toLowerCase();
41331
40986
  return modelName.includes("gpt-5.3-codex") || modelName.includes("gpt-5-3-codex");
41332
40987
  }
41333
- var GEMINI_PROVIDERS = ["google/", "google-vertex/"];
40988
+ var GEMINI_PROVIDERS2 = ["google/", "google-vertex/"];
41334
40989
  function isGeminiModel(model) {
41335
- if (GEMINI_PROVIDERS.some((prefix) => model.startsWith(prefix)))
40990
+ if (GEMINI_PROVIDERS2.some((prefix) => model.startsWith(prefix)))
41336
40991
  return true;
41337
40992
  if (model.startsWith("github-copilot/") && extractModelName(model).toLowerCase().startsWith("gemini"))
41338
40993
  return true;
@@ -52034,16 +51689,14 @@ import * as fs18 from "fs";
52034
51689
  import * as path11 from "path";
52035
51690
 
52036
51691
  // src/cli/openai-only-model-catalog.ts
52037
- var OPENAI_ONLY_AGENT_OVERRIDES = {
52038
- explore: { model: "openai/gpt-5.4", variant: "medium" },
52039
- librarian: { model: "openai/gpt-5.4", variant: "medium" }
52040
- };
52041
- var OPENAI_ONLY_CATEGORY_OVERRIDES = {
52042
- artistry: { model: "openai/gpt-5.4", variant: "xhigh" },
52043
- quick: { model: "openai/gpt-5.4", variant: "low" },
52044
- "visual-engineering": { model: "openai/gpt-5.4", variant: "high" },
52045
- writing: { model: "openai/gpt-5.4", variant: "medium" }
52046
- };
51692
+ var OPENAI_ONLY_AGENT_OVERRIDES = Object.fromEntries(Object.entries(AGENT_MODEL_DEFAULTS).filter(([, def]) => def.specialCases?.openAiOnlyOverride).map(([name, def]) => {
51693
+ const override = def.specialCases.openAiOnlyOverride;
51694
+ return [name, { model: override.model, variant: override.variant }];
51695
+ }));
51696
+ var OPENAI_ONLY_CATEGORY_OVERRIDES = Object.fromEntries(Object.entries(CATEGORY_MODEL_DEFAULTS).filter(([, def]) => def.specialCases?.openAiOnlyOverride).map(([name, def]) => {
51697
+ const override = def.specialCases.openAiOnlyOverride;
51698
+ return [name, { model: override.model, variant: override.variant }];
51699
+ }));
52047
51700
  function isOpenAiOnlyAvailability(availability) {
52048
51701
  return availability.native.openai && !availability.native.claude && !availability.native.gemini && !availability.opencodeZen && !availability.copilot && !availability.zai && !availability.kimiForCoding;
52049
51702
  }
@@ -52099,6 +51752,45 @@ function synthesizeComputedDefaultsConfig(snapshot) {
52099
51752
  categories: generatedConfig.categories
52100
51753
  };
52101
51754
  }
51755
+ // src/shared/config-provenance.ts
51756
+ var explicitAgentOverridesStore = new WeakMap;
51757
+ var explicitCategoryConfigsStore = new WeakMap;
51758
+ function registerConfigProvenance(input) {
51759
+ const {
51760
+ effectiveAgents,
51761
+ effectiveCategories,
51762
+ explicitAgents,
51763
+ explicitCategories
51764
+ } = input;
51765
+ if (effectiveAgents) {
51766
+ explicitAgentOverridesStore.set(effectiveAgents, explicitAgents ?? {});
51767
+ }
51768
+ if (effectiveCategories) {
51769
+ explicitCategoryConfigsStore.set(effectiveCategories, explicitCategories ?? {});
51770
+ }
51771
+ }
51772
+ function getExplicitAgentOverride(agentOverrides, agentName) {
51773
+ return getValueByKey(explicitAgentOverridesStore.get(agentOverrides ?? {}) ?? agentOverrides, agentName);
51774
+ }
51775
+ function hasExplicitAgentOverride(agentOverrides, agentName) {
51776
+ return getExplicitAgentOverride(agentOverrides, agentName) !== undefined;
51777
+ }
51778
+ function getExplicitCategoryConfig(userCategories, categoryName) {
51779
+ return getValueByKey(explicitCategoryConfigsStore.get(userCategories ?? {}) ?? userCategories, categoryName);
51780
+ }
51781
+ function hasExplicitCategoryConfig(userCategories, categoryName) {
51782
+ return getExplicitCategoryConfig(userCategories, categoryName) !== undefined;
51783
+ }
51784
+ function getEffectiveCategoryConfig(userCategories, categoryName) {
51785
+ return getValueByKey(userCategories, categoryName);
51786
+ }
51787
+ function getValueByKey(config2, key) {
51788
+ if (!config2) {
51789
+ return;
51790
+ }
51791
+ return config2[key] ?? Object.entries(config2).find(([entryKey]) => entryKey.toLowerCase() === key.toLowerCase())?.[1];
51792
+ }
51793
+
52102
51794
  // src/plugin-config.ts
52103
51795
  var PARTIAL_STRING_ARRAY_KEYS = new Set([
52104
51796
  "disabled_mcps",
@@ -52262,11 +51954,20 @@ function loadPluginConfig(directory, ctx) {
52262
51954
  const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
52263
51955
  const rawUserConfig = loadConfigFromPath2(userConfigPath, ctx) ?? {};
52264
51956
  const userConfig = stripInvalidUserInstallDefaults(rawUserConfig, userConfigPath);
52265
- let config2 = mergeConfigs(synthesizeComputedDefaultsConfig(userConfig._install_defaults), userConfig);
51957
+ const computedDefaultsConfig = synthesizeComputedDefaultsConfig(userConfig._install_defaults);
51958
+ let explicitConfig = userConfig;
51959
+ let config2 = mergeConfigs(computedDefaultsConfig, userConfig);
52266
51960
  const projectConfig = stripProjectInstallDefaults(loadConfigFromPath2(projectConfigPath, ctx), projectConfigPath);
52267
51961
  if (projectConfig) {
51962
+ explicitConfig = mergeConfigs(explicitConfig, projectConfig);
52268
51963
  config2 = mergeConfigs(config2, projectConfig);
52269
51964
  }
51965
+ registerConfigProvenance({
51966
+ effectiveAgents: config2.agents,
51967
+ effectiveCategories: config2.categories,
51968
+ explicitAgents: explicitConfig.agents,
51969
+ explicitCategories: explicitConfig.categories
51970
+ });
52270
51971
  config2 = {
52271
51972
  ...config2
52272
51973
  };
@@ -72014,8 +71715,8 @@ function resolveFallbackChainForCallOmoAgent(args) {
72014
71715
  const { subagentType, agentOverrides, userCategories } = args;
72015
71716
  const agentConfigKey = getAgentConfigKey(subagentType);
72016
71717
  const agentRequirement = AGENT_MODEL_REQUIREMENTS[agentConfigKey];
72017
- const agentOverride = agentOverrides?.[agentConfigKey] ?? (agentOverrides ? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === agentConfigKey)?.[1] : undefined);
72018
- const normalizedFallbackModels = normalizeFallbackModels(agentOverride?.fallback_models ?? (agentOverride?.category ? userCategories?.[agentOverride.category]?.fallback_models : undefined));
71718
+ const agentOverride = getExplicitAgentOverride(agentOverrides, agentConfigKey);
71719
+ const normalizedFallbackModels = normalizeFallbackModels(agentOverride?.fallback_models ?? (agentOverride?.category ? getEffectiveCategoryConfig(userCategories, agentOverride.category)?.fallback_models : undefined));
72019
71720
  const defaultProviderID = agentRequirement?.fallbackChain?.[0]?.providers?.[0] ?? "opencode";
72020
71721
  const configuredFallbackChain = buildFallbackChainFromModels(normalizedFallbackModels, defaultProviderID);
72021
71722
  return configuredFallbackChain ?? agentRequirement?.fallbackChain;
@@ -74368,8 +74069,9 @@ init_logger();
74368
74069
  function resolveCategoryConfig(categoryName, options) {
74369
74070
  const { userCategories, inheritedModel: _inheritedModel, systemDefaultModel, availableModels } = options;
74370
74071
  const defaultConfig = DEFAULT_CATEGORIES[categoryName];
74371
- const userConfig = userCategories?.[categoryName];
74372
- const hasExplicitUserConfig = userConfig !== undefined;
74072
+ const userConfig = getEffectiveCategoryConfig(userCategories, categoryName);
74073
+ const explicitUserConfig = getExplicitCategoryConfig(userCategories, categoryName);
74074
+ const hasExplicitUserConfig = hasExplicitCategoryConfig(userCategories, categoryName);
74373
74075
  if (userConfig?.disable) {
74374
74076
  return null;
74375
74077
  }
@@ -74385,15 +74087,15 @@ function resolveCategoryConfig(categoryName, options) {
74385
74087
  return null;
74386
74088
  }
74387
74089
  const model = resolveModel({
74388
- userModel: userConfig?.model,
74389
- inheritedModel: defaultConfig?.model,
74090
+ userModel: explicitUserConfig?.model,
74091
+ inheritedModel: userConfig?.model ?? defaultConfig?.model,
74390
74092
  systemDefault: systemDefaultModel
74391
74093
  });
74392
74094
  const config4 = {
74393
74095
  ...defaultConfig,
74394
74096
  ...userConfig,
74395
74097
  model,
74396
- variant: userConfig?.variant ?? defaultConfig?.variant
74098
+ variant: explicitUserConfig?.variant ?? userConfig?.variant ?? defaultConfig?.variant
74397
74099
  };
74398
74100
  let promptAppend = defaultPromptAppend;
74399
74101
  if (userConfig?.prompt_append) {
@@ -74603,7 +74305,8 @@ Available categories: ${allCategoryNames}`
74603
74305
  let modelInfo;
74604
74306
  let categoryModel;
74605
74307
  const overrideModel = coderJuniorModel;
74606
- const explicitCategoryModel = userCategories?.[args.category]?.model;
74308
+ const explicitCategoryConfig = getExplicitCategoryConfig(userCategories, args.category);
74309
+ const explicitCategoryModel = explicitCategoryConfig?.model;
74607
74310
  if (!requirement) {
74608
74311
  actualModel = explicitCategoryModel ?? overrideModel ?? resolved.model;
74609
74312
  if (actualModel) {
@@ -74637,7 +74340,7 @@ Available categories: ${allCategoryNames}`
74637
74340
  const source = type2 === "user-defined" ? "override" : type2 === "system-default" ? "system-default" : "category-default";
74638
74341
  modelInfo = { model: actualModel, type: type2, source };
74639
74342
  const parsedModel = parseModelString(actualModel);
74640
- const variantToUse = userCategories?.[args.category]?.variant ?? resolvedVariant ?? resolved.config.variant;
74343
+ const variantToUse = explicitCategoryConfig?.variant ?? resolvedVariant ?? resolved.config.variant;
74641
74344
  categoryModel = parsedModel ? variantToUse ? { ...parsedModel, variant: variantToUse } : parsedModel : undefined;
74642
74345
  }
74643
74346
  }
@@ -74738,9 +74441,9 @@ Create the work plan directly - that's your job as the planning agent.`
74738
74441
  }
74739
74442
  agentToUse = matchedAgent.name;
74740
74443
  const agentConfigKey = getAgentConfigKey(agentToUse);
74741
- const agentOverride = agentOverrides?.[agentConfigKey] ?? (agentOverrides ? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === agentConfigKey)?.[1] : undefined);
74444
+ const agentOverride = getExplicitAgentOverride(agentOverrides, agentConfigKey);
74742
74445
  const agentRequirement = AGENT_MODEL_REQUIREMENTS[agentConfigKey];
74743
- const normalizedAgentFallbackModels = normalizeFallbackModels(agentOverride?.fallback_models ?? (agentOverride?.category ? userCategories?.[agentOverride.category]?.fallback_models : undefined));
74446
+ const normalizedAgentFallbackModels = normalizeFallbackModels(agentOverride?.fallback_models ?? (agentOverride?.category ? getEffectiveCategoryConfig(userCategories, agentOverride.category)?.fallback_models : undefined));
74744
74447
  if (agentOverride?.model || agentRequirement || matchedAgent.model) {
74745
74448
  const availableModels = await getAvailableModelsForDelegateTask(client2);
74746
74449
  const normalizedMatchedModel = matchedAgent.model ? normalizeModelFormat(matchedAgent.model) : undefined;
@@ -92343,7 +92046,7 @@ function collectPendingBuiltinAgents(input) {
92343
92046
  if (disabledAgents.some((name2) => name2.toLowerCase() === agentName.toLowerCase()))
92344
92047
  continue;
92345
92048
  const agentConfigKey = getAgentConfigKey(agentName);
92346
- const override = agentOverrides[agentConfigKey] ?? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === agentConfigKey.toLowerCase())?.[1];
92049
+ const override = getExplicitAgentOverride(agentOverrides, agentConfigKey);
92347
92050
  const requirement = AGENT_MODEL_REQUIREMENTS[agentConfigKey];
92348
92051
  if (requirement?.requiresModel && availableModels) {
92349
92052
  if (!isModelAvailable(requirement.requiresModel, availableModels)) {
@@ -92402,9 +92105,9 @@ function maybeCreateCoderConfig(input) {
92402
92105
  useTaskSystem,
92403
92106
  disableOmoEnv = false
92404
92107
  } = input;
92405
- const coderOverride = agentOverrides["coder"];
92108
+ const coderOverride = getExplicitAgentOverride(agentOverrides, "coder");
92406
92109
  const coderRequirement = AGENT_MODEL_REQUIREMENTS["coder"];
92407
- const hasCoderExplicitConfig = coderOverride !== undefined;
92110
+ const hasCoderExplicitConfig = hasExplicitAgentOverride(agentOverrides, "coder");
92408
92111
  const meetsCoderAnyModelRequirement = !coderRequirement?.requiresAnyModel || hasCoderExplicitConfig || isFirstRunNoCache || isAnyFallbackModelAvailable(coderRequirement.fallbackChain, availableModels);
92409
92112
  if (disabledAgents.includes("coder") || !meetsCoderAnyModelRequirement)
92410
92113
  return;
@@ -92450,9 +92153,9 @@ function maybeCreateGptcoderConfig(input) {
92450
92153
  } = input;
92451
92154
  if (disabledAgents.includes("gptcoder"))
92452
92155
  return;
92453
- const gptcoderOverride = agentOverrides["gptcoder"];
92156
+ const gptcoderOverride = getExplicitAgentOverride(agentOverrides, "gptcoder");
92454
92157
  const gptcoderRequirement = AGENT_MODEL_REQUIREMENTS["gptcoder"];
92455
- const hasGptcoderExplicitConfig = gptcoderOverride !== undefined;
92158
+ const hasGptcoderExplicitConfig = hasExplicitAgentOverride(agentOverrides, "gptcoder");
92456
92159
  const hasRequiredProvider = !gptcoderRequirement?.requiresProvider || hasGptcoderExplicitConfig || isFirstRunNoCache || isAnyProviderConnected(gptcoderRequirement.requiresProvider, availableModels);
92457
92160
  if (!hasRequiredProvider)
92458
92161
  return;
@@ -92497,7 +92200,7 @@ function maybeCreateAtlasConfig(input) {
92497
92200
  } = input;
92498
92201
  if (disabledAgents.includes("atlas"))
92499
92202
  return;
92500
- const orchestratorOverride = agentOverrides["atlas"];
92203
+ const orchestratorOverride = getExplicitAgentOverride(agentOverrides, "atlas");
92501
92204
  const atlasRequirement = AGENT_MODEL_REQUIREMENTS["atlas"];
92502
92205
  const atlasResolution = applyModelResolution({
92503
92206
  uiSelectedModel: orchestratorOverride?.model ? undefined : uiSelectedModel,
@@ -94967,6 +94670,8 @@ function resolveCategoryConfig2(categoryName, userCategories) {
94967
94670
  // src/plugin-handlers/planner-agent-config-builder.ts
94968
94671
  async function buildPlannerAgentConfig(params) {
94969
94672
  const categoryConfig = params.pluginPlannerOverride?.category ? resolveCategoryConfig2(params.pluginPlannerOverride.category, params.userCategories) : undefined;
94673
+ const explicitCategoryConfig = params.pluginPlannerOverride?.category ? getExplicitCategoryConfig(params.userCategories, params.pluginPlannerOverride.category) : undefined;
94674
+ const effectiveCategoryConfig = params.pluginPlannerOverride?.category ? getEffectiveCategoryConfig(params.userCategories, params.pluginPlannerOverride.category) : undefined;
94970
94675
  const requirement = AGENT_MODEL_REQUIREMENTS["planner"];
94971
94676
  const connectedProviders = readConnectedProvidersCache();
94972
94677
  const availableModels = await fetchAvailableModels(undefined, {
@@ -94975,7 +94680,8 @@ async function buildPlannerAgentConfig(params) {
94975
94680
  const modelResolution = resolveModelPipeline({
94976
94681
  intent: {
94977
94682
  uiSelectedModel: params.currentModel,
94978
- userModel: params.pluginPlannerOverride?.model ?? categoryConfig?.model
94683
+ userModel: params.pluginPlannerOverride?.model ?? explicitCategoryConfig?.model,
94684
+ categoryDefaultModel: effectiveCategoryConfig?.model
94979
94685
  },
94980
94686
  constraints: { availableModels },
94981
94687
  policy: {