@link-assistant/agent 0.25.7 → 0.25.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.25.7",
3
+ "version": "0.25.8",
4
4
  "description": "A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface. Bun-only runtime.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -15,6 +15,17 @@ import {
15
15
  getDefaultCompactionSafetyMarginPercent,
16
16
  } from './defaults.ts';
17
17
 
18
+ export class ModelResolutionError extends Error {
19
+ constructor({ modelArgv, defaultModel }) {
20
+ super(
21
+ `Detected a --model flag that could not be parsed reliably from argv ${JSON.stringify(modelArgv)}. ` +
22
+ `Refusing to continue with default model "${defaultModel}". ` +
23
+ 'Pass each option and value as a separate argv element, for example: ["--model", "provider/model", "--verbose"].'
24
+ );
25
+ this.name = 'ModelResolutionError';
26
+ }
27
+ }
28
+
18
29
  /**
19
30
  * Parse model config from argv. Supports "provider/model" or short "model" format.
20
31
  * @param {object} argv - Parsed command line arguments
@@ -75,18 +86,13 @@ export async function parseModelConfig(
75
86
  rawArgvStr.includes('-m ') ||
76
87
  rawArgvStr.includes('-m=')
77
88
  ) {
78
- Log.Default.error(() => ({
79
- message:
80
- 'CRITICAL: --model flag detected in process.argv but both getModelFromProcessArgv() and yargs returned default. ' +
81
- 'This is likely a Bun/yargs argument parsing bug (oven-sh/bun#22157). ' +
82
- 'The requested model will NOT be used — the default model will be used instead.',
83
- processArgv: process.argv,
84
- bunArgv:
85
- typeof globalThis.Bun !== 'undefined' && globalThis.Bun.argv
86
- ? globalThis.Bun.argv
87
- : '(not available)',
89
+ const modelArgv = process.argv.filter(
90
+ (arg) => typeof arg === 'string' && /(^|\s)(--model|-m)(=|\s)/.test(arg)
91
+ );
92
+ throw new ModelResolutionError({
93
+ modelArgv: modelArgv.length > 0 ? modelArgv : process.argv,
88
94
  defaultModel,
89
- }));
95
+ });
90
96
  }
91
97
  }
92
98