ikie-cli 0.1.42 → 0.1.44
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.js +1 -1
- package/dist/onboarding.js +2 -2
- package/dist/repl.js +23 -11
- package/dist/theme.js +10 -1
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -11,7 +11,7 @@ export const DEFAULT_MODEL = 'kimi-k2p7-code';
|
|
|
11
11
|
* The hosted ikie API (masks the upstream provider behind ik_live_ keys).
|
|
12
12
|
* Override with IKIE_HOST env var, e.g. for local dev or a custom domain.
|
|
13
13
|
*/
|
|
14
|
-
export const IKIE_HOST = process.env.IKIE_HOST ?? '
|
|
14
|
+
export const IKIE_HOST = process.env.IKIE_HOST ?? 'https://ikie-cli.xyz';
|
|
15
15
|
export const IKIE_API_BASE = `${IKIE_HOST}/api/v1`;
|
|
16
16
|
/**
|
|
17
17
|
* The port ikie's own host connection uses. A bash command that kills processes
|
package/dist/onboarding.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createInterface } from 'node:readline';
|
|
2
2
|
import { c, drawBanner, successLine, infoLine, errorLine } from './theme.js';
|
|
3
3
|
import { login } from './auth.js';
|
|
4
|
-
import { saveConfig, isLoggedIn } from './config.js';
|
|
4
|
+
import { saveConfig, isLoggedIn, IKIE_HOST } from './config.js';
|
|
5
5
|
function waitForEnter(message) {
|
|
6
6
|
const msg = message || 'Press Enter to continue...';
|
|
7
7
|
return new Promise((resolve) => {
|
|
@@ -135,7 +135,7 @@ function displayCompletion() {
|
|
|
135
135
|
console.log(c.primary('2.') + ' Type ' + c.accent('/help') + ' to see all commands');
|
|
136
136
|
console.log(c.primary('3.') + ' Start building something amazing!');
|
|
137
137
|
console.log();
|
|
138
|
-
console.log(c.muted('Dashboard:') + ' ' + c.dim(
|
|
138
|
+
console.log(c.muted('Dashboard:') + ' ' + c.dim(`${IKIE_HOST}/dashboard`));
|
|
139
139
|
console.log();
|
|
140
140
|
console.log(c.success.bold('Happy coding!'));
|
|
141
141
|
console.log();
|
package/dist/repl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as readline from 'node:readline';
|
|
2
2
|
import { execSync, exec } from 'child_process';
|
|
3
3
|
import { restoreStdinListeners, extractUpstreamError } from './agent.js';
|
|
4
|
-
import { c, PROMPT, CONTINUE_PROMPT, PROMPT_ARROW, printPromptHeader, promptHeaderText, modeTag, drawBanner, infoLine, successLine, errorLine, THEMES, setTheme, stripAnsi, contextRing, renderSlashMenu, supportsVT, CH,
|
|
4
|
+
import { c, PROMPT, CONTINUE_PROMPT, PROMPT_ARROW, printPromptHeader, promptHeaderText, modeTag, drawBanner, infoLine, successLine, errorLine, THEMES, setTheme, stripAnsi, contextRing, renderSlashMenu, supportsVT, CH, planApprovalPrompt, planHeader, } from './theme.js';
|
|
5
5
|
import { renderMarkdown } from './renderer.js';
|
|
6
6
|
import { loadAllMemory } from './memory.js';
|
|
7
7
|
import { HOME_DIR, saveConfig, DEFAULT_MODEL, IKIE_HOST, IKIE_API_BASE, isLoggedIn, getApiKey, loadConfig } from './config.js';
|
|
@@ -17,7 +17,9 @@ async function fetchModelsFromServer(config) {
|
|
|
17
17
|
const apiUrl = baseUrl.includes('/api/v1')
|
|
18
18
|
? baseUrl.replace('/api/v1', '/api/models')
|
|
19
19
|
: `${IKIE_HOST}/api/models`;
|
|
20
|
-
|
|
20
|
+
// Bound the request: an unreachable host would otherwise leave fetch() hanging
|
|
21
|
+
// for the OS connect timeout (~2 min) with no output, freezing the picker.
|
|
22
|
+
const response = await fetch(apiUrl, { signal: AbortSignal.timeout(8000) });
|
|
21
23
|
if (!response.ok)
|
|
22
24
|
throw new Error(`Failed to fetch models (${response.status})`);
|
|
23
25
|
const data = await response.json();
|
|
@@ -1048,8 +1050,12 @@ function selectModelInteractively(rl, config) {
|
|
|
1048
1050
|
resolve();
|
|
1049
1051
|
};
|
|
1050
1052
|
drawPickerFn?.();
|
|
1051
|
-
}).catch(() => {
|
|
1052
|
-
|
|
1053
|
+
}).catch((err) => {
|
|
1054
|
+
const reason = err?.name === 'TimeoutError'
|
|
1055
|
+
? `server did not respond (${config.baseURL || IKIE_API_BASE})`
|
|
1056
|
+
: err instanceof Error ? err.message : String(err);
|
|
1057
|
+
console.log(errorLine(`Failed to load models: ${reason}`));
|
|
1058
|
+
console.log(infoLine(`Current model: ${config.model}`));
|
|
1053
1059
|
resolve();
|
|
1054
1060
|
});
|
|
1055
1061
|
});
|
|
@@ -1360,7 +1366,19 @@ export async function startREPL(agent, config, projectContext, oneShot) {
|
|
|
1360
1366
|
rl.write(token);
|
|
1361
1367
|
};
|
|
1362
1368
|
const routeInputData = (data) => {
|
|
1363
|
-
|
|
1369
|
+
let text = data.toString('utf8');
|
|
1370
|
+
// Normalize application-cursor-key (SS3) arrow sequences to their CSI
|
|
1371
|
+
// equivalents. Terminals in DECCKM mode (commonly enabled by tmux/screen
|
|
1372
|
+
// and some emulators) send arrows as \x1bOA/B/C/D instead of \x1b[A/B/C/D;
|
|
1373
|
+
// without this, every arrow-key selector (model, theme, slash menu) breaks.
|
|
1374
|
+
if (text === '\x1bOA')
|
|
1375
|
+
text = '\x1b[A';
|
|
1376
|
+
else if (text === '\x1bOB')
|
|
1377
|
+
text = '\x1b[B';
|
|
1378
|
+
else if (text === '\x1bOC')
|
|
1379
|
+
text = '\x1b[C';
|
|
1380
|
+
else if (text === '\x1bOD')
|
|
1381
|
+
text = '\x1b[D';
|
|
1364
1382
|
// ── Live slash-menu navigation (only while the menu is open) ──
|
|
1365
1383
|
if (menuOpen) {
|
|
1366
1384
|
if (text === '\x1b[A') {
|
|
@@ -1559,12 +1577,6 @@ export async function startREPL(agent, config, projectContext, oneShot) {
|
|
|
1559
1577
|
currentPrompt = prompt;
|
|
1560
1578
|
rl.setPrompt(prompt);
|
|
1561
1579
|
rl.prompt();
|
|
1562
|
-
// Display bottom status bar with mode toggle hint
|
|
1563
|
-
const mode = agent.getMode();
|
|
1564
|
-
const statusText = `${mode} · shift+tab to toggle`;
|
|
1565
|
-
process.stdout.write(`\n${bottomBar('', statusText)}\r`);
|
|
1566
|
-
// Move cursor back up to prompt line
|
|
1567
|
-
process.stdout.write('\x1b[1A');
|
|
1568
1580
|
}
|
|
1569
1581
|
};
|
|
1570
1582
|
rl.on('close', () => {
|
package/dist/theme.js
CHANGED
|
@@ -297,7 +297,16 @@ export function promptHeaderText(mode = 'agent') {
|
|
|
297
297
|
const branch = getGitBranchFast();
|
|
298
298
|
const gitSegment = branch ? ` ${c.muted('on')} ${c.secondary(branch)}` : '';
|
|
299
299
|
const themeSegment = ` ${c.muted('theme')} ${c.secondary(activeTheme.name)}`;
|
|
300
|
-
|
|
300
|
+
const leftStr = `${c.primary(CH.tl)} ${c.primary.bold('ikie')} ${c.muted('·')} ${modeTag(mode)}${gitSegment}${themeSegment} ${c.muted('in')} ${c.accent(cwdName)}`;
|
|
301
|
+
const rightStr = `${mode} · shift+tab to toggle`;
|
|
302
|
+
const cols = process.stdout.columns ?? 80;
|
|
303
|
+
const leftLen = stripAnsi(leftStr).length;
|
|
304
|
+
const rightLen = rightStr.length;
|
|
305
|
+
const space = cols - leftLen - rightLen - 1; // -1 safety to prevent soft-wrap
|
|
306
|
+
if (space > 0) {
|
|
307
|
+
return `${leftStr}${' '.repeat(space)}${c.dim(rightStr)}`;
|
|
308
|
+
}
|
|
309
|
+
return leftStr;
|
|
301
310
|
}
|
|
302
311
|
export function printPromptHeader(mode = 'agent') {
|
|
303
312
|
process.stdout.write(`\n${promptHeaderText(mode)}\n`);
|