ikie-cli 0.1.18 → 0.1.20
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/dist/config.d.ts +5 -0
- package/dist/config.js +14 -0
- package/dist/index.js +20 -1
- package/dist/repl.js +2 -3
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export declare function ensureHome(): void;
|
|
|
33
33
|
export declare function loadConfig(): IkieConfig;
|
|
34
34
|
export declare function saveConfig(patch: Partial<IkieConfig>): void;
|
|
35
35
|
export declare function getApiKey(cfg: IkieConfig): string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* True if the user has explicitly set a model in their config file
|
|
38
|
+
* (as opposed to falling back to the hardcoded DEFAULT_MODEL).
|
|
39
|
+
*/
|
|
40
|
+
export declare function hasExplicitModel(): boolean;
|
|
36
41
|
/** True when signed into a hosted ikie account. */
|
|
37
42
|
export declare function isLoggedIn(cfg: IkieConfig): boolean;
|
|
38
43
|
/** Persist the hosted account login (ik_live_ key from `ikie login`). */
|
package/dist/config.js
CHANGED
|
@@ -49,6 +49,20 @@ export function saveConfig(patch) {
|
|
|
49
49
|
export function getApiKey(cfg) {
|
|
50
50
|
return cfg.account?.apiKey;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* True if the user has explicitly set a model in their config file
|
|
54
|
+
* (as opposed to falling back to the hardcoded DEFAULT_MODEL).
|
|
55
|
+
*/
|
|
56
|
+
export function hasExplicitModel() {
|
|
57
|
+
try {
|
|
58
|
+
if (existsSync(CONFIG_FILE)) {
|
|
59
|
+
const raw = JSON.parse(readFileSync(CONFIG_FILE, 'utf-8'));
|
|
60
|
+
return typeof raw.model === 'string';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch { }
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
52
66
|
/** True when signed into a hosted ikie account. */
|
|
53
67
|
export function isLoggedIn(cfg) {
|
|
54
68
|
return Boolean(cfg.account?.apiKey);
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import process from 'process';
|
|
3
3
|
import OpenAI from 'openai';
|
|
4
4
|
import minimist from 'minimist';
|
|
5
|
-
import { loadConfig, getApiKey, IKIE_API_BASE, DEFAULT_MODEL } from './config.js';
|
|
5
|
+
import { loadConfig, getApiKey, IKIE_API_BASE, IKIE_HOST, DEFAULT_MODEL, hasExplicitModel } from './config.js';
|
|
6
6
|
import { detectProjectContext, formatContextForPrompt } from './context.js';
|
|
7
7
|
import { loadAllMemory, formatMemoryForPrompt } from './memory.js';
|
|
8
8
|
import { buildSystemPrompt, Agent } from './agent.js';
|
|
@@ -78,6 +78,25 @@ async function main() {
|
|
|
78
78
|
if (Number.isFinite(rpm) && rpm > 0)
|
|
79
79
|
config.requestsPerMinute = Math.floor(rpm);
|
|
80
80
|
}
|
|
81
|
+
// If user hasn't explicitly chosen a model, fetch the server's default.
|
|
82
|
+
if (!argv.model && !hasExplicitModel()) {
|
|
83
|
+
try {
|
|
84
|
+
const modelsUrl = (config.baseURL ?? IKIE_API_BASE).includes('/api/v1')
|
|
85
|
+
? (config.baseURL ?? IKIE_API_BASE).replace('/api/v1', '/api/models')
|
|
86
|
+
: `${IKIE_HOST}/api/models`;
|
|
87
|
+
const res = await fetch(modelsUrl);
|
|
88
|
+
if (res.ok) {
|
|
89
|
+
const data = await res.json();
|
|
90
|
+
const serverDefault = data.models?.find(m => m.is_default);
|
|
91
|
+
if (serverDefault) {
|
|
92
|
+
config.model = serverDefault.name;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// Silently fall back to DEFAULT_MODEL
|
|
98
|
+
}
|
|
99
|
+
}
|
|
81
100
|
const apiKey = getApiKey(config);
|
|
82
101
|
if (!apiKey) {
|
|
83
102
|
console.error(`
|
package/dist/repl.js
CHANGED
|
@@ -503,7 +503,6 @@ async function handleSlashCommand(input, agent, config, projectContext, rl, sess
|
|
|
503
503
|
config.requestsPerMinute = 10;
|
|
504
504
|
config.theme = 'nebula';
|
|
505
505
|
saveConfig({
|
|
506
|
-
model: DEFAULT_MODEL,
|
|
507
506
|
maxTokens: 32768,
|
|
508
507
|
temperature: 0.6,
|
|
509
508
|
topP: 0.95,
|
|
@@ -1268,8 +1267,8 @@ export async function startREPL(agent, config, projectContext, oneShot) {
|
|
|
1268
1267
|
}
|
|
1269
1268
|
}
|
|
1270
1269
|
}
|
|
1271
|
-
// Plan mode:
|
|
1272
|
-
if (agent.getMode() === 'plan' && !abortController.signal.aborted) {
|
|
1270
|
+
// Plan mode: only offer execution if the agent actually produced a plan (used tools).
|
|
1271
|
+
if (agent.getMode() === 'plan' && !abortController.signal.aborted && agent.getLastTurnStats().toolCalls > 0) {
|
|
1273
1272
|
process.stdin.removeListener('data', cancelHandler);
|
|
1274
1273
|
const go = await confirmExecutePlan();
|
|
1275
1274
|
process.stdin.on('data', cancelHandler);
|
package/dist/theme.d.ts
CHANGED
package/dist/theme.js
CHANGED
|
@@ -3,7 +3,7 @@ import os from 'os';
|
|
|
3
3
|
import { join as pathJoin, basename } from 'path';
|
|
4
4
|
import { existsSync, readFileSync } from 'fs';
|
|
5
5
|
import { loadConfig, saveConfig } from './config.js';
|
|
6
|
-
export const VERSION = '0.1.
|
|
6
|
+
export const VERSION = '0.1.20';
|
|
7
7
|
const IKIE_BANNER = [
|
|
8
8
|
' ██╗██╗ ██╗██╗███████╗',
|
|
9
9
|
' ██║██║ ██╔╝██║██╔════╝',
|