@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 +1 -1
- package/src/cli/model-config.js +17 -11
package/package.json
CHANGED
package/src/cli/model-config.js
CHANGED
|
@@ -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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|