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/cli/index.js CHANGED
@@ -3425,296 +3425,207 @@ var init_add_plugin_to_opencode_config = __esm(() => {
3425
3425
  var INSTALL_DEFAULTS_SNAPSHOT_VERSION = 1;
3426
3426
  var init_install_defaults_contract = () => {};
3427
3427
 
3428
- // src/cli/model-fallback-requirements.ts
3429
- var CLI_AGENT_MODEL_REQUIREMENTS, CLI_CATEGORY_MODEL_REQUIREMENTS;
3430
- var init_model_fallback_requirements = __esm(() => {
3431
- CLI_AGENT_MODEL_REQUIREMENTS = {
3428
+ // src/shared/agent-model-defaults.ts
3429
+ var CLAUDE_PROVIDERS, OPENAI_PROVIDERS, OPENAI_NATIVE_PROVIDERS, GEMINI_PROVIDERS, KIMI_K25_PROVIDERS, AGENT_MODEL_DEFAULTS, CATEGORY_MODEL_DEFAULTS;
3430
+ var init_agent_model_defaults = __esm(() => {
3431
+ CLAUDE_PROVIDERS = ["anthropic", "github-copilot", "opencode"];
3432
+ OPENAI_PROVIDERS = ["openai", "github-copilot", "opencode"];
3433
+ OPENAI_NATIVE_PROVIDERS = ["openai", "opencode"];
3434
+ GEMINI_PROVIDERS = ["google", "github-copilot", "opencode"];
3435
+ KIMI_K25_PROVIDERS = ["opencode", "moonshotai", "moonshotai-cn", "firmware", "ollama-cloud", "aihubmix"];
3436
+ AGENT_MODEL_DEFAULTS = {
3432
3437
  coder: {
3433
- fallbackChain: [
3434
- {
3435
- providers: ["anthropic", "github-copilot", "opencode"],
3436
- model: "claude-opus-4-6",
3437
- variant: "max"
3438
- },
3438
+ chain: [
3439
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3439
3440
  { providers: ["kimi-for-coding"], model: "k2p5" },
3440
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
3441
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" }
3441
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3442
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "medium" },
3443
+ { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
3444
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
3442
3445
  ],
3443
- requiresAnyModel: true
3446
+ includeInInstall: true,
3447
+ requiresAnyProvider: [
3448
+ "anthropic",
3449
+ "github-copilot",
3450
+ "opencode",
3451
+ "kimi-for-coding",
3452
+ "moonshotai",
3453
+ "moonshotai-cn",
3454
+ "firmware",
3455
+ "ollama-cloud",
3456
+ "aihubmix",
3457
+ "openai",
3458
+ "zai-coding-plan"
3459
+ ]
3444
3460
  },
3445
3461
  gptcoder: {
3446
- fallbackChain: [
3447
- {
3448
- providers: ["openai", "opencode"],
3449
- model: "gpt-5.4",
3450
- variant: "medium"
3451
- }
3462
+ chain: [
3463
+ { providers: ["openai", "venice", "opencode"], model: "gpt-5.4", variant: "medium" },
3464
+ { providers: ["github-copilot"], model: "gpt-5.4", variant: "medium" }
3452
3465
  ],
3453
- requiresProvider: ["openai", "opencode"]
3466
+ includeInInstall: true,
3467
+ requiresAnyProvider: ["openai", "github-copilot", "venice", "opencode"]
3468
+ },
3469
+ planner: {
3470
+ chain: [
3471
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3472
+ { providers: ["kimi-for-coding"], model: "k2p5" },
3473
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "high" },
3474
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro" }
3475
+ ],
3476
+ includeInInstall: true
3454
3477
  },
3455
3478
  oracle: {
3456
- fallbackChain: [
3457
- {
3458
- providers: ["openai", "github-copilot", "opencode"],
3459
- model: "gpt-5.4",
3460
- variant: "high"
3461
- },
3462
- {
3463
- providers: ["google", "github-copilot", "opencode"],
3464
- model: "gemini-3.1-pro",
3465
- variant: "high"
3466
- },
3467
- {
3468
- providers: ["anthropic", "github-copilot", "opencode"],
3469
- model: "claude-opus-4-6",
3470
- variant: "max"
3471
- }
3472
- ]
3479
+ chain: [
3480
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "high" },
3481
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3482
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
3483
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3484
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
3485
+ ],
3486
+ includeInInstall: true
3473
3487
  },
3474
3488
  librarian: {
3475
- fallbackChain: [
3476
- { providers: ["zai-coding-plan"], model: "glm-4.7" },
3477
- { providers: ["opencode"], model: "glm-4.7-free" },
3478
- {
3479
- providers: ["anthropic", "github-copilot", "opencode"],
3480
- model: "claude-sonnet-4-5"
3481
- }
3482
- ]
3489
+ chain: [
3490
+ { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" },
3491
+ { providers: ["opencode"], model: "glm-4.7" },
3492
+ { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-5" },
3493
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true },
3494
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true },
3495
+ { providers: ["opencode"], model: "glm-4.7-free", alwaysAvailable: true }
3496
+ ],
3497
+ includeInInstall: true,
3498
+ specialCases: { zaiOverride: { model: "zai-coding-plan/glm-4.7" }, openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "medium" } }
3483
3499
  },
3484
3500
  explore: {
3485
- fallbackChain: [
3501
+ chain: [
3486
3502
  { providers: ["github-copilot"], model: "grok-code-fast-1" },
3503
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true },
3487
3504
  { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
3488
- { providers: ["opencode"], model: "gpt-5-nano" }
3489
- ]
3505
+ { providers: ["opencode"], model: "gpt-5-nano", alwaysAvailable: true }
3506
+ ],
3507
+ includeInInstall: true,
3508
+ specialCases: { customResolver: "explore-agent", openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "medium" } }
3490
3509
  },
3491
3510
  "multimodal-looker": {
3492
- fallbackChain: [
3493
- {
3494
- providers: ["openai", "opencode"],
3495
- model: "gpt-5.4",
3496
- variant: "medium"
3497
- },
3498
- { providers: ["kimi-for-coding"], model: "k2p5" },
3499
- {
3500
- providers: ["google", "github-copilot", "opencode"],
3501
- model: "gemini-3-flash"
3502
- },
3503
- { providers: ["zai-coding-plan"], model: "glm-4.6v" },
3504
- { providers: ["opencode"], model: "gpt-5-nano" }
3505
- ]
3506
- },
3507
- planner: {
3508
- fallbackChain: [
3509
- {
3510
- providers: ["anthropic", "github-copilot", "opencode"],
3511
- model: "claude-opus-4-6",
3512
- variant: "max"
3513
- },
3514
- { providers: ["kimi-for-coding"], model: "k2p5" },
3515
- {
3516
- providers: ["openai", "github-copilot", "opencode"],
3517
- model: "gpt-5.4",
3518
- variant: "high"
3519
- },
3520
- {
3521
- providers: ["google", "github-copilot", "opencode"],
3522
- model: "gemini-3.1-pro"
3523
- }
3524
- ]
3511
+ 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" }],
3512
+ includeInInstall: true
3525
3513
  },
3526
3514
  planConsultant: {
3527
- fallbackChain: [
3528
- {
3529
- providers: ["anthropic", "github-copilot", "opencode"],
3530
- model: "claude-opus-4-6",
3531
- variant: "max"
3532
- },
3533
- { providers: ["kimi-for-coding"], model: "k2p5" },
3534
- {
3535
- providers: ["openai", "github-copilot", "opencode"],
3536
- model: "gpt-5.4",
3537
- variant: "high"
3538
- },
3539
- {
3540
- providers: ["google", "github-copilot", "opencode"],
3541
- model: "gemini-3.1-pro",
3542
- variant: "high"
3543
- }
3544
- ]
3515
+ 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" }],
3516
+ includeInInstall: true
3545
3517
  },
3546
3518
  planReviewer: {
3547
- fallbackChain: [
3548
- {
3549
- providers: ["openai", "github-copilot", "opencode"],
3550
- model: "gpt-5.4",
3551
- variant: "xhigh"
3552
- },
3553
- {
3554
- providers: ["anthropic", "github-copilot", "opencode"],
3555
- model: "claude-opus-4-6",
3556
- variant: "max"
3557
- },
3558
- {
3559
- providers: ["google", "github-copilot", "opencode"],
3560
- model: "gemini-3.1-pro",
3561
- variant: "high"
3562
- }
3563
- ]
3519
+ chain: [
3520
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4", variant: "xhigh" },
3521
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3522
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3523
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
3524
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
3525
+ ],
3526
+ includeInInstall: true
3564
3527
  },
3565
3528
  atlas: {
3566
- fallbackChain: [
3567
- { providers: ["kimi-for-coding"], model: "k2p5" },
3568
- {
3569
- providers: ["anthropic", "github-copilot", "opencode"],
3570
- model: "claude-sonnet-4-5"
3571
- },
3572
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
3573
- {
3574
- providers: ["google", "github-copilot", "opencode"],
3575
- model: "gemini-3.1-pro"
3576
- }
3577
- ]
3529
+ 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" }],
3530
+ includeInInstall: true
3531
+ },
3532
+ "coder-junior": {
3533
+ 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" }],
3534
+ includeInInstall: false
3578
3535
  }
3579
3536
  };
3580
- CLI_CATEGORY_MODEL_REQUIREMENTS = {
3537
+ CATEGORY_MODEL_DEFAULTS = {
3581
3538
  "visual-engineering": {
3582
- fallbackChain: [
3583
- {
3584
- providers: ["google", "github-copilot", "opencode"],
3585
- model: "gemini-3.1-pro",
3586
- variant: "high"
3587
- },
3539
+ chain: [
3540
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
3588
3541
  { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
3589
- {
3590
- providers: ["anthropic", "github-copilot", "opencode"],
3591
- model: "claude-opus-4-6",
3592
- variant: "max"
3593
- },
3542
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3594
3543
  { providers: ["kimi-for-coding"], model: "k2p5" }
3595
- ]
3544
+ ],
3545
+ includeInInstall: true,
3546
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "high" } }
3596
3547
  },
3597
3548
  ultrabrain: {
3598
- fallbackChain: [
3599
- {
3600
- providers: ["openai", "opencode"],
3601
- model: "gpt-5.4",
3602
- variant: "xhigh"
3603
- },
3604
- {
3605
- providers: ["google", "github-copilot", "opencode"],
3606
- model: "gemini-3.1-pro",
3607
- variant: "high"
3608
- },
3609
- {
3610
- providers: ["anthropic", "github-copilot", "opencode"],
3611
- model: "claude-opus-4-6",
3612
- variant: "max"
3613
- }
3614
- ]
3549
+ chain: [
3550
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "xhigh" },
3551
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
3552
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3553
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3554
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
3555
+ ],
3556
+ includeInInstall: true
3615
3557
  },
3616
3558
  deep: {
3617
- fallbackChain: [
3618
- {
3619
- providers: ["openai", "opencode"],
3620
- model: "gpt-5.4",
3621
- variant: "medium"
3622
- },
3623
- {
3624
- providers: ["anthropic", "github-copilot", "opencode"],
3625
- model: "claude-opus-4-6",
3626
- variant: "max"
3627
- },
3628
- {
3629
- providers: ["google", "github-copilot", "opencode"],
3630
- model: "gemini-3.1-pro",
3631
- variant: "high"
3632
- }
3559
+ chain: [
3560
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "medium" },
3561
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3562
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
3563
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3564
+ { providers: ["opencode"], model: "big-pickle", alwaysAvailable: true }
3633
3565
  ],
3634
- requiresModel: "gpt-5.4"
3566
+ includeInInstall: true
3635
3567
  },
3636
3568
  artistry: {
3637
- fallbackChain: [
3638
- {
3639
- providers: ["google", "github-copilot", "opencode"],
3640
- model: "gemini-3.1-pro",
3641
- variant: "high"
3642
- },
3643
- {
3644
- providers: ["anthropic", "github-copilot", "opencode"],
3645
- model: "claude-opus-4-6",
3646
- variant: "max"
3647
- },
3648
- {
3649
- providers: ["openai", "github-copilot", "opencode"],
3650
- model: "gpt-5.4"
3651
- }
3569
+ chain: [
3570
+ { providers: GEMINI_PROVIDERS, model: "gemini-3.1-pro", variant: "high" },
3571
+ { providers: CLAUDE_PROVIDERS, model: "claude-opus-4-6", variant: "max" },
3572
+ { providers: OPENAI_PROVIDERS, model: "gpt-5.4" },
3573
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3574
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true }
3652
3575
  ],
3653
- requiresModel: "gemini-3.1-pro"
3576
+ includeInInstall: true,
3577
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "xhigh" } }
3654
3578
  },
3655
3579
  quick: {
3656
- fallbackChain: [
3657
- {
3658
- providers: ["anthropic", "github-copilot", "opencode"],
3659
- model: "claude-haiku-4-5"
3660
- },
3661
- {
3662
- providers: ["google", "github-copilot", "opencode"],
3663
- model: "gemini-3-flash"
3664
- },
3665
- { providers: ["opencode"], model: "gpt-5-nano" }
3666
- ]
3580
+ chain: [
3581
+ { providers: CLAUDE_PROVIDERS, model: "claude-haiku-4-5" },
3582
+ { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" },
3583
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.1-codex-mini", variant: "low" },
3584
+ { providers: ["opencode"], model: "gpt-5-nano", alwaysAvailable: true }
3585
+ ],
3586
+ includeInInstall: true,
3587
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "low" } }
3667
3588
  },
3668
3589
  "unspecified-low": {
3669
- fallbackChain: [
3670
- {
3671
- providers: ["anthropic", "github-copilot", "opencode"],
3672
- model: "claude-sonnet-4-5"
3673
- },
3674
- {
3675
- providers: ["openai", "opencode"],
3676
- model: "gpt-5.4",
3677
- variant: "medium"
3678
- },
3679
- {
3680
- providers: ["google", "github-copilot", "opencode"],
3681
- model: "gemini-3-flash"
3682
- }
3683
- ]
3590
+ chain: [
3591
+ { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-6" },
3592
+ { providers: KIMI_K25_PROVIDERS, model: "kimi-k2.5" },
3593
+ { providers: OPENAI_NATIVE_PROVIDERS, model: "gpt-5.4", variant: "medium" },
3594
+ { providers: GEMINI_PROVIDERS, model: "gemini-3-flash" },
3595
+ { providers: ["opencode"], model: "minimax-m2.5-free", alwaysAvailable: true }
3596
+ ],
3597
+ includeInInstall: true
3684
3598
  },
3685
3599
  "unspecified-high": {
3686
- fallbackChain: [
3687
- {
3688
- providers: ["openai", "github-copilot", "opencode"],
3689
- model: "gpt-5.4",
3690
- variant: "high"
3691
- },
3692
- {
3693
- providers: ["anthropic", "github-copilot", "opencode"],
3694
- model: "claude-opus-4-6",
3695
- variant: "max"
3696
- },
3697
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
3698
- { providers: ["kimi-for-coding"], model: "k2p5" },
3699
- { providers: ["opencode"], model: "kimi-k2.5" }
3700
- ]
3600
+ 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" }],
3601
+ includeInInstall: true
3701
3602
  },
3702
3603
  writing: {
3703
- fallbackChain: [
3704
- { providers: ["kimi-for-coding"], model: "k2p5" },
3705
- {
3706
- providers: ["google", "github-copilot", "opencode"],
3707
- model: "gemini-3-flash"
3708
- },
3709
- {
3710
- providers: ["anthropic", "github-copilot", "opencode"],
3711
- model: "claude-sonnet-4-5"
3712
- }
3713
- ]
3604
+ chain: [{ providers: GEMINI_PROVIDERS, model: "gemini-3-flash" }, { providers: ["kimi-for-coding"], model: "k2p5" }, { providers: CLAUDE_PROVIDERS, model: "claude-sonnet-4-6" }],
3605
+ includeInInstall: true,
3606
+ specialCases: { openAiOnlyOverride: { model: "openai/gpt-5.4", variant: "medium" } }
3714
3607
  }
3715
3608
  };
3716
3609
  });
