ikie-cli 0.1.11 → 0.1.13
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/repl.js +6 -3
- package/dist/theme.d.ts +2 -1
- package/dist/theme.js +10 -13
- package/package.json +1 -1
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 } from './agent.js';
|
|
4
|
-
import { c, PROMPT, CONTINUE_PROMPT, printPromptHeader, modeTag, drawBanner, infoLine, successLine, errorLine, THEMES, setTheme, stripAnsi, contextRing, } from './theme.js';
|
|
4
|
+
import { c, PROMPT, CONTINUE_PROMPT, PROMPT_ARROW, printPromptHeader, modeTag, drawBanner, infoLine, successLine, errorLine, THEMES, setTheme, stripAnsi, contextRing, } 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 } from './config.js';
|
|
@@ -980,15 +980,18 @@ export async function startREPL(agent, config, projectContext, oneShot) {
|
|
|
980
980
|
rl.setPrompt(CONTINUE_PROMPT);
|
|
981
981
|
}
|
|
982
982
|
else {
|
|
983
|
+
printPromptHeader(agent.getMode());
|
|
983
984
|
const tokens = agent.estimateConversationTokens();
|
|
984
985
|
const pct = tokens / contextWindow;
|
|
985
986
|
const ring = tokens > 0 ? contextRing(Math.min(pct, 1)) : '';
|
|
986
|
-
|
|
987
|
+
const prompt = ring
|
|
988
|
+
? `${c.primary('╰─')} ${ring} ${c.primary(PROMPT_ARROW + ' ')}`
|
|
989
|
+
: PROMPT;
|
|
987
990
|
if (imageState.pending.length) {
|
|
988
991
|
const labels = imageState.pending.map(image => `[Image #${image.id}]`).join(' ');
|
|
989
992
|
process.stdout.write(`${c.muted(' attached')} ${c.secondary(labels)}\n`);
|
|
990
993
|
}
|
|
991
|
-
rl.setPrompt(
|
|
994
|
+
rl.setPrompt(prompt);
|
|
992
995
|
}
|
|
993
996
|
rl.prompt();
|
|
994
997
|
};
|
package/dist/theme.d.ts
CHANGED
|
@@ -41,9 +41,10 @@ export declare function drawBanner(model: string): void;
|
|
|
41
41
|
export declare function modeTag(mode: 'agent' | 'plan'): string;
|
|
42
42
|
/** Circular fill indicator for context usage. */
|
|
43
43
|
export declare function contextRing(pct: number): string;
|
|
44
|
-
export declare function printPromptHeader(mode?: 'agent' | 'plan'
|
|
44
|
+
export declare function printPromptHeader(mode?: 'agent' | 'plan'): void;
|
|
45
45
|
export declare const PROMPT: string;
|
|
46
46
|
export declare const CONTINUE_PROMPT: string;
|
|
47
|
+
export declare const PROMPT_ARROW: string;
|
|
47
48
|
export declare class InlineSpinner {
|
|
48
49
|
private timer;
|
|
49
50
|
private delayTimer;
|
package/dist/theme.js
CHANGED
|
@@ -268,23 +268,20 @@ export function contextRing(pct) {
|
|
|
268
268
|
const color = pct < 0.7 ? c.success : pct < 0.85 ? c.warning : c.error;
|
|
269
269
|
return `${color(char)} ${color(`${Math.round(pct * 100)}%`)}`;
|
|
270
270
|
}
|
|
271
|
-
|
|
271
|
+
const IS_WIN = process.platform === 'win32';
|
|
272
|
+
const CH = IS_WIN
|
|
273
|
+
? { tl: '+-', prompt: '\\->', cont: '| ', arrow: '>', dot: '●' }
|
|
274
|
+
: { tl: '╭─', prompt: '╰─❯', cont: '│ ', arrow: '❯', dot: '●' };
|
|
275
|
+
export function printPromptHeader(mode = 'agent') {
|
|
272
276
|
const cwdName = basename(process.cwd()) || '/';
|
|
273
277
|
const branch = getGitBranchFast();
|
|
274
278
|
const gitSegment = branch ? ` ${c.muted('on')} ${c.secondary(branch)}` : '';
|
|
275
279
|
const themeSegment = ` ${c.muted('theme')} ${c.secondary(activeTheme.name)}`;
|
|
276
|
-
|
|
277
|
-
if (ring) {
|
|
278
|
-
const cols = process.stdout.columns ?? 80;
|
|
279
|
-
const pad = Math.max(1, cols - stripAnsi(left).length - stripAnsi(ring).length - 1);
|
|
280
|
-
process.stdout.write(`\n${left}${' '.repeat(pad)}${ring}\n`);
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
process.stdout.write(`\n${left}\n`);
|
|
284
|
-
}
|
|
280
|
+
process.stdout.write(`\n${c.primary(CH.tl)} ${c.primary.bold('ikie')} ${c.muted('·')} ${modeTag(mode)}${gitSegment}${themeSegment} ${c.muted('in')} ${c.accent(cwdName)}\n`);
|
|
285
281
|
}
|
|
286
|
-
export const PROMPT = c.primary(
|
|
287
|
-
export const CONTINUE_PROMPT = c.primary(
|
|
282
|
+
export const PROMPT = c.primary(`${CH.prompt} `);
|
|
283
|
+
export const CONTINUE_PROMPT = c.primary(CH.cont);
|
|
284
|
+
export const PROMPT_ARROW = CH.arrow;
|
|
288
285
|
export class InlineSpinner {
|
|
289
286
|
timer = null;
|
|
290
287
|
delayTimer = null;
|
|
@@ -464,5 +461,5 @@ export function permissionPrompt(toolName, preview) {
|
|
|
464
461
|
`${c.error.bold('n')} ${c.muted('deny')} ` +
|
|
465
462
|
`${c.info.bold('a')} ${c.muted('always')} ` +
|
|
466
463
|
`${c.muted.bold('!')} ${c.muted('never')}\n` +
|
|
467
|
-
` ${c.muted(
|
|
464
|
+
` ${c.muted(CH.arrow)} `);
|
|
468
465
|
}
|