@zhiman_innies/innies-codex 0.122.47 → 0.122.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/innies-config.js +112 -16
  2. package/package.json +5 -5
@@ -13,7 +13,14 @@ const DEFAULT_PROVIDER = "zhiman_35b";
13
13
  // The earlier "qwen3.6-27b" string was a placeholder that did not
14
14
  // correspond to a real DashScope model id.
15
15
  const DASHSCOPE_MODEL = "qwen3.6-27b";
16
- const QWEN_MODELS = new Set([DEFAULT_MODEL, DASHSCOPE_MODEL]);
16
+ // Private-deployment 27B vLLM slug. Distinct from the 35B `qwen35_35b`
17
+ // managed default and the bailian public-cloud `qwen3.6-27b`. Lives
18
+ // behind its own provider id (`zhiman_27b`) so the two private
19
+ // deployments can carry different base_url / env_key overrides
20
+ // without colliding on the builtin `zhiman` factory.
21
+ const PRIVATE_27B_MODEL = "qwen36_27b";
22
+ const PRIVATE_27B_PROVIDER = "zhiman_27b";
23
+ const QWEN_MODELS = new Set([DEFAULT_MODEL, DASHSCOPE_MODEL, PRIVATE_27B_MODEL]);
17
24
  const LEGACY_MODELS = new Set(["qwen-plus", "qwen-plus-latest"]);
18
25
  const DEFAULT_HOME_DIR = ".inniescoder";
19
26
  const DEFAULT_CATALOG_FILENAME = "catalog.json";
@@ -23,6 +30,7 @@ const DEFAULT_SUPERPOWERS_DIRNAME = "superpowers";
23
30
  const INSTALL_SUPERPOWERS_ENV = "INNIES_INSTALL_SUPERPOWERS";
24
31
  const SUPERPOWERS_MARKER_FILENAME = ".innies-superpowers.marker";
25
32
  const ZHIMAN_35B_PROVIDER_HEADER = "[model_providers.zhiman_35b]";
33
+ const ZHIMAN_27B_PROVIDER_HEADER = "[model_providers.zhiman_27b]";
26
34
  const DASHSCOPE_PROVIDER_HEADER = "[model_providers.dashscope]";
27
35
  // Default `wire_api` emitted in freshly generated provider blocks. Both
28
36
  // the private vLLM and the DashScope public cloud only expose the
@@ -45,9 +53,6 @@ const ROOT_MANAGED_SETTINGS = Object.freeze([
45
53
  ["model_catalog_json", null],
46
54
  ["model_reasoning_effort", null],
47
55
  ]);
48
- const LEGACY_MANAGED_GPT_MODEL = "gpt-5.5";
49
- const LEGACY_MANAGED_GPT_PROVIDER = "openai";
50
- const LEGACY_MANAGED_GPT_REASONING = "high";
51
56
 