3717
3610
 
3611
+ // src/cli/model-fallback-requirements.ts
3612
+ function toCliModelRequirements(defaults, options = {}) {
3613
+ return Object.fromEntries(Object.entries(defaults).filter(([, def]) => def.includeInInstall).map(([name, def]) => [
3614
+ name,
3615
+ {
3616
+ fallbackChain: def.chain,
3617
+ requiresAnyModel: options.includeProviderRequirements && def.requiresAnyProvider?.length ? true : undefined,
3618
+ requiresProvider: options.includeProviderRequirements ? def.requiresAnyProvider : undefined
3619
+ }
3620
+ ]));
3621
+ }
3622
+ var CLI_AGENT_MODEL_REQUIREMENTS, CLI_CATEGORY_MODEL_REQUIREMENTS;
3623
+ var init_model_fallback_requirements = __esm(() => {
3624
+ init_agent_model_defaults();
3625
+ CLI_AGENT_MODEL_REQUIREMENTS = toCliModelRequirements(AGENT_MODEL_DEFAULTS, { includeProviderRequirements: true });
3626
+ CLI_CATEGORY_MODEL_REQUIREMENTS = toCliModelRequirements(CATEGORY_MODEL_DEFAULTS);
3627
+ });
3628
+
3718
3629
  // src/shared/provider-model-id-transform.ts
