@bahulam/code 0.1.18 → 0.1.19
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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shipped npm-side model defaults.
|
|
3
|
+
*
|
|
4
|
+
* Source of truth is backend `app/services/model_defaults.py`; release sync
|
|
5
|
+
* writes `model-defaults-default.json` next to the shipped catalog.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
|
|
12
|
+
export const FALLBACK_MODEL_DEFAULTS = Object.freeze({
|
|
13
|
+
reasoning: 'deepseek/deepseek-v4-flash',
|
|
14
|
+
fast: 'deepseek/deepseek-v4-flash',
|
|
15
|
+
planning: 'deepseek/deepseek-v4-pro',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const _dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const DEFAULTS_PATH = path.join(_dirname, 'model-defaults-default.json');
|
|
20
|
+
|
|
21
|
+
function clean(value) {
|
|
22
|
+
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function readShippedModelDefaults() {
|
|
26
|
+
try {
|
|
27
|
+
const data = JSON.parse(fs.readFileSync(DEFAULTS_PATH, 'utf-8'));
|
|
28
|
+
const defaults = data?.defaults && typeof data.defaults === 'object' ? data.defaults : {};
|
|
29
|
+
return {
|
|
30
|
+
reasoning: clean(defaults.reasoning) || FALLBACK_MODEL_DEFAULTS.reasoning,
|
|
31
|
+
fast: clean(defaults.fast) || FALLBACK_MODEL_DEFAULTS.fast,
|
|
32
|
+
planning: clean(defaults.planning) || FALLBACK_MODEL_DEFAULTS.planning,
|
|
33
|
+
};
|
|
34
|
+
} catch {
|
|
35
|
+
return { ...FALLBACK_MODEL_DEFAULTS };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const SHIPPED_MODEL_DEFAULTS = readShippedModelDefaults();
|
|
40
|
+
export const DEFAULT_REASONING_MODEL = SHIPPED_MODEL_DEFAULTS.reasoning;
|
|
41
|
+
export const DEFAULT_FAST_MODEL = SHIPPED_MODEL_DEFAULTS.fast;
|
|
42
|
+
export const DEFAULT_PLANNING_MODEL = SHIPPED_MODEL_DEFAULTS.planning;
|
package/src/config/settings.mjs
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import os from 'os';
|
|
10
|
+
import { DEFAULT_FAST_MODEL, DEFAULT_REASONING_MODEL } from './model-defaults.mjs';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Full settings schema with defaults.
|
|
@@ -30,9 +31,9 @@ export const SETTINGS_SCHEMA = {
|
|
|
30
31
|
Stop: [],
|
|
31
32
|
SessionStart: [],
|
|
32
33
|
},
|
|
33
|
-
model:
|
|
34
|
+
model: DEFAULT_REASONING_MODEL,
|
|
34
35
|
subagentModel: null,
|
|
35
|
-
fastModel:
|
|
36
|
+
fastModel: DEFAULT_FAST_MODEL,
|
|
36
37
|
fastMode: false,
|
|
37
38
|
alwaysThinkingEnabled: false,
|
|
38
39
|
autoCompactEnabled: true,
|
package/src/tools/agent.mjs
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { createAgentLoop } from '../core/agent-loop.mjs';
|
|
12
12
|
import { createToolRegistry } from './registry.mjs';
|
|
13
13
|
import { createPermissionChecker } from '../permissions/checker.mjs';
|
|
14
|
+
import { DEFAULT_REASONING_MODEL } from '../config/model-defaults.mjs';
|
|
14
15
|
|
|
15
16
|
export const AgentTool = {
|
|
16
17
|
name: 'Agent',
|
|
@@ -59,7 +60,7 @@ export const AgentTool = {
|
|
|
59
60
|
_nextBgId: 0,
|
|
60
61
|
|
|
61
62
|
async call(input, options = {}) {
|
|
62
|
-
const model = input.model || process.env.SUBAGENT_MODEL ||
|
|
63
|
+
const model = input.model || process.env.SUBAGENT_MODEL || DEFAULT_REASONING_MODEL;
|
|
63
64
|
const tools = createToolRegistry({
|
|
64
65
|
pluginRegistry: options.pluginRegistry || null,
|
|
65
66
|
stateEmit: options.stateEmit || null,
|
package/src/ui/commands.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { SessionManager } from '../core/session.mjs';
|
|
|
9
9
|
import { CheckpointManager } from '../core/checkpoints.mjs';
|
|
10
10
|
import { readEnv, listEnvVars } from '../config/env.mjs';
|
|
11
11
|
import * as telemetry from '../telemetry/index.mjs';
|
|
12
|
+
import { DEFAULT_FAST_MODEL, DEFAULT_REASONING_MODEL } from '../config/model-defaults.mjs';
|
|
12
13
|
|
|
13
14
|
const checkpoints = new CheckpointManager();
|
|
14
15
|
let sessionManager = null;
|
|
@@ -134,12 +135,14 @@ export const COMMANDS = {
|
|
|
134
135
|
'/fast': {
|
|
135
136
|
description: 'Toggle fast mode (uses faster, cheaper model)',
|
|
136
137
|
handler(args, state) {
|
|
137
|
-
if (state.
|
|
138
|
-
state.
|
|
139
|
-
|
|
138
|
+
if (state.fastMode) {
|
|
139
|
+
state.fastMode = false;
|
|
140
|
+
state.model = DEFAULT_REASONING_MODEL;
|
|
141
|
+
return `Fast mode OFF — using ${DEFAULT_REASONING_MODEL}`;
|
|
140
142
|
}
|
|
141
|
-
state.
|
|
142
|
-
|
|
143
|
+
state.fastMode = true;
|
|
144
|
+
state.model = DEFAULT_FAST_MODEL;
|
|
145
|
+
return `Fast mode ON — using ${DEFAULT_FAST_MODEL}`;
|
|
143
146
|
},
|
|
144
147
|
},
|
|
145
148
|
|