52
57
  export function resolveInniesHome() {
53
58
  if (process.env.INNIES_HOME) {
@@ -300,6 +305,8 @@ function defaultInniesConfig(catalogPath, managedDefault) {
300
305
  "",
301
306
  defaultZhiman35bProviderBlock(),
302
307
  "",
308
+ defaultZhiman27bProviderBlock(),
309
+ "",
303
310
  defaultDashscopeProviderBlock(),
304
311
  "",
305
312
  ].join("\n");
@@ -332,6 +339,9 @@ function normalizeInniesConfig(contents, catalogPath, state) {
332
339
  if (!updated.includes(ZHIMAN_35B_PROVIDER_HEADER)) {
333
340
  updated = `${updated.trimEnd()}\n\n${defaultZhiman35bProviderBlock()}\n`;
334
341
  }
342
+ if (!updated.includes(ZHIMAN_27B_PROVIDER_HEADER)) {
343
+ updated = `${updated.trimEnd()}\n\n${defaultZhiman27bProviderBlock()}\n`;
344
+ }
335
345
  if (!updated.includes(DASHSCOPE_PROVIDER_HEADER)) {
336
346
  updated = `${updated.trimEnd()}\n\n${defaultDashscopeProviderBlock()}\n`;
337
347
  }
@@ -360,14 +370,17 @@ function preservedUserManagedLines(contents, catalogPath) {
360
370
  (preservedModelValue === DEFAULT_MODEL &&
361
371
  (preservedProviderValue == null || preservedProviderValue === DEFAULT_PROVIDER)) ||
362
372
  (preservedModelValue === DASHSCOPE_MODEL &&
363
- (preservedProviderValue == null || preservedProviderValue === "dashscope"));
373
+ (preservedProviderValue == null || preservedProviderValue === "dashscope")) ||
374
+ (preservedModelValue === PRIVATE_27B_MODEL &&
375
+ (preservedProviderValue == null ||
376
+ preservedProviderValue === PRIVATE_27B_PROVIDER));
364
377
  const preservedEffort = preservesQwenModel
365
378
  ? null
366
379
  : readRootSetting(contents, "model_reasoning_effort");
367
380
 
368
381
  return [
369
- preservedModelProvider ?? 'model_provider = "openai"',
370
- preservedModel ?? 'model = "gpt-5.5"',
382
+ preservedModelProvider ?? `model_provider = "${DEFAULT_PROVIDER}"`,
383
+ preservedModel ?? `model = "${DEFAULT_MODEL}"`,
371
384
  `model_catalog_json = ${JSON.stringify(catalogPath)}`,
372
385
  ...(preservedEffort ? [preservedEffort] : []),
373
386
  ];
@@ -419,11 +432,8 @@ function determineModelSelectionState(contents, previousState) {
419
432
  }
420
433
 
421
434
  if (
422
- previousState.model_selection_state === MODEL_SELECTION_STATES.MANAGED_DEFAULT &&
423
- currentModel === LEGACY_MANAGED_GPT_MODEL &&
424
- currentProvider === LEGACY_MANAGED_GPT_PROVIDER &&
425
- extractRootSettingValue(contents, "model_reasoning_effort") ===
426
- LEGACY_MANAGED_GPT_REASONING
435
+ currentModel === PRIVATE_27B_MODEL &&
436
+ (currentProvider == null || currentProvider === PRIVATE_27B_PROVIDER)
427
437
  ) {
428
438
  return previousState;
429
439
  }
@@ -432,7 +442,8 @@ function determineModelSelectionState(contents, previousState) {
432
442
  currentModel != null &&
433
443
  !LEGACY_MODELS.has(currentModel) &&
434
444
  (currentModel !== DEFAULT_MODEL || currentProvider !== DEFAULT_PROVIDER) &&
435
- (currentModel !== DASHSCOPE_MODEL || currentProvider !== "dashscope")
445
+ (currentModel !== DASHSCOPE_MODEL || currentProvider !== "dashscope") &&
446
+ (currentModel !== PRIVATE_27B_MODEL || currentProvider !== PRIVATE_27B_PROVIDER)
436
447
  ) {
437
448
  return {
438
449
  model_selection_state: MODEL_SELECTION_STATES.USER_SELECTED,
@@ -481,20 +492,82 @@ function normalizeManagedProviderBlocks(contents) {
481
492
  // NOTE: we deliberately do NOT auto-inject `base_url` or `env_key`
482
493
  // into user blocks. The user must configure these themselves (either
483
494
  // in the TOML block or via the corresponding env var: ZHIMAN_API_KEY
484
- // / BAILIAN_API_KEY / ZHIMAN_35B_API_KEY). The Rust builtin
495
+ // / DASHSCOPE_API_KEY / ZHIMAN_35B_API_KEY). The Rust builtin
485
496
  // providers fall back to the env var when `env_key` is absent from
486
497
  // the TOML, so the only thing that is strictly required from the
487
- // user is `base_url` (or the ZHIMAN_BASE_URL / BAILIAN_BASE_URL env
498
+ // user is `base_url` (or the ZHIMAN_BASE_URL / DASHSCOPE_BASE_URL env
488
499
  // var). We only normalize `wire_api` to a known-good value.
489
500
  let updated = normalizeProviderBlock(contents, {
490
501
  providerHeader: ZHIMAN_35B_PROVIDER_HEADER,
491
502
  });
503
+ updated = normalizeProviderBlock(updated, {
504
+ providerHeader: ZHIMAN_27B_PROVIDER_HEADER,
505
+ });
492
506
  updated = normalizeProviderBlock(updated, {
493
507
  providerHeader: DASHSCOPE_PROVIDER_HEADER,
494
508
  });
509
+ // Migration safety net: legacy / typo'd `env_key` names for the
510
+ // dashscope block. If a user has `env_key = "BAILIAN_API_KEY"` (the
511
+ // pre-rename name) or any other variant, codex will read that env
512
+ // var, find it unset, and silently fall back to the builtin OpenAI
513
+ // default — which then 401s on api.openai.com with whatever
514
+ // OPENAI_API_KEY happens to be set. That looks like a streaming /
515
+ // interruption bug to the user. Pin the value to the canonical
516
+ // DASHSCOPE_API_KEY here so the lookup matches the factory and the
517
+ // user manual.
518
+ updated = enforceDashscopeEnvKey(updated);
495
519
  return updated;
496
520
  }
497
521
 
522
+ // Pin the dashscope block's `env_key` to DASHSCOPE_API_KEY. The block
523
+ // is the user-facing alias for the builtin `bailian` provider; the
524
+ // factory at codex-rs/model-provider-info/src/lib.rs reads
525
+ // `DASHSCOPE_API_KEY` (and only that name) from the environment, so
526
+ // anything else here is a typo / legacy name. Auto-correct with a
527
+ // console warning instead of failing the whole normalize run.
528
+ function enforceDashscopeEnvKey(contents) {
529
+ const lines = contents.split(/\r?\n/);
530
+ let inDashscope = false;
531
+ let rewrote = false;
532
+ const updated = [];
533
+ for (const line of lines) {
534
+ const trimmed = line.trim();
535
+ if (/^\[[^\]]+\]$/.test(trimmed)) {
536
+ inDashscope = trimmed === DASHSCOPE_PROVIDER_HEADER;
537
+ updated.push(line);
538
+ continue;
539
+ }
540
+ if (inDashscope) {
541
+ const m = line.match(/^(\s*)env_key\s*=\s*"?([^"\s#]+)"?(\s*)(#.*)?$/);
542
+ if (m) {
543
+ const [, indent, value, , comment] = m;
544
+ if (value !== "DASHSCOPE_API_KEY") {
545
+ console.warn(
546
+ `[innies-config] ${DASHSCOPE_PROVIDER_HEADER} env_key="${value}" ` +
547
+ `is not the canonical DASHSCOPE_API_KEY — auto-correcting ` +
548
+ `(legacy name or typo; the Rust factory only reads ` +
549
+ `DASHSCOPE_API_KEY, so anything else triggers a silent ` +
550
+ `fallback to api.openai.com and a 401).`
551
+ );
552
+ const tail = comment ? ` ${comment}` : "";
553
+ updated.push(`${indent}env_key = "DASHSCOPE_API_KEY"${tail}`);
554
+ rewrote = true;
555
+ continue;
556
+ }
557
+ }
558
+ }
559
+ updated.push(line);
560
+ }
561
+ return rewrote ? updated.join("\n") : contents;
562
+ }
563
+
564
+ // Exported for unit testing in scripts/test_innies_config.js. Keep
565
+ // the signature stable — the test imports it directly via
566
+ // `require()` and asserts on the input/output transform.
567
+ export function _enforceDashscopeEnvKeyForTest(contents) {
568
+ return enforceDashscopeEnvKey(contents);
569
+ }
570
+
498
571
  function normalizeProviderBlock(contents, provider) {
499
572
  const lines = contents.split(/\r?\n/);
500
573
  const updated = [];
@@ -556,12 +629,35 @@ function defaultZhiman35bProviderBlock() {
556
629
  ].join("\n");
557
630
  }
558
631
 
632
+ function defaultZhiman27bProviderBlock() {
633
+ // Mirrors defaultZhiman35bProviderBlock for the 27B private
634
+ // deployment. Same install-contract rule: do NOT prefill `base_url` or
635
+ // `env_key` — the user must configure both, otherwise the binary
636
+ // would call a real network endpoint on first run. Distinct provider
637
+ // name (`zhiman_27b` vs `zhiman_35b`) and env var so the two private
638
+ // deployments can be configured independently.
639
+ return [
640
+ ZHIMAN_27B_PROVIDER_HEADER,
641
+ 'name = "zhiman_27b"',
642
+ `# base_url = "http://your-private-deployment/v1" # FILL IN: private vLLM / OpenAI-compatible endpoint`,
643
+ `# env_key = "ZHIMAN_27B_API_KEY" # FILL IN: name of the env var holding your API key`,
644
+ `wire_api = "${DEFAULT_PROVIDER_WIRE_API}"`,
645
+ ].join("\n");
646
+ }
647
+
559
648
  function defaultDashscopeProviderBlock() {
649
+ // The DashScope user block is the user-facing alias for the builtin
650
+ // `bailian` provider (same DashScope public cloud, same qwen3.6-27b
651
+ // model). The `env_key` placeholder is `DASHSCOPE_API_KEY` to match
652
+ // the builtin factory's canonical name and the user manual —
653
+ // either uncomment this line and set DASHSCOPE_API_KEY, or leave
654
+ // it commented and set DASHSCOPE_API_KEY as a regular env var, both
655
+ // paths converge.
560
656
  return [
561
657
  DASHSCOPE_PROVIDER_HEADER,
562
658
  'name = "DashScope"',
563
659
  `# base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1" # FILL IN: DashScope OpenAI-compatible endpoint`,
564
- `# env_key = "DASHSCOPE_API_KEY" # FILL IN: name of the env var holding your DashScope API key`,
660
+ `# env_key = "DASHSCOPE_API_KEY" # FILL IN: name of the env var holding your DashScope API key`,
565
661
  `wire_api = "${DEFAULT_PROVIDER_WIRE_API}"`,
566
662
  ].join("\n");
567
663
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhiman_innies/innies-codex",
3
- "version": "0.122.47",
3
+ "version": "0.122.49",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "innies": "bin/innies.js"
@@ -23,9 +23,9 @@
23
23
  "postinstall": "node bin/innies-init.js"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@zhiman_innies/innies-codex-darwin-x64": "0.122.47-darwin-x64",
27
- "@zhiman_innies/innies-codex-darwin-arm64": "0.122.47-darwin-arm64",
28
- "@zhiman_innies/innies-codex-win32-x64": "0.122.47-win32-x64",
29
- "@zhiman_innies/innies-codex-win32-arm64": "0.122.47-win32-arm64"
26
+ "@zhiman_innies/innies-codex-darwin-x64": "0.122.49-darwin-x64",
27
+ "@zhiman_innies/innies-codex-darwin-arm64": "0.122.49-darwin-arm64",
28
+ "@zhiman_innies/innies-codex-win32-x64": "0.122.49-win32-x64",
29
+ "@zhiman_innies/innies-codex-win32-arm64": "0.122.49-win32-arm64"
30
30
  }
31
31
  }