@zhiman_innies/innies-codex 0.122.57 → 0.122.58

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.
@@ -563,12 +563,15 @@ function normalizeManagedProviderBlocks(contents) {
563
563
  return updated;
564
564
  }
565
565
 
566
- // Pin the dashscope block's `env_key` to DASHSCOPE_API_KEY. The block
567
- // is the user-facing alias for the builtin `bailian` provider; the
568
- // factory at codex-rs/model-provider-info/src/lib.rs reads
569
- // `DASHSCOPE_API_KEY` (and only that name) from the environment, so
570
- // anything else here is a typo / legacy name. Auto-correct with a
571
- // console warning instead of failing the whole normalize run.
566
+ // Pin the dashscope block's `env_key` to DASHSCOPE_API_KEY, and its
567
+ // `name` to "bailian" (the builtin factory id). The block is the
568
+ // user-facing alias for the builtin `bailian` provider; the factory
569
+ // at codex-rs/model-provider-info/src/lib.rs reads `DASHSCOPE_API_KEY`
570
+ // (and only that name) from the environment and the block's `name`
571
+ // field must equal `BAILIAN_PROVIDER_ID = "bailian"` so the
572
+ // anti-silent-fallback guard in `to_api_provider` recognizes the
573
+ // merged provider. Auto-correct legacy / typo'd values with a console
574
+ // warning instead of failing the whole normalize run.
572
575
  function enforceDashscopeEnvKey(contents) {
573
576
  const lines = contents.split(/\r?\n/);
574
577
  let inDashscope = false;
@@ -582,6 +585,36 @@ function enforceDashscopeEnvKey(contents) {
582
585
  continue;
583
586
  }
584
587
  if (inDashscope) {
588
+ // N1 (2026-06-14): migrate legacy `name = "DashScope"` →
589
+ // `name = "bailian"`. The block key (`dashscope`) is the
590
+ // user-facing alias and is unchanged; only the inner `name`
591
+ // field is canonicalized to match `BAILIAN_PROVIDER_ID`. A
592
+ // mismatched name (e.g. "DashScope") silently falls through
593
+ // the anti-silent-fallback guard because
594
+ // `to_api_provider` lowercases `self.name` and checks
595
+ // `name_lc == "bailian"` / `"dashscope"` / starts_with("zhiman"),
596
+ // so "DashScope" lowercases to "dashscope" which IS matched —
597
+ // but the user-facing error message names the wrong canonical
598
+ // env var (DASHSCOPE_BASE_URL vs ZHIMAN_BASE_URL) and the
599
+ // operator gets confused. Pin to "bailian" for a clean merge.
600
+ const nameMatch = line.match(/^(\s*)name\s*=\s*"([^"]+)"(\s*)(#.*)?$/);
601
+ if (nameMatch) {
602
+ const [, indent, value, , comment] = nameMatch;
603
+ if (value !== "bailian") {
604
+ console.warn(
605
+ `[innies-config] ${DASHSCOPE_PROVIDER_HEADER} name="${value}" ` +
606
+ `is not the canonical "bailian" — auto-correcting ` +
607
+ `(legacy template default; the Rust factory's ` +
608
+ `BAILIAN_PROVIDER_ID is "bailian", and a mismatched ` +
609
+ `name yields a misleading DASHSCOPE_BASE_URL / ` +
610
+ `ZHIMAN_BASE_URL error from the anti-silent-fallback guard).`
611
+ );
612
+ const tail = comment ? ` ${comment}` : "";
613
+ updated.push(`${indent}name = "bailian"${tail}`);
614
+ rewrote = true;
615
+ continue;
616
+ }
617
+ }
585
618
  const m = line.match(/^(\s*)env_key\s*=\s*"?([^"\s#]+)"?(\s*)(#.*)?$/);
586
619
  if (m) {
587
620
  const [, indent, value, , comment] = m;
@@ -740,6 +773,19 @@ function defaultDashscopeProviderBlock() {
740
773
  // it commented and set DASHSCOPE_API_KEY as a regular env var, both
741
774
  // paths converge.
742
775
  //
776
+ // N1 (2026-06-14): the block's `name` field MUST be "bailian" (the
777
+ // builtin factory's `BAILIAN_PROVIDER_ID`), not "DashScope". A
778
+ // mismatch silently falls through the anti-silent-fallback guard
779
+ // in `codex-rs/model-provider-info/src/lib.rs::to_api_provider`
780
+ // (the `is_non_openai_builtin && base_url.contains("api.openai.com")`
781
+ // check uses `self.name.to_ascii_lowercase()`, which catches "dashscope"
782
+ // but emits a misleading error for an unknown "DashScope" name) and
783
+ // the request 401s at api.openai.com with the user's OPENAI_API_KEY.
784
+ // Pin to "bailian" so the merge layer and the factory's
785
+ // `create_bailian_provider` recognize the block as the public-cloud
786
+ // DashScope alias. The block *key* (`dashscope`) is the user-facing
787
+ // alias and stays the same — only the *name* field is canonicalized.
788
+ //
743
789
  // DashScope-specific note: the top-level `enable_thinking` flag is
744
790
  // the canonical thinking toggle (NOT the nested `chat_template_kwargs`
745
791
  // form, which DashScope rejects with HTTP 400). Use
@@ -747,7 +793,7 @@ function defaultDashscopeProviderBlock() {
747
793
  // `model_reasoning_effort` at the root.
748
794
  return [
749
795
  DASHSCOPE_PROVIDER_HEADER,
750
- 'name = "DashScope"',
796
+ 'name = "bailian"',
751
797
  `# base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1" # FILL IN: DashScope OpenAI-compatible endpoint`,
752
798
  `# env_key = "DASHSCOPE_API_KEY" # FILL IN: name of the env var holding your DashScope API key`,
753
799
  `wire_api = "${DEFAULT_PROVIDER_WIRE_API}"`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhiman_innies/innies-codex",
3
- "version": "0.122.57",
3
+ "version": "0.122.58",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "innies": "bin/innies.js"
@@ -21,11 +21,5 @@
21
21
  "packageManager": "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc",
22
22
  "scripts": {
23
23
  "postinstall": "node bin/innies-init.js"
24
- },
25
- "optionalDependencies": {
26
- "@zhiman_innies/innies-codex-darwin-x64": "0.122.57-darwin-x64",
27
- "@zhiman_innies/innies-codex-darwin-arm64": "0.122.57-darwin-arm64",
28
- "@zhiman_innies/innies-codex-win32-x64": "0.122.57-win32-x64",
29
- "@zhiman_innies/innies-codex-win32-arm64": "0.122.57-win32-arm64"
30
24
  }
31
- }
25
+ }