@link-assistant/agent 0.16.13 → 0.16.14
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/defaults.ts +15 -0
- package/src/cli/model-config.js +5 -4
- package/src/index.js +2 -1
- package/src/tool/task.ts +3 -2
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default CLI configuration values.
|
|
3
|
+
*
|
|
4
|
+
* Centralizing defaults here ensures all code references the same value (#208).
|
|
5
|
+
* When the default model changes, update this file only.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Default model used when no `--model` CLI argument is provided. */
|
|
9
|
+
export const DEFAULT_MODEL = 'opencode/minimax-m2.5-free';
|
|
10
|
+
|
|
11
|
+
/** Default provider ID extracted from DEFAULT_MODEL. */
|
|
12
|
+
export const DEFAULT_PROVIDER_ID = DEFAULT_MODEL.split('/')[0];
|
|
13
|
+
|
|
14
|
+
/** Default model ID extracted from DEFAULT_MODEL. */
|
|
15
|
+
export const DEFAULT_MODEL_ID = DEFAULT_MODEL.split('/').slice(1).join('/');
|
package/src/cli/model-config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getModelFromProcessArgv } from './argv.ts';
|
|
2
2
|
import { Log } from '../util/log.ts';
|
|
3
|
+
import { DEFAULT_PROVIDER_ID, DEFAULT_MODEL_ID } from './defaults.ts';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Parse model config from argv. Supports "provider/model" or short "model" format.
|
|
@@ -16,7 +17,7 @@ export async function parseModelConfig(argv, outputError, outputStatus) {
|
|
|
16
17
|
let modelArg = argv.model;
|
|
17
18
|
|
|
18
19
|
// ALWAYS prefer the CLI value over yargs when available (#196)
|
|
19
|
-
// The yargs default
|
|
20
|
+
// The yargs default (DEFAULT_MODEL) can silently override user's --model argument
|
|
20
21
|
if (cliModelArg) {
|
|
21
22
|
if (cliModelArg !== modelArg) {
|
|
22
23
|
Log.Default.warn(() => ({
|
|
@@ -45,7 +46,7 @@ export async function parseModelConfig(argv, outputError, outputStatus) {
|
|
|
45
46
|
// Do NOT fall back to defaults - if the user provided an invalid format, fail clearly (#196)
|
|
46
47
|
if (!providerID || !modelID) {
|
|
47
48
|
throw new Error(
|
|
48
|
-
`Invalid model format: "${modelArg}". Expected "provider/model" format (e.g., "
|
|
49
|
+
`Invalid model format: "${modelArg}". Expected "provider/model" format (e.g., "${DEFAULT_PROVIDER_ID}/${DEFAULT_MODEL_ID}"). ` +
|
|
49
50
|
`Provider: "${providerID || '(empty)'}", Model: "${modelID || '(empty)'}".`
|
|
50
51
|
);
|
|
51
52
|
}
|
|
@@ -124,9 +125,9 @@ export async function parseModelConfig(argv, outputError, outputStatus) {
|
|
|
124
125
|
// Set environment variable for the provider to use
|
|
125
126
|
process.env.CLAUDE_CODE_OAUTH_TOKEN = creds.accessToken;
|
|
126
127
|
|
|
127
|
-
// If user specified the default model (
|
|
128
|
+
// If user specified the default model (DEFAULT_MODEL), switch to claude-oauth
|
|
128
129
|
// If user explicitly specified kilo or another provider, warn but respect their choice
|
|
129
|
-
if (providerID ===
|
|
130
|
+
if (providerID === DEFAULT_PROVIDER_ID && modelID === DEFAULT_MODEL_ID) {
|
|
130
131
|
providerID = 'claude-oauth';
|
|
131
132
|
modelID = 'claude-sonnet-4-5';
|
|
132
133
|
} else if (!['claude-oauth', 'anthropic'].includes(providerID)) {
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Server } from './server/server.ts';
|
|
|
6
6
|
import { Instance } from './project/instance.ts';
|
|
7
7
|
import { Log } from './util/log.ts';
|
|
8
8
|
import { parseModelConfig } from './cli/model-config.js';
|
|
9
|
+
import { DEFAULT_MODEL } from './cli/defaults.ts';
|
|
9
10
|
// Bus is used via createBusEventSubscription in event-handler.js
|
|
10
11
|
import { Session } from './session/index.ts';
|
|
11
12
|
import { SessionPrompt } from './session/prompt.ts';
|
|
@@ -588,7 +589,7 @@ async function main() {
|
|
|
588
589
|
.option('model', {
|
|
589
590
|
type: 'string',
|
|
590
591
|
description: 'Model to use in format providerID/modelID',
|
|
591
|
-
default:
|
|
592
|
+
default: DEFAULT_MODEL,
|
|
592
593
|
})
|
|
593
594
|
.option('json-standard', {
|
|
594
595
|
type: 'string',
|
package/src/tool/task.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Agent } from '../agent/agent';
|
|
|
9
9
|
import { SessionPrompt } from '../session/prompt';
|
|
10
10
|
import { iife } from '../util/iife';
|
|
11
11
|
import { defer } from '../util/defer';
|
|
12
|
+
import { DEFAULT_PROVIDER_ID, DEFAULT_MODEL_ID } from '../cli/defaults';
|
|
12
13
|
|
|
13
14
|
export const TaskTool = Tool.define('task', async () => {
|
|
14
15
|
const agents = await Agent.list().then((x) =>
|
|
@@ -99,8 +100,8 @@ export const TaskTool = Tool.define('task', async () => {
|
|
|
99
100
|
|
|
100
101
|
const model = agent.model ??
|
|
101
102
|
parentModel ?? {
|
|
102
|
-
modelID:
|
|
103
|
-
providerID:
|
|
103
|
+
modelID: DEFAULT_MODEL_ID,
|
|
104
|
+
providerID: DEFAULT_PROVIDER_ID,
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
function cancel() {
|