3719
3630
  function transformModelForProvider(provider, model) {
3720
3631
  if (provider === "github-copilot") {
@@ -3732,6 +3643,14 @@ var init_provider_model_id_transform = () => {};
3732
3643
  // src/cli/fallback-chain-resolution.ts
3733
3644
  function resolveModelFromChain(fallbackChain, availability) {
3734
3645
  for (const entry of fallbackChain) {
3646
+ if (entry.alwaysAvailable) {
3647
+ const provider = entry.providers[0];
3648
+ const transformedModel = transformModelForProvider(provider, entry.model);
3649
+ return {
3650
+ model: `${provider}/${transformedModel}`,
3651
+ variant: entry.variant
3652
+ };
3653
+ }
3735
3654
  for (const provider of entry.providers) {
3736
3655
  if (isProviderAvailable(provider, availability)) {
3737
3656
  const transformedModel = transformModelForProvider(provider, entry.model);
@@ -3747,13 +3666,12 @@ function resolveModelFromChain(fallbackChain, availability) {
3747
3666
  function getCoderFallbackChain() {
3748
3667
  return CLI_AGENT_MODEL_REQUIREMENTS.coder.fallbackChain;
3749
3668
  }
3750
- function isAnyFallbackEntryAvailable(fallbackChain, availability) {
3751
- return fallbackChain.some((entry) => entry.providers.some((provider) => isProviderAvailable(provider, availability)));
3752
- }
3753
3669
  function isRequiredModelAvailable(requiresModel, fallbackChain, availability) {
3754
3670
  const matchingEntry = fallbackChain.find((entry) => entry.model === requiresModel);
3755
3671
  if (!matchingEntry)
3756
3672
  return false;
3673
+ if (matchingEntry.alwaysAvailable)
3674
+ return true;
3757
3675
  return matchingEntry.providers.some((provider) => isProviderAvailable(provider, availability));
3758
3676
  }
3759
3677
  function isRequiredProviderAvailable(requiredProviders, availability) {
@@ -3782,26 +3700,22 @@ function toComputedProviderAvailability(providers, options) {
3782
3700
  }
3783
3701
  function computeDefaultsFromProviders(providers, options) {
3784
3702
  const availability = toComputedProviderAvailability(providers, options);
3785
- if (!hasAnyProvider(availability)) {
3786
- return {
3787
- agents: Object.fromEntries(Object.entries(CLI_AGENT_MODEL_REQUIREMENTS).filter(([role, requirement]) => !(role === "coder" && requirement.requiresAnyModel)).map(([role]) => [role, { model: ULTIMATE_FALLBACK }])),
3788
- categories: Object.fromEntries(Object.keys(CLI_CATEGORY_MODEL_REQUIREMENTS).map((category) => [category, { model: ULTIMATE_FALLBACK }]))
3789
- };
3790
- }
3703
+ const hasAnyUsableFallback = (chain) => chain?.some((entry) => entry.alwaysAvailable || entry.providers.some((p) => isProviderAvailable(p, availability)));
3704
+ const canUseCoder = !CLI_AGENT_MODEL_REQUIREMENTS.coder.requiresAnyModel || hasAnyUsableFallback(getCoderFallbackChain());
3791
3705
  const agents = {};
3792
3706
  const categories = {};
3793
3707
  for (const [role, requirement] of Object.entries(CLI_AGENT_MODEL_REQUIREMENTS)) {
3794
- if (role === "librarian" && availability.zai) {
3708
+ if (role === "librarian" && availability.zai && AGENT_MODEL_DEFAULTS.librarian.specialCases?.zaiOverride) {
3795
3709
  agents[role] = { model: ZAI_MODEL };
3796
3710
  continue;
3797
3711
  }
3798
- if (role === "explore") {
3712
+ if (role === "explore" && AGENT_MODEL_DEFAULTS.explore.specialCases?.customResolver === "explore-agent") {
3799
3713
  agents[role] = resolveExploreAgent(availability);
3800
3714
  continue;
3801
3715
  }
3802
3716
  if (role === "coder") {
3803
3717
  const fallbackChain = getCoderFallbackChain();
3804
- if (requirement.requiresAnyModel && !isAnyFallbackEntryAvailable(fallbackChain, availability)) {
3718
+ if (requirement.requiresAnyModel && !canUseCoder) {
3805
3719
  continue;
3806
3720
  }
3807
3721
  const resolvedCoder = resolveModelFromChain(fallbackChain, availability);
@@ -3810,23 +3724,20 @@ function computeDefaultsFromProviders(providers, options) {
3810
3724
  }
3811
3725
  continue;
3812
3726
  }
3813
- const resolved = resolveRequirementDefault(requirement, availability);
3727
+ const resolved = resolveRequirementDefault(requirement, availability, requirement.fallbackChain, getUltimateFallback(role));
3814
3728
  if (resolved) {
3815
3729
  agents[role] = resolved;
3816
3730
  }
3817
3731
  }
3818
3732
  for (const [category, requirement] of Object.entries(CLI_CATEGORY_MODEL_REQUIREMENTS)) {
3819
3733
  const fallbackChain = category === "unspecified-high" && !availability.isMaxPlan ? CLI_CATEGORY_MODEL_REQUIREMENTS["unspecified-low"].fallbackChain : requirement.fallbackChain;
3820
- const resolved = resolveRequirementDefault(requirement, availability, fallbackChain);
3734
+ const resolved = resolveRequirementDefault(requirement, availability, fallbackChain, getCategoryUltimateFallback(category));
3821
3735
  if (resolved) {
3822
3736
  categories[category] = resolved;
3823
3737
  }
3824
3738
  }
3825
3739
  return { agents, categories };
3826
3740
  }
3827
- function hasAnyProvider(availability) {
3828
- return availability.native.claude || availability.native.openai || availability.native.gemini || availability.opencodeZen || availability.copilot || availability.zai || availability.kimiForCoding;
3829
- }
3830
3741
  function resolveExploreAgent(availability) {
3831
3742
  if (availability.native.claude) {
3832
3743
  return { model: "anthropic/claude-haiku-4-5" };
@@ -3839,7 +3750,7 @@ function resolveExploreAgent(availability) {
3839
3750
  }
3840
3751
  return { model: "opencode/gpt-5-nano" };
3841
3752
  }
3842
- function resolveRequirementDefault(requirement, availability, fallbackChain = requirement.fallbackChain) {
3753
+ function resolveRequirementDefault(requirement, availability, fallbackChain = requirement.fallbackChain, ultimateFallback = GLOBAL_ULTIMATE_FALLBACK) {
3843
3754
  if (requirement.requiresModel && !isRequiredModelAvailable(requirement.requiresModel, requirement.fallbackChain, availability)) {
3844
3755
  return;
3845
3756
  }
@@ -3848,17 +3759,35 @@ function resolveRequirementDefault(requirement, availability, fallbackChain = re
3848
3759
  }
3849
3760
  const resolved = resolveModelFromChain(fallbackChain, availability);
3850
3761
  if (!resolved) {
3851
- return { model: ULTIMATE_FALLBACK };
3762
+ return { model: ultimateFallback };
3852
3763
  }
3853
3764
  return withVariant(resolved.model, resolved.variant ?? requirement.variant);
3854
3765
  }
3766
+ function getUltimateFallback(agentName) {
3767
+ return getFallbackModelFromChain(AGENT_MODEL_DEFAULTS[agentName]?.chain) ?? GLOBAL_ULTIMATE_FALLBACK;
3768
+ }
3769
+ function getCategoryUltimateFallback(categoryName) {
3770
+ return getFallbackModelFromChain(CATEGORY_MODEL_DEFAULTS[categoryName]?.chain) ?? GLOBAL_ULTIMATE_FALLBACK;
3771
+ }
3772
+ function getFallbackModelFromChain(fallbackChain) {
3773
+ const lastEntry = fallbackChain?.[fallbackChain.length - 1];
3774
+ const provider = lastEntry?.providers[0];
3775
+ if (!provider) {
3776
+ return;
3777
+ }
3778
+ return `${provider}/${lastEntry.model}`;
3779
+ }
3855
3780
  function withVariant(model, variant) {
3856
3781
  return variant ? { model, variant } : { model };
3857
3782
  }
3858
- var ZAI_MODEL = "zai-coding-plan/glm-4.7", ULTIMATE_FALLBACK = "opencode/glm-4.7-free";
3783
+ var ZAI_MODEL, GLOBAL_ULTIMATE_FALLBACK;
3859
3784
  var init_computed_install_defaults = __esm(() => {
3860
3785
  init_fallback_chain_resolution();
3786
+ init_provider_availability();
3861
3787
  init_model_fallback_requirements();
3788
+ init_agent_model_defaults();
3789
+ ZAI_MODEL = AGENT_MODEL_DEFAULTS.librarian.specialCases?.zaiOverride?.model ?? "zai-coding-plan/glm-4.7";
3790
+ GLOBAL_ULTIMATE_FALLBACK = getFallbackModelFromChain(AGENT_MODEL_DEFAULTS.librarian.chain) ?? "opencode/glm-4.7-free";
3862
3791
  });
3863
3792
 
3864
3793
  // src/cli/provider-availability.ts
@@ -5490,7 +5419,7 @@ var {
5490
5419
  // package.json
5491
5420
  var package_default = {
5492
5421
  name: "drizzy-agent",
5493
- version: "0.4.2",
5422
+ version: "0.5.1",
5494
5423
  description: "DrizzyAgent - AI agent plugin for OpenCode",
5495
5424
  main: "dist/index.js",
5496
5425
  types: "dist/index.d.ts",
@@ -5566,17 +5495,17 @@ var package_default = {
5566
5495
  typescript: "^5.7.3"
5567
5496
  },
5568
5497
  optionalDependencies: {
5569
- "drizzy-agent-darwin-arm64": "0.4.2",
5570
- "drizzy-agent-darwin-x64": "0.4.2",
5571
- "drizzy-agent-darwin-x64-baseline": "0.4.2",
5572
- "drizzy-agent-linux-arm64": "0.4.2",
5573
- "drizzy-agent-linux-arm64-musl": "0.4.2",
5574
- "drizzy-agent-linux-x64": "0.4.2",
5575
- "drizzy-agent-linux-x64-baseline": "0.4.2",
5576
- "drizzy-agent-linux-x64-musl": "0.4.2",
5577
- "drizzy-agent-linux-x64-musl-baseline": "0.4.2",
5578
- "drizzy-agent-windows-x64": "0.4.2",
5579
- "drizzy-agent-windows-x64-baseline": "0.4.2"
5498
+ "drizzy-agent-darwin-arm64": "0.5.1",
5499
+ "drizzy-agent-darwin-x64": "0.5.1",
5500
+ "drizzy-agent-darwin-x64-baseline": "0.5.1",
5501
+ "drizzy-agent-linux-arm64": "0.5.1",
5502
+ "drizzy-agent-linux-arm64-musl": "0.5.1",
5503
+ "drizzy-agent-linux-x64": "0.5.1",
5504
+ "drizzy-agent-linux-x64-baseline": "0.5.1",
5505
+ "drizzy-agent-linux-x64-musl": "0.5.1",
5506
+ "drizzy-agent-linux-x64-musl-baseline": "0.5.1",
5507
+ "drizzy-agent-windows-x64": "0.5.1",
5508
+ "drizzy-agent-windows-x64-baseline": "0.5.1"
5580
5509
  },
5581
5510
  overrides: {
5582
5511
  "@opencode-ai/sdk": "^1.2.24"
@@ -7400,16 +7329,15 @@ import * as fs3 from "fs";
7400
7329
  import * as path3 from "path";
7401
7330
 
7402
7331
  // src/cli/openai-only-model-catalog.ts
7403
- var OPENAI_ONLY_AGENT_OVERRIDES = {
7404
- explore: { model: "openai/gpt-5.4", variant: "medium" },
7405
- librarian: { model: "openai/gpt-5.4", variant: "medium" }
7406
- };
7407
- var OPENAI_ONLY_CATEGORY_OVERRIDES = {
7408
- artistry: { model: "openai/gpt-5.4", variant: "xhigh" },
7409
- quick: { model: "openai/gpt-5.4", variant: "low" },
7410
- "visual-engineering": { model: "openai/gpt-5.4", variant: "high" },
7411
- writing: { model: "openai/gpt-5.4", variant: "medium" }
7412
- };
7332
+ init_agent_model_defaults();
7333
+ var OPENAI_ONLY_AGENT_OVERRIDES = Object.fromEntries(Object.entries(AGENT_MODEL_DEFAULTS).filter(([, def]) => def.specialCases?.openAiOnlyOverride).map(([name, def]) => {
7334
+ const override = def.specialCases.openAiOnlyOverride;
7335
+ return [name, { model: override.model, variant: override.variant }];
7336
+ }));
7337
+ var OPENAI_ONLY_CATEGORY_OVERRIDES = Object.fromEntries(Object.entries(CATEGORY_MODEL_DEFAULTS).filter(([, def]) => def.specialCases?.openAiOnlyOverride).map(([name, def]) => {
7338
+ const override = def.specialCases.openAiOnlyOverride;
7339
+ return [name, { model: override.model, variant: override.variant }];
7340
+ }));
7413
7341
  function isOpenAiOnlyAvailability(availability) {
7414
7342
  return availability.native.openai && !availability.native.claude && !availability.native.gemini && !availability.opencodeZen && !availability.copilot && !availability.zai && !availability.kimiForCoding;
7415
7343
  }
@@ -21455,6 +21383,24 @@ var DrizzyAgentConfigSchema = exports_external.object({
21455
21383
  _install_defaults: InstallDefaultsSnapshotSchema.optional(),
21456
21384
  _migrations: exports_external.array(exports_external.string()).optional()
21457
21385
  });
21386
+ // src/shared/config-provenance.ts
21387
+ var explicitAgentOverridesStore = new WeakMap;
21388
+ var explicitCategoryConfigsStore = new WeakMap;
21389
+ function registerConfigProvenance(input) {
21390
+ const {
21391
+ effectiveAgents,
21392
+ effectiveCategories,
21393
+ explicitAgents,
21394
+ explicitCategories
21395
+ } = input;
21396
+ if (effectiveAgents) {
21397
+ explicitAgentOverridesStore.set(effectiveAgents, explicitAgents ?? {});
21398
+ }
21399
+ if (effectiveCategories) {
21400
+ explicitCategoryConfigsStore.set(effectiveCategories, explicitCategories ?? {});
21401
+ }
21402
+ }
21403
+
21458
21404
  // node_modules/js-yaml/dist/js-yaml.mjs
21459
21405
  /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
21460
21406
  function isNothing(subject) {
@@ -24484,319 +24430,54 @@ function getAgentConfigKey(agentName) {
24484
24430
  }
24485
24431
 
24486
24432
  // src/shared/model-requirements.ts
24487
- var AGENT_MODEL_REQUIREMENTS = {
24433
+ init_agent_model_defaults();
24434
+ var LEGACY_AGENT_REQUIREMENT_OVERRIDES = {
24488
24435
  coder: {
24489
- fallbackChain: [
24490
- {
24491
- providers: ["anthropic", "github-copilot", "opencode"],
24492
- model: "claude-opus-4-6",
24493
- variant: "max"
24494
- },
24495
- { providers: ["kimi-for-coding"], model: "k2p5" },
24496
- {
24497
- providers: [
24498
- "opencode",
24499
- "moonshotai",
24500
- "moonshotai-cn",
24501
- "firmware",
24502
- "ollama-cloud",
24503
- "aihubmix"
24504
- ],
24505
- model: "kimi-k2.5"
24506
- },
24507
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
24508
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
24509
- { providers: ["opencode"], model: "big-pickle" }
24510
- ],
24511
24436
  requiresAnyModel: true
24512
24437
  },
24513
24438
  gptcoder: {
24514
- fallbackChain: [
24515
- {
24516
- providers: ["openai", "venice", "opencode"],
24517
- model: "gpt-5.4",
24518
- variant: "medium"
24519
- },
24520
- { providers: ["github-copilot"], model: "gpt-5.4", variant: "medium" }
24521
- ],
24522
- requiresProvider: ["openai", "github-copilot", "venice", "opencode"]
24523
- },
24524
- oracle: {
24525
- fallbackChain: [
24526
- {
24527
- providers: ["openai", "github-copilot", "opencode"],
24528
- model: "gpt-5.4",
24529
- variant: "high"
24530
- },
24531
- {
24532
- providers: ["google", "github-copilot", "opencode"],
24533
- model: "gemini-3.1-pro",
24534
- variant: "high"
24535
- },
24536
- {
24537
- providers: ["anthropic", "github-copilot", "opencode"],
24538
- model: "claude-opus-4-6",
24539
- variant: "max"
24540
- }
24541
- ]
24542
- },
24543
- librarian: {
24544
- fallbackChain: [
24545
- {
24546
- providers: ["google", "github-copilot", "opencode"],
24547
- model: "gemini-3-flash"
24548
- },
24549
- { providers: ["opencode"], model: "minimax-m2.5-free" },
24550
- { providers: ["opencode"], model: "big-pickle" }
24551
- ]
24552
- },
24553
- explore: {
24554
- fallbackChain: [
24555
- { providers: ["github-copilot"], model: "grok-code-fast-1" },
24556
- { providers: ["opencode"], model: "minimax-m2.5-free" },
24557
- { providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
24558
- { providers: ["opencode"], model: "gpt-5-nano" }
24559
- ]
24560
- },
24561
- "multimodal-looker": {
24562
- fallbackChain: [
24563
- {
24564
- providers: ["openai", "opencode"],
24565
- model: "gpt-5.4",
24566
- variant: "medium"
24567
- },
24568
- { providers: ["kimi-for-coding"], model: "k2p5" },
24569
- {
24570
- providers: ["google", "github-copilot", "opencode"],
24571
- model: "gemini-3-flash"
24572
- },
24573
- { providers: ["zai-coding-plan"], model: "glm-4.6v" },
24574
- {
24575
- providers: ["openai", "github-copilot", "opencode"],
24576
- model: "gpt-5-nano"
24577
- }
24578
- ]
24579
- },
24580
- planner: {
24581
- fallbackChain: [
24582
- {
24583
- providers: ["anthropic", "github-copilot", "opencode"],
24584
- model: "claude-opus-4-6",
24585
- variant: "max"
24586
- },
24587
- {
24588
- providers: ["openai", "github-copilot", "opencode"],
24589
- model: "gpt-5.4",
24590
- variant: "high"
24591
- },
24592
- {
24593
- providers: ["google", "github-copilot", "opencode"],
24594
- model: "gemini-3.1-pro"
24595
- }
24596
- ]
24597
- },
24598
- planConsultant: {
24599
- fallbackChain: [
24600
- {
24601
- providers: ["anthropic", "github-copilot", "opencode"],
24602
- model: "claude-opus-4-6",
24603
- variant: "max"
24604
- },
24605
- {
24606
- providers: ["openai", "github-copilot", "opencode"],
24607
- model: "gpt-5.4",
24608
- variant: "high"
24609
- },
24610
- {
24611
- providers: ["google", "github-copilot", "opencode"],
24612
- model: "gemini-3.1-pro",
24613
- variant: "high"
24614
- }
24615
- ]
24616
- },
24617
- planReviewer: {
24618
- fallbackChain: [
24619
- {
24620
- providers: ["openai", "github-copilot", "opencode"],
24621
- model: "gpt-5.4",
24622
- variant: "xhigh"
24623
- },
24624
- {
24625
- providers: ["anthropic", "github-copilot", "opencode"],
24626
- model: "claude-opus-4-6",
24627
- variant: "max"
24628
- },
24629
- {
24630
- providers: ["google", "github-copilot", "opencode"],
24631
- model: "gemini-3.1-pro",
24632
- variant: "high"
24633
- }
24634
- ]
24439
+ requiresProvider: AGENT_MODEL_DEFAULTS.gptcoder.requiresAnyProvider
24635
24440
  },
24636
24441
  atlas: {
24637
- fallbackChain: [
24638
- {
24639
- providers: ["anthropic", "github-copilot", "opencode"],
24640
- model: "claude-sonnet-4-6"
24641
- },
24642
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" }
24643
- ]
24644
- },
24645
- "coder-junior": {
24646
- fallbackChain: [
24647
- {
24648
- providers: ["anthropic", "github-copilot", "opencode"],
24649
- model: "claude-sonnet-4-6"
24650
- },
24651
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
24652
- {
24653
- providers: ["google", "github-copilot", "opencode"],
24654
- model: "gemini-3-flash"
24655
- }
24656
- ]
24442
+ fallbackChain: pickFallbackEntries(AGENT_MODEL_DEFAULTS.atlas.chain, ["claude-sonnet-4-6", "gpt-5.4"])
24657
24443
  }
24658
24444
  };
24659
- var CATEGORY_MODEL_REQUIREMENTS = {
24445
+ var LEGACY_CATEGORY_REQUIREMENT_OVERRIDES = {
24660
24446
  "visual-engineering": {
24661
- fallbackChain: [
24662
- {
24663
- providers: ["google", "github-copilot", "opencode"],
24664
- model: "gemini-3.1-pro",
24665
- variant: "high"
24666
- },
24667
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
24668
- {
24669
- providers: ["anthropic", "github-copilot", "opencode"],
24670
- model: "claude-opus-4-6",
24671
- variant: "max"
24672
- }
24673
- ]
24674
- },
24675
- ultrabrain: {
24676
- fallbackChain: [
24677
- {
24678
- providers: ["openai", "opencode"],
24679
- model: "gpt-5.4",
24680
- variant: "xhigh"
24681
- },
24682
- {
24683
- providers: ["google", "github-copilot", "opencode"],
24684
- model: "gemini-3.1-pro",
24685
- variant: "high"
24686
- },
24687
- {
24688
- providers: ["anthropic", "github-copilot", "opencode"],
24689
- model: "claude-opus-4-6",
24690
- variant: "max"
24691
- }
24692
- ]
24447
+ fallbackChain: excludeFallbackEntries(CATEGORY_MODEL_DEFAULTS["visual-engineering"].chain, ["k2p5"])
24693
24448
  },
24694
24449
  deep: {
24695
- fallbackChain: [
24696
- {
24697
- providers: ["openai", "opencode"],
24698
- model: "gpt-5.4",
24699
- variant: "medium"
24700
- },
24701
- {
24702
- providers: ["anthropic", "github-copilot", "opencode"],
24703
- model: "claude-opus-4-6",
24704
- variant: "max"
24705
- },
24706
- {
24707
- providers: ["google", "github-copilot", "opencode"],
24708
- model: "gemini-3.1-pro",
24709
- variant: "high"
24710
- }
24711
- ],
24712
24450
  requiresModel: "gpt-5.4"
24713
24451
  },
24714
24452
  artistry: {
24715
- fallbackChain: [
24716
- {
24717
- providers: ["google", "github-copilot", "opencode"],
24718
- model: "gemini-3.1-pro",
24719
- variant: "high"
24720
- },
24721
- {
24722
- providers: ["anthropic", "github-copilot", "opencode"],
24723
- model: "claude-opus-4-6",
24724
- variant: "max"
24725
- },
24726
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" }
24727
- ],
24728
24453
  requiresModel: "gemini-3.1-pro"
24729
24454
  },
24730
- quick: {
24731
- fallbackChain: [
24732
- {
24733
- providers: ["anthropic", "github-copilot", "opencode"],
24734
- model: "claude-haiku-4-5"
24735
- },
24736
- {
24737
- providers: ["google", "github-copilot", "opencode"],
24738
- model: "gemini-3-flash"
24739
- },
24740
- { providers: ["opencode"], model: "gpt-5-nano" }
24741
- ]
24742
- },
24743
- "unspecified-low": {
24744
- fallbackChain: [
24745
- {
24746
- providers: ["anthropic", "github-copilot", "opencode"],
24747
- model: "claude-sonnet-4-6"
24748
- },
24749
- {
24750
- providers: ["openai", "opencode"],
24751
- model: "gpt-5.4",
24752
- variant: "medium"
24753
- },
24754
- {
24755
- providers: ["google", "github-copilot", "opencode"],
24756
- model: "gemini-3-flash"
24757
- }
24758
- ]
24759
- },
24760
- "unspecified-high": {
24761
- fallbackChain: [
24762
- {
24763
- providers: ["anthropic", "github-copilot", "opencode"],
24764
- model: "claude-opus-4-6",
24765
- variant: "max"
24766
- },
24767
- {
24768
- providers: ["openai", "github-copilot", "opencode"],
24769
- model: "gpt-5.4",
24770
- variant: "high"
24771
- },
24772
- { providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
24773
- { providers: ["kimi-for-coding"], model: "k2p5" },
24774
- {
24775
- providers: [
24776
- "opencode",
24777
- "moonshotai",
24778
- "moonshotai-cn",
24779
- "firmware",
24780
- "ollama-cloud",
24781
- "aihubmix"
24782
- ],
24783
- model: "kimi-k2.5"
24784
- }
24785
- ]
24786
- },
24787
24455
  writing: {
24788
- fallbackChain: [
24789
- {
24790
- providers: ["google", "github-copilot", "opencode"],
24791
- model: "gemini-3-flash"
24792
- },
24793
- {
24794
- providers: ["anthropic", "github-copilot", "opencode"],
24795
- model: "claude-sonnet-4-6"
24796
- }
24797
- ]
24456
+ fallbackChain: excludeFallbackEntries(CATEGORY_MODEL_DEFAULTS.writing.chain, ["k2p5"])
24798
24457
  }
24799
24458
  };
24459
+ var AGENT_MODEL_REQUIREMENTS = toModelRequirements(AGENT_MODEL_DEFAULTS, LEGACY_AGENT_REQUIREMENT_OVERRIDES);
24460
+ var CATEGORY_MODEL_REQUIREMENTS = toModelRequirements(CATEGORY_MODEL_DEFAULTS, LEGACY_CATEGORY_REQUIREMENT_OVERRIDES);
24461
+ function toModelRequirements(defaults, overrides) {
24462
+ return Object.fromEntries(Object.entries(defaults).map(([name, def]) => {
24463
+ const override = overrides[name];
24464
+ return [
24465
+ name,
24466
+ {
24467
+ fallbackChain: def.chain,
24468
+ ...override
24469
+ }
24470
+ ];
24471
+ }));
24472
+ }
24473
+ function pickFallbackEntries(chain, models) {
24474
+ const allowedModels = new Set(models);
24475
+ return chain.filter((entry) => allowedModels.has(entry.model));
24476
+ }
24477
+ function excludeFallbackEntries(chain, models) {
24478
+ const excludedModels = new Set(models);
24479
+ return chain.filter((entry) => !excludedModels.has(entry.model));
24480
+ }
24800
24481
  // src/shared/session-cursor.ts
24801
24482
  var sessionCursors = new Map;
24802
24483
  // src/shared/model-resolution-pipeline.ts
@@ -25073,11 +24754,20 @@ function loadPluginConfig(directory, ctx) {
25073
24754
  const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
25074
24755
  const rawUserConfig = loadConfigFromPath(userConfigPath, ctx) ?? {};
25075
24756
  const userConfig = stripInvalidUserInstallDefaults(rawUserConfig, userConfigPath);
25076
- let config2 = mergeConfigs(synthesizeComputedDefaultsConfig(userConfig._install_defaults), userConfig);
24757
+ const computedDefaultsConfig = synthesizeComputedDefaultsConfig(userConfig._install_defaults);
24758
+ let explicitConfig = userConfig;
24759
+ let config2 = mergeConfigs(computedDefaultsConfig, userConfig);
25077
24760
  const projectConfig = stripProjectInstallDefaults(loadConfigFromPath(projectConfigPath, ctx), projectConfigPath);
25078
24761
  if (projectConfig) {
24762
+ explicitConfig = mergeConfigs(explicitConfig, projectConfig);
25079
24763
  config2 = mergeConfigs(config2, projectConfig);
25080
24764
  }
24765
+ registerConfigProvenance({
24766
+ effectiveAgents: config2.agents,
24767
+ effectiveCategories: config2.categories,
24768
+ explicitAgents: explicitConfig.agents,
24769
+ explicitCategories: explicitConfig.categories
24770
+ });
25081
24771
  config2 = {
25082
24772
  ...config2
25083
24773
